Some minor changes
[phpeclipse.git] / net.sourceforge.phpeclipse / src / test / PHPParser.java
index 219e662..301d62c 100644 (file)
@@ -209,14 +209,14 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
                   e.currentToken.sourceStart,
                   e.currentToken.sourceEnd,
                   errorLevel,
-                  "Line " + e.currentToken.beginLine+", "+e.currentToken.sourceStart+":"+e.currentToken.sourceEnd);
+                  "Line " + e.currentToken.beginLine+", "+e.currentToken.sourceStart+':'+e.currentToken.sourceEnd);
       } else {
         setMarker(fileToParse,
                   errorMessage,
                   errorStart,
                   errorEnd,
                   errorLevel,
-                  "Line " + e.currentToken.beginLine+", "+errorStart+":"+errorEnd);
+                  "Line " + e.currentToken.beginLine+", "+errorStart+':'+errorEnd);
         errorStart = -1;
         errorEnd = -1;
       }
@@ -312,9 +312,8 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon
           currentPosition > SimpleCharStream.currentBuffer.length()) {
       return;
     }
-    final char[] chars = SimpleCharStream.currentBuffer.substring(htmlStart,
-                                                                  currentPosition).toCharArray();
-    pushOnAstNodes(new HTMLCode(chars, htmlStart,currentPosition));
+    final String html = SimpleCharStream.currentBuffer.substring(htmlStart, currentPosition);
+    pushOnAstNodes(new HTMLCode(html, htmlStart,currentPosition));
   }
 
   /** Create a new task. */
@@ -953,7 +952,7 @@ Token token;
       break;
     case IDENTIFIER:
       token = jj_consume_token(IDENTIFIER);
-   outlineInfo.addVariable("$" + token.image);
+   outlineInfo.addVariable('$' + token.image);
    {if (true) return new Variable(token.image,token.sourceStart,token.sourceEnd);}
       break;
     default:
@@ -1266,7 +1265,7 @@ final Expression expr,expr2;
       ;
     }
     variableDeclaration = VariableDeclaratorNoSuffix();
-    outlineInfo.addVariable("$"+variableDeclaration.name());
+    outlineInfo.addVariable('$'+variableDeclaration.name());
     if (token != null) {
       variableDeclaration.setReference(true);
     }
@@ -1889,7 +1888,7 @@ final Expression expr,expr2;
       expr = UnaryExpression();
     } catch (ParseException e) {
     if (errorMessage != null) {if (true) throw e;}
-    errorMessage = "unexpected token '"+e.currentToken.next.image+"'";
+    errorMessage = "unexpected token '"+e.currentToken.next.image+'\'';
     errorLevel   = ERROR;
     errorStart = PHPParser.token.sourceStart;
     errorEnd   = PHPParser.token.sourceEnd;
@@ -4005,6 +4004,7 @@ Token token;
   Statement statement;
   final ArrayList stmts = new ArrayList();
   final Token token = PHPParser.token;
+  final int start = PHPParser.token.next.sourceStart;
     expr = SwitchLabel();
     label_31:
     while (true) {
@@ -4123,7 +4123,8 @@ Token token;
     final Statement[] stmtsArray = new Statement[listSize];
     stmts.toArray(stmtsArray);
     if (expr == null) {//it's a default
-      {if (true) return new DefaultCase(stmtsArray,token.sourceStart,stmtsArray[listSize-1].sourceEnd);}
+      final int end = PHPParser.token.next.sourceStart;
+      {if (true) return new DefaultCase(stmtsArray,start,end);}
     }
     if (listSize != 0) {
       {if (true) return new Case(expr,stmtsArray,expr.sourceStart,stmtsArray[listSize-1].sourceEnd);}
@@ -5107,7 +5108,7 @@ Token token;
     }
     try {
       statement = Statement();
-     pos = rparenToken.sourceEnd+1;
+     pos = statement.sourceEnd+1;
     } catch (ParseException e) {
     if (errorMessage != null) {if (true) throw e;}
     errorMessage = "statement expected";
@@ -5120,7 +5121,7 @@ Token token;
                                variable,
                                statement,
                                foreachToken.sourceStart,
-                               statement.sourceEnd);}
+                               pos);}
     throw new Error("Missing return statement in function");
   }
 
@@ -5963,6 +5964,12 @@ final ArrayList list = new ArrayList();
     return false;
   }
 
+  static final private boolean jj_3_5() {
+    if (jj_3R_45()) return true;
+    if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
+    return false;
+  }
+
   static final private boolean jj_3R_186() {
     if (jj_scan_token(BIT_AND)) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
@@ -6002,12 +6009,6 @@ final ArrayList list = new ArrayList();
     return false;
   }
 
-  static final private boolean jj_3_5() {
-    if (jj_3R_45()) 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(ORASSIGN)) return true;
     if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;