Small improvements in parser
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / parser / Parser.java
index 8770f4a..a838e7f 100644 (file)
@@ -74,42 +74,13 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
 
   protected boolean diet = false; //tells the scanner to jump over some
 
-  // parts of the code/expressions like
-  // method bodies
-  //scanner token
+  /**
+   * the PHP token scanner
+   */
   public Scanner scanner;
 
-  //  private ArrayList phpList;
-
-  //  private int currentPHPString;
-
-  //  private boolean phpEnd;
-
-  // private static HashMap keywordMap = null;
-  private String str;
-
-  // current character
-  //  char ch;
-  // current token
   int token;
 
-  // row counter for syntax errors:
-  //int rowCount;
-  // column counter for syntax errors:
-  //int columnCount;
-  //int chIndx;
-  //
-  //   // current identifier
-  //   String identifier;
-  //  Long longNumber;
-
-  //  Double doubleNumber;
-
-  //  private String stringValue;
-
-  /** Contains the current expression. */
-  // private StringBuffer expression;
-  //private boolean phpMode;
   protected int modifiers;
 
   protected int modifiersSourceStart;
@@ -117,28 +88,12 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
   protected Parser(ProblemReporter problemReporter) {
     this.problemReporter = problemReporter;
     this.options = problemReporter.options;
-    //    this.currentPHPString = 0;
-    //         PHPParserSuperclass.fileToParse = fileToParse;
-    //    this.phpList = null;
-    //    this.indexManager = null;
-    this.str = "";
     this.token = TokenNameEOF;
-    //    this.chIndx = 0;
-    //    this.rowCount = 1;
-    //    this.columnCount = 0;
-    //    this.phpEnd = false;
-    //   getNextToken();
     this.initializeScanner();
   }
 
   public void setFileToParse(IFile fileToParse) {
-    //    this.currentPHPString = 0;
-    //    PHPParserSuperclass.fileToParse = fileToParse;
-    //    this.phpList = null;
-    //    this.indexManager = null;
-    this.str = "";
     this.token = TokenNameEOF;
-    //    this.phpEnd = false;
     this.initializeScanner();
   }
 
@@ -161,7 +116,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     //    PHPParserSuperclass.fileToParse = fileToParse;
     //    this.phpList = null;
     this.includesList = null;
-    this.str = "";
+//    this.str = "";
     this.token = TokenNameEOF;
     //    this.chIndx = 0;
     //    this.rowCount = 1;
@@ -236,12 +191,12 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     }
   }
 
-  private void reportSyntaxWarning(String error, int problemStartPosition, int problemEndPosition) {
-    if (referenceContext != null) {
-      problemReporter.phpParsingWarning(new String[] { error }, problemStartPosition, problemEndPosition, referenceContext,
-          compilationUnit.compilationResult);
-    }
-  }
+//  private void reportSyntaxWarning(String error, int problemStartPosition, int problemEndPosition) {
+//    if (referenceContext != null) {
+//      problemReporter.phpParsingWarning(new String[] { error }, problemStartPosition, problemEndPosition, referenceContext,
+//          compilationUnit.compilationResult);
+//    }
+//  }
 
   /**
    * gets the next token from input
@@ -269,7 +224,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
   }
 
   public void init(String s) {
-    this.str = s;
+//    this.str = s;
     this.token = TokenNameEOF;
     this.includesList = new ArrayList();
     //    this.chIndx = 0;
@@ -292,7 +247,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     referenceContext = null;
     this.includesList = new ArrayList();
     //    this.indexManager = indexManager;
-    this.str = "";
+//    this.str = "";
     this.token = TokenNameEOF;
     //    this.chIndx = 0;
     //    this.rowCount = 1;
@@ -789,7 +744,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
         expr();
         if (token == TokenNameSEMICOLON) {
           getNextToken();
-        } 
+        }
         if (token != TokenNameINLINE_HTML) {
           throwSyntaxError("Missing '?>' for open PHP expression block ('<?=').");
         }
@@ -908,6 +863,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
       if (token != TokenNameVariable) {
         throwSyntaxError("Variable expected in 'catch' statement.");
       }
+      addVariableSet();
       getNextToken();
       if (token != TokenNameRPAREN) {
         throwSyntaxError("')' expected in 'catch' statement.");
@@ -1039,6 +995,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
       if (token != TokenNameVariable) {
         throwSyntaxError("Variable expected in 'catch' statement.");
       }
+      addVariableSet();
       getNextToken();
       if (token != TokenNameRPAREN) {
         throwSyntaxError("')' expected in 'catch' statement.");
@@ -1284,19 +1241,19 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     }
   }
 
-  private void class_extends(TypeDeclaration typeDecl) {
-    // /* empty */
-    // | T_EXTENDS interface_list
-    if (token == TokenNameextends) {
-      getNextToken();
-
-      if (token == TokenNameIdentifier) {
-        getNextToken();
-      } else {
-        throwSyntaxError("Class name expected after keyword 'extends'.");
-      }
-    }
-  }
+//  private void class_extends(TypeDeclaration typeDecl) {
+//    //       /* empty */
+//    //       | T_EXTENDS interface_list
+//    if (token == TokenNameextends) {
+//      getNextToken();
+//
+//      if (token == TokenNameIdentifier) {
+//        getNextToken();
+//      } else {
+//        throwSyntaxError("Class name expected after keyword 'extends'.");
+//      }
+//    }
+//  }
 
   private void interface_extends_list(TypeDeclaration typeDecl) {
     // /* empty */
@@ -2360,68 +2317,68 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
       //       | '`' encaps_list '`'
       //  | common_scalar
       //       | '`' encaps_list '`'
-      case TokenNameEncapsedString0:
-        scanner.encapsedStringStack.push(new Character('`'));
-        getNextToken();
-        try {
-          if (token == TokenNameEncapsedString0) {
-          } else {
-            encaps_list();
-            if (token != TokenNameEncapsedString0) {
-              throwSyntaxError("\'`\' expected at end of string" + "(Found token: " + scanner.toStringAction(token) + " )");
-            }
-          }
-        } finally {
-          scanner.encapsedStringStack.pop();
-          getNextToken();
-        }
-        break;
-      //      | '\'' encaps_list '\''
-      case TokenNameEncapsedString1:
-        scanner.encapsedStringStack.push(new Character('\''));
-        getNextToken();
-        try {
-          exprSourceStart = scanner.getCurrentTokenStartPosition();
-          if (token == TokenNameEncapsedString1) {
-            expression = new StringLiteralSQ(scanner.getCurrentStringLiteralSource(exprSourceStart), exprSourceStart, scanner
-                .getCurrentTokenEndPosition());
-          } else {
-            encaps_list();
-            if (token != TokenNameEncapsedString1) {
-              throwSyntaxError("\'\'\' expected at end of string" + "(Found token: " + scanner.toStringAction(token) + " )");
-            } else {
-              expression = new StringLiteralSQ(scanner.getCurrentStringLiteralSource(exprSourceStart), exprSourceStart, scanner
-                  .getCurrentTokenEndPosition());
-            }
-          }
-        } finally {
-          scanner.encapsedStringStack.pop();
-          getNextToken();
-        }
-        break;
-      //| '"' encaps_list '"'
-      case TokenNameEncapsedString2:
-        scanner.encapsedStringStack.push(new Character('"'));
-        getNextToken();
-        try {
-          exprSourceStart = scanner.getCurrentTokenStartPosition();
-          if (token == TokenNameEncapsedString2) {
-            expression = new StringLiteralDQ(scanner.getCurrentStringLiteralSource(exprSourceStart), exprSourceStart, scanner
-                .getCurrentTokenEndPosition());
-          } else {
-            encaps_list();
-            if (token != TokenNameEncapsedString2) {
-              throwSyntaxError("'\"' expected at end of string" + "(Found token: " + scanner.toStringAction(token) + " )");
-            } else {
-              expression = new StringLiteralDQ(scanner.getCurrentStringLiteralSource(exprSourceStart), exprSourceStart, scanner
-                  .getCurrentTokenEndPosition());
-            }
-          }
-        } finally {
-          scanner.encapsedStringStack.pop();
-          getNextToken();
-        }
-        break;
+      //      case TokenNameEncapsedString0:
+      //        scanner.encapsedStringStack.push(new Character('`'));
+      //        getNextToken();
+      //        try {
+      //          if (token == TokenNameEncapsedString0) {
+      //          } else {
+      //            encaps_list();
+      //            if (token != TokenNameEncapsedString0) {
+      //              throwSyntaxError("\'`\' expected at end of string" + "(Found token: " + scanner.toStringAction(token) + " )");
+      //            }
+      //          }
+      //        } finally {
+      //          scanner.encapsedStringStack.pop();
+      //          getNextToken();
+      //        }
+      //        break;
+      //      // | '\'' encaps_list '\''
+      //      case TokenNameEncapsedString1:
+      //        scanner.encapsedStringStack.push(new Character('\''));
+      //        getNextToken();
+      //        try {
+      //          exprSourceStart = scanner.getCurrentTokenStartPosition();
+      //          if (token == TokenNameEncapsedString1) {
+      //            expression = new StringLiteralSQ(scanner.getCurrentStringLiteralSource(exprSourceStart), exprSourceStart, scanner
+      //                .getCurrentTokenEndPosition());
+      //          } else {
+      //            encaps_list();
+      //            if (token != TokenNameEncapsedString1) {
+      //              throwSyntaxError("\'\'\' expected at end of string" + "(Found token: " + scanner.toStringAction(token) + " )");
+      //            } else {
+      //              expression = new StringLiteralSQ(scanner.getCurrentStringLiteralSource(exprSourceStart), exprSourceStart, scanner
+      //                  .getCurrentTokenEndPosition());
+      //            }
+      //          }
+      //        } finally {
+      //          scanner.encapsedStringStack.pop();
+      //          getNextToken();
+      //        }
+      //        break;
+      //      //| '"' encaps_list '"'
+      //      case TokenNameEncapsedString2:
+      //        scanner.encapsedStringStack.push(new Character('"'));
+      //        getNextToken();
+      //        try {
+      //          exprSourceStart = scanner.getCurrentTokenStartPosition();
+      //          if (token == TokenNameEncapsedString2) {
+      //            expression = new StringLiteralDQ(scanner.getCurrentStringLiteralSource(exprSourceStart), exprSourceStart, scanner
+      //                .getCurrentTokenEndPosition());
+      //          } else {
+      //            encaps_list();
+      //            if (token != TokenNameEncapsedString2) {
+      //              throwSyntaxError("'\"' expected at end of string" + "(Found token: " + scanner.toStringAction(token) + " )");
+      //            } else {
+      //              expression = new StringLiteralDQ(scanner.getCurrentStringLiteralSource(exprSourceStart), exprSourceStart, scanner
+      //                  .getCurrentTokenEndPosition());
+      //            }
+      //          }
+      //        } finally {
+      //          scanner.encapsedStringStack.pop();
+      //          getNextToken();
+      //        }
+      //        break;
       case TokenNameStringDoubleQuote:
         expression = new StringLiteralDQ(scanner.getCurrentStringLiteralSource(), scanner.getCurrentTokenStartPosition(), scanner
             .getCurrentTokenEndPosition());
@@ -2537,9 +2494,6 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
           if (lhs != null && lhs instanceof FieldReference) {
             addVariableSet(((FieldReference) lhs).token);
           }
-          //          if (lhsVar != null) {
-          //            addVariableSet(lhsVar);
-          //          }
           getNextToken();
           if (token == TokenNameAND) {
             getNextToken();
@@ -3100,28 +3054,10 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     //  base_variable_with_function_calls:
     // base_variable
     //| function_call
-    boolean functionCall = false;
     if (Scanner.TRACE) {
       System.out.println("TRACE: base_variable_with_function_calls()");
     }
-    //    if (token == TokenNameIdentifier) {
-    //      functionCall = true;
-    //    } else if (token == TokenNameVariable) {
-    //      int tempToken = token;
-    //      int tempPosition = scanner.currentPosition;
-    //      getNextToken();
-    //      if (token == TokenNameLPAREN) {
-    //        functionCall = true;
-    //      }
-    //      token = tempToken;
-    //      scanner.currentPosition = tempPosition;
-    //      scanner.phpMode = true;
-    //    }
-    //    if (functionCall) {
     return function_call(lefthandside, ignoreVar);
-    //    } else {
-    //      base_variable();
-    //    }
   }
 
   private Expression base_variable() {
@@ -3401,246 +3337,246 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     getNextToken();
   }
 
-  private void encaps_list() {
-    //                 encaps_list encaps_var
-    //         | encaps_list T_STRING
-    //         | encaps_list T_NUM_STRING
-    //         | encaps_list T_ENCAPSED_AND_WHITESPACE
-    //         | encaps_list T_CHARACTER
-    //         | encaps_list T_BAD_CHARACTER
-    //         | encaps_list '['
-    //         | encaps_list ']'
-    //         | encaps_list '{'
-    //         | encaps_list '}'
-    //         | encaps_list T_OBJECT_OPERATOR
-    //         | /* empty */
-    while (true) {
-      switch (token) {
-      case TokenNameSTRING:
-        getNextToken();
-        break;
-      case TokenNameLBRACE:
-        //          scanner.encapsedStringStack.pop();
-        getNextToken();
-        break;
-      case TokenNameRBRACE:
-        //          scanner.encapsedStringStack.pop();
-        getNextToken();
-        break;
-      case TokenNameLBRACKET:
-        //          scanner.encapsedStringStack.pop();
-        getNextToken();
-        break;
-      case TokenNameRBRACKET:
-        //          scanner.encapsedStringStack.pop();
-        getNextToken();
-        break;
-      case TokenNameMINUS_GREATER:
-        //          scanner.encapsedStringStack.pop();
-        getNextToken();
-        break;
-      case TokenNameVariable:
-      case TokenNameDOLLAR_LBRACE:
-      case TokenNameLBRACE_DOLLAR:
-        encaps_var();
-        break;
-      default:
-        char encapsedChar = ((Character) scanner.encapsedStringStack.peek()).charValue();
-        if (encapsedChar == '$') {
-          scanner.encapsedStringStack.pop();
-          encapsedChar = ((Character) scanner.encapsedStringStack.peek()).charValue();
-          switch (encapsedChar) {
-          case '`':
-            if (token == TokenNameEncapsedString0) {
-              return;
-            }
-            token = TokenNameSTRING;
-            continue;
-          case '\'':
-            if (token == TokenNameEncapsedString1) {
-              return;
-            }
-            token = TokenNameSTRING;
-            continue;
-          case '"':
-            if (token == TokenNameEncapsedString2) {
-              return;
-            }
-            token = TokenNameSTRING;
-            continue;
-          }
-        }
-        return;
-      }
-    }
-  }
+  //  private void encaps_list() {
+  //    // encaps_list encaps_var
+  //    // | encaps_list T_STRING
+  //    // | encaps_list T_NUM_STRING
+  //    // | encaps_list T_ENCAPSED_AND_WHITESPACE
+  //    // | encaps_list T_CHARACTER
+  //    // | encaps_list T_BAD_CHARACTER
+  //    // | encaps_list '['
+  //    // | encaps_list ']'
+  //    // | encaps_list '{'
+  //    // | encaps_list '}'
+  //    // | encaps_list T_OBJECT_OPERATOR
+  //    // | /* empty */
+  //    while (true) {
+  //      switch (token) {
+  //      case TokenNameSTRING:
+  //        getNextToken();
+  //        break;
+  //      case TokenNameLBRACE:
+  //        // scanner.encapsedStringStack.pop();
+  //        getNextToken();
+  //        break;
+  //      case TokenNameRBRACE:
+  //        // scanner.encapsedStringStack.pop();
+  //        getNextToken();
+  //        break;
+  //      case TokenNameLBRACKET:
+  //        // scanner.encapsedStringStack.pop();
+  //        getNextToken();
+  //        break;
+  //      case TokenNameRBRACKET:
+  //        // scanner.encapsedStringStack.pop();
+  //        getNextToken();
+  //        break;
+  //      case TokenNameMINUS_GREATER:
+  //        // scanner.encapsedStringStack.pop();
+  //        getNextToken();
+  //        break;
+  //      case TokenNameVariable:
+  //      case TokenNameDOLLAR_LBRACE:
+  //      case TokenNameLBRACE_DOLLAR:
+  //        encaps_var();
+  //        break;
+  //      default:
+  //        char encapsedChar = ((Character) scanner.encapsedStringStack.peek()).charValue();
+  //        if (encapsedChar == '$') {
+  //          scanner.encapsedStringStack.pop();
+  //          encapsedChar = ((Character) scanner.encapsedStringStack.peek()).charValue();
+  //          switch (encapsedChar) {
+  //          case '`':
+  //            if (token == TokenNameEncapsedString0) {
+  //              return;
+  //            }
+  //            token = TokenNameSTRING;
+  //            continue;
+  //          case '\'':
+  //            if (token == TokenNameEncapsedString1) {
+  //              return;
+  //            }
+  //            token = TokenNameSTRING;
+  //            continue;
+  //          case '"':
+  //            if (token == TokenNameEncapsedString2) {
+  //              return;
+  //            }
+  //            token = TokenNameSTRING;
+  //            continue;
+  //          }
+  //        }
+  //        return;
+  //      }
+  //    }
+  //  }
 
-  private void encaps_var() {
-    //                 T_VARIABLE
-    //         | T_VARIABLE '[' encaps_var_offset ']'
-    //         | T_VARIABLE T_OBJECT_OPERATOR T_STRING
-    //         | T_DOLLAR_OPEN_CURLY_BRACES expr '}'
-    //         | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}'
-    //         | T_CURLY_OPEN variable '}'
-    switch (token) {
-    case TokenNameVariable:
-      getNextToken();
-      if (token == TokenNameLBRACKET) {
-        getNextToken();
-        expr(); //encaps_var_offset();
-        if (token != TokenNameRBRACKET) {
-          throwSyntaxError("']' expected after variable.");
-        }
-        //          scanner.encapsedStringStack.pop();
-        getNextToken();
-        //          }
-      } else if (token == TokenNameMINUS_GREATER) {
-        getNextToken();
-        if (token != TokenNameIdentifier) {
-          throwSyntaxError("Identifier expected after '->'.");
-        }
-        //          scanner.encapsedStringStack.pop();
-        getNextToken();
-      }
-      //        else {
-      //          // scanner.encapsedStringStack.pop();
-      //          int tempToken = TokenNameSTRING;
-      //          if (!scanner.encapsedStringStack.isEmpty()
-      //              && (token == TokenNameEncapsedString0
-      //                  || token == TokenNameEncapsedString1
-      //                  || token == TokenNameEncapsedString2 || token ==
-      // TokenNameERROR)) {
-      //            char encapsedChar = ((Character)
-      // scanner.encapsedStringStack.peek())
-      //                .charValue();
-      //            switch (token) {
-      //              case TokenNameEncapsedString0 :
-      //                if (encapsedChar == '`') {
-      //                  tempToken = TokenNameEncapsedString0;
-      //                }
-      //                break;
-      //              case TokenNameEncapsedString1 :
-      //                if (encapsedChar == '\'') {
-      //                  tempToken = TokenNameEncapsedString1;
-      //                }
-      //                break;
-      //              case TokenNameEncapsedString2 :
-      //                if (encapsedChar == '"') {
-      //                  tempToken = TokenNameEncapsedString2;
-      //                }
-      //                break;
-      //              case TokenNameERROR :
-      //                if (scanner.source[scanner.currentPosition - 1] == '\\') {
-      //                  scanner.currentPosition--;
-      //                  getNextToken();
-      //                }
-      //                break;
-      //            }
-      //          }
-      //          token = tempToken;
-      //        }
-      break;
-    case TokenNameDOLLAR_LBRACE:
-      getNextToken();
-      if (token == TokenNameDOLLAR_LBRACE) {
-        encaps_var();
-      } else if (token == TokenNameIdentifier) {
-        getNextToken();
-        if (token == TokenNameLBRACKET) {
-          getNextToken();
-          //            if (token == TokenNameRBRACKET) {
-          //              getNextToken();
-          //            } else {
-          expr();
-          if (token != TokenNameRBRACKET) {
-            throwSyntaxError("']' expected after '${'.");
-          }
-          getNextToken();
-          //            }
-        }
-      } else {
-        expr();
-      }
-      if (token != TokenNameRBRACE) {
-        throwSyntaxError("'}' expected.");
-      }
-      getNextToken();
-      break;
-    case TokenNameLBRACE_DOLLAR:
-      getNextToken();
-      if (token == TokenNameLBRACE_DOLLAR) {
-        encaps_var();
-      } else if (token == TokenNameIdentifier || token > TokenNameKEYWORD) {
-        getNextToken();
-        if (token == TokenNameLBRACKET) {
-          getNextToken();
-          //            if (token == TokenNameRBRACKET) {
-          //              getNextToken();
-          //            } else {
-          expr();
-          if (token != TokenNameRBRACKET) {
-            throwSyntaxError("']' expected.");
-          }
-          getNextToken();
-          //            }
-        } else if (token == TokenNameMINUS_GREATER) {
-          getNextToken();
-          if (token != TokenNameIdentifier && token != TokenNameVariable) {
-            throwSyntaxError("String or Variable token expected.");
-          }
-          getNextToken();
-          if (token == TokenNameLBRACKET) {
-            getNextToken();
-            //            if (token == TokenNameRBRACKET) {
-            //              getNextToken();
-            //            } else {
-            expr();
-            if (token != TokenNameRBRACKET) {
-              throwSyntaxError("']' expected after '${'.");
-            }
-            getNextToken();
-            //            }
-          }
-        }
-        //          if (token != TokenNameRBRACE) {
-        //            throwSyntaxError("'}' expected after '{$'.");
-        //          }
-        //          // scanner.encapsedStringStack.pop();
-        //          getNextToken();
-      } else {
-        expr();
-        if (token != TokenNameRBRACE) {
-          throwSyntaxError("'}' expected.");
-        }
-        //          scanner.encapsedStringStack.pop();
-        getNextToken();
-      }
-      break;
-    }
-  }
+  //  private void encaps_var() {
+  //    // T_VARIABLE
+  //    // | T_VARIABLE '[' encaps_var_offset ']'
+  //    // | T_VARIABLE T_OBJECT_OPERATOR T_STRING
+  //    // | T_DOLLAR_OPEN_CURLY_BRACES expr '}'
+  //    // | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}'
+  //    // | T_CURLY_OPEN variable '}'
+  //    switch (token) {
+  //    case TokenNameVariable:
+  //      getNextToken();
+  //      if (token == TokenNameLBRACKET) {
+  //        getNextToken();
+  //        expr(); //encaps_var_offset();
+  //        if (token != TokenNameRBRACKET) {
+  //          throwSyntaxError("']' expected after variable.");
+  //        }
+  //        // scanner.encapsedStringStack.pop();
+  //        getNextToken();
+  //        // }
+  //      } else if (token == TokenNameMINUS_GREATER) {
+  //        getNextToken();
+  //        if (token != TokenNameIdentifier) {
+  //          throwSyntaxError("Identifier expected after '->'.");
+  //        }
+  //        // scanner.encapsedStringStack.pop();
+  //        getNextToken();
+  //      }
+  //      // else {
+  //      // // scanner.encapsedStringStack.pop();
+  //      // int tempToken = TokenNameSTRING;
+  //      // if (!scanner.encapsedStringStack.isEmpty()
+  //      // && (token == TokenNameEncapsedString0
+  //      // || token == TokenNameEncapsedString1
+  //      // || token == TokenNameEncapsedString2 || token ==
+  //      // TokenNameERROR)) {
+  //      // char encapsedChar = ((Character)
+  //      // scanner.encapsedStringStack.peek())
+  //      // .charValue();
+  //      // switch (token) {
+  //      // case TokenNameEncapsedString0 :
+  //      // if (encapsedChar == '`') {
+  //      // tempToken = TokenNameEncapsedString0;
+  //      // }
+  //      // break;
+  //      // case TokenNameEncapsedString1 :
+  //      // if (encapsedChar == '\'') {
+  //      // tempToken = TokenNameEncapsedString1;
+  //      // }
+  //      // break;
+  //      // case TokenNameEncapsedString2 :
+  //      // if (encapsedChar == '"') {
+  //      // tempToken = TokenNameEncapsedString2;
+  //      // }
+  //      // break;
+  //      // case TokenNameERROR :
+  //      // if (scanner.source[scanner.currentPosition - 1] == '\\') {
+  //      // scanner.currentPosition--;
+  //      // getNextToken();
+  //      // }
+  //      // break;
+  //      // }
+  //      // }
+  //      // token = tempToken;
+  //      // }
+  //      break;
+  //    case TokenNameDOLLAR_LBRACE:
+  //      getNextToken();
+  //      if (token == TokenNameDOLLAR_LBRACE) {
+  //        encaps_var();
+  //      } else if (token == TokenNameIdentifier) {
+  //        getNextToken();
+  //        if (token == TokenNameLBRACKET) {
+  //          getNextToken();
+  //          // if (token == TokenNameRBRACKET) {
+  //          // getNextToken();
+  //          // } else {
+  //          expr();
+  //          if (token != TokenNameRBRACKET) {
+  //            throwSyntaxError("']' expected after '${'.");
+  //          }
+  //          getNextToken();
+  //          // }
+  //        }
+  //      } else {
+  //        expr();
+  //      }
+  //      if (token != TokenNameRBRACE) {
+  //        throwSyntaxError("'}' expected.");
+  //      }
+  //      getNextToken();
+  //      break;
+  //    case TokenNameLBRACE_DOLLAR:
+  //      getNextToken();
+  //      if (token == TokenNameLBRACE_DOLLAR) {
+  //        encaps_var();
+  //      } else if (token == TokenNameIdentifier || token > TokenNameKEYWORD) {
+  //        getNextToken();
+  //        if (token == TokenNameLBRACKET) {
+  //          getNextToken();
+  //          // if (token == TokenNameRBRACKET) {
+  //          // getNextToken();
+  //          // } else {
+  //          expr();
+  //          if (token != TokenNameRBRACKET) {
+  //            throwSyntaxError("']' expected.");
+  //          }
+  //          getNextToken();
+  //          // }
+  //        } else if (token == TokenNameMINUS_GREATER) {
+  //          getNextToken();
+  //          if (token != TokenNameIdentifier && token != TokenNameVariable) {
+  //            throwSyntaxError("String or Variable token expected.");
+  //          }
+  //          getNextToken();
+  //          if (token == TokenNameLBRACKET) {
+  //            getNextToken();
+  //            // if (token == TokenNameRBRACKET) {
+  //            // getNextToken();
+  //            // } else {
+  //            expr();
+  //            if (token != TokenNameRBRACKET) {
+  //              throwSyntaxError("']' expected after '${'.");
+  //            }
+  //            getNextToken();
+  //            // }
+  //          }
+  //        }
+  //        // if (token != TokenNameRBRACE) {
+  //        // throwSyntaxError("'}' expected after '{$'.");
+  //        // }
+  //        // // scanner.encapsedStringStack.pop();
+  //        // getNextToken();
+  //      } else {
+  //        expr();
+  //        if (token != TokenNameRBRACE) {
+  //          throwSyntaxError("'}' expected.");
+  //        }
+  //        // scanner.encapsedStringStack.pop();
+  //        getNextToken();
+  //      }
+  //      break;
+  //    }
+  //  }
 
-  private void encaps_var_offset() {
-    //                 T_STRING
-    //         | T_NUM_STRING
-    //         | T_VARIABLE
-    switch (token) {
-    case TokenNameSTRING:
-      getNextToken();
-      break;
-    case TokenNameIntegerLiteral:
-      getNextToken();
-      break;
-    case TokenNameVariable:
-      getNextToken();
-      break;
-    case TokenNameIdentifier:
-      getNextToken();
-      break;
-    default:
-      throwSyntaxError("Variable or String token expected.");
-      break;
-    }
-  }
+//  private void encaps_var_offset() {
+//    //               T_STRING
+//    //       | T_NUM_STRING
+//    //       | T_VARIABLE
+//    switch (token) {
+//    case TokenNameSTRING:
+//      getNextToken();
+//      break;
+//    case TokenNameIntegerLiteral:
+//      getNextToken();
+//      break;
+//    case TokenNameVariable:
+//      getNextToken();
+//      break;
+//    case TokenNameIdentifier:
+//      getNextToken();
+//      break;
+//    default:
+//      throwSyntaxError("Variable or String token expected.");
+//      break;
+//    }
+//  }
 
   private void internal_functions_in_yacc() {
     //    int start = 0;
@@ -3703,6 +3639,11 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     }
   }
 
+  /**
+   * Parse and check the include file name
+   * 
+   * @param includeToken
+   */
   private void checkFileName(int includeToken) {
     //<include-token> expr
     int start = scanner.getCurrentTokenStartPosition();
@@ -3765,19 +3706,15 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
           IPath path = PHPFileUtil.determineFilePath(includeNameString, file, project);
 
           if (path == null) {
-            //              reportSyntaxError("File: " + expression.toStringExpression() + " doesn't exist in project: "
-            //                  + project.getLocation().toString(), literal.sourceStart, literal.sourceEnd);
+            // SyntaxError: "File: << >> doesn't exist in project."
             String[] args = { expression.toStringExpression(), project.getLocation().toString() };
             problemReporter.phpIncludeNotExistWarning(args, literal.sourceStart, literal.sourceEnd, referenceContext,
                 compilationUnit.compilationResult);
           } else {
             try {
-              //              String projectPath = ProjectPrefUtil.getDocumentRoot(file.getProject()).toString();
-              //              String filePath = file.getRawLocation().toString();
               String filePath = path.toString();
               String ext = file.getRawLocation().getFileExtension();
               int fileExtensionLength = ext == null ? 0 : ext.length() + 1;
-              int length;
 
               impt.tokens = CharOperation.splitOn('/', filePath.toCharArray(), 0, filePath.length() - fileExtensionLength);
               impt.setFile(PHPFileUtil.createFile(path, project));
@@ -3902,33 +3839,39 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
         throwSyntaxError("'`' expected at end of static string.");
       }
       break;
-    case TokenNameEncapsedString1:
-      try {
-        scanner.currentCharacter = scanner.source[scanner.currentPosition++];
-        while (scanner.currentCharacter != '\'') {
-          if (scanner.currentCharacter == '\\') {
-            scanner.currentPosition++;
-          }
-          scanner.currentCharacter = scanner.source[scanner.currentPosition++];
-        }
-        getNextToken();
-      } catch (IndexOutOfBoundsException e) {
-        throwSyntaxError("'\'' expected at end of static string.");
-      }
+    //    case TokenNameEncapsedString1:
+    //      try {
+    //        scanner.currentCharacter = scanner.source[scanner.currentPosition++];
+    //        while (scanner.currentCharacter != '\'') {
+    //          if (scanner.currentCharacter == '\\') {
+    //            scanner.currentPosition++;
+    //          }
+    //          scanner.currentCharacter = scanner.source[scanner.currentPosition++];
+    //        }
+    //        getNextToken();
+    //      } catch (IndexOutOfBoundsException e) {
+    //        throwSyntaxError("'\'' expected at end of static string.");
+    //      }
+    //      break;
+    //    case TokenNameEncapsedString2:
+    //      try {
+    //        scanner.currentCharacter = scanner.source[scanner.currentPosition++];
+    //        while (scanner.currentCharacter != '"') {
+    //          if (scanner.currentCharacter == '\\') {
+    //            scanner.currentPosition++;
+    //          }
+    //          scanner.currentCharacter = scanner.source[scanner.currentPosition++];
+    //        }
+    //        getNextToken();
+    //      } catch (IndexOutOfBoundsException e) {
+    //        throwSyntaxError("'\"' expected at end of static string.");
+    //      }
+    //      break;
+    case TokenNameStringSingleQuote:
+      getNextToken();
       break;
-    case TokenNameEncapsedString2:
-      try {
-        scanner.currentCharacter = scanner.source[scanner.currentPosition++];
-        while (scanner.currentCharacter != '"') {
-          if (scanner.currentCharacter == '\\') {
-            scanner.currentPosition++;
-          }
-          scanner.currentCharacter = scanner.source[scanner.currentPosition++];
-        }
-        getNextToken();
-      } catch (IndexOutOfBoundsException e) {
-        throwSyntaxError("'\"' expected at end of static string.");
-      }
+    case TokenNameStringDoubleQuote:
+      getNextToken();
       break;
     case TokenNamePLUS:
       getNextToken();
@@ -3991,110 +3934,17 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     }
   }
 
-  public void reportSyntaxError() { //int act, int currentKind, int
-    // stateStackTop) {
-    /* remember current scanner position */
-    int startPos = scanner.startPosition;
-    int currentPos = scanner.currentPosition;
-    //         String[] expectings;
-    //         String tokenName = name[symbol_index[currentKind]];
-    //fetch all "accurate" possible terminals that could recover the error
-    //         int start, end = start = asi(stack[stateStackTop]);
-    //         while (asr[end] != 0)
-    //                 end++;
-    //         int length = end - start;
-    //         expectings = new String[length];
-    //         if (length != 0) {
-    //                 char[] indexes = new char[length];
-    //                 System.arraycopy(asr, start, indexes, 0, length);
-    //                 for (int i = 0; i < length; i++) {
-    //                         expectings[i] = name[symbol_index[indexes[i]]];
-    //                 }
-    //         }
-    //if the pb is an EOF, try to tell the user that they are some
-    //         if (tokenName.equals(UNEXPECTED_EOF)) {
-    //                 if (!this.checkAndReportBracketAnomalies(problemReporter())) {
-    //                         char[] tokenSource;
-    //                         try {
-    //                                 tokenSource = this.scanner.getCurrentTokenSource();
-    //                         } catch (Exception e) {
-    //                                 tokenSource = new char[] {};
-    //                         }
-    //                         problemReporter().parseError(
-    //                                 this.scanner.startPosition,
-    //                                 this.scanner.currentPosition - 1,
-    //                                 tokenSource,
-    //                                 tokenName,
-    //                                 expectings);
-    //                 }
-    //         } else { //the next test is HEAVILY grammar DEPENDENT.
-    //                 if ((length == 14)
-    //                         && (expectings[0] == "=") //$NON-NLS-1$
-    //                         && (expectings[1] == "*=") //$NON-NLS-1$
-    //                         && (expressionPtr > -1)) {
-    //                                 switch(currentKind) {
-    //                                         case TokenNameSEMICOLON:
-    //                                         case TokenNamePLUS:
-    //                                         case TokenNameMINUS:
-    //                                         case TokenNameDIVIDE:
-    //                                         case TokenNameREMAINDER:
-    //                                         case TokenNameMULTIPLY:
-    //                                         case TokenNameLEFT_SHIFT:
-    //                                         case TokenNameRIGHT_SHIFT:
-    //// case TokenNameUNSIGNED_RIGHT_SHIFT:
-    //                                         case TokenNameLESS:
-    //                                         case TokenNameGREATER:
-    //                                         case TokenNameLESS_EQUAL:
-    //                                         case TokenNameGREATER_EQUAL:
-    //                                         case TokenNameEQUAL_EQUAL:
-    //                                         case TokenNameNOT_EQUAL:
-    //                                         case TokenNameXOR:
-    //                                         case TokenNameAND:
-    //                                         case TokenNameOR:
-    //                                         case TokenNameOR_OR:
-    //                                         case TokenNameAND_AND:
-    //                                                 // the ; is not the expected token ==> it ends a statement when an
-    // expression is not ended
-    //                                                 problemReporter().invalidExpressionAsStatement(expressionStack[expressionPtr]);
-    //                                                 break;
-    //                                         case TokenNameRBRACE :
-    //                                                 problemReporter().missingSemiColon(expressionStack[expressionPtr]);
-    //                                                 break;
-    //                                         default:
-    //                                                 char[] tokenSource;
-    //                                                 try {
-    //                                                         tokenSource = this.scanner.getCurrentTokenSource();
-    //                                                 } catch (Exception e) {
-    //                                                         tokenSource = new char[] {};
-    //                                                 }
-    //                                                 problemReporter().parseError(
-    //                                                         this.scanner.startPosition,
-    //                                                         this.scanner.currentPosition - 1,
-    //                                                         tokenSource,
-    //                                                         tokenName,
-    //                                                         expectings);
-    //                                                 this.checkAndReportBracketAnomalies(problemReporter());
-    //                                 }
-    //                 } else {
-    char[] tokenSource;
-    try {
-      tokenSource = this.scanner.getCurrentTokenSource();
-    } catch (Exception e) {
-      tokenSource = new char[] {};
-    }
-    //                         problemReporter().parseError(
-    //                                 this.scanner.startPosition,
-    //                                 this.scanner.currentPosition - 1,
-    //                                 tokenSource,
-    //                                 tokenName,
-    //                                 expectings);
-    this.checkAndReportBracketAnomalies(problemReporter());
-    //                 }
-    //         }
-    /* reset scanner where it was */
-    scanner.startPosition = startPos;
-    scanner.currentPosition = currentPos;
-  }
+//  public void reportSyntaxError() { //int act, int currentKind, int
+//    // stateStackTop) {
+//    /* remember current scanner position */
+//    int startPos = scanner.startPosition;
+//    int currentPos = scanner.currentPosition;
+//    
+//    this.checkAndReportBracketAnomalies(problemReporter());
+//    /* reset scanner where it was */
+//    scanner.startPosition = startPos;
+//    scanner.currentPosition = currentPos;
+//  }
 
   public static final int RoundBracket = 0;
 
@@ -4158,397 +4008,397 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
   /*
    * Reconsider the entire source looking for inconsistencies in {} () []
    */
-  public boolean checkAndReportBracketAnomalies(ProblemReporter problemReporter) {
-    scanner.wasAcr = false;
-    boolean anomaliesDetected = false;
-    try {
-      char[] source = scanner.source;
-      int[] leftCount = { 0, 0, 0 };
-      int[] rightCount = { 0, 0, 0 };
-      int[] depths = { 0, 0, 0 };
-      int[][] leftPositions = new int[][] { new int[10], new int[10], new int[10] };
-      int[][] leftDepths = new int[][] { new int[10], new int[10], new int[10] };
-      int[][] rightPositions = new int[][] { new int[10], new int[10], new int[10] };
-      int[][] rightDepths = new int[][] { new int[10], new int[10], new int[10] };
-      scanner.currentPosition = scanner.initialPosition; //starting
-      // point
-      // (first-zero-based
-      // char)
-      while (scanner.currentPosition < scanner.eofPosition) { //loop for
-        // jumping
-        // over
-        // comments
-        try {
-          // ---------Consume white space and handles
-          // startPosition---------
-          boolean isWhiteSpace;
-          do {
-            scanner.startPosition = scanner.currentPosition;
-            //                                         if (((scanner.currentCharacter =
-            // source[scanner.currentPosition++]) == '\\') &&
-            // (source[scanner.currentPosition] == 'u')) {
-            //                                                 isWhiteSpace = scanner.jumpOverUnicodeWhiteSpace();
-            //                                         } else {
-            if (scanner.recordLineSeparator && ((scanner.currentCharacter == '\r') || (scanner.currentCharacter == '\n'))) {
-              if (scanner.lineEnds[scanner.linePtr] < scanner.startPosition) {
-                // only record line positions we have not
-                // recorded yet
-                scanner.pushLineSeparator();
-              }
-            }
-            isWhiteSpace = CharOperation.isWhitespace(scanner.currentCharacter);
-            //                                         }
-          } while (isWhiteSpace && (scanner.currentPosition < scanner.eofPosition));
-          // -------consume token until } is found---------
-          switch (scanner.currentCharacter) {
-          case '{': {
-            int index = leftCount[CurlyBracket]++;
-            if (index == leftPositions[CurlyBracket].length) {
-              System.arraycopy(leftPositions[CurlyBracket], 0, (leftPositions[CurlyBracket] = new int[index * 2]), 0, index);
-              System.arraycopy(leftDepths[CurlyBracket], 0, (leftDepths[CurlyBracket] = new int[index * 2]), 0, index);
-            }
-            leftPositions[CurlyBracket][index] = scanner.startPosition;
-            leftDepths[CurlyBracket][index] = depths[CurlyBracket]++;
-          }
-            break;
-          case '}': {
-            int index = rightCount[CurlyBracket]++;
-            if (index == rightPositions[CurlyBracket].length) {
-              System.arraycopy(rightPositions[CurlyBracket], 0, (rightPositions[CurlyBracket] = new int[index * 2]), 0, index);
-              System.arraycopy(rightDepths[CurlyBracket], 0, (rightDepths[CurlyBracket] = new int[index * 2]), 0, index);
-            }
-            rightPositions[CurlyBracket][index] = scanner.startPosition;
-            rightDepths[CurlyBracket][index] = --depths[CurlyBracket];
-          }
-            break;
-          case '(': {
-            int index = leftCount[RoundBracket]++;
-            if (index == leftPositions[RoundBracket].length) {
-              System.arraycopy(leftPositions[RoundBracket], 0, (leftPositions[RoundBracket] = new int[index * 2]), 0, index);
-              System.arraycopy(leftDepths[RoundBracket], 0, (leftDepths[RoundBracket] = new int[index * 2]), 0, index);
-            }
-            leftPositions[RoundBracket][index] = scanner.startPosition;
-            leftDepths[RoundBracket][index] = depths[RoundBracket]++;
-          }
-            break;
-          case ')': {
-            int index = rightCount[RoundBracket]++;
-            if (index == rightPositions[RoundBracket].length) {
-              System.arraycopy(rightPositions[RoundBracket], 0, (rightPositions[RoundBracket] = new int[index * 2]), 0, index);
-              System.arraycopy(rightDepths[RoundBracket], 0, (rightDepths[RoundBracket] = new int[index * 2]), 0, index);
-            }
-            rightPositions[RoundBracket][index] = scanner.startPosition;
-            rightDepths[RoundBracket][index] = --depths[RoundBracket];
-          }
-            break;
-          case '[': {
-            int index = leftCount[SquareBracket]++;
-            if (index == leftPositions[SquareBracket].length) {
-              System.arraycopy(leftPositions[SquareBracket], 0, (leftPositions[SquareBracket] = new int[index * 2]), 0, index);
-              System.arraycopy(leftDepths[SquareBracket], 0, (leftDepths[SquareBracket] = new int[index * 2]), 0, index);
-            }
-            leftPositions[SquareBracket][index] = scanner.startPosition;
-            leftDepths[SquareBracket][index] = depths[SquareBracket]++;
-          }
-            break;
-          case ']': {
-            int index = rightCount[SquareBracket]++;
-            if (index == rightPositions[SquareBracket].length) {
-              System.arraycopy(rightPositions[SquareBracket], 0, (rightPositions[SquareBracket] = new int[index * 2]), 0, index);
-              System.arraycopy(rightDepths[SquareBracket], 0, (rightDepths[SquareBracket] = new int[index * 2]), 0, index);
-            }
-            rightPositions[SquareBracket][index] = scanner.startPosition;
-            rightDepths[SquareBracket][index] = --depths[SquareBracket];
-          }
-            break;
-          case '\'': {
-            if (scanner.getNextChar('\\')) {
-              scanner.scanEscapeCharacter();
-            } else { // consume next character
-              scanner.unicodeAsBackSlash = false;
-              //                                                                       if (((scanner.currentCharacter =
-              // source[scanner.currentPosition++]) ==
-              // '\\') &&
-              // (source[scanner.currentPosition] ==
-              // 'u')) {
-              //                                                                               scanner.getNextUnicodeChar();
-              //                                                                       } else {
-              if (scanner.withoutUnicodePtr != 0) {
-                scanner.withoutUnicodeBuffer[++scanner.withoutUnicodePtr] = scanner.currentCharacter;
-              }
-              //                                                                       }
-            }
-            scanner.getNextChar('\'');
-            break;
-          }
-          case '"':
-            // consume next character
-            scanner.unicodeAsBackSlash = false;
-            //                                                 if (((scanner.currentCharacter =
-            // source[scanner.currentPosition++]) == '\\') &&
-            // (source[scanner.currentPosition] == 'u')) {
-            //                                                         scanner.getNextUnicodeChar();
-            //                                                 } else {
-            if (scanner.withoutUnicodePtr != 0) {
-              scanner.withoutUnicodeBuffer[++scanner.withoutUnicodePtr] = scanner.currentCharacter;
-            }
-            //                                                 }
-            while (scanner.currentCharacter != '"') {
-              if (scanner.currentCharacter == '\r') {
-                if (source[scanner.currentPosition] == '\n')
-                  scanner.currentPosition++;
-                break; // the string cannot go further that
-                // the line
-              }
-              if (scanner.currentCharacter == '\n') {
-                break; // the string cannot go further that
-                // the line
-              }
-              if (scanner.currentCharacter == '\\') {
-                scanner.scanEscapeCharacter();
-              }
-              // consume next character
-              scanner.unicodeAsBackSlash = false;
-              //                                                               if (((scanner.currentCharacter =
-              // source[scanner.currentPosition++]) == '\\')
-              // && (source[scanner.currentPosition] == 'u'))
-              // {
-              //                                                                       scanner.getNextUnicodeChar();
-              //                                                               } else {
-              if (scanner.withoutUnicodePtr != 0) {
-                scanner.withoutUnicodeBuffer[++scanner.withoutUnicodePtr] = scanner.currentCharacter;
-              }
-              //                                                               }
-            }
-            break;
-          case '/': {
-            int test;
-            if ((test = scanner.getNextChar('/', '*')) == 0) { //line
-              // comment
-              //get the next char
-              if (((scanner.currentCharacter = source[scanner.currentPosition++]) == '\\')
-                  && (source[scanner.currentPosition] == 'u')) {
-                //-------------unicode traitement
-                // ------------
-                int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
-                scanner.currentPosition++;
-                while (source[scanner.currentPosition] == 'u') {
-                  scanner.currentPosition++;
-                }
-                if ((c1 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c1 < 0
-                    || (c2 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c2 < 0
-                    || (c3 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c3 < 0
-                    || (c4 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c4 < 0) { //error
-                  // don't
-                  // care of the
-                  // value
-                  scanner.currentCharacter = 'A';
-                } //something different from \n and \r
-                else {
-                  scanner.currentCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
-                }
-              }
-              while (scanner.currentCharacter != '\r' && scanner.currentCharacter != '\n') {
-                //get the next char
-                scanner.startPosition = scanner.currentPosition;
-                if (((scanner.currentCharacter = source[scanner.currentPosition++]) == '\\')
-                    && (source[scanner.currentPosition] == 'u')) {
-                  //-------------unicode traitement
-                  // ------------
-                  int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
-                  scanner.currentPosition++;
-                  while (source[scanner.currentPosition] == 'u') {
-                    scanner.currentPosition++;
-                  }
-                  if ((c1 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c1 < 0
-                      || (c2 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c2 < 0
-                      || (c3 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c3 < 0
-                      || (c4 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c4 < 0) { //error
-                    // don't
-                    // care of the
-                    // value
-                    scanner.currentCharacter = 'A';
-                  } //something different from \n
-                  // and \r
-                  else {
-                    scanner.currentCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
-                  }
-                }
-              }
-              if (scanner.recordLineSeparator && ((scanner.currentCharacter == '\r') || (scanner.currentCharacter == '\n'))) {
-                if (scanner.lineEnds[scanner.linePtr] < scanner.startPosition) {
-                  // only record line positions we
-                  // have not recorded yet
-                  scanner.pushLineSeparator();
-                  if (this.scanner.taskTags != null) {
-                    this.scanner.checkTaskTag(this.scanner.getCurrentTokenStartPosition(), this.scanner
-                        .getCurrentTokenEndPosition());
-                  }
-                }
-              }
-              break;
-            }
-            if (test > 0) { //traditional and annotation
-              // comment
-              boolean star = false;
-              // consume next character
-              scanner.unicodeAsBackSlash = false;
-              //                                                                       if (((scanner.currentCharacter =
-              // source[scanner.currentPosition++]) ==
-              // '\\') &&
-              // (source[scanner.currentPosition] ==
-              // 'u')) {
-              //                                                                               scanner.getNextUnicodeChar();
-              //                                                                       } else {
-              if (scanner.withoutUnicodePtr != 0) {
-                scanner.withoutUnicodeBuffer[++scanner.withoutUnicodePtr] = scanner.currentCharacter;
-              }
-              //                                                                       }
-              if (scanner.currentCharacter == '*') {
-                star = true;
-              }
-              //get the next char
-              if (((scanner.currentCharacter = source[scanner.currentPosition++]) == '\\')
-                  && (source[scanner.currentPosition] == 'u')) {
-                //-------------unicode traitement
-                // ------------
-                int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
-                scanner.currentPosition++;
-                while (source[scanner.currentPosition] == 'u') {
-                  scanner.currentPosition++;
-                }
-                if ((c1 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c1 < 0
-                    || (c2 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c2 < 0
-                    || (c3 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c3 < 0
-                    || (c4 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c4 < 0) { //error
-                  // don't
-                  // care of the
-                  // value
-                  scanner.currentCharacter = 'A';
-                } //something different from * and /
-                else {
-                  scanner.currentCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
-                }
-              }
-              //loop until end of comment */
-              while ((scanner.currentCharacter != '/') || (!star)) {
-                star = scanner.currentCharacter == '*';
-                //get next char
-                if (((scanner.currentCharacter = source[scanner.currentPosition++]) == '\\')
-                    && (source[scanner.currentPosition] == 'u')) {
-                  //-------------unicode traitement
-                  // ------------
-                  int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
-                  scanner.currentPosition++;
-                  while (source[scanner.currentPosition] == 'u') {
-                    scanner.currentPosition++;
-                  }
-                  if ((c1 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c1 < 0
-                      || (c2 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c2 < 0
-                      || (c3 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c3 < 0
-                      || (c4 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c4 < 0) { //error
-                    // don't
-                    // care of the
-                    // value
-                    scanner.currentCharacter = 'A';
-                  } //something different from * and
-                  // /
-                  else {
-                    scanner.currentCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
-                  }
-                }
-              }
-              if (this.scanner.taskTags != null) {
-                this.scanner.checkTaskTag(this.scanner.getCurrentTokenStartPosition(), this.scanner.getCurrentTokenEndPosition());
-              }
-              break;
-            }
-            break;
-          }
-          default:
-            if (Scanner.isPHPIdentifierStart(scanner.currentCharacter)) {
-              scanner.scanIdentifierOrKeyword(false);
-              break;
-            }
-            if (Character.isDigit(scanner.currentCharacter)) {
-              scanner.scanNumber(false);
-              break;
-            }
-          }
-          //-----------------end switch while
-          // try--------------------
-        } catch (IndexOutOfBoundsException e) {
-          break; // read until EOF
-        } catch (InvalidInputException e) {
-          return false; // no clue
-        }
-      }
-      if (scanner.recordLineSeparator) {
-        compilationUnit.compilationResult.lineSeparatorPositions = scanner.getLineEnds();
-      }
-      // check placement anomalies against other kinds of brackets
-      for (int kind = 0; kind < BracketKinds; kind++) {
-        for (int leftIndex = leftCount[kind] - 1; leftIndex >= 0; leftIndex--) {
-          int start = leftPositions[kind][leftIndex]; // deepest
-          // first
-          // find matching closing bracket
-          int depth = leftDepths[kind][leftIndex];
-          int end = -1;
-          for (int i = 0; i < rightCount[kind]; i++) {
-            int pos = rightPositions[kind][i];
-            // want matching bracket further in source with same
-            // depth
-            if ((pos > start) && (depth == rightDepths[kind][i])) {
-              end = pos;
-              break;
-            }
-          }
-          if (end < 0) { // did not find a good closing match
-            problemReporter.unmatchedBracket(start, referenceContext, compilationUnit.compilationResult);
-            return true;
-          }
-          // check if even number of opening/closing other brackets
-          // in between this pair of brackets
-          int balance = 0;
-          for (int otherKind = 0; (balance == 0) && (otherKind < BracketKinds); otherKind++) {
-            for (int i = 0; i < leftCount[otherKind]; i++) {
-              int pos = leftPositions[otherKind][i];
-              if ((pos > start) && (pos < end))
-                balance++;
-            }
-            for (int i = 0; i < rightCount[otherKind]; i++) {
-              int pos = rightPositions[otherKind][i];
-              if ((pos > start) && (pos < end))
-                balance--;
-            }
-            if (balance != 0) {
-              problemReporter.unmatchedBracket(start, referenceContext, compilationUnit.compilationResult); //bracket
-              // anomaly
-              return true;
-            }
-          }
-        }
-        // too many opening brackets ?
-        for (int i = rightCount[kind]; i < leftCount[kind]; i++) {
-          anomaliesDetected = true;
-          problemReporter.unmatchedBracket(leftPositions[kind][leftCount[kind] - i - 1], referenceContext,
-              compilationUnit.compilationResult);
-        }
-        // too many closing brackets ?
-        for (int i = leftCount[kind]; i < rightCount[kind]; i++) {
-          anomaliesDetected = true;
-          problemReporter.unmatchedBracket(rightPositions[kind][i], referenceContext, compilationUnit.compilationResult);
-        }
-        if (anomaliesDetected)
-          return true;
-      }
-      return anomaliesDetected;
-    } catch (ArrayStoreException e) { // jdk1.2.2 jit bug
-      return anomaliesDetected;
-    } catch (NullPointerException e) { // jdk1.2.2 jit bug
-      return anomaliesDetected;
-    }
-  }
+//  public boolean checkAndReportBracketAnomalies(ProblemReporter problemReporter) {
+//    scanner.wasAcr = false;
+//    boolean anomaliesDetected = false;
+//    try {
+//      char[] source = scanner.source;
+//      int[] leftCount = { 0, 0, 0 };
+//      int[] rightCount = { 0, 0, 0 };
+//      int[] depths = { 0, 0, 0 };
+//      int[][] leftPositions = new int[][] { new int[10], new int[10], new int[10] };
+//      int[][] leftDepths = new int[][] { new int[10], new int[10], new int[10] };
+//      int[][] rightPositions = new int[][] { new int[10], new int[10], new int[10] };
+//      int[][] rightDepths = new int[][] { new int[10], new int[10], new int[10] };
+//      scanner.currentPosition = scanner.initialPosition; //starting
+//      // point
+//      // (first-zero-based
+//      // char)
+//      while (scanner.currentPosition < scanner.eofPosition) { //loop for
+//        // jumping
+//        // over
+//        // comments
+//        try {
+//          // ---------Consume white space and handles
+//          // startPosition---------
+//          boolean isWhiteSpace;
+//          do {
+//            scanner.startPosition = scanner.currentPosition;
+//            //                                               if (((scanner.currentCharacter =
+//            // source[scanner.currentPosition++]) == '\\') &&
+//            // (source[scanner.currentPosition] == 'u')) {
+//            //                                                       isWhiteSpace = scanner.jumpOverUnicodeWhiteSpace();
+//            //                                               } else {
+//            if (scanner.recordLineSeparator && ((scanner.currentCharacter == '\r') || (scanner.currentCharacter == '\n'))) {
+//              if (scanner.lineEnds[scanner.linePtr] < scanner.startPosition) {
+//                // only record line positions we have not
+//                // recorded yet
+//                scanner.pushLineSeparator();
+//              }
+//            }
+//            isWhiteSpace = CharOperation.isWhitespace(scanner.currentCharacter);
+//            //                                               }
+//          } while (isWhiteSpace && (scanner.currentPosition < scanner.eofPosition));
+//          // -------consume token until } is found---------
+//          switch (scanner.currentCharacter) {
+//          case '{': {
+//            int index = leftCount[CurlyBracket]++;
+//            if (index == leftPositions[CurlyBracket].length) {
+//              System.arraycopy(leftPositions[CurlyBracket], 0, (leftPositions[CurlyBracket] = new int[index * 2]), 0, index);
+//              System.arraycopy(leftDepths[CurlyBracket], 0, (leftDepths[CurlyBracket] = new int[index * 2]), 0, index);
+//            }
+//            leftPositions[CurlyBracket][index] = scanner.startPosition;
+//            leftDepths[CurlyBracket][index] = depths[CurlyBracket]++;
+//          }
+//            break;
+//          case '}': {
+//            int index = rightCount[CurlyBracket]++;
+//            if (index == rightPositions[CurlyBracket].length) {
+//              System.arraycopy(rightPositions[CurlyBracket], 0, (rightPositions[CurlyBracket] = new int[index * 2]), 0, index);
+//              System.arraycopy(rightDepths[CurlyBracket], 0, (rightDepths[CurlyBracket] = new int[index * 2]), 0, index);
+//            }
+//            rightPositions[CurlyBracket][index] = scanner.startPosition;
+//            rightDepths[CurlyBracket][index] = --depths[CurlyBracket];
+//          }
+//            break;
+//          case '(': {
+//            int index = leftCount[RoundBracket]++;
+//            if (index == leftPositions[RoundBracket].length) {
+//              System.arraycopy(leftPositions[RoundBracket], 0, (leftPositions[RoundBracket] = new int[index * 2]), 0, index);
+//              System.arraycopy(leftDepths[RoundBracket], 0, (leftDepths[RoundBracket] = new int[index * 2]), 0, index);
+//            }
+//            leftPositions[RoundBracket][index] = scanner.startPosition;
+//            leftDepths[RoundBracket][index] = depths[RoundBracket]++;
+//          }
+//            break;
+//          case ')': {
+//            int index = rightCount[RoundBracket]++;
+//            if (index == rightPositions[RoundBracket].length) {
+//              System.arraycopy(rightPositions[RoundBracket], 0, (rightPositions[RoundBracket] = new int[index * 2]), 0, index);
+//              System.arraycopy(rightDepths[RoundBracket], 0, (rightDepths[RoundBracket] = new int[index * 2]), 0, index);
+//            }
+//            rightPositions[RoundBracket][index] = scanner.startPosition;
+//            rightDepths[RoundBracket][index] = --depths[RoundBracket];
+//          }
+//            break;
+//          case '[': {
+//            int index = leftCount[SquareBracket]++;
+//            if (index == leftPositions[SquareBracket].length) {
+//              System.arraycopy(leftPositions[SquareBracket], 0, (leftPositions[SquareBracket] = new int[index * 2]), 0, index);
+//              System.arraycopy(leftDepths[SquareBracket], 0, (leftDepths[SquareBracket] = new int[index * 2]), 0, index);
+//            }
+//            leftPositions[SquareBracket][index] = scanner.startPosition;
+//            leftDepths[SquareBracket][index] = depths[SquareBracket]++;
+//          }
+//            break;
+//          case ']': {
+//            int index = rightCount[SquareBracket]++;
+//            if (index == rightPositions[SquareBracket].length) {
+//              System.arraycopy(rightPositions[SquareBracket], 0, (rightPositions[SquareBracket] = new int[index * 2]), 0, index);
+//              System.arraycopy(rightDepths[SquareBracket], 0, (rightDepths[SquareBracket] = new int[index * 2]), 0, index);
+//            }
+//            rightPositions[SquareBracket][index] = scanner.startPosition;
+//            rightDepths[SquareBracket][index] = --depths[SquareBracket];
+//          }
+//            break;
+//          case '\'': {
+//            if (scanner.getNextChar('\\')) {
+//              scanner.scanEscapeCharacter();
+//            } else { // consume next character
+//              scanner.unicodeAsBackSlash = false;
+//              //                                                                     if (((scanner.currentCharacter =
+//              // source[scanner.currentPosition++]) ==
+//              // '\\') &&
+//              // (source[scanner.currentPosition] ==
+//              // 'u')) {
+//              //                                                                             scanner.getNextUnicodeChar();
+//              //                                                                     } else {
+//              if (scanner.withoutUnicodePtr != 0) {
+//                scanner.withoutUnicodeBuffer[++scanner.withoutUnicodePtr] = scanner.currentCharacter;
+//              }
+//              //                                                                     }
+//            }
+//            scanner.getNextChar('\'');
+//            break;
+//          }
+//          case '"':
+//            // consume next character
+//            scanner.unicodeAsBackSlash = false;
+//            //                                                       if (((scanner.currentCharacter =
+//            // source[scanner.currentPosition++]) == '\\') &&
+//            // (source[scanner.currentPosition] == 'u')) {
+//            //                                                               scanner.getNextUnicodeChar();
+//            //                                                       } else {
+//            if (scanner.withoutUnicodePtr != 0) {
+//              scanner.withoutUnicodeBuffer[++scanner.withoutUnicodePtr] = scanner.currentCharacter;
+//            }
+//            //                                                       }
+//            while (scanner.currentCharacter != '"') {
+//              if (scanner.currentCharacter == '\r') {
+//                if (source[scanner.currentPosition] == '\n')
+//                  scanner.currentPosition++;
+//                break; // the string cannot go further that
+//                // the line
+//              }
+//              if (scanner.currentCharacter == '\n') {
+//                break; // the string cannot go further that
+//                // the line
+//              }
+//              if (scanner.currentCharacter == '\\') {
+//                scanner.scanEscapeCharacter();
+//              }
+//              // consume next character
+//              scanner.unicodeAsBackSlash = false;
+//              //                                                             if (((scanner.currentCharacter =
+//              // source[scanner.currentPosition++]) == '\\')
+//              // && (source[scanner.currentPosition] == 'u'))
+//              // {
+//              //                                                                     scanner.getNextUnicodeChar();
+//              //                                                             } else {
+//              if (scanner.withoutUnicodePtr != 0) {
+//                scanner.withoutUnicodeBuffer[++scanner.withoutUnicodePtr] = scanner.currentCharacter;
+//              }
+//              //                                                             }
+//            }
+//            break;
+//          case '/': {
+//            int test;
+//            if ((test = scanner.getNextChar('/', '*')) == 0) { //line
+//              // comment
+//              //get the next char
+//              if (((scanner.currentCharacter = source[scanner.currentPosition++]) == '\\')
+//                  && (source[scanner.currentPosition] == 'u')) {
+//                //-------------unicode traitement
+//                // ------------
+//                int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
+//                scanner.currentPosition++;
+//                while (source[scanner.currentPosition] == 'u') {
+//                  scanner.currentPosition++;
+//                }
+//                if ((c1 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c1 < 0
+//                    || (c2 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c2 < 0
+//                    || (c3 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c3 < 0
+//                    || (c4 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c4 < 0) { //error
+//                  // don't
+//                  // care of the
+//                  // value
+//                  scanner.currentCharacter = 'A';
+//                } //something different from \n and \r
+//                else {
+//                  scanner.currentCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
+//                }
+//              }
+//              while (scanner.currentCharacter != '\r' && scanner.currentCharacter != '\n') {
+//                //get the next char
+//                scanner.startPosition = scanner.currentPosition;
+//                if (((scanner.currentCharacter = source[scanner.currentPosition++]) == '\\')
+//                    && (source[scanner.currentPosition] == 'u')) {
+//                  //-------------unicode traitement
+//                  // ------------
+//                  int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
+//                  scanner.currentPosition++;
+//                  while (source[scanner.currentPosition] == 'u') {
+//                    scanner.currentPosition++;
+//                  }
+//                  if ((c1 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c1 < 0
+//                      || (c2 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c2 < 0
+//                      || (c3 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c3 < 0
+//                      || (c4 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c4 < 0) { //error
+//                    // don't
+//                    // care of the
+//                    // value
+//                    scanner.currentCharacter = 'A';
+//                  } //something different from \n
+//                  // and \r
+//                  else {
+//                    scanner.currentCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
+//                  }
+//                }
+//              }
+//              if (scanner.recordLineSeparator && ((scanner.currentCharacter == '\r') || (scanner.currentCharacter == '\n'))) {
+//                if (scanner.lineEnds[scanner.linePtr] < scanner.startPosition) {
+//                  // only record line positions we
+//                  // have not recorded yet
+//                  scanner.pushLineSeparator();
+//                  if (this.scanner.taskTags != null) {
+//                    this.scanner.checkTaskTag(this.scanner.getCurrentTokenStartPosition(), this.scanner
+//                        .getCurrentTokenEndPosition());
+//                  }
+//                }
+//              }
+//              break;
+//            }
+//            if (test > 0) { //traditional and annotation
+//              // comment
+//              boolean star = false;
+//              // consume next character
+//              scanner.unicodeAsBackSlash = false;
+//              //                                                                     if (((scanner.currentCharacter =
+//              // source[scanner.currentPosition++]) ==
+//              // '\\') &&
+//              // (source[scanner.currentPosition] ==
+//              // 'u')) {
+//              //                                                                             scanner.getNextUnicodeChar();
+//              //                                                                     } else {
+//              if (scanner.withoutUnicodePtr != 0) {
+//                scanner.withoutUnicodeBuffer[++scanner.withoutUnicodePtr] = scanner.currentCharacter;
+//              }
+//              //                                                                     }
+//              if (scanner.currentCharacter == '*') {
+//                star = true;
+//              }
+//              //get the next char
+//              if (((scanner.currentCharacter = source[scanner.currentPosition++]) == '\\')
+//                  && (source[scanner.currentPosition] == 'u')) {
+//                //-------------unicode traitement
+//                // ------------
+//                int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
+//                scanner.currentPosition++;
+//                while (source[scanner.currentPosition] == 'u') {
+//                  scanner.currentPosition++;
+//                }
+//                if ((c1 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c1 < 0
+//                    || (c2 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c2 < 0
+//                    || (c3 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c3 < 0
+//                    || (c4 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c4 < 0) { //error
+//                  // don't
+//                  // care of the
+//                  // value
+//                  scanner.currentCharacter = 'A';
+//                } //something different from * and /
+//                else {
+//                  scanner.currentCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
+//                }
+//              }
+//              //loop until end of comment */
+//              while ((scanner.currentCharacter != '/') || (!star)) {
+//                star = scanner.currentCharacter == '*';
+//                //get next char
+//                if (((scanner.currentCharacter = source[scanner.currentPosition++]) == '\\')
+//                    && (source[scanner.currentPosition] == 'u')) {
+//                  //-------------unicode traitement
+//                  // ------------
+//                  int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
+//                  scanner.currentPosition++;
+//                  while (source[scanner.currentPosition] == 'u') {
+//                    scanner.currentPosition++;
+//                  }
+//                  if ((c1 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c1 < 0
+//                      || (c2 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c2 < 0
+//                      || (c3 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c3 < 0
+//                      || (c4 = Character.getNumericValue(source[scanner.currentPosition++])) > 15 || c4 < 0) { //error
+//                    // don't
+//                    // care of the
+//                    // value
+//                    scanner.currentCharacter = 'A';
+//                  } //something different from * and
+//                  // /
+//                  else {
+//                    scanner.currentCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
+//                  }
+//                }
+//              }
+//              if (this.scanner.taskTags != null) {
+//                this.scanner.checkTaskTag(this.scanner.getCurrentTokenStartPosition(), this.scanner.getCurrentTokenEndPosition());
+//              }
+//              break;
+//            }
+//            break;
+//          }
+//          default:
+//            if (Scanner.isPHPIdentifierStart(scanner.currentCharacter)) {
+//              scanner.scanIdentifierOrKeyword(false);
+//              break;
+//            }
+//            if (Character.isDigit(scanner.currentCharacter)) {
+//              scanner.scanNumber(false);
+//              break;
+//            }
+//          }
+//          //-----------------end switch while
+//          // try--------------------
+//        } catch (IndexOutOfBoundsException e) {
+//          break; // read until EOF
+//        } catch (InvalidInputException e) {
+//          return false; // no clue
+//        }
+//      }
+//      if (scanner.recordLineSeparator) {
+//        compilationUnit.compilationResult.lineSeparatorPositions = scanner.getLineEnds();
+//      }
+//      // check placement anomalies against other kinds of brackets
+//      for (int kind = 0; kind < BracketKinds; kind++) {
+//        for (int leftIndex = leftCount[kind] - 1; leftIndex >= 0; leftIndex--) {
+//          int start = leftPositions[kind][leftIndex]; // deepest
+//          // first
+//          // find matching closing bracket
+//          int depth = leftDepths[kind][leftIndex];
+//          int end = -1;
+//          for (int i = 0; i < rightCount[kind]; i++) {
+//            int pos = rightPositions[kind][i];
+//            // want matching bracket further in source with same
+//            // depth
+//            if ((pos > start) && (depth == rightDepths[kind][i])) {
+//              end = pos;
+//              break;
+//            }
+//          }
+//          if (end < 0) { // did not find a good closing match
+//            problemReporter.unmatchedBracket(start, referenceContext, compilationUnit.compilationResult);
+//            return true;
+//          }
+//          // check if even number of opening/closing other brackets
+//          // in between this pair of brackets
+//          int balance = 0;
+//          for (int otherKind = 0; (balance == 0) && (otherKind < BracketKinds); otherKind++) {
+//            for (int i = 0; i < leftCount[otherKind]; i++) {
+//              int pos = leftPositions[otherKind][i];
+//              if ((pos > start) && (pos < end))
+//                balance++;
+//            }
+//            for (int i = 0; i < rightCount[otherKind]; i++) {
+//              int pos = rightPositions[otherKind][i];
+//              if ((pos > start) && (pos < end))
+//                balance--;
+//            }
+//            if (balance != 0) {
+//              problemReporter.unmatchedBracket(start, referenceContext, compilationUnit.compilationResult); //bracket
+//              // anomaly
+//              return true;
+//            }
+//          }
+//        }
+//        // too many opening brackets ?
+//        for (int i = rightCount[kind]; i < leftCount[kind]; i++) {
+//          anomaliesDetected = true;
+//          problemReporter.unmatchedBracket(leftPositions[kind][leftCount[kind] - i - 1], referenceContext,
+//              compilationUnit.compilationResult);
+//        }
+//        // too many closing brackets ?
+//        for (int i = leftCount[kind]; i < rightCount[kind]; i++) {
+//          anomaliesDetected = true;
+//          problemReporter.unmatchedBracket(rightPositions[kind][i], referenceContext, compilationUnit.compilationResult);
+//        }
+//        if (anomaliesDetected)
+//          return true;
+//      }
+//      return anomaliesDetected;
+//    } catch (ArrayStoreException e) { // jdk1.2.2 jit bug
+//      return anomaliesDetected;
+//    } catch (NullPointerException e) { // jdk1.2.2 jit bug
+//      return anomaliesDetected;
+//    }
+//  }
 
   protected void pushOnAstLengthStack(int pos) {
     try {
@@ -4601,7 +4451,6 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
     String ext = file.getRawLocation().getFileExtension();
     int fileExtensionLength = ext == null ? 0 : ext.length() + 1;
     ImportReference impt;
-    int length;
     char[][] tokens;
     if (filePath.startsWith(projectPath)) {
       tokens = CharOperation
@@ -4710,18 +4559,6 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
    */
   private boolean containsVariableSet() {
     return containsVariableSet(scanner.getCurrentTokenSource());
-    //    if (!fStackUnassigned.isEmpty()) {
-    //      HashSet set;
-    //      String str = new String(scanner.getCurrentTokenSource());
-    //      for (int i = 0; i < fStackUnassigned.size(); i++) {
-    //        set = (HashSet) fStackUnassigned.get(i);
-    //        if (set.contains(str)) {
-    //          return true;
-    //        }
-    //      }
-    //      return false;
-    //    }
-    //    return true;
   }
 
   private boolean containsVariableSet(char[] token) {