improved PHP Scanner
[phpeclipse.git] / net.sourceforge.phpeclipse / src / test / PHPParser.java
index f23c733..cdb51d8 100644 (file)
@@ -7,7 +7,6 @@ import org.eclipse.core.runtime.CoreException;
 import org.eclipse.ui.texteditor.MarkerUtilities;
 import org.eclipse.jface.preference.IPreferenceStore;
 
-import java.io.CharArrayReader;
 import java.util.Hashtable;
 import java.io.StringReader;
 import java.text.MessageFormat;
@@ -15,6 +14,9 @@ import java.text.MessageFormat;
 import net.sourceforge.phpeclipse.actions.PHPStartApacheAction;
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
 import net.sourceforge.phpdt.internal.compiler.parser.PHPOutlineInfo;
+import net.sourceforge.phpdt.internal.compiler.parser.PHPSegmentWithChildren;
+import net.sourceforge.phpdt.internal.compiler.parser.PHPFunctionDeclaration;
+import net.sourceforge.phpdt.internal.compiler.parser.PHPClassDeclaration;
 
 /**
  * A new php parser.
@@ -25,10 +27,11 @@ import net.sourceforge.phpdt.internal.compiler.parser.PHPOutlineInfo;
  */
 public class PHPParser extends PHPParserSuperclass implements PHPParserConstants {
 
-  private static PHPParser me;
-
   private static IFile fileToParse;
 
+  /** The current segment */
+  private static PHPSegmentWithChildren currentSegment;
+
   private static final String PARSE_ERROR_STRING = "Parse error"; //$NON-NLS-1$
   private static final String PARSE_WARNING_STRING = "Warning"; //$NON-NLS-1$
   public static final int ERROR = 2;
@@ -41,28 +44,10 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
   public PHPParser() {
   }
 
-  public static PHPParser getInstance(IFile fileToParse) {
-    if (me == null) {
-      me = new PHPParser(fileToParse);
-    } else {
-      me.setFileToParse(fileToParse);
-    }
-    return me;
-  }
-
   public void setFileToParse(IFile fileToParse) {
     this.fileToParse = fileToParse;
   }
 
-  public static PHPParser getInstance(java.io.Reader stream) {
-    if (me == null) {
-      me = new PHPParser(stream);
-    } else {
-      me.ReInit(stream);
-    }
-    return me;
-  }
-
   public PHPParser(IFile fileToParse) {
     this(new StringReader(""));
     this.fileToParse = fileToParse;
@@ -84,11 +69,12 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
       jj_input_stream = new SimpleCharStream(stream, 1, 1);
     }
     ReInit(stream);
-    phpTest();
+    phpFile();
   }
 
   public PHPOutlineInfo parseInfo(Object parent, String s) {
     outlineInfo = new PHPOutlineInfo(parent);
+    currentSegment = outlineInfo.getDeclarations();
     StringReader stream = new StringReader(s);
     if (jj_input_stream == null) {
       jj_input_stream = new SimpleCharStream(stream, 1, 1);
@@ -207,7 +193,12 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     try {
       parse();
     } catch (ParseException e) {
-      PHPeclipsePlugin.log(e);
+      if (errorMessage == null) {
+        PHPeclipsePlugin.log(e);
+      } else {
+        setMarker(errorMessage, e.currentToken.beginLine, errorLevel);
+        errorMessage = null;
+      }
     }
   }
 
@@ -253,16 +244,16 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     label_1:
     while (true) {
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case 1:
+      case PHPSTART:
         ;
         break;
       default:
         jj_la1[0] = jj_gen;
         break label_1;
       }
-      jj_consume_token(1);
+      jj_consume_token(PHPSTART);
       Php();
-      jj_consume_token(128);
+      jj_consume_token(PHPEND);
     }
     jj_consume_token(0);
   }
@@ -320,8 +311,11 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
   }
 
   static final public void ClassDeclaration() throws ParseException {
+  PHPClassDeclaration classDeclaration;
+  Token className;
+  int pos = jj_input_stream.bufpos;
     jj_consume_token(CLASS);
-    jj_consume_token(IDENTIFIER);
+    className = jj_consume_token(IDENTIFIER);
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case EXTENDS:
       jj_consume_token(EXTENDS);
@@ -331,7 +325,11 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
       jj_la1[2] = jj_gen;
       ;
     }
+    classDeclaration = new PHPClassDeclaration(currentSegment,className.image,pos);
+    currentSegment.add(classDeclaration);
+    currentSegment = classDeclaration;
     ClassBody();
+    currentSegment = (PHPSegmentWithChildren) currentSegment.getParent();
   }
 
   static final public void ClassBody() throws ParseException {
@@ -540,8 +538,11 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
   }
 
   static final public void MethodDeclaration() throws ParseException {
+  PHPFunctionDeclaration functionDeclaration;
     jj_consume_token(FUNCTION);
-    MethodDeclarator();
+    functionDeclaration = MethodDeclarator();
+    currentSegment.add(functionDeclaration);
+    currentSegment = functionDeclaration;
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case LBRACE:
       Block();
@@ -554,19 +555,31 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
       jj_consume_token(-1);
       throw new ParseException();
     }
+    currentSegment = (PHPSegmentWithChildren) currentSegment.getParent();
   }
 
-  static final public void MethodDeclarator() throws ParseException {
+  static final public PHPFunctionDeclaration MethodDeclarator() throws ParseException {
+  Token bit_and = null;
+  Token identifier;
+  StringBuffer methodDeclaration = new StringBuffer();
+  String formalParameters;
+  int pos = jj_input_stream.bufpos;
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case BIT_AND:
-      jj_consume_token(BIT_AND);
+      bit_and = jj_consume_token(BIT_AND);
       break;
     default:
       jj_la1[14] = jj_gen;
       ;
     }
-    jj_consume_token(IDENTIFIER);
+    identifier = jj_consume_token(IDENTIFIER);
     FormalParameters();
+    if (bit_and != null) {
+      methodDeclaration.append("&");
+    }
+    methodDeclaration.append(identifier);
+    {if (true) return new PHPFunctionDeclaration(currentSegment,methodDeclaration.toString(),pos);}
+    throw new Error("Missing return statement in function");
   }
 
   static final public void FormalParameters() throws ParseException {
@@ -1400,7 +1413,13 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
       jj_la1[57] = jj_gen;
       ;
     }
-    jj_consume_token(RPAREN);
+    try {
+      jj_consume_token(RPAREN);
+    } catch (ParseException e) {
+    errorMessage = "')' expected to close the argument list";
+    errorLevel   = ERROR;
+    {if (true) throw e;}
+    }
   }
 
   static final public void ArgumentList() throws ParseException {
@@ -1416,7 +1435,13 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
         break label_24;
       }
       jj_consume_token(COMMA);
-      Expression();
+      try {
+        Expression();
+      } catch (ParseException e) {
+        errorMessage = "expression expected after a comma in argument list";
+        errorLevel   = ERROR;
+        {if (true) throw e;}
+      }
     }
   }
 
@@ -1430,8 +1455,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
       case SEMICOLON:
         jj_consume_token(SEMICOLON);
         break;
-      case 128:
-        jj_consume_token(128);
+      case 127:
+        jj_consume_token(127);
         break;
       default:
         jj_la1[59] = jj_gen;
@@ -1520,8 +1545,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
       case SEMICOLON:
         jj_consume_token(SEMICOLON);
         break;
-      case 128:
-        jj_consume_token(128);
+      case 127:
+        jj_consume_token(127);
         break;
       default:
         jj_la1[61] = jj_gen;
@@ -1536,8 +1561,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
       case SEMICOLON:
         jj_consume_token(SEMICOLON);
         break;
-      case 128:
-        jj_consume_token(128);
+      case 127:
+        jj_consume_token(127);
         break;
       default:
         jj_la1[62] = jj_gen;
@@ -1552,8 +1577,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
       case SEMICOLON:
         jj_consume_token(SEMICOLON);
         break;
-      case 128:
-        jj_consume_token(128);
+      case 127:
+        jj_consume_token(127);
         break;
       default:
         jj_la1[63] = jj_gen;
@@ -1568,8 +1593,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
       case SEMICOLON:
         jj_consume_token(SEMICOLON);
         break;
-      case 128:
-        jj_consume_token(128);
+      case 127:
+        jj_consume_token(127);
         break;
       default:
         jj_la1[64] = jj_gen;
@@ -1610,8 +1635,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
       case SEMICOLON:
         jj_consume_token(SEMICOLON);
         break;
-      case 128:
-        jj_consume_token(128);
+      case 127:
+        jj_consume_token(127);
         break;
       default:
         jj_la1[67] = jj_gen;
@@ -1645,8 +1670,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     case SEMICOLON:
       jj_consume_token(SEMICOLON);
       break;
-    case 128:
-      jj_consume_token(128);
+    case 127:
+      jj_consume_token(127);
       break;
     default:
       jj_la1[69] = jj_gen;
@@ -1675,8 +1700,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     case SEMICOLON:
       jj_consume_token(SEMICOLON);
       break;
-    case 128:
-      jj_consume_token(128);
+    case 127:
+      jj_consume_token(127);
       break;
     default:
       jj_la1[71] = jj_gen;
@@ -2088,8 +2113,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
       case SEMICOLON:
         jj_consume_token(SEMICOLON);
         break;
-      case 128:
-        jj_consume_token(128);
+      case 127:
+        jj_consume_token(127);
         break;
       default:
         jj_la1[84] = jj_gen;
@@ -2151,8 +2176,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     case SEMICOLON:
       jj_consume_token(SEMICOLON);
       break;
-    case 128:
-      jj_consume_token(128);
+    case 127:
+      jj_consume_token(127);
       break;
     default:
       jj_la1[86] = jj_gen;
@@ -2373,152 +2398,6 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     return retval;
   }
 
-  static final private boolean jj_3R_77() {
-    if (jj_scan_token(PLUSASSIGN)) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    return false;
-  }
-
-  static final private boolean jj_3R_98() {
-    if (jj_scan_token(BIT_OR)) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    if (jj_3R_97()) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    return false;
-  }
-
-  static final private boolean jj_3R_101() {
-    if (jj_scan_token(XOR)) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    if (jj_3R_100()) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    return false;
-  }
-
-  static final private boolean jj_3R_104() {
-    if (jj_3R_106()) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    Token xsp;
-    while (true) {
-      xsp = jj_scanpos;
-      if (jj_3R_107()) { jj_scanpos = xsp; break; }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    }
-    return false;
-  }
-
-  static final private boolean jj_3R_91() {
-    if (jj_scan_token(_ORL)) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    return false;
-  }
-
-  static final private boolean jj_3R_96() {
-    if (jj_scan_token(_ANDL)) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    return false;
-  }
-
-  static final private boolean jj_3R_94() {
-    if (jj_scan_token(DOT)) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    if (jj_3R_93()) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    return false;
-  }
-
-  static final private boolean jj_3R_102() {
-    if (jj_3R_104()) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    Token xsp;
-    while (true) {
-      xsp = jj_scanpos;
-      if (jj_3R_105()) { jj_scanpos = xsp; break; }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    }
-    return false;
-  }
-
-  static final private boolean jj_3R_90() {
-    if (jj_scan_token(SC_OR)) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    return false;
-  }
-
-  static final private boolean jj_3R_76() {
-    if (jj_scan_token(REMASSIGN)) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    return false;
-  }
-
-  static final private boolean jj_3R_100() {
-    if (jj_3R_102()) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    Token xsp;
-    while (true) {
-      xsp = jj_scanpos;
-      if (jj_3R_103()) { jj_scanpos = xsp; break; }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    }
-    return false;
-  }
-
-  static final private boolean jj_3R_72() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_90()) {
-    jj_scanpos = xsp;
-    if (jj_3R_91()) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    if (jj_3R_71()) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    return false;
-  }
-
-  static final private boolean jj_3R_95() {
-    if (jj_scan_token(SC_AND)) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    return false;
-  }
-
-  static final private boolean jj_3R_89() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_95()) {
-    jj_scanpos = xsp;
-    if (jj_3R_96()) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    if (jj_3R_88()) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    return false;
-  }
-
-  static final private boolean jj_3R_97() {
-    if (jj_3R_100()) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    Token xsp;
-    while (true) {
-      xsp = jj_scanpos;
-      if (jj_3R_101()) { jj_scanpos = xsp; break; }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    }
-    return false;
-  }
-
-  static final private boolean jj_3R_67() {
-    if (jj_scan_token(HOOK)) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    if (jj_3R_37()) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    if (jj_scan_token(COLON)) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    if (jj_3R_59()) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    return false;
-  }
-
   static final private boolean jj_3R_93() {
     if (jj_3R_97()) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
@@ -2700,6 +2579,18 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     return false;
   }
 
+  static final private boolean jj_3R_41() {
+    if (jj_3R_54()) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    Token xsp;
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_55()) { jj_scanpos = xsp; break; }
+      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    }
+    return false;
+  }
+
   static final private boolean jj_3R_48() {
     if (jj_scan_token(DOUBLE)) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
@@ -2759,23 +2650,19 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     return false;
   }
 
-  static final private boolean jj_3_2() {
-    if (jj_scan_token(COMMA)) return true;
+  static final private boolean jj_3R_40() {
+    if (jj_scan_token(IDENTIFIER)) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    if (jj_3R_35()) return true;
+    if (jj_scan_token(COLON)) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
     return false;
   }
 
-  static final private boolean jj_3R_41() {
-    if (jj_3R_54()) return true;
+  static final private boolean jj_3_2() {
+    if (jj_scan_token(COMMA)) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    if (jj_3R_35()) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    Token xsp;
-    while (true) {
-      xsp = jj_scanpos;
-      if (jj_3R_55()) { jj_scanpos = xsp; break; }
-      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    }
     return false;
   }
 
@@ -2791,18 +2678,18 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     return false;
   }
 
-  static final private boolean jj_3R_176() {
-    if (jj_scan_token(ARRAYASSIGN)) return true;
+  static final private boolean jj_3R_58() {
+    if (jj_scan_token(PRINT)) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
     if (jj_3R_37()) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
     return false;
   }
 
-  static final private boolean jj_3R_40() {
-    if (jj_scan_token(IDENTIFIER)) return true;
+  static final private boolean jj_3R_176() {
+    if (jj_scan_token(ARRAYASSIGN)) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    if (jj_scan_token(COLON)) return true;
+    if (jj_3R_37()) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
     return false;
   }
@@ -2873,6 +2760,12 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     return false;
   }
 
+  static final private boolean jj_3R_39() {
+    if (jj_scan_token(127)) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    return false;
+  }
+
   static final private boolean jj_3R_64() {
     if (jj_scan_token(IDENTIFIER)) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
@@ -2923,14 +2816,6 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     return false;
   }
 
-  static final private boolean jj_3R_58() {
-    if (jj_scan_token(PRINT)) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    if (jj_3R_37()) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    return false;
-  }
-
   static final private boolean jj_3R_86() {
     if (jj_scan_token(DOLLAR_ID)) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
@@ -2954,6 +2839,12 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     return false;
   }
 
+  static final private boolean jj_3R_38() {
+    if (jj_scan_token(SEMICOLON)) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    return false;
+  }
+
   static final private boolean jj_3R_61() {
     if (jj_3R_69()) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
@@ -2976,26 +2867,6 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     return false;
   }
 
-  static final private boolean jj_3R_39() {
-    if (jj_scan_token(128)) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    return false;
-  }
-
-  static final private boolean jj_3R_38() {
-    if (jj_scan_token(SEMICOLON)) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    return false;
-  }
-
-  static final private boolean jj_3R_179() {
-    if (jj_scan_token(COMMA)) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    if (jj_3R_37()) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    return false;
-  }
-
   static final private boolean jj_3_6() {
     if (jj_3R_40()) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
@@ -3015,8 +2886,10 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     return false;
   }
 
-  static final private boolean jj_3R_177() {
-    if (jj_3R_178()) return true;
+  static final private boolean jj_3R_179() {
+    if (jj_scan_token(COMMA)) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    if (jj_3R_37()) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
     return false;
   }
@@ -3033,6 +2906,12 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     return false;
   }
 
+  static final private boolean jj_3R_177() {
+    if (jj_3R_178()) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    return false;
+  }
+
   static final private boolean jj_3R_174() {
     if (jj_scan_token(LPAREN)) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
@@ -3555,6 +3434,12 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     return false;
   }
 
+  static final private boolean jj_3_7() {
+    if (jj_3R_41()) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    return false;
+  }
+
   static final private boolean jj_3R_79() {
     if (jj_scan_token(LSHIFTASSIGN)) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
@@ -3716,12 +3601,6 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     return false;
   }
 
-  static final private boolean jj_3_7() {
-    if (jj_3R_41()) return true;
-    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
-    return false;
-  }
-
   static final private boolean jj_3R_78() {
     if (jj_scan_token(MINUSASSIGN)) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
@@ -3760,6 +3639,152 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
     return false;
   }
 
+  static final private boolean jj_3R_77() {
+    if (jj_scan_token(PLUSASSIGN)) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    return false;
+  }
+
+  static final private boolean jj_3R_98() {
+    if (jj_scan_token(BIT_OR)) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    if (jj_3R_97()) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    return false;
+  }
+
+  static final private boolean jj_3R_101() {
+    if (jj_scan_token(XOR)) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    if (jj_3R_100()) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    return false;
+  }
+
+  static final private boolean jj_3R_104() {
+    if (jj_3R_106()) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    Token xsp;
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_107()) { jj_scanpos = xsp; break; }
+      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    }
+    return false;
+  }
+
+  static final private boolean jj_3R_91() {
+    if (jj_scan_token(_ORL)) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    return false;
+  }
+
+  static final private boolean jj_3R_96() {
+    if (jj_scan_token(_ANDL)) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    return false;
+  }
+
+  static final private boolean jj_3R_94() {
+    if (jj_scan_token(DOT)) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    if (jj_3R_93()) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    return false;
+  }
+
+  static final private boolean jj_3R_102() {
+    if (jj_3R_104()) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    Token xsp;
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_105()) { jj_scanpos = xsp; break; }
+      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    }
+    return false;
+  }
+
+  static final private boolean jj_3R_90() {
+    if (jj_scan_token(SC_OR)) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    return false;
+  }
+
+  static final private boolean jj_3R_76() {
+    if (jj_scan_token(REMASSIGN)) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    return false;
+  }
+
+  static final private boolean jj_3R_100() {
+    if (jj_3R_102()) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    Token xsp;
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_103()) { jj_scanpos = xsp; break; }
+      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    }
+    return false;
+  }
+
+  static final private boolean jj_3R_72() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_90()) {
+    jj_scanpos = xsp;
+    if (jj_3R_91()) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    if (jj_3R_71()) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    return false;
+  }
+
+  static final private boolean jj_3R_95() {
+    if (jj_scan_token(SC_AND)) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    return false;
+  }
+
+  static final private boolean jj_3R_89() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_95()) {
+    jj_scanpos = xsp;
+    if (jj_3R_96()) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    if (jj_3R_88()) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    return false;
+  }
+
+  static final private boolean jj_3R_97() {
+    if (jj_3R_100()) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    Token xsp;
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_101()) { jj_scanpos = xsp; break; }
+      if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    }
+    return false;
+  }
+
+  static final private boolean jj_3R_67() {
+    if (jj_scan_token(HOOK)) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    if (jj_3R_37()) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    if (jj_scan_token(COLON)) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    if (jj_3R_59()) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    return false;
+  }
+
   static private boolean jj_initialized_once = false;
   static public PHPParserTokenManager token_source;
   static SimpleCharStream jj_input_stream;
@@ -3771,11 +3796,10 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
   static private boolean jj_semLA;
   static private int jj_gen;
   static final private int[] jj_la1 = new int[95];
-  static final private int[] jj_la1_0 = {0x2,0xff960000,0x0,0xc0000,0xc0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x0,0x800000,0x0,0x0,0x0,0x0,0x800000,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x1800000,0x0,0x0,0xfe900000,0x0,0x0,0x0,0x0,0x3c000000,0x0,0x0,0x0,0x0,0x0,0x0,0xff960000,0xff960000,0x0,0x0,0x0,0x800000,0x0,0xff960000,0x0,0x200000,0x400000,0xff900000,0x0,0xff900000,0x0,0x800000,0x1800000,0x800000,0x800000,0x0,0x0,0x0,0x1800000,};
-  static final private int[] jj_la1_1 = {0x0,0x1aed48,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x86400,0x0,0x0,0x0,0x0,0x0,0x7f400000,0x0,0x86400,0x0,0x0,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x86400,0x0,0x86400,0x0,0x0,0x1,0x1,0x2000,0x2000,0x0,0x1,0x86400,0x1,0x84400,0x80400,0x86400,0x0,0x0,0x12a948,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1aed48,0x1aed48,0x0,0x0,0x0,0x2000,0x90,0x1aed48,0x90,0x0,0x0,0x1aed48,0x0,0x1aed48,0x0,0x2000,0x86400,0x2000,0x2000,0x0,0x0,0x0,0x86400,};
-  static final private int[] jj_la1_2 = {0x0,0x232288a2,0x0,0x0,0x0,0x400000,0x4000000,0x20000,0x2000000,0x20000,0x2020800,0x0,0x230088a2,0x220000,0x0,0x400000,0x2000000,0x0,0x0,0x4000000,0x230088a2,0x4000000,0x40000000,0x0,0x0,0x1,0x1,0x800000,0x0,0x0,0x0,0x0,0x0,0x18000000,0x18000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x230088a2,0x20000000,0x20088a2,0x0,0x0,0x88000,0x88000,0x2000800,0x2000800,0x2000800,0x88000,0x230088a2,0x80000,0xa2,0x0,0x230088a2,0x400000,0x200000,0x2220800,0x200000,0x200000,0x200000,0x200000,0x0,0x400000,0x200000,0x400000,0x200000,0x400000,0x200000,0x232288a2,0x232288a2,0x400000,0x4000000,0x4000000,0x2000800,0x0,0x232288a2,0x0,0x0,0x0,0x232288a2,0x200000,0xa32288a2,0x200000,0x2000800,0x230088a2,0x2000800,0x2000800,0x400000,0x800,0x800,0x230088a2,};
-  static final private int[] jj_la1_3 = {0x0,0x800003c0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x0,0x0,0x0,0x800003c0,0x0,0x1000,0x0,0x80001000,0x1000,0x0,0x7ff80000,0x800003c0,0x7ff80000,0x0,0x10,0x10,0x20,0x20,0x0,0x2000,0x4000,0x1000,0x9,0x9,0x6,0x6,0x70000,0x70000,0x300,0x300,0x8c00,0x8c00,0x300,0x800003c0,0x0,0x80000000,0xc0,0xc0,0x0,0x0,0x80000000,0x80000000,0x80000000,0x0,0x800003c0,0x0,0x0,0x0,0x800003c0,0x0,0x0,0x800000c0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800003c0,0x800003c0,0x0,0x7ff800c0,0x7ff800c0,0x800000c0,0x0,0x800003c0,0x0,0x0,0x0,0x800003c0,0x0,0x800003c0,0x0,0x800000c0,0x800003c0,0x800000c0,0x800000c0,0x0,0x0,0x0,0x800003c0,};
-  static final private int[] jj_la1_4 = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1,0x1,0x1,0x1,0x0,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
+  static final private int[] jj_la1_0 = {0x2,0x7fcb0000,0x0,0x60000,0x60000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xc00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400000,0x0,0x400000,0x0,0x0,0x80000000,0x80000000,0x400000,0x0,0x0,0x80000000,0xc00000,0x80000000,0x0,0x0,0xc00000,0x0,0x0,0x7f480000,0x0,0x0,0x0,0x0,0x1e000000,0x0,0x0,0x0,0x0,0x0,0x0,0x7fcb0000,0x7fcb0000,0x0,0x0,0x0,0x400000,0x0,0x7fcb0000,0x0,0x100000,0x200000,0x7fc80000,0x0,0x7fc80000,0x0,0x400000,0xc00000,0x400000,0x400000,0x0,0x0,0x0,0xc00000,};
+  static final private int[] jj_la1_1 = {0x0,0xd76a4,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x43200,0x0,0x0,0x0,0x0,0x0,0x3fa00000,0x0,0x43200,0x0,0x0,0x40000000,0x40000000,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x43200,0x0,0x43200,0x0,0x0,0x0,0x0,0x1000,0x1000,0x0,0x0,0x43200,0x0,0x42200,0x40200,0x43200,0x0,0x0,0x954a4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xd76a4,0xd76a4,0x0,0x0,0x0,0x1000,0x48,0xd76a4,0x48,0x0,0x0,0xd76a4,0x0,0xd76a4,0x0,0x1000,0x43200,0x1000,0x1000,0x0,0x0,0x0,0x43200,};
+  static final private int[] jj_la1_2 = {0x0,0x11914451,0x0,0x0,0x0,0x200000,0x2000000,0x10000,0x1000000,0x10000,0x1010400,0x0,0x11804451,0x110000,0x0,0x200000,0x1000000,0x0,0x0,0x2000000,0x11804451,0x2000000,0x20000000,0x0,0x0,0x0,0x0,0x400000,0x0,0x0,0x0,0x80000000,0x80000000,0xc000000,0xc000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x11804451,0x10000000,0x1004451,0x0,0x0,0x44000,0x44000,0x1000400,0x1000400,0x1000400,0x44000,0x11804451,0x40000,0x51,0x0,0x11804451,0x200000,0x100000,0x1110400,0x100000,0x100000,0x100000,0x100000,0x0,0x200000,0x100000,0x200000,0x100000,0x200000,0x100000,0x11914451,0x11914451,0x200000,0x2000000,0x2000000,0x1000400,0x0,0x11914451,0x0,0x0,0x0,0x11914451,0x100000,0x51914451,0x100000,0x1000400,0x11804451,0x1000400,0x1000400,0x200000,0x400,0x400,0x11804451,};
+  static final private int[] jj_la1_3 = {0x0,0x400001e0,0x0,0x0,0x0,0x0,0x0,0x0,0x40000000,0x0,0x0,0x0,0x400001e0,0x0,0x800,0x0,0x40000800,0x800,0x0,0x3ffc0000,0x400001e0,0x3ffc0000,0x0,0x8,0x8,0x10,0x10,0x0,0x1000,0x2000,0x800,0x4,0x4,0x3,0x3,0x38000,0x38000,0x180,0x180,0x4600,0x4600,0x180,0x400001e0,0x0,0x40000000,0x60,0x60,0x0,0x0,0x40000000,0x40000000,0x40000000,0x0,0x400001e0,0x0,0x0,0x0,0x400001e0,0x0,0x80000000,0x40000060,0x80000000,0x80000000,0x80000000,0x80000000,0x0,0x0,0x80000000,0x0,0x80000000,0x0,0x80000000,0x400001e0,0x400001e0,0x0,0x3ffc0060,0x3ffc0060,0x40000060,0x0,0x400001e0,0x0,0x0,0x0,0x400001e0,0x80000000,0x400001e0,0x80000000,0x40000060,0x400001e0,0x40000060,0x40000060,0x0,0x0,0x0,0x400001e0,};
   static final private JJCalls[] jj_2_rtns = new JJCalls[7];
   static private boolean jj_rescan = false;
   static private int jj_gc = 0;
@@ -3962,8 +3986,8 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
 
   static final public ParseException generateParseException() {
     jj_expentries.removeAllElements();
-    boolean[] la1tokens = new boolean[129];
-    for (int i = 0; i < 129; i++) {
+    boolean[] la1tokens = new boolean[128];
+    for (int i = 0; i < 128; i++) {
       la1tokens[i] = false;
     }
     if (jj_kind >= 0) {
@@ -3985,13 +4009,10 @@ public class PHPParser extends PHPParserSuperclass implements PHPParserConstants
           if ((jj_la1_3[i] & (1<<j)) != 0) {
             la1tokens[96+j] = true;
           }
-          if ((jj_la1_4[i] & (1<<j)) != 0) {
-            la1tokens[128+j] = true;
-          }
         }
       }
     }
-    for (int i = 0; i < 129; i++) {
+    for (int i = 0; i < 128; i++) {
       if (la1tokens[i]) {
         jj_expentry = new int[1];
         jj_expentry[0] = i;