From: kpouer Date: Mon, 18 Aug 2003 17:43:19 +0000 (+0000) Subject: a lot of bugfixes X-Git-Url: http://git.phpeclipse.com a lot of bugfixes --- diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java index 48fdda2..b61470f 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java @@ -222,11 +222,11 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild return list; } - private boolean isVariableDeclaredBefore(List list, VariableUsage var) { + private boolean isVariableDeclaredBefore(final List list, final VariableUsage var) { final String name = var.getName(); final int pos = var.getStartOffset(); for (int i = 0; i < list.size(); i++) { - VariableUsage variableUsage = (VariableUsage) list.get(i); + final VariableUsage variableUsage = (VariableUsage) list.get(i); if (variableUsage.getName().equals(name) && variableUsage.getStartOffset() < pos) { return true; } @@ -269,7 +269,7 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild */ private void findUnusedParameters(final List vars, final List parameters) { for (int i = 0; i < parameters.size(); i++) { - VariableUsage param = ((VariableUsage)parameters.get(i)); + final VariableUsage param = ((VariableUsage)parameters.get(i)); if (!isVariableInList(param.getName(),vars)) { try { PHPParserSuperclass.setMarker("warning, the parameter "+param.getName() +" seems to be never used in your method", @@ -300,7 +300,7 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild */ private void findUnknownUsedVars(final List usedVars, final List declaredVars) { for (int i = 0; i < usedVars.size(); i++) { - VariableUsage variableUsage = (VariableUsage) usedVars.get(i); + final VariableUsage variableUsage = (VariableUsage) usedVars.get(i); if (variableUsage.getName().equals("this")) continue; // this is a special variable if (!isVariableDeclaredBefore(declaredVars, variableUsage)) { try { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PostfixedUnaryExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PostfixedUnaryExpression.java index a358e25..22e31be 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PostfixedUnaryExpression.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PostfixedUnaryExpression.java @@ -5,7 +5,9 @@ package net.sourceforge.phpdt.internal.compiler.ast; */ public class PostfixedUnaryExpression extends UnaryExpression { - public PostfixedUnaryExpression(final Expression expression, final int operator, final int sourceEnd) { + public PostfixedUnaryExpression(final Expression expression, + final int operator, + final int sourceEnd) { super(expression, operator, expression.sourceStart, sourceEnd); } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteral.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteral.java index 5a515aa..b8f3672 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteral.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/StringLiteral.java @@ -15,7 +15,7 @@ import test.Token; public class StringLiteral extends Literal { String source; - public StringLiteral(Token token) { + public StringLiteral(final Token token) { super(token.sourceStart,token.sourceEnd); source = token.image; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SwitchStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SwitchStatement.java index e582ed8..ad8f484 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SwitchStatement.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/SwitchStatement.java @@ -1,7 +1,5 @@ package net.sourceforge.phpdt.internal.compiler.ast; -import net.sourceforge.phpdt.internal.compiler.ast.declarations.VariableUsage; - import java.util.List; import java.util.ArrayList; diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.java b/net.sourceforge.phpeclipse/src/test/PHPParser.java index 207a344..13544ce 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.java +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.java @@ -64,7 +64,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon /** The cursor in expression stack. */ private static int nodePtr; - private static final boolean PARSER_DEBUG = true; + public static final boolean PARSER_DEBUG = false; public final void setFileToParse(final IFile fileToParse) { PHPParser.fileToParse = fileToParse; @@ -167,6 +167,13 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon return outlineInfo; } + /** + * This function will throw the exception if we are in debug mode + * and process it if we are in production mode. + * this should be fast since the PARSER_DEBUG is static final so the difference will be at compile time + * @param e the exception + * @throws ParseException the thrown exception + */ private static void processParseExceptionDebug(final ParseException e) throws ParseException { if (PARSER_DEBUG) { throw e; @@ -202,14 +209,14 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon e.currentToken.sourceStart, e.currentToken.sourceEnd, errorLevel, - "Line " + e.currentToken.beginLine); + "Line " + e.currentToken.beginLine+", "+e.currentToken.sourceStart+":"+e.currentToken.sourceEnd); } else { setMarker(fileToParse, errorMessage, errorStart, errorEnd, errorLevel, - "Line " + e.currentToken.beginLine); + "Line " + e.currentToken.beginLine+", "+errorStart+":"+errorEnd); errorStart = -1; errorEnd = -1; } @@ -398,8 +405,8 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon PHPParser.createNewHTMLCode(); } catch (TokenMgrError e) { PHPeclipsePlugin.log(e); - errorStart = SimpleCharStream.getPosition(); - errorEnd = errorStart + 1; + errorStart = SimpleCharStream.beginOffset; + errorEnd = SimpleCharStream.endOffset; errorMessage = e.getMessage(); errorLevel = ERROR; {if (true) throw generateParseException();} @@ -592,7 +599,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon static final public ClassDeclaration ClassDeclaration() throws ParseException { final ClassDeclaration classDeclaration; Token className = null; - final Token superclassName, token; + final Token superclassName, token, extendsToken; String classNameImage = SYNTAX_ERROR_CHAR; String superclassNameImage = null; token = jj_consume_token(CLASS); @@ -602,21 +609,21 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = token.sourceEnd+1; + errorEnd = token.sourceEnd+1; processParseExceptionDebug(e); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case EXTENDS: - jj_consume_token(EXTENDS); + extendsToken = jj_consume_token(EXTENDS); try { superclassName = jj_consume_token(IDENTIFIER); superclassNameImage = superclassName.image; } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = extendsToken.sourceEnd+1; + errorEnd = extendsToken.sourceEnd+1; processParseExceptionDebug(e); superclassNameImage = SYNTAX_ERROR_CHAR; } @@ -723,10 +730,12 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon final ArrayList arrayList = new ArrayList(); final Token token; Token token2 = null; + int pos; token = jj_consume_token(VAR); variableDeclaration = VariableDeclaratorNoSuffix(); - arrayList.add(variableDeclaration); - outlineInfo.addVariable(variableDeclaration.name()); + arrayList.add(variableDeclaration); + outlineInfo.addVariable(variableDeclaration.name()); + pos = variableDeclaration.sourceEnd; label_4: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -739,16 +748,17 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } jj_consume_token(COMMA); variableDeclaration = VariableDeclaratorNoSuffix(); - arrayList.add(variableDeclaration); - outlineInfo.addVariable(variableDeclaration.name()); + arrayList.add(variableDeclaration); + outlineInfo.addVariable(variableDeclaration.name()); + pos = variableDeclaration.sourceEnd; } try { token2 = jj_consume_token(SEMICOLON); } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected after variable declaration"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = pos+1; + errorEnd = pos+1; processParseExceptionDebug(e); } list = new VariableDeclaration[arrayList.size()]; @@ -816,17 +826,18 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon static final public VariableDeclaration VariableDeclarator() throws ParseException { final AbstractVariable variable; Expression initializer = null; + final Token token; variable = VariableDeclaratorId(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ASSIGN: - jj_consume_token(ASSIGN); + token = jj_consume_token(ASSIGN); try { initializer = VariableInitializer(); } catch (ParseException e) { errorMessage = "Literal expression expected in variable initializer"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = token.sourceEnd+1; + errorEnd = token.sourceEnd+1; processParseExceptionDebug(e); } break; @@ -1217,7 +1228,7 @@ final Expression expr,expr2; token = jj_consume_token(FUNCTION); try { functionDeclaration = MethodDeclarator(token.sourceStart); - outlineInfo.addVariable(new String(functionDeclaration.name)); + outlineInfo.addVariable(functionDeclaration.name); } catch (ParseException e) { if (errorMessage != null) {if (true) throw e;} errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function identifier expected"; @@ -1244,10 +1255,11 @@ final Expression expr,expr2; Token reference = null; final Hashtable formalParameters = new Hashtable(); String identifierChar = SYNTAX_ERROR_CHAR; - final int end; + int end = start; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BIT_AND: reference = jj_consume_token(BIT_AND); + end = reference.sourceEnd; break; default: jj_la1[25] = jj_gen; @@ -1255,12 +1267,13 @@ final Expression expr,expr2; } try { identifier = jj_consume_token(IDENTIFIER); - identifierChar = identifier.image; + identifierChar = identifier.image; + end = identifier.sourceEnd; } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function identifier expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = e.currentToken.sourceEnd; + errorEnd = e.currentToken.next.sourceStart; processParseExceptionDebug(e); } end = FormalParameters(formalParameters); @@ -1295,21 +1308,23 @@ final Expression expr,expr2; static final public int FormalParameters(final Hashtable parameters) throws ParseException { VariableDeclaration var; final Token token; - int end; + Token tok = PHPParser.token; + int end = tok.sourceEnd; try { - jj_consume_token(LPAREN); + tok = jj_consume_token(LPAREN); + end = tok.sourceEnd; } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', '(' expected after function identifier"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = e.currentToken.next.sourceStart; + errorEnd = e.currentToken.next.sourceEnd; processParseExceptionDebug(e); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BIT_AND: case DOLLAR_ID: var = FormalParameter(); - parameters.put(new String(var.name()),var); + parameters.put(var.name(),var);end = var.sourceEnd; label_7: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -1322,7 +1337,7 @@ final Expression expr,expr2; } jj_consume_token(COMMA); var = FormalParameter(); - parameters.put(new String(var.name()),var); + parameters.put(var.name(),var);end = var.sourceEnd; } break; default: @@ -1335,10 +1350,9 @@ final Expression expr,expr2; } catch (ParseException e) { errorMessage = "')' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = e.currentToken.next.sourceStart; + errorEnd = e.currentToken.next.sourceEnd; processParseExceptionDebug(e); - end = e.currentToken.sourceStart; } {if (true) return end;} throw new Error("Missing return statement in function"); @@ -1790,6 +1804,7 @@ final Expression expr,expr2; static final public Expression EqualityExpression() throws ParseException { Expression expr,expr2; int operator; + Token token; expr = RelationalExpression(); label_14: while (true) { @@ -1807,24 +1822,24 @@ final Expression expr,expr2; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case EQUAL_EQUAL: - jj_consume_token(EQUAL_EQUAL); - operator = OperatorIds.EQUAL_EQUAL; + token = jj_consume_token(EQUAL_EQUAL); + operator = OperatorIds.EQUAL_EQUAL; break; case DIF: - jj_consume_token(DIF); - operator = OperatorIds.DIF; + token = jj_consume_token(DIF); + operator = OperatorIds.DIF; break; case NOT_EQUAL: - jj_consume_token(NOT_EQUAL); - operator = OperatorIds.DIF; + token = jj_consume_token(NOT_EQUAL); + operator = OperatorIds.DIF; break; case BANGDOUBLEEQUAL: - jj_consume_token(BANGDOUBLEEQUAL); - operator = OperatorIds.BANG_EQUAL_EQUAL; + token = jj_consume_token(BANGDOUBLEEQUAL); + operator = OperatorIds.BANG_EQUAL_EQUAL; break; case TRIPLEEQUAL: - jj_consume_token(TRIPLEEQUAL); - operator = OperatorIds.EQUAL_EQUAL_EQUAL; + token = jj_consume_token(TRIPLEEQUAL); + operator = OperatorIds.EQUAL_EQUAL_EQUAL; break; default: jj_la1[45] = jj_gen; @@ -1839,9 +1854,10 @@ final Expression expr,expr2; } errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = token.sourceEnd +1; + errorEnd = token.sourceEnd +1; + expr2 = new ConstantIdentifier(SYNTAX_ERROR_CHAR,token.sourceEnd +1,token.sourceEnd +1); + processParseExceptionDebug(e); } expr = new BinaryExpression(expr,expr2,operator); } @@ -1981,8 +1997,8 @@ final Expression expr,expr2; if (errorMessage != null) {if (true) throw e;} errorMessage = "unexpected token '"+e.currentToken.next.image+"'"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = PHPParser.token.sourceStart; + errorEnd = PHPParser.token.sourceEnd; {if (true) throw e;} } label_18: @@ -2184,9 +2200,9 @@ final Token token; } catch (ParseException e) { errorMessage = "')' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = expr.sourceEnd +1; + errorEnd = expr.sourceEnd +1; + processParseExceptionDebug(e); } {if (true) return expr;} break; @@ -2395,7 +2411,9 @@ final Token token,token1; final Token token; token = jj_consume_token(ARRAY); vars = ArrayInitializer(); - {if (true) return new ArrayInitializer(vars,token.sourceStart,SimpleCharStream.getPosition());} + {if (true) return new ArrayInitializer(vars, + token.sourceStart, + PHPParser.token.sourceEnd);} throw new Error("Missing return statement in function"); } @@ -2438,6 +2456,8 @@ final Token token,token1; static final public AbstractVariable VariableSuffix(final AbstractVariable prefix) throws ParseException { Expression expression = null; final Token classAccessToken; + Token token; + int pos; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case CLASSACCESS: classAccessToken = jj_consume_token(CLASSACCESS); @@ -2468,7 +2488,8 @@ final Token token,token1; ClassAccess.NORMAL);} break; case LBRACKET: - jj_consume_token(LBRACKET); + token = jj_consume_token(LBRACKET); + pos = token.sourceEnd+1; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ARRAY: case LIST: @@ -2523,6 +2544,7 @@ final Token token,token1; case LPAREN: case DOLLAR_ID: expression = Expression(); + pos = expression.sourceEnd+1; break; case STRING: case OBJECT: @@ -2534,6 +2556,7 @@ final Token token,token1; case INT: case INTEGER: expression = Type(); + pos = expression.sourceEnd+1; break; default: jj_la1[70] = jj_gen; @@ -2546,15 +2569,16 @@ final Token token,token1; ; } try { - jj_consume_token(RBRACKET); + token = jj_consume_token(RBRACKET); + pos = token.sourceEnd; } catch (ParseException e) { errorMessage = "']' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } - {if (true) return new ArrayDeclarator(prefix,expression,SimpleCharStream.getPosition());} + {if (true) return new ArrayDeclarator(prefix,expression,pos);} break; default: jj_la1[72] = jj_gen; @@ -2633,14 +2657,15 @@ final Token token; } try { token = jj_consume_token(RPAREN); + {if (true) return new FunctionCall(func,args,token.sourceEnd);} } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected to close the argument list"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = args[args.length-1].sourceEnd+1; + errorEnd = args[args.length-1].sourceEnd+1; + processParseExceptionDebug(e); } - {if (true) return new FunctionCall(func,args,token.sourceEnd);} + {if (true) return new FunctionCall(func,args,args[args.length-1].sourceEnd);} throw new Error("Missing return statement in function"); } @@ -2652,8 +2677,10 @@ final Token token; static final public Expression[] ArgumentList() throws ParseException { Expression arg; final ArrayList list = new ArrayList(); +int pos; +Token token; arg = Expression(); - list.add(arg); + list.add(arg);pos = arg.sourceEnd; label_20: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -2664,16 +2691,18 @@ final ArrayList list = new ArrayList(); jj_la1[75] = jj_gen; break label_20; } - jj_consume_token(COMMA); + token = jj_consume_token(COMMA); + pos = token.sourceEnd; try { arg = Expression(); list.add(arg); + pos = arg.sourceEnd; } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. An expression expected after a comma in argument list"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos+1; + errorEnd = pos+1; + processParseException(e); } } final Expression[] arguments = new Expression[list.size()]; @@ -2799,9 +2828,9 @@ final ArrayList list = new ArrayList(); if (e.currentToken.next.kind != PHPParserConstants.PHPEND) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = statement.sourceEnd+1; + errorEnd = statement.sourceEnd+1; + processParseExceptionDebug(e); } } {if (true) return statement;} @@ -2809,59 +2838,69 @@ final ArrayList list = new ArrayList(); } static final public Define defineStatement() throws ParseException { - final int start = SimpleCharStream.getPosition(); Expression defineName,defineValue; - jj_consume_token(DEFINE); + final Token defineToken; + Token token; + int pos; + defineToken = jj_consume_token(DEFINE); + pos = defineToken.sourceEnd+1; try { - jj_consume_token(LPAREN); + token = jj_consume_token(LPAREN); + pos = token.sourceEnd+1; } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', '(' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = pos; + errorEnd = pos; processParseExceptionDebug(e); } try { defineName = Expression(); + pos = defineName.sourceEnd+1; } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); + defineName = new StringLiteral(SYNTAX_ERROR_CHAR,pos,pos); } try { - jj_consume_token(COMMA); + token = jj_consume_token(COMMA); + pos = defineName.sourceEnd+1; } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ',' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = pos; + errorEnd = pos; processParseExceptionDebug(e); } try { defineValue = Expression(); + pos = defineValue.sourceEnd+1; } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); + defineValue = new StringLiteral(SYNTAX_ERROR_CHAR,pos,pos); } try { - jj_consume_token(RPAREN); + token = jj_consume_token(RPAREN); + pos = token.sourceEnd+1; } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = pos; + errorEnd = pos; processParseExceptionDebug(e); } {if (true) return new Define(currentSegment, defineName, defineValue, - start, - SimpleCharStream.getPosition());} + defineToken.sourceStart, + pos);} throw new Error("Missing return statement in function"); } @@ -2977,26 +3016,27 @@ final ArrayList list = new ArrayList(); * An include statement. It's "include" an expression; */ static final public InclusionStatement IncludeStatement() throws ParseException { - final Expression expr; + Expression expr; final int keyword; final InclusionStatement inclusionStatement; final Token token, token2; + int pos; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case REQUIRE: token = jj_consume_token(REQUIRE); - keyword = InclusionStatement.REQUIRE; + keyword = InclusionStatement.REQUIRE;pos=token.sourceEnd; break; case REQUIRE_ONCE: token = jj_consume_token(REQUIRE_ONCE); - keyword = InclusionStatement.REQUIRE_ONCE; + keyword = InclusionStatement.REQUIRE_ONCE;pos=token.sourceEnd; break; case INCLUDE: token = jj_consume_token(INCLUDE); - keyword = InclusionStatement.INCLUDE; + keyword = InclusionStatement.INCLUDE;pos=token.sourceEnd; break; case INCLUDE_ONCE: token = jj_consume_token(INCLUDE_ONCE); - keyword = InclusionStatement.INCLUDE_ONCE; + keyword = InclusionStatement.INCLUDE_ONCE;pos=token.sourceEnd; break; default: jj_la1[81] = jj_gen; @@ -3005,15 +3045,17 @@ final ArrayList list = new ArrayList(); } try { expr = Expression(); + pos=expr.sourceEnd; } catch (ParseException e) { if (errorMessage != null) { {if (true) throw e;} } errorMessage = "unexpected token '"+ e.currentToken.next.image+"', expression expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos+1; + errorEnd = pos+1; + expr = new ConstantIdentifier(SYNTAX_ERROR_CHAR,pos,pos); + processParseExceptionDebug(e); } inclusionStatement = new InclusionStatement(currentSegment, keyword, @@ -3036,10 +3078,10 @@ final ArrayList list = new ArrayList(); static final public PrintExpression PrintExpression() throws ParseException { final Expression expr; - final int pos = SimpleCharStream.getPosition(); - jj_consume_token(PRINT); + final Token printToken; + token = jj_consume_token(PRINT); expr = Expression(); - {if (true) return new PrintExpression(expr,pos,SimpleCharStream.getPosition());} + {if (true) return new PrintExpression(expr,token.sourceStart,expr.sourceEnd);} throw new Error("Missing return statement in function"); } @@ -3047,11 +3089,14 @@ final ArrayList list = new ArrayList(); Expression expr = null; final Expression expression; final ArrayList list = new ArrayList(); - final int pos = SimpleCharStream.getPosition(); - final Token listToken; + int pos; + final Token listToken, rParen; + Token token; listToken = jj_consume_token(LIST); + pos = listToken.sourceEnd; try { - jj_consume_token(LPAREN); + token = jj_consume_token(LPAREN); + pos = token.sourceEnd; } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', '(' expected"; errorLevel = ERROR; @@ -3063,7 +3108,7 @@ final ArrayList list = new ArrayList(); case DOLLAR: case DOLLAR_ID: expr = VariableDeclaratorId(); - list.add(expr); + list.add(expr);pos = expr.sourceEnd; break; default: jj_la1[82] = jj_gen; @@ -3081,19 +3126,20 @@ final ArrayList list = new ArrayList(); break label_22; } try { - jj_consume_token(COMMA); + token = jj_consume_token(COMMA); + pos = token.sourceEnd; } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ',' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos+1; + errorEnd = pos+1; + processParseExceptionDebug(e); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case DOLLAR: case DOLLAR_ID: expr = VariableDeclaratorId(); - list.add(expr); + list.add(expr);pos = expr.sourceEnd; break; default: jj_la1[84] = jj_gen; @@ -3101,13 +3147,14 @@ final ArrayList list = new ArrayList(); } } try { - jj_consume_token(RPAREN); + rParen = jj_consume_token(RPAREN); + pos = rParen.sourceEnd; } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos+1; + errorEnd = pos+1; + processParseExceptionDebug(e); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ASSIGN: @@ -3117,16 +3164,16 @@ final ArrayList list = new ArrayList(); list.toArray(vars); {if (true) return new ListExpression(vars, expression, - pos, - SimpleCharStream.getPosition());} + listToken.sourceStart, + expression.sourceEnd);} break; default: jj_la1[85] = jj_gen; ; } - final Variable[] vars = new Variable[list.size()]; + final AbstractVariable[] vars = new AbstractVariable[list.size()]; list.toArray(vars); - {if (true) return new ListExpression(vars,pos,SimpleCharStream.getPosition());} + {if (true) return new ListExpression(vars,listToken.sourceStart,pos);} throw new Error("Missing return statement in function"); } @@ -3181,9 +3228,10 @@ final ArrayList list = new ArrayList(); final ArrayList vars = new ArrayList(); final GlobalStatement global; final Token token, token2; + int pos; token = jj_consume_token(GLOBAL); expr = Variable(); - vars.add(expr); + vars.add(expr);pos = expr.sourceEnd+1; label_24: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -3196,25 +3244,26 @@ final ArrayList list = new ArrayList(); } jj_consume_token(COMMA); expr = Variable(); - vars.add(expr); + vars.add(expr);pos = expr.sourceEnd+1; } try { token2 = jj_consume_token(SEMICOLON); + pos = token2.sourceEnd+1; + } catch (ParseException e) { + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. a ';' was expected"; + errorLevel = ERROR; + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); + } final Variable[] variables = new Variable[vars.size()]; vars.toArray(variables); global = new GlobalStatement(currentSegment, variables, token.sourceStart, - token2.sourceEnd); + pos); currentSegment.add(global); {if (true) return global;} - } catch (ParseException e) { - errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. a ';' was expected"; - errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} - } throw new Error("Missing return statement in function"); } @@ -3222,9 +3271,10 @@ final ArrayList list = new ArrayList(); final ArrayList vars = new ArrayList(); VariableDeclaration expr; final Token token, token2; + int pos; token = jj_consume_token(STATIC); expr = VariableDeclarator(); - vars.add(expr); + vars.add(expr);pos = expr.sourceEnd+1; label_25: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -3237,22 +3287,23 @@ final ArrayList list = new ArrayList(); } jj_consume_token(COMMA); expr = VariableDeclarator(); - vars.add(expr); + vars.add(expr);pos = expr.sourceEnd+1; } try { token2 = jj_consume_token(SEMICOLON); - final VariableDeclaration[] variables = new VariableDeclaration[vars.size()]; - vars.toArray(variables); - {if (true) return new StaticStatement(variables, - token.sourceStart, - token2.sourceEnd);} + pos = token2.sourceEnd+1; } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. a ';' was expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos; + errorEnd = pos; + processParseException(e); } + final VariableDeclaration[] variables = new VariableDeclaration[vars.size()]; + vars.toArray(variables); + {if (true) return new StaticStatement(variables, + token.sourceStart, + pos);} throw new Error("Missing return statement in function"); } @@ -3277,14 +3328,18 @@ final ArrayList list = new ArrayList(); final ArrayList list = new ArrayList(); Statement statement; final Token token, token2; + int pos,start; try { token = jj_consume_token(LBRACE); + pos = token.sourceEnd+1;start=token.sourceStart; } catch (ParseException e) { errorMessage = "'{' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + pos = PHPParser.token.sourceEnd+1; + start=pos; + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } label_26: while (true) { @@ -3382,11 +3437,11 @@ final ArrayList list = new ArrayList(); case SEMICOLON: case DOLLAR_ID: statement = BlockStatement(); - list.add(statement); + list.add(statement);pos = statement.sourceEnd+1; break; case PHPEND: statement = htmlBlock(); - list.add(statement); + list.add(statement);pos = statement.sourceEnd+1; break; default: jj_la1[90] = jj_gen; @@ -3396,16 +3451,17 @@ final ArrayList list = new ArrayList(); } try { token2 = jj_consume_token(RBRACE); + pos = token2.sourceEnd+1; } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.image +"', '}' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } final Statement[] statements = new Statement[list.size()]; list.toArray(statements); - {if (true) return new Block(statements,token.sourceStart,token2.sourceEnd);} + {if (true) return new Block(statements,start,pos);} throw new Error("Missing return statement in function"); } @@ -3619,6 +3675,7 @@ final ArrayList list = new ArrayList(); */ static final public Expression StatementExpression() throws ParseException { final Expression expr; + final Token operator; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PLUS_PLUS: case MINUS_MINUS: @@ -3637,16 +3694,16 @@ final ArrayList list = new ArrayList(); case MINUS_MINUS: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PLUS_PLUS: - jj_consume_token(PLUS_PLUS); - {if (true) return new PostfixedUnaryExpression(expr, - OperatorIds.PLUS_PLUS, - SimpleCharStream.getPosition());} + operator = jj_consume_token(PLUS_PLUS); + {if (true) return new PostfixedUnaryExpression(expr, + OperatorIds.PLUS_PLUS, + operator.sourceEnd);} break; case MINUS_MINUS: - jj_consume_token(MINUS_MINUS); - {if (true) return new PostfixedUnaryExpression(expr, - OperatorIds.MINUS_MINUS, - SimpleCharStream.getPosition());} + operator = jj_consume_token(MINUS_MINUS); + {if (true) return new PostfixedUnaryExpression(expr, + OperatorIds.MINUS_MINUS, + operator.sourceEnd);} break; default: jj_la1[95] = jj_gen; @@ -3669,40 +3726,45 @@ final ArrayList list = new ArrayList(); } static final public SwitchStatement SwitchStatement() throws ParseException { - final Expression variable; + Expression variable; final AbstractCase[] cases; - final int pos = SimpleCharStream.getPosition(); - final Token switchToken; + final Token switchToken,lparenToken,rparenToken; + int pos; switchToken = jj_consume_token(SWITCH); + pos = switchToken.sourceEnd+1; try { - jj_consume_token(LPAREN); + lparenToken = jj_consume_token(LPAREN); + pos = lparenToken.sourceEnd+1; } catch (ParseException e) { errorMessage = "'(' expected after 'switch'"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } try { variable = Expression(); + pos = variable.sourceEnd+1; } catch (ParseException e) { if (errorMessage != null) { {if (true) throw e;} } errorMessage = "expression expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); + variable = new ConstantIdentifier(SYNTAX_ERROR_CHAR,pos,pos); } try { - jj_consume_token(RPAREN); + rparenToken = jj_consume_token(RPAREN); + pos = rparenToken.sourceEnd+1; } catch (ParseException e) { errorMessage = "')' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACE: @@ -3716,14 +3778,20 @@ final ArrayList list = new ArrayList(); jj_consume_token(-1); throw new ParseException(); } - {if (true) return new SwitchStatement(variable,cases,switchToken.sourceStart,SimpleCharStream.getPosition());} + {if (true) return new SwitchStatement(variable, + cases, + switchToken.sourceStart, + PHPParser.token.sourceEnd);} throw new Error("Missing return statement in function"); } static final public AbstractCase[] switchStatementBrace() throws ParseException { AbstractCase cas; final ArrayList cases = new ArrayList(); - jj_consume_token(LBRACE); + Token token; + int pos; + token = jj_consume_token(LBRACE); + pos = token.sourceEnd; label_28: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -3736,20 +3804,21 @@ final ArrayList list = new ArrayList(); break label_28; } cas = switchLabel0(); - cases.add(cas); + cases.add(cas);pos = cas.sourceEnd; } try { - jj_consume_token(RBRACE); - final AbstractCase[] abcase = new AbstractCase[cases.size()]; - cases.toArray(abcase); - {if (true) return abcase;} + token = jj_consume_token(RBRACE); + pos = token.sourceEnd; } catch (ParseException e) { errorMessage = "'}' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos+1; + errorEnd = pos+1; + processParseExceptionDebug(e); } + final AbstractCase[] abcase = new AbstractCase[cases.size()]; + cases.toArray(abcase); + {if (true) return abcase;} throw new Error("Missing return statement in function"); } @@ -3761,7 +3830,10 @@ final ArrayList list = new ArrayList(); static final public AbstractCase[] switchStatementColon(final int start, final int end) throws ParseException { AbstractCase cas; final ArrayList cases = new ArrayList(); - jj_consume_token(COLON); + Token token; + int pos; + token = jj_consume_token(COLON); + pos = token.sourceEnd; try { setMarker(fileToParse, "Ugly syntax detected, you should switch () {...} instead of switch (): ... enswitch;", @@ -3784,29 +3856,31 @@ final ArrayList list = new ArrayList(); break label_29; } cas = switchLabel0(); - cases.add(cas); + cases.add(cas);pos = cas.sourceEnd; } try { - jj_consume_token(ENDSWITCH); + token = jj_consume_token(ENDSWITCH); + pos = token.sourceEnd; } catch (ParseException e) { errorMessage = "'endswitch' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos+1; + errorEnd = pos+1; + processParseExceptionDebug(e); } try { - jj_consume_token(SEMICOLON); - final AbstractCase[] abcase = new AbstractCase[cases.size()]; - cases.toArray(abcase); - {if (true) return abcase;} + token = jj_consume_token(SEMICOLON); + pos = token.sourceEnd; } catch (ParseException e) { errorMessage = "';' expected after 'endswitch' keyword"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos+1; + errorEnd = pos+1; + processParseExceptionDebug(e); } + final AbstractCase[] abcase = new AbstractCase[cases.size()]; + cases.toArray(abcase); + {if (true) return abcase;} throw new Error("Missing return statement in function"); } @@ -3814,7 +3888,7 @@ final ArrayList list = new ArrayList(); final Expression expr; Statement statement; final ArrayList stmts = new ArrayList(); - final int pos = SimpleCharStream.getPosition(); + final Token token = PHPParser.token; expr = SwitchLabel(); label_30: while (true) { @@ -3931,12 +4005,17 @@ final ArrayList list = new ArrayList(); jj_la1[103] = jj_gen; ; } - final Statement[] stmtsArray = new Statement[stmts.size()]; - stmts.toArray(stmtsArray); - if (expr == null) {//it's a default - {if (true) return new DefaultCase(stmtsArray,pos,SimpleCharStream.getPosition());} - } - {if (true) return new Case(expr,stmtsArray,pos,SimpleCharStream.getPosition());} + final int listSize = stmts.size(); + 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);} + } + if (listSize != 0) { + {if (true) return new Case(expr,stmtsArray,expr.sourceStart,stmtsArray[listSize-1].sourceEnd);} + } else { + {if (true) return new Case(expr,stmtsArray,expr.sourceStart,expr.sourceEnd);} + } throw new Error("Missing return statement in function"); } @@ -3996,7 +4075,9 @@ final ArrayList list = new ArrayList(); static final public Break BreakStatement() throws ParseException { Expression expression = null; final Token token, token2; + int pos; token = jj_consume_token(BREAK); + pos = token.sourceEnd+1; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ARRAY: case LIST: @@ -4020,6 +4101,7 @@ final ArrayList list = new ArrayList(); case LPAREN: case DOLLAR_ID: expression = Expression(); + pos = expression.sourceEnd+1; break; default: jj_la1[105] = jj_gen; @@ -4027,14 +4109,15 @@ final ArrayList list = new ArrayList(); } try { token2 = jj_consume_token(SEMICOLON); + pos = token2.sourceEnd; } catch (ParseException e) { errorMessage = "';' expected after 'break' keyword"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } - {if (true) return new Break(expression, token.sourceStart, token2.sourceEnd);} + {if (true) return new Break(expression, token.sourceStart, pos);} throw new Error("Missing return statement in function"); } @@ -4056,8 +4139,8 @@ final ArrayList list = new ArrayList(); } catch (ParseException e) { errorMessage = "'(' expected after " + keyword + " keyword"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length(); - errorEnd = errorStart +1; + errorStart = PHPParser.token.sourceEnd + 1; + errorEnd = PHPParser.token.sourceEnd + 1; processParseExceptionDebug(e); } condition = Expression(); @@ -4066,8 +4149,8 @@ final ArrayList list = new ArrayList(); } catch (ParseException e) { errorMessage = "')' expected after " + keyword + " keyword"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = condition.sourceEnd+1; + errorEnd = condition.sourceEnd+1; processParseExceptionDebug(e); } {if (true) return condition;} @@ -4411,8 +4494,8 @@ final ArrayList list = new ArrayList(); final Expression condition; Statement statement; final ArrayList list = new ArrayList(); - final int pos = SimpleCharStream.getPosition(); - jj_consume_token(ELSEIF); + final Token elseifToken; + elseifToken = jj_consume_token(ELSEIF); condition = Condition("elseif"); jj_consume_token(COLON); label_34: @@ -4519,17 +4602,20 @@ final ArrayList list = new ArrayList(); throw new ParseException(); } } - final Statement[] stmtsArray = new Statement[list.size()]; + final int sizeList = list.size(); + final Statement[] stmtsArray = new Statement[sizeList]; list.toArray(stmtsArray); - {if (true) return new ElseIf(condition,stmtsArray ,pos,SimpleCharStream.getPosition());} + {if (true) return new ElseIf(condition,stmtsArray , + elseifToken.sourceStart, + stmtsArray[sizeList-1].sourceEnd);} throw new Error("Missing return statement in function"); } static final public Else ElseStatementColon() throws ParseException { Statement statement; final ArrayList list = new ArrayList(); - final int pos = SimpleCharStream.getPosition(); - jj_consume_token(ELSE); + final Token elseToken; + elseToken = jj_consume_token(ELSE); jj_consume_token(COLON); label_35: while (true) { @@ -4623,7 +4709,7 @@ final ArrayList list = new ArrayList(); case SEMICOLON: case DOLLAR_ID: statement = Statement(); - list.add(statement); + list.add(statement); break; case PHPEND: statement = htmlBlock(); @@ -4635,35 +4721,33 @@ final ArrayList list = new ArrayList(); throw new ParseException(); } } - final Statement[] stmtsArray = new Statement[list.size()]; + final int sizeList = list.size(); + final Statement[] stmtsArray = new Statement[sizeList]; list.toArray(stmtsArray); - {if (true) return new Else(stmtsArray,pos,SimpleCharStream.getPosition());} + {if (true) return new Else(stmtsArray,elseToken.sourceStart,stmtsArray[sizeList-1].sourceEnd);} throw new Error("Missing return statement in function"); } static final public ElseIf ElseIfStatement() throws ParseException { final Expression condition; - final Statement statement; - final ArrayList list = new ArrayList(); - final int pos = SimpleCharStream.getPosition(); - jj_consume_token(ELSEIF); + //final Statement statement; + final Token elseifToken; + final Statement[] statement = new Statement[1]; + elseifToken = jj_consume_token(ELSEIF); condition = Condition("elseif"); - statement = Statement(); - list.add(statement);/*todo:do better*/ - final Statement[] stmtsArray = new Statement[list.size()]; - list.toArray(stmtsArray); - {if (true) return new ElseIf(condition,stmtsArray,pos,SimpleCharStream.getPosition());} + statement[0] = Statement(); + {if (true) return new ElseIf(condition,statement,elseifToken.sourceStart,statement[0].sourceEnd);} throw new Error("Missing return statement in function"); } static final public WhileStatement WhileStatement() throws ParseException { final Expression condition; final Statement action; - final int pos = SimpleCharStream.getPosition(); - jj_consume_token(WHILE); + final Token whileToken; + whileToken = jj_consume_token(WHILE); condition = Condition("while"); - action = WhileStatement0(pos,pos + 5); - {if (true) return new WhileStatement(condition,action,pos,SimpleCharStream.getPosition());} + action = WhileStatement0(whileToken.sourceStart,whileToken.sourceEnd); + {if (true) return new WhileStatement(condition,action,whileToken.sourceStart,action.sourceEnd);} throw new Error("Missing return statement in function"); } @@ -4812,89 +4896,105 @@ final ArrayList list = new ArrayList(); static final public DoStatement DoStatement() throws ParseException { final Statement action; final Expression condition; - final Token token, token2; + final Token token; + Token token2 = null; token = jj_consume_token(DO); action = Statement(); jj_consume_token(WHILE); condition = Condition("while"); try { token2 = jj_consume_token(SEMICOLON); - {if (true) return new DoStatement(condition,action,token.sourceStart,token2.sourceEnd);} } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = condition.sourceEnd+1; + errorEnd = condition.sourceEnd+1; + processParseExceptionDebug(e); } + if (token2 == null) { + {if (true) return new DoStatement(condition,action,token.sourceStart,condition.sourceEnd);} + } + {if (true) return new DoStatement(condition,action,token.sourceStart,token2.sourceEnd);} throw new Error("Missing return statement in function"); } static final public ForeachStatement ForeachStatement() throws ParseException { - Statement statement; - Expression expression; - ArrayVariableDeclaration variable; - Token token; - token = jj_consume_token(FOREACH); + Statement statement = null; + Expression expression = null; + ArrayVariableDeclaration variable = null; + Token foreachToken; + Token lparenToken = null; + Token asToken = null; + Token rparenToken = null; + int pos; + foreachToken = jj_consume_token(FOREACH); try { - jj_consume_token(LPAREN); + lparenToken = jj_consume_token(LPAREN); + pos = lparenToken.sourceEnd+1; } catch (ParseException e) { errorMessage = "'(' expected after 'foreach' keyword"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = foreachToken.sourceEnd+1; + errorEnd = foreachToken.sourceEnd+1; + processParseExceptionDebug(e); + {pos = foreachToken.sourceEnd+1;} } try { expression = Expression(); + pos = expression.sourceEnd+1; } catch (ParseException e) { errorMessage = "variable expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } try { - jj_consume_token(AS); + asToken = jj_consume_token(AS); + pos = asToken.sourceEnd+1; } catch (ParseException e) { errorMessage = "'as' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } try { variable = ArrayVariable(); + pos = variable.sourceEnd+1; } catch (ParseException e) { + if (errorMessage != null) {if (true) throw e;} errorMessage = "variable expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } try { - jj_consume_token(RPAREN); + rparenToken = jj_consume_token(RPAREN); + pos = rparenToken.sourceEnd+1; } catch (ParseException e) { errorMessage = "')' expected after 'foreach' keyword"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } try { statement = Statement(); + pos = rparenToken.sourceEnd+1; } catch (ParseException e) { if (errorMessage != null) {if (true) throw e;} errorMessage = "statement expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } {if (true) return new ForeachStatement(expression, variable, statement, - token.sourceStart, + foreachToken.sourceStart, statement.sourceEnd);} throw new Error("Missing return statement in function"); } @@ -4904,8 +5004,8 @@ final ArrayList list = new ArrayList(); * @return a node representing the for statement */ static final public ForStatement ForStatement() throws ParseException { -final Token token,token2; -final int pos = SimpleCharStream.getPosition(); +final Token token,tokenEndFor,token2,tokenColon; +int pos; Expression[] initializations = null; Expression condition = null; Expression[] increments = null; @@ -5058,7 +5158,8 @@ final ArrayList list = new ArrayList(); action.sourceEnd);} break; case COLON: - jj_consume_token(COLON); + tokenColon = jj_consume_token(COLON); + pos = tokenColon.sourceEnd+1; label_37: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -5109,7 +5210,7 @@ final ArrayList list = new ArrayList(); break label_37; } action = Statement(); - list.add(action); + list.add(action);pos = action.sourceEnd+1; } try { setMarker(fileToParse, @@ -5122,33 +5223,35 @@ final ArrayList list = new ArrayList(); PHPeclipsePlugin.log(e); } try { - jj_consume_token(ENDFOR); + tokenEndFor = jj_consume_token(ENDFOR); + pos = tokenEndFor.sourceEnd+1; } catch (ParseException e) { errorMessage = "'endfor' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } try { token2 = jj_consume_token(SEMICOLON); - final Statement[] stmtsArray = new Statement[list.size()]; - list.toArray(stmtsArray); - {if (true) return new ForStatement(initializations, - condition, - increments, - new Block(stmtsArray, - stmtsArray[0].sourceStart, - stmtsArray[stmtsArray.length-1].sourceEnd), - token.sourceStart, - token2.sourceEnd);} + pos = token2.sourceEnd+1; } catch (ParseException e) { errorMessage = "';' expected after 'endfor' keyword"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } + final Statement[] stmtsArray = new Statement[list.size()]; + list.toArray(stmtsArray); + {if (true) return new ForStatement(initializations, + condition, + increments, + new Block(stmtsArray, + stmtsArray[0].sourceStart, + stmtsArray[stmtsArray.length-1].sourceEnd), + token.sourceStart, + pos);} break; default: jj_la1[124] = jj_gen; @@ -5225,7 +5328,8 @@ final ArrayList list = new ArrayList(); static final public Continue ContinueStatement() throws ParseException { Expression expr = null; - final Token token,token2; + final Token token; + Token token2 = null; token = jj_consume_token(CONTINUE); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ARRAY: @@ -5257,20 +5361,32 @@ final ArrayList list = new ArrayList(); } try { token2 = jj_consume_token(SEMICOLON); - {if (true) return new Continue(expr,token.sourceStart,token2.sourceEnd);} } catch (ParseException e) { errorMessage = "';' expected after 'continue' statement"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + if (expr == null) { + errorStart = token.sourceEnd+1; + errorEnd = token.sourceEnd+1; + } else { + errorStart = expr.sourceEnd+1; + errorEnd = expr.sourceEnd+1; + } + processParseExceptionDebug(e); } + if (token2 == null) { + if (expr == null) { + {if (true) return new Continue(expr,token.sourceStart,token.sourceEnd);} + } + {if (true) return new Continue(expr,token.sourceStart,expr.sourceEnd);} + } + {if (true) return new Continue(expr,token.sourceStart,token2.sourceEnd);} throw new Error("Missing return statement in function"); } static final public ReturnStatement ReturnStatement() throws ParseException { Expression expr = null; - final Token token,token2; + final Token token; + Token token2 = null; token = jj_consume_token(RETURN); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ARRAY: @@ -5302,14 +5418,25 @@ final ArrayList list = new ArrayList(); } try { token2 = jj_consume_token(SEMICOLON); - {if (true) return new ReturnStatement(expr,token.sourceStart,token2.sourceEnd);} } catch (ParseException e) { errorMessage = "';' expected after 'return' statement"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + if (expr == null) { + errorStart = token.sourceEnd+1; + errorEnd = token.sourceEnd+1; + } else { + errorStart = expr.sourceEnd+1; + errorEnd = expr.sourceEnd+1; + } + processParseExceptionDebug(e); + } + if (token2 == null) { + if (expr == null) { + {if (true) return new ReturnStatement(expr,token.sourceStart,token.sourceEnd);} + } + {if (true) return new ReturnStatement(expr,token.sourceStart,expr.sourceEnd);} } + {if (true) return new ReturnStatement(expr,token.sourceStart,token2.sourceEnd);} throw new Error("Missing return statement in function"); } @@ -5355,97 +5482,55 @@ final ArrayList list = new ArrayList(); return retval; } - static final private boolean jj_3R_114() { - if (jj_scan_token(XOR)) return true; + static final private boolean jj_3R_112() { + if (jj_scan_token(ASSIGN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_113()) return true; + if (jj_3R_47()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_46() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_52()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(RBRACKET)) return true; + static final private boolean jj_3R_204() { + if (jj_3R_115()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_108() { - if (jj_3R_113()) return true; + static final private boolean jj_3R_105() { + if (jj_scan_token(DOT)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_114()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } - return false; - } - - static final private boolean jj_3R_50() { - if (jj_3R_64()) return true; + if (jj_3R_102()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_109() { - if (jj_scan_token(BIT_OR)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_108()) return true; + static final private boolean jj_3R_203() { + if (jj_3R_48()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_102() { - if (jj_3R_108()) return true; + static final private boolean jj_3R_202() { + if (jj_scan_token(IDENTIFIER)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_109()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } return false; } - static final private boolean jj_3R_45() { - if (jj_scan_token(CLASSACCESS)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + static final private boolean jj_3R_197() { Token xsp; xsp = jj_scanpos; - if (jj_3R_50()) { + if (jj_3R_202()) { jj_scanpos = xsp; - if (jj_3R_51()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_39() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_45()) { + if (jj_3R_203()) { jj_scanpos = xsp; - if (jj_3R_46()) return true; + if (jj_3R_204()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_105() { - if (jj_scan_token(DOT)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_102()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_204() { + static final private boolean jj_3R_116() { if (jj_3R_115()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; @@ -5463,32 +5548,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_203() { - if (jj_3R_48()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_202() { - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_197() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_202()) { - jj_scanpos = xsp; - if (jj_3R_203()) { - jj_scanpos = xsp; - if (jj_3R_204()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_107() { if (jj_scan_token(_ANDL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5509,6 +5568,16 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3R_111() { + if (jj_scan_token(COMMA)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_116()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_99() { Token xsp; xsp = jj_scanpos; @@ -5522,16 +5591,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_153() { - if (jj_scan_token(LBRACE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_47()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(RBRACE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_80() { if (jj_3R_96()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5556,6 +5615,22 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3R_110() { + if (jj_3R_115()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_153() { + if (jj_scan_token(LBRACE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_47()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RBRACE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_72() { if (jj_scan_token(IDENTIFIER)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5566,10 +5641,8 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_112() { - if (jj_scan_token(ASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_47()) return true; + static final private boolean jj_3R_198() { + if (jj_3R_201()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -5580,20 +5653,43 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_198() { - if (jj_3R_201()) return true; + static final private boolean jj_3R_100() { + if (jj_scan_token(OR_OR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_100() { - if (jj_scan_token(OR_OR)) return true; + static final private boolean jj_3R_103() { + if (jj_scan_token(LIST)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LPAREN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_110()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + while (true) { + xsp = jj_scanpos; + if (jj_3R_111()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + if (jj_scan_token(RPAREN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + xsp = jj_scanpos; + if (jj_3R_112()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_116() { - if (jj_3R_115()) return true; + static final private boolean jj_3R_82() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_100()) { + jj_scanpos = xsp; + if (jj_3R_101()) 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_80()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -5619,19 +5715,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_82() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_100()) { - jj_scanpos = xsp; - if (jj_3R_101()) 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_80()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_75() { if (jj_3R_80()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5644,60 +5727,62 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_111() { - if (jj_scan_token(COMMA)) return true; + static final private boolean jj_3R_190() { + if (jj_scan_token(NEW)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_197()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; xsp = jj_scanpos; - if (jj_3R_116()) jj_scanpos = xsp; + if (jj_3R_198()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_144() { - if (jj_3R_129()) return true; + static final private boolean jj_3R_196() { + if (jj_3R_201()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_190() { - if (jj_scan_token(NEW)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_197()) return true; + static final private boolean jj_3R_189() { + if (jj_3R_115()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; xsp = jj_scanpos; - if (jj_3R_198()) jj_scanpos = xsp; + if (jj_3R_196()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3_2() { - if (jj_scan_token(DOLLAR)) return true; + static final private boolean jj_3R_104() { + if (jj_scan_token(PRINT)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(DOLLAR)) return true; + if (jj_3R_47()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_196() { - if (jj_3R_201()) return true; + static final private boolean jj_3R_144() { + if (jj_3R_129()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_110() { - if (jj_3R_115()) return true; + static final private boolean jj_3_2() { + if (jj_scan_token(DOLLAR)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(DOLLAR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_189() { - if (jj_3R_115()) return true; + static final private boolean jj_3R_68() { + if (jj_3R_75()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; xsp = jj_scanpos; - if (jj_3R_196()) jj_scanpos = xsp; + if (jj_3R_78()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -5708,16 +5793,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_68() { - if (jj_3R_75()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_78()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_137() { if (jj_scan_token(DOLLAR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5726,28 +5801,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_103() { - if (jj_scan_token(LIST)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(LPAREN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_110()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - while (true) { - xsp = jj_scanpos; - if (jj_3R_111()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } - if (jj_scan_token(RPAREN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - xsp = jj_scanpos; - if (jj_3R_112()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_195() { if (jj_3R_201()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5760,32 +5813,16 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_129() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_136()) { - jj_scanpos = xsp; - if (jj_3R_137()) { - jj_scanpos = xsp; - if (jj_3R_138()) return true; + static final private boolean jj_3R_94() { + if (jj_scan_token(DOTASSIGN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_136() { - if (jj_scan_token(DOLLAR_ID)) return true; + static final private boolean jj_3R_194() { + if (jj_scan_token(STATICCLASSACCESS)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_144()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_94() { - if (jj_scan_token(DOTASSIGN)) return true; + if (jj_3R_197()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -5802,23 +5839,33 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_194() { - if (jj_scan_token(STATICCLASSACCESS)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_197()) return true; + static final private boolean jj_3R_91() { + if (jj_scan_token(ANDASSIGN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_91() { - if (jj_scan_token(ANDASSIGN)) return true; + static final private boolean jj_3R_129() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_136()) { + jj_scanpos = xsp; + if (jj_3R_137()) { + jj_scanpos = xsp; + if (jj_3R_138()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_128() { - if (jj_3R_129()) return true; + static final private boolean jj_3R_136() { + if (jj_scan_token(DOLLAR_ID)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_144()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -5846,26 +5893,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_104() { - if (jj_scan_token(PRINT)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_47()) 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(REMASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_85() { - if (jj_scan_token(SLASHASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_188() { if (jj_scan_token(IDENTIFIER)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5895,6 +5922,24 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3R_128() { + if (jj_3R_129()) 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(REMASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_85() { + if (jj_scan_token(SLASHASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_84() { if (jj_scan_token(STARASSIGN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5959,12 +6004,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_98() { - if (jj_3R_104()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_175() { if (jj_3R_184()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5977,20 +6016,9 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_97() { - if (jj_3R_103()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_81() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_97()) { - jj_scanpos = xsp; - if (jj_3R_98()) return true; + static final private boolean jj_3R_98() { + if (jj_3R_104()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -6015,6 +6043,23 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3R_97() { + if (jj_3R_103()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_81() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_97()) { + jj_scanpos = xsp; + if (jj_3R_98()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_73() { if (jj_scan_token(DOLLAR_ID)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6185,12 +6230,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3_1() { - if (jj_3R_39()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_169() { if (jj_scan_token(LPAREN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6236,15 +6275,9 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_115() { - if (jj_3R_65()) return true; + static final private boolean jj_3_1() { + if (jj_3R_39()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3_1()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } return false; } @@ -6254,6 +6287,14 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3R_49() { + if (jj_scan_token(COMMA)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_47()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_62() { if (jj_scan_token(INTEGER)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6272,20 +6313,50 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3R_165() { + if (jj_scan_token(MINUS_MINUS)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_115() { + if (jj_3R_65()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3_1()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + static final private boolean jj_3R_59() { if (jj_scan_token(DOUBLE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } + static final private boolean jj_3R_44() { + if (jj_3R_47()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_49()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + static final private boolean jj_3R_58() { if (jj_scan_token(REAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_165() { - if (jj_scan_token(MINUS_MINUS)) return true; + static final private boolean jj_3R_164() { + if (jj_scan_token(PLUS_PLUS)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -6302,12 +6373,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_164() { - if (jj_scan_token(PLUS_PLUS)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_48() { Token xsp; xsp = jj_scanpos; @@ -6365,6 +6430,12 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3_6() { + if (jj_3R_44()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_160() { if (jj_3R_162()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6404,26 +6475,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_49() { - if (jj_scan_token(COMMA)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_47()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_44() { - if (jj_3R_47()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_49()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } - return false; - } - static final private boolean jj_3R_156() { if (jj_3R_157()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6466,6 +6517,14 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3R_43() { + if (jj_3R_47()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + 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_152() { if (jj_scan_token(REMAINDER)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6500,14 +6559,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_43() { - if (jj_3R_47()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - 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_139() { if (jj_3R_145()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6532,12 +6583,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3_6() { - if (jj_3R_44()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_140() { Token xsp; xsp = jj_scanpos; @@ -6551,6 +6596,12 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3_5() { + if (jj_3R_43()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_130() { if (jj_3R_139()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6563,12 +6614,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3_5() { - if (jj_3R_43()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_143() { if (jj_scan_token(RUNSIGNEDSHIFT)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6615,12 +6660,32 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3R_208() { + if (jj_scan_token(COMMA)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_47()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_135() { if (jj_scan_token(GE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } + static final private boolean jj_3R_207() { + if (jj_3R_47()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_208()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + static final private boolean jj_3R_134() { if (jj_scan_token(LE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6658,14 +6723,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_208() { - if (jj_scan_token(COMMA)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_47()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_119() { if (jj_3R_121()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6678,15 +6735,9 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_207() { - if (jj_3R_47()) return true; + static final private boolean jj_3R_205() { + if (jj_3R_207()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_208()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } return false; } @@ -6704,6 +6755,18 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3R_201() { + if (jj_scan_token(LPAREN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_205()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RPAREN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_199() { if (jj_3R_40()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6716,14 +6779,20 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_205() { - if (jj_3R_207()) return true; + static final private boolean jj_3R_127() { + if (jj_scan_token(TRIPLEEQUAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_67() { - if (jj_3R_48()) return true; + static final private boolean jj_3R_126() { + if (jj_scan_token(BANGDOUBLEEQUAL)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_125() { + if (jj_scan_token(NOT_EQUAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -6743,24 +6812,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_127() { - if (jj_scan_token(TRIPLEEQUAL)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_126() { - if (jj_scan_token(BANGDOUBLEEQUAL)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_125() { - if (jj_scan_token(NOT_EQUAL)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_124() { if (jj_scan_token(DIF)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6773,22 +6824,20 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_201() { - if (jj_scan_token(LPAREN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_205()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(RPAREN)) return true; + static final private boolean jj_3R_181() { + if (jj_scan_token(NULL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_206() { - if (jj_scan_token(ARRAYASSIGN)) return true; + static final private boolean jj_3R_180() { + if (jj_scan_token(FALSE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_47()) return true; + return false; + } + + static final private boolean jj_3R_179() { + if (jj_scan_token(TRUE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -6815,37 +6864,27 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_117() { - if (jj_3R_119()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_120()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } - return false; - } - - static final private boolean jj_3R_40() { - if (jj_3R_47()) return true; + static final private boolean jj_3R_178() { + if (jj_scan_token(STRING_LITERAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_206()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_181() { - if (jj_scan_token(NULL)) return true; + static final private boolean jj_3R_177() { + if (jj_scan_token(FLOATING_POINT_LITERAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_180() { - if (jj_scan_token(FALSE)) return true; + static final private boolean jj_3R_117() { + if (jj_3R_119()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_120()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } return false; } @@ -6855,24 +6894,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_179() { - if (jj_scan_token(TRUE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_178() { - if (jj_scan_token(STRING_LITERAL)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_177() { - if (jj_scan_token(FLOATING_POINT_LITERAL)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_176() { if (jj_scan_token(INTEGER_LITERAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6902,6 +6923,24 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3R_206() { + if (jj_scan_token(ARRAYASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_47()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_40() { + if (jj_3R_47()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_206()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_118() { if (jj_scan_token(BIT_AND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6910,6 +6949,24 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3R_113() { + if (jj_3R_117()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_118()) { 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_3R_48()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_52() { Token xsp; xsp = jj_scanpos; @@ -6927,13 +6984,83 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_113() { - if (jj_3R_117()) return true; + static final private boolean jj_3R_46() { + if (jj_scan_token(LBRACKET)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_52()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RBRACKET)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_114() { + if (jj_scan_token(XOR)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_113()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_108() { + if (jj_3R_113()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_118()) { jj_scanpos = xsp; break; } + if (jj_3R_114()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3R_50() { + if (jj_3R_64()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_45() { + if (jj_scan_token(CLASSACCESS)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_50()) { + jj_scanpos = xsp; + if (jj_3R_51()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_39() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_45()) { + jj_scanpos = xsp; + if (jj_3R_46()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_109() { + if (jj_scan_token(BIT_OR)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_108()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_102() { + if (jj_3R_108()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_109()) { jj_scanpos = xsp; break; } if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } return false; diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.jj b/net.sourceforge.phpeclipse/src/test/PHPParser.jj index d45ca07..e8ab5f2 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.jj +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.jj @@ -87,7 +87,7 @@ public final class PHPParser extends PHPParserSuperclass { /** The cursor in expression stack. */ private static int nodePtr; - private static final boolean PARSER_DEBUG = true; + public static final boolean PARSER_DEBUG = false; public final void setFileToParse(final IFile fileToParse) { PHPParser.fileToParse = fileToParse; @@ -190,6 +190,13 @@ public final class PHPParser extends PHPParserSuperclass { return outlineInfo; } + /** + * This function will throw the exception if we are in debug mode + * and process it if we are in production mode. + * this should be fast since the PARSER_DEBUG is static final so the difference will be at compile time + * @param e the exception + * @throws ParseException the thrown exception + */ private static void processParseExceptionDebug(final ParseException e) throws ParseException { if (PARSER_DEBUG) { throw e; @@ -225,14 +232,14 @@ public final class PHPParser extends PHPParserSuperclass { e.currentToken.sourceStart, e.currentToken.sourceEnd, errorLevel, - "Line " + e.currentToken.beginLine); + "Line " + e.currentToken.beginLine+", "+e.currentToken.sourceStart+":"+e.currentToken.sourceEnd); } else { setMarker(fileToParse, errorMessage, errorStart, errorEnd, errorLevel, - "Line " + e.currentToken.beginLine); + "Line " + e.currentToken.beginLine+", "+errorStart+":"+errorEnd); errorStart = -1; errorEnd = -1; } @@ -658,8 +665,8 @@ void phpFile() : {PHPParser.createNewHTMLCode();} } catch (TokenMgrError e) { PHPeclipsePlugin.log(e); - errorStart = SimpleCharStream.getPosition(); - errorEnd = errorStart + 1; + errorStart = SimpleCharStream.beginOffset; + errorEnd = SimpleCharStream.endOffset; errorMessage = e.getMessage(); errorLevel = ERROR; throw generateParseException(); @@ -729,7 +736,7 @@ ClassDeclaration ClassDeclaration() : { final ClassDeclaration classDeclaration; Token className = null; - final Token superclassName, token; + final Token superclassName, token, extendsToken; String classNameImage = SYNTAX_ERROR_CHAR; String superclassNameImage = null; } @@ -741,20 +748,20 @@ ClassDeclaration ClassDeclaration() : } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = token.sourceEnd+1; + errorEnd = token.sourceEnd+1; processParseExceptionDebug(e); } [ - + extendsToken = try { superclassName = {superclassNameImage = superclassName.image;} } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = extendsToken.sourceEnd+1; + errorEnd = extendsToken.sourceEnd+1; processParseExceptionDebug(e); superclassNameImage = SYNTAX_ERROR_CHAR; } @@ -840,23 +847,30 @@ FieldDeclaration FieldDeclaration() : final ArrayList arrayList = new ArrayList(); final Token token; Token token2 = null; + int pos; } { token = variableDeclaration = VariableDeclaratorNoSuffix() - {arrayList.add(variableDeclaration); - outlineInfo.addVariable(variableDeclaration.name());} + { + arrayList.add(variableDeclaration); + outlineInfo.addVariable(variableDeclaration.name()); + pos = variableDeclaration.sourceEnd; + } ( variableDeclaration = VariableDeclaratorNoSuffix() - {arrayList.add(variableDeclaration); - outlineInfo.addVariable(variableDeclaration.name());} + { + arrayList.add(variableDeclaration); + outlineInfo.addVariable(variableDeclaration.name()); + pos = variableDeclaration.sourceEnd; + } )* try { token2 = } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected after variable declaration"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = pos+1; + errorEnd = pos+1; processParseExceptionDebug(e); } @@ -924,18 +938,19 @@ VariableDeclaration VariableDeclarator() : { final AbstractVariable variable; Expression initializer = null; + final Token token; } { variable = VariableDeclaratorId() [ - + token = try { initializer = VariableInitializer() } catch (ParseException e) { errorMessage = "Literal expression expected in variable initializer"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = token.sourceEnd+1; + errorEnd = token.sourceEnd+1; processParseExceptionDebug(e); } ] @@ -1209,7 +1224,7 @@ MethodDeclaration MethodDeclaration() : token = try { functionDeclaration = MethodDeclarator(token.sourceStart) - {outlineInfo.addVariable(new String(functionDeclaration.name));} + {outlineInfo.addVariable(functionDeclaration.name);} } catch (ParseException e) { if (errorMessage != null) throw e; errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function identifier expected"; @@ -1236,18 +1251,21 @@ MethodDeclaration MethodDeclarator(final int start) : Token reference = null; final Hashtable formalParameters = new Hashtable(); String identifierChar = SYNTAX_ERROR_CHAR; - final int end; + int end = start; } { - [reference = ] + [reference = {end = reference.sourceEnd;}] try { identifier = - {identifierChar = identifier.image;} + { + identifierChar = identifier.image; + end = identifier.sourceEnd; + } } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function identifier expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = e.currentToken.sourceEnd; + errorEnd = e.currentToken.next.sourceStart; processParseExceptionDebug(e); } end = FormalParameters(formalParameters) @@ -1284,24 +1302,26 @@ int FormalParameters(final Hashtable parameters) : { VariableDeclaration var; final Token token; - int end; + Token tok = PHPParser.token; + int end = tok.sourceEnd; } { try { - + tok = + {end = tok.sourceEnd;} } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', '(' expected after function identifier"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = e.currentToken.next.sourceStart; + errorEnd = e.currentToken.next.sourceEnd; processParseExceptionDebug(e); } [ var = FormalParameter() - {parameters.put(new String(var.name()),var);} + {parameters.put(var.name(),var);end = var.sourceEnd;} ( var = FormalParameter() - {parameters.put(new String(var.name()),var);} + {parameters.put(var.name(),var);end = var.sourceEnd;} )* ] try { @@ -1310,10 +1330,9 @@ int FormalParameters(final Hashtable parameters) : } catch (ParseException e) { errorMessage = "')' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = e.currentToken.next.sourceStart; + errorEnd = e.currentToken.next.sourceEnd; processParseExceptionDebug(e); - end = e.currentToken.sourceStart; } {return end;} } @@ -1545,15 +1564,16 @@ Expression EqualityExpression() : { Expression expr,expr2; int operator; + Token token; } { expr = RelationalExpression() ( - ( {operator = OperatorIds.EQUAL_EQUAL;} - | {operator = OperatorIds.DIF;} - | {operator = OperatorIds.DIF;} - | {operator = OperatorIds.BANG_EQUAL_EQUAL;} - | {operator = OperatorIds.EQUAL_EQUAL_EQUAL;} + ( token = {operator = OperatorIds.EQUAL_EQUAL;} + | token = {operator = OperatorIds.DIF;} + | token = {operator = OperatorIds.DIF;} + | token = {operator = OperatorIds.BANG_EQUAL_EQUAL;} + | token = {operator = OperatorIds.EQUAL_EQUAL_EQUAL;} ) try { expr2 = RelationalExpression() @@ -1563,9 +1583,10 @@ Expression EqualityExpression() : } errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = token.sourceEnd +1; + errorEnd = token.sourceEnd +1; + expr2 = new ConstantIdentifier(SYNTAX_ERROR_CHAR,token.sourceEnd +1,token.sourceEnd +1); + processParseExceptionDebug(e); } { expr = new BinaryExpression(expr,expr2,operator); @@ -1639,8 +1660,8 @@ Expression MultiplicativeExpression() : if (errorMessage != null) throw e; errorMessage = "unexpected token '"+e.currentToken.next.image+"'"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = PHPParser.token.sourceStart; + errorEnd = PHPParser.token.sourceEnd; throw e; } ( @@ -1742,9 +1763,9 @@ Expression UnaryExpressionNotPlusMinus() : } catch (ParseException e) { errorMessage = "')' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = expr.sourceEnd +1; + errorEnd = expr.sourceEnd +1; + processParseExceptionDebug(e); } {return expr;} } @@ -1866,7 +1887,9 @@ ArrayInitializer ArrayDeclarator() : } { token = vars = ArrayInitializer() - {return new ArrayInitializer(vars,token.sourceStart,SimpleCharStream.getPosition());} + {return new ArrayInitializer(vars, + token.sourceStart, + PHPParser.token.sourceEnd);} } Expression ClassIdentifier(): @@ -1887,6 +1910,8 @@ AbstractVariable VariableSuffix(final AbstractVariable prefix) : { Expression expression = null; final Token classAccessToken; + Token token; + int pos; } { classAccessToken = @@ -1903,17 +1928,20 @@ AbstractVariable VariableSuffix(final AbstractVariable prefix) : expression, ClassAccess.NORMAL);} | - [ expression = Expression() | expression = Type() ] //Not good + token = {pos = token.sourceEnd+1;} + [ expression = Expression() {pos = expression.sourceEnd+1;} + | expression = Type() {pos = expression.sourceEnd+1;}] //Not good try { - + token = + {pos = token.sourceEnd;} } catch (ParseException e) { errorMessage = "']' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } - {return new ArrayDeclarator(prefix,expression,SimpleCharStream.getPosition());} + {return new ArrayDeclarator(prefix,expression,pos);} } Literal Literal() : @@ -1938,14 +1966,15 @@ final Token token; [ args = ArgumentList() ] try { token = + {return new FunctionCall(func,args,token.sourceEnd);} } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected to close the argument list"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = args[args.length-1].sourceEnd+1; + errorEnd = args[args.length-1].sourceEnd+1; + processParseExceptionDebug(e); } - {return new FunctionCall(func,args,token.sourceEnd);} + {return new FunctionCall(func,args,args[args.length-1].sourceEnd);} } /** @@ -1957,20 +1986,23 @@ Expression[] ArgumentList() : { Expression arg; final ArrayList list = new ArrayList(); +int pos; +Token token; } { arg = Expression() - {list.add(arg);} - ( + {list.add(arg);pos = arg.sourceEnd;} + ( token = {pos = token.sourceEnd;} try { arg = Expression() - {list.add(arg);} + {list.add(arg); + pos = arg.sourceEnd;} } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. An expression expected after a comma in argument list"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos+1; + errorEnd = pos+1; + processParseException(e); } )* { @@ -2034,9 +2066,9 @@ Statement expressionStatement() : if (e.currentToken.next.kind != PHPParserConstants.PHPEND) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = statement.sourceEnd+1; + errorEnd = statement.sourceEnd+1; + processParseExceptionDebug(e); } } {return statement;} @@ -2044,61 +2076,70 @@ Statement expressionStatement() : Define defineStatement() : { - final int start = SimpleCharStream.getPosition(); Expression defineName,defineValue; + final Token defineToken; + Token token; + int pos; } { - + defineToken = {pos = defineToken.sourceEnd+1;} try { - + token = + {pos = token.sourceEnd+1;} } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', '(' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = pos; + errorEnd = pos; processParseExceptionDebug(e); } try { defineName = Expression() + {pos = defineName.sourceEnd+1;} } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); + defineName = new StringLiteral(SYNTAX_ERROR_CHAR,pos,pos); } try { - + token = + {pos = defineName.sourceEnd+1;} } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ',' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = pos; + errorEnd = pos; processParseExceptionDebug(e); } try { defineValue = Expression() + {pos = defineValue.sourceEnd+1;} } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); + defineValue = new StringLiteral(SYNTAX_ERROR_CHAR,pos,pos); } try { - + token = + {pos = token.sourceEnd+1;} } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = pos; + errorEnd = pos; processParseExceptionDebug(e); } {return new Define(currentSegment, defineName, defineValue, - start, - SimpleCharStream.getPosition());} + defineToken.sourceStart, + pos);} } /** @@ -2146,27 +2187,30 @@ HTMLBlock htmlBlock() : */ InclusionStatement IncludeStatement() : { - final Expression expr; + Expression expr; final int keyword; final InclusionStatement inclusionStatement; final Token token, token2; + int pos; } { - ( token = {keyword = InclusionStatement.REQUIRE;} - | token = {keyword = InclusionStatement.REQUIRE_ONCE;} - | token = {keyword = InclusionStatement.INCLUDE;} - | token = {keyword = InclusionStatement.INCLUDE_ONCE;}) + ( token = {keyword = InclusionStatement.REQUIRE;pos=token.sourceEnd;} + | token = {keyword = InclusionStatement.REQUIRE_ONCE;pos=token.sourceEnd;} + | token = {keyword = InclusionStatement.INCLUDE;pos=token.sourceEnd;} + | token = {keyword = InclusionStatement.INCLUDE_ONCE;pos=token.sourceEnd;}) try { expr = Expression() + {pos=expr.sourceEnd;} } catch (ParseException e) { if (errorMessage != null) { throw e; } errorMessage = "unexpected token '"+ e.currentToken.next.image+"', expression expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos+1; + errorEnd = pos+1; + expr = new ConstantIdentifier(SYNTAX_ERROR_CHAR,pos,pos); + processParseExceptionDebug(e); } {inclusionStatement = new InclusionStatement(currentSegment, keyword, @@ -2190,10 +2234,11 @@ InclusionStatement IncludeStatement() : PrintExpression PrintExpression() : { final Expression expr; - final int pos = SimpleCharStream.getPosition(); + final Token printToken; } { - expr = Expression() {return new PrintExpression(expr,pos,SimpleCharStream.getPosition());} + token = expr = Expression() + {return new PrintExpression(expr,token.sourceStart,expr.sourceEnd);} } ListExpression ListExpression() : @@ -2201,13 +2246,14 @@ ListExpression ListExpression() : Expression expr = null; final Expression expression; final ArrayList list = new ArrayList(); - final int pos = SimpleCharStream.getPosition(); - final Token listToken; + int pos; + final Token listToken, rParen; + Token token; } { - listToken = + listToken = {pos = listToken.sourceEnd;} try { - + token = {pos = token.sourceEnd;} } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', '(' expected"; errorLevel = ERROR; @@ -2217,29 +2263,31 @@ ListExpression ListExpression() : } [ expr = VariableDeclaratorId() - {list.add(expr);} + {list.add(expr);pos = expr.sourceEnd;} ] {if (expr == null) list.add(null);} ( try { - + token = + {pos = token.sourceEnd;} } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ',' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos+1; + errorEnd = pos+1; + processParseExceptionDebug(e); } - [expr = VariableDeclaratorId() {list.add(expr);}] + [expr = VariableDeclaratorId() {list.add(expr);pos = expr.sourceEnd;}] )* try { - + rParen = + {pos = rParen.sourceEnd;} } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos+1; + errorEnd = pos+1; + processParseExceptionDebug(e); } [ expression = Expression() { @@ -2247,13 +2295,13 @@ ListExpression ListExpression() : list.toArray(vars); return new ListExpression(vars, expression, - pos, - SimpleCharStream.getPosition());} + listToken.sourceStart, + expression.sourceEnd);} ] { - final Variable[] vars = new Variable[list.size()]; + final AbstractVariable[] vars = new AbstractVariable[list.size()]; list.toArray(vars); - return new ListExpression(vars,pos,SimpleCharStream.getPosition());} + return new ListExpression(vars,listToken.sourceStart,pos);} } /** @@ -2301,33 +2349,35 @@ GlobalStatement GlobalStatement() : final ArrayList vars = new ArrayList(); final GlobalStatement global; final Token token, token2; + int pos; } { token = expr = Variable() - {vars.add(expr);} + {vars.add(expr);pos = expr.sourceEnd+1;} ( expr = Variable() - {vars.add(expr);} + {vars.add(expr);pos = expr.sourceEnd+1;} )* try { token2 = + {pos = token2.sourceEnd+1;} + } catch (ParseException e) { + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. a ';' was expected"; + errorLevel = ERROR; + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); + } { final Variable[] variables = new Variable[vars.size()]; vars.toArray(variables); global = new GlobalStatement(currentSegment, variables, token.sourceStart, - token2.sourceEnd); + pos); currentSegment.add(global); return global;} - } catch (ParseException e) { - errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. a ';' was expected"; - errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; - } } StaticStatement StaticStatement() : @@ -2335,27 +2385,29 @@ StaticStatement StaticStatement() : final ArrayList vars = new ArrayList(); VariableDeclaration expr; final Token token, token2; + int pos; } { - token = expr = VariableDeclarator() {vars.add(expr);} + token = expr = VariableDeclarator() {vars.add(expr);pos = expr.sourceEnd+1;} ( - expr = VariableDeclarator() {vars.add(expr);} + expr = VariableDeclarator() {vars.add(expr);pos = expr.sourceEnd+1;} )* try { token2 = + {pos = token2.sourceEnd+1;} + } catch (ParseException e) { + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. a ';' was expected"; + errorLevel = ERROR; + errorStart = pos; + errorEnd = pos; + processParseException(e); + } { final VariableDeclaration[] variables = new VariableDeclaration[vars.size()]; vars.toArray(variables); return new StaticStatement(variables, token.sourceStart, - token2.sourceEnd);} - } catch (ParseException e) { - errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. a ';' was expected"; - errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; - } + pos);} } LabeledStatement LabeledStatement() : @@ -2380,32 +2432,37 @@ Block Block() : final ArrayList list = new ArrayList(); Statement statement; final Token token, token2; + int pos,start; } { try { token = + {pos = token.sourceEnd+1;start=token.sourceStart;} } catch (ParseException e) { errorMessage = "'{' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + pos = PHPParser.token.sourceEnd+1; + start=pos; + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } - ( statement = BlockStatement() {list.add(statement);} - | statement = htmlBlock() {list.add(statement);})* + ( statement = BlockStatement() {list.add(statement);pos = statement.sourceEnd+1;} + | statement = htmlBlock() {list.add(statement);pos = statement.sourceEnd+1;})* try { token2 = + {pos = token2.sourceEnd+1;} } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.image +"', '}' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } { final Statement[] statements = new Statement[list.size()]; list.toArray(statements); - return new Block(statements,token.sourceStart,token2.sourceEnd);} + return new Block(statements,start,pos);} } Statement BlockStatement() : @@ -2504,84 +2561,95 @@ EmptyStatement EmptyStatement() : Expression StatementExpression() : { final Expression expr; + final Token operator; } { expr = PreIncDecExpression() {return expr;} | expr = PrimaryExpression() - [ {return new PostfixedUnaryExpression(expr, - OperatorIds.PLUS_PLUS, - SimpleCharStream.getPosition());} - | {return new PostfixedUnaryExpression(expr, - OperatorIds.MINUS_MINUS, - SimpleCharStream.getPosition());} + [ operator = {return new PostfixedUnaryExpression(expr, + OperatorIds.PLUS_PLUS, + operator.sourceEnd);} + | operator = {return new PostfixedUnaryExpression(expr, + OperatorIds.MINUS_MINUS, + operator.sourceEnd);} ] {return expr;} } SwitchStatement SwitchStatement() : { - final Expression variable; + Expression variable; final AbstractCase[] cases; - final int pos = SimpleCharStream.getPosition(); - final Token switchToken; + final Token switchToken,lparenToken,rparenToken; + int pos; } { - switchToken = + switchToken = {pos = switchToken.sourceEnd+1;} try { - + lparenToken = + {pos = lparenToken.sourceEnd+1;} } catch (ParseException e) { errorMessage = "'(' expected after 'switch'"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } try { - variable = Expression() + variable = Expression() {pos = variable.sourceEnd+1;} } catch (ParseException e) { if (errorMessage != null) { throw e; } errorMessage = "expression expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); + variable = new ConstantIdentifier(SYNTAX_ERROR_CHAR,pos,pos); } try { - + rparenToken = {pos = rparenToken.sourceEnd+1;} } catch (ParseException e) { errorMessage = "')' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } - (cases = switchStatementBrace() | cases = switchStatementColon(switchToken.sourceStart, switchToken.sourceEnd)) - {return new SwitchStatement(variable,cases,switchToken.sourceStart,SimpleCharStream.getPosition());} + ( cases = switchStatementBrace() + | cases = switchStatementColon(switchToken.sourceStart, switchToken.sourceEnd)) + {return new SwitchStatement(variable, + cases, + switchToken.sourceStart, + PHPParser.token.sourceEnd);} } AbstractCase[] switchStatementBrace() : { AbstractCase cas; final ArrayList cases = new ArrayList(); + Token token; + int pos; } { - - ( cas = switchLabel0() {cases.add(cas);})* + token = {pos = token.sourceEnd;} + ( cas = switchLabel0() {cases.add(cas);pos = cas.sourceEnd;})* try { - - { - final AbstractCase[] abcase = new AbstractCase[cases.size()]; - cases.toArray(abcase); - return abcase;} + token = + {pos = token.sourceEnd;} } catch (ParseException e) { errorMessage = "'}' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos+1; + errorEnd = pos+1; + processParseExceptionDebug(e); + } + { + final AbstractCase[] abcase = new AbstractCase[cases.size()]; + cases.toArray(abcase); + return abcase; } } /** @@ -2593,9 +2661,11 @@ AbstractCase[] switchStatementColon(final int start, final int end) : { AbstractCase cas; final ArrayList cases = new ArrayList(); + Token token; + int pos; } { - + token = {pos = token.sourceEnd;} {try { setMarker(fileToParse, "Ugly syntax detected, you should switch () {...} instead of switch (): ... enswitch;", @@ -2606,28 +2676,29 @@ AbstractCase[] switchStatementColon(final int start, final int end) : } catch (CoreException e) { PHPeclipsePlugin.log(e); }} - ( cas = switchLabel0() {cases.add(cas);})* + ( cas = switchLabel0() {cases.add(cas);pos = cas.sourceEnd;})* try { - + token = {pos = token.sourceEnd;} } catch (ParseException e) { errorMessage = "'endswitch' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos+1; + errorEnd = pos+1; + processParseExceptionDebug(e); } try { - - { - final AbstractCase[] abcase = new AbstractCase[cases.size()]; - cases.toArray(abcase); - return abcase;} + token = {pos = token.sourceEnd;} } catch (ParseException e) { errorMessage = "';' expected after 'endswitch' keyword"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos+1; + errorEnd = pos+1; + processParseExceptionDebug(e); + } + { + final AbstractCase[] abcase = new AbstractCase[cases.size()]; + cases.toArray(abcase); + return abcase; } } @@ -2636,7 +2707,7 @@ AbstractCase switchLabel0() : final Expression expr; Statement statement; final ArrayList stmts = new ArrayList(); - final int pos = SimpleCharStream.getPosition(); + final Token token = PHPParser.token; } { expr = SwitchLabel() @@ -2644,12 +2715,18 @@ AbstractCase switchLabel0() : | statement = htmlBlock() {stmts.add(statement);})* [ statement = BreakStatement() {stmts.add(statement);}] { - final Statement[] stmtsArray = new Statement[stmts.size()]; - stmts.toArray(stmtsArray); - if (expr == null) {//it's a default - return new DefaultCase(stmtsArray,pos,SimpleCharStream.getPosition()); + final int listSize = stmts.size(); + final Statement[] stmtsArray = new Statement[listSize]; + stmts.toArray(stmtsArray); + if (expr == null) {//it's a default + return new DefaultCase(stmtsArray,token.sourceStart,stmtsArray[listSize-1].sourceEnd); + } + if (listSize != 0) { + return new Case(expr,stmtsArray,expr.sourceStart,stmtsArray[listSize-1].sourceEnd); + } else { + return new Case(expr,stmtsArray,expr.sourceStart,expr.sourceEnd); + } } - return new Case(expr,stmtsArray,pos,SimpleCharStream.getPosition());} } /** @@ -2702,19 +2779,22 @@ Break BreakStatement() : { Expression expression = null; final Token token, token2; + int pos; } { - token = [ expression = Expression() ] + token = {pos = token.sourceEnd+1;} + [ expression = Expression() {pos = expression.sourceEnd+1;}] try { token2 = + {pos = token2.sourceEnd;} } catch (ParseException e) { errorMessage = "';' expected after 'break' keyword"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } - {return new Break(expression, token.sourceStart, token2.sourceEnd);} + {return new Break(expression, token.sourceStart, pos);} } IfStatement IfStatement() : @@ -2740,8 +2820,8 @@ Expression Condition(final String keyword) : } catch (ParseException e) { errorMessage = "'(' expected after " + keyword + " keyword"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length(); - errorEnd = errorStart +1; + errorStart = PHPParser.token.sourceEnd + 1; + errorEnd = PHPParser.token.sourceEnd + 1; processParseExceptionDebug(e); } condition = Expression() @@ -2750,8 +2830,8 @@ Expression Condition(final String keyword) : } catch (ParseException e) { errorMessage = "')' expected after " + keyword + " keyword"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = condition.sourceEnd+1; + errorEnd = condition.sourceEnd+1; processParseExceptionDebug(e); } {return condition;} @@ -2865,59 +2945,61 @@ ElseIf ElseIfStatementColon() : final Expression condition; Statement statement; final ArrayList list = new ArrayList(); - final int pos = SimpleCharStream.getPosition(); + final Token elseifToken; } { - condition = Condition("elseif") + elseifToken = condition = Condition("elseif") ( statement = Statement() {list.add(statement);} | statement = htmlBlock() {list.add(statement);})* { - final Statement[] stmtsArray = new Statement[list.size()]; + final int sizeList = list.size(); + final Statement[] stmtsArray = new Statement[sizeList]; list.toArray(stmtsArray); - return new ElseIf(condition,stmtsArray ,pos,SimpleCharStream.getPosition());} + return new ElseIf(condition,stmtsArray , + elseifToken.sourceStart, + stmtsArray[sizeList-1].sourceEnd);} } Else ElseStatementColon() : { Statement statement; final ArrayList list = new ArrayList(); - final int pos = SimpleCharStream.getPosition(); + final Token elseToken; } { - ( statement = Statement() {list.add(statement);} + elseToken = ( statement = Statement() {list.add(statement);} | statement = htmlBlock() {list.add(statement);})* { - final Statement[] stmtsArray = new Statement[list.size()]; + final int sizeList = list.size(); + final Statement[] stmtsArray = new Statement[sizeList]; list.toArray(stmtsArray); - return new Else(stmtsArray,pos,SimpleCharStream.getPosition());} + return new Else(stmtsArray,elseToken.sourceStart,stmtsArray[sizeList-1].sourceEnd);} } ElseIf ElseIfStatement() : { final Expression condition; - final Statement statement; - final ArrayList list = new ArrayList(); - final int pos = SimpleCharStream.getPosition(); + //final Statement statement; + final Token elseifToken; + final Statement[] statement = new Statement[1]; } { - condition = Condition("elseif") statement = Statement() {list.add(statement);/*todo:do better*/} + elseifToken = condition = Condition("elseif") statement[0] = Statement() { - final Statement[] stmtsArray = new Statement[list.size()]; - list.toArray(stmtsArray); - return new ElseIf(condition,stmtsArray,pos,SimpleCharStream.getPosition());} + return new ElseIf(condition,statement,elseifToken.sourceStart,statement[0].sourceEnd);} } WhileStatement WhileStatement() : { final Expression condition; final Statement action; - final int pos = SimpleCharStream.getPosition(); + final Token whileToken; } { - + whileToken = condition = Condition("while") - action = WhileStatement0(pos,pos + 5) - {return new WhileStatement(condition,action,pos,SimpleCharStream.getPosition());} + action = WhileStatement0(whileToken.sourceStart,whileToken.sourceEnd) + {return new WhileStatement(condition,action,whileToken.sourceStart,action.sourceEnd);} } Statement WhileStatement0(final int start, final int end) : @@ -2969,90 +3051,108 @@ DoStatement DoStatement() : { final Statement action; final Expression condition; - final Token token, token2; + final Token token; + Token token2 = null; } { token = action = Statement() condition = Condition("while") try { token2 = - {return new DoStatement(condition,action,token.sourceStart,token2.sourceEnd);} } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = condition.sourceEnd+1; + errorEnd = condition.sourceEnd+1; + processParseExceptionDebug(e); + } + { + if (token2 == null) { + return new DoStatement(condition,action,token.sourceStart,condition.sourceEnd); + } + return new DoStatement(condition,action,token.sourceStart,token2.sourceEnd); } } ForeachStatement ForeachStatement() : { - Statement statement; - Expression expression; - ArrayVariableDeclaration variable; - Token token; + Statement statement = null; + Expression expression = null; + ArrayVariableDeclaration variable = null; + Token foreachToken; + Token lparenToken = null; + Token asToken = null; + Token rparenToken = null; + int pos; } { - token = - try { - + foreachToken = + try { + lparenToken = + {pos = lparenToken.sourceEnd+1;} } catch (ParseException e) { errorMessage = "'(' expected after 'foreach' keyword"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = foreachToken.sourceEnd+1; + errorEnd = foreachToken.sourceEnd+1; + processParseExceptionDebug(e); + {pos = foreachToken.sourceEnd+1;} } try { expression = Expression() + {pos = expression.sourceEnd+1;} } catch (ParseException e) { errorMessage = "variable expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } try { - + asToken = + {pos = asToken.sourceEnd+1;} } catch (ParseException e) { errorMessage = "'as' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } try { variable = ArrayVariable() + {pos = variable.sourceEnd+1;} } catch (ParseException e) { + if (errorMessage != null) throw e; errorMessage = "variable expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } try { - + rparenToken = + {pos = rparenToken.sourceEnd+1;} } catch (ParseException e) { errorMessage = "')' expected after 'foreach' keyword"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } try { statement = Statement() + {pos = rparenToken.sourceEnd+1;} } catch (ParseException e) { if (errorMessage != null) throw e; errorMessage = "statement expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } {return new ForeachStatement(expression, variable, statement, - token.sourceStart, + foreachToken.sourceStart, statement.sourceEnd);} } @@ -3063,8 +3163,8 @@ ForeachStatement ForeachStatement() : */ ForStatement ForStatement() : { -final Token token,token2; -final int pos = SimpleCharStream.getPosition(); +final Token token,tokenEndFor,token2,tokenColon; +int pos; Expression[] initializations = null; Expression condition = null; Expression[] increments = null; @@ -3094,8 +3194,8 @@ final ArrayList list = new ArrayList(); token.sourceStart, action.sourceEnd);} | - - (action = Statement() {list.add(action);})* + tokenColon = {pos = tokenColon.sourceEnd+1;} + (action = Statement() {list.add(action);pos = action.sourceEnd+1;})* { try { setMarker(fileToParse, @@ -3109,34 +3209,36 @@ final ArrayList list = new ArrayList(); } } try { - + tokenEndFor = + {pos = tokenEndFor.sourceEnd+1;} } catch (ParseException e) { errorMessage = "'endfor' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } try { token2 = - { - final Statement[] stmtsArray = new Statement[list.size()]; - list.toArray(stmtsArray); - return new ForStatement(initializations, - condition, - increments, - new Block(stmtsArray, - stmtsArray[0].sourceStart, - stmtsArray[stmtsArray.length-1].sourceEnd), - token.sourceStart, - token2.sourceEnd);} + {pos = token2.sourceEnd+1;} } catch (ParseException e) { errorMessage = "';' expected after 'endfor' keyword"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + errorStart = pos; + errorEnd = pos; + processParseExceptionDebug(e); } + { + final Statement[] stmtsArray = new Statement[list.size()]; + list.toArray(stmtsArray); + return new ForStatement(initializations, + condition, + increments, + new Block(stmtsArray, + stmtsArray[0].sourceStart, + stmtsArray[stmtsArray.length-1].sourceEnd), + token.sourceStart, + pos);} ) } @@ -3171,38 +3273,66 @@ Expression[] StatementExpressionList() : Continue ContinueStatement() : { Expression expr = null; - final Token token,token2; + final Token token; + Token token2 = null; } { token = [ expr = Expression() ] try { token2 = - {return new Continue(expr,token.sourceStart,token2.sourceEnd);} } catch (ParseException e) { errorMessage = "';' expected after 'continue' statement"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + if (expr == null) { + errorStart = token.sourceEnd+1; + errorEnd = token.sourceEnd+1; + } else { + errorStart = expr.sourceEnd+1; + errorEnd = expr.sourceEnd+1; + } + processParseExceptionDebug(e); + } + { + if (token2 == null) { + if (expr == null) { + return new Continue(expr,token.sourceStart,token.sourceEnd); + } + return new Continue(expr,token.sourceStart,expr.sourceEnd); + } + return new Continue(expr,token.sourceStart,token2.sourceEnd); } } ReturnStatement ReturnStatement() : { Expression expr = null; - final Token token,token2; + final Token token; + Token token2 = null; } { token = [ expr = Expression() ] try { token2 = - {return new ReturnStatement(expr,token.sourceStart,token2.sourceEnd);} } catch (ParseException e) { errorMessage = "';' expected after 'return' statement"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; - throw e; - } + if (expr == null) { + errorStart = token.sourceEnd+1; + errorEnd = token.sourceEnd+1; + } else { + errorStart = expr.sourceEnd+1; + errorEnd = expr.sourceEnd+1; + } + processParseExceptionDebug(e); + } + { + if (token2 == null) { + if (expr == null) { + return new ReturnStatement(expr,token.sourceStart,token.sourceEnd); + } + return new ReturnStatement(expr,token.sourceStart,expr.sourceEnd); + } + return new ReturnStatement(expr,token.sourceStart,token2.sourceEnd); + } }