X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.java b/net.sourceforge.phpeclipse/src/test/PHPParser.java index d559705..c4cc3b5 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.java +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.java @@ -78,24 +78,26 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon PHPParser.fileToParse = fileToParse; } - public static final void phpParserTester(final String strEval) throws ParseException { + public final void phpParserTester(final String strEval) throws ParseException { final StringReader stream = new StringReader(strEval); if (jj_input_stream == null) { jj_input_stream = new SimpleCharStream(stream, 1, 1); + token_source = new PHPParserTokenManager(jj_input_stream); } ReInit(new StringReader(strEval)); init(); phpDocument = new PHPDocument(null,"_root".toCharArray()); currentSegment = phpDocument; outlineInfo = new PHPOutlineInfo(null, currentSegment); - PHPParserTokenManager.SwitchTo(PHPParserTokenManager.PHPPARSING); + token_source.SwitchTo(PHPParserTokenManager.PHPPARSING); phpTest(); } - public static final void htmlParserTester(final File fileName) throws FileNotFoundException, ParseException { + public final void htmlParserTester(final File fileName) throws FileNotFoundException, ParseException { final Reader stream = new FileReader(fileName); if (jj_input_stream == null) { jj_input_stream = new SimpleCharStream(stream, 1, 1); + token_source = new PHPParserTokenManager(jj_input_stream); } ReInit(stream); init(); @@ -105,10 +107,11 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon phpFile(); } - public static final void htmlParserTester(final String strEval) throws ParseException { + public final void htmlParserTester(final String strEval) throws ParseException { final StringReader stream = new StringReader(strEval); if (jj_input_stream == null) { jj_input_stream = new SimpleCharStream(stream, 1, 1); + token_source = new PHPParserTokenManager(jj_input_stream); } ReInit(stream); init(); @@ -151,6 +154,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon final StringReader stream = new StringReader(s); if (jj_input_stream == null) { jj_input_stream = new SimpleCharStream(stream, 1, 1); + token_source = new PHPParserTokenManager(jj_input_stream); } ReInit(stream); init(); @@ -209,14 +213,14 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon e.currentToken.sourceStart, e.currentToken.sourceEnd, errorLevel, - "Line " + e.currentToken.beginLine+", "+e.currentToken.sourceStart+":"+e.currentToken.sourceEnd); + "Line " + e.currentToken.beginLine+", "+e.currentToken.sourceStart+':'+e.currentToken.sourceEnd); } else { setMarker(fileToParse, errorMessage, errorStart, errorEnd, errorLevel, - "Line " + e.currentToken.beginLine+", "+errorStart+":"+errorEnd); + "Line " + e.currentToken.beginLine+", "+errorStart+':'+errorEnd); errorStart = -1; errorEnd = -1; } @@ -270,6 +274,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon final StringReader stream = new StringReader(s); if (jj_input_stream == null) { jj_input_stream = new SimpleCharStream(stream, 1, 1); + token_source = new PHPParserTokenManager(jj_input_stream); } ReInit(stream); init(); @@ -305,52 +310,51 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon /** * Put a new html block in the stack. */ - public static final void createNewHTMLCode() { + public final void createNewHTMLCode() { final int currentPosition = token.sourceStart; if (currentPosition == htmlStart || currentPosition < htmlStart || - currentPosition > SimpleCharStream.currentBuffer.length()) { + currentPosition > jj_input_stream.getCurrentBuffer().length()) { return; } - final char[] chars = SimpleCharStream.currentBuffer.substring(htmlStart, - currentPosition).toCharArray(); - pushOnAstNodes(new HTMLCode(chars, htmlStart,currentPosition)); + final String html = jj_input_stream.getCurrentBuffer().substring(htmlStart, currentPosition); + pushOnAstNodes(new HTMLCode(html, htmlStart,currentPosition)); } /** Create a new task. */ - public static final void createNewTask(final int todoStart) { - final String todo = SimpleCharStream.currentBuffer.substring(todoStart, - SimpleCharStream.currentBuffer.indexOf("\n", + public final void createNewTask(final int todoStart) { + final String todo = jj_input_stream.getCurrentBuffer().substring(todoStart, + jj_input_stream.getCurrentBuffer().indexOf("\n", todoStart)-1); if (!PARSER_DEBUG) { try { setMarker(fileToParse, todo, - SimpleCharStream.getBeginLine(), + jj_input_stream.getBeginLine(), TASK, - "Line "+SimpleCharStream.getBeginLine()); + "Line "+jj_input_stream.getBeginLine()); } catch (CoreException e) { PHPeclipsePlugin.log(e); } } } - private static final void parse() throws ParseException { + private final void parse() throws ParseException { phpFile(); } - static final public void todo() throws ParseException { + final public void todo() throws ParseException { Token todoToken; todoToken = jj_consume_token(23); createNewTask(todoToken.sourceStart); } - static final public void phpTest() throws ParseException { + final public void phpTest() throws ParseException { Php(); jj_consume_token(0); } - static final public void phpFile() throws ParseException { + final public void phpFile() throws ParseException { try { label_1: while (true) { @@ -410,11 +414,11 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } PhpBlock(); } - PHPParser.createNewHTMLCode(); + createNewHTMLCode(); } catch (TokenMgrError e) { PHPeclipsePlugin.log(e); - errorStart = SimpleCharStream.beginOffset; - errorEnd = SimpleCharStream.endOffset; + errorStart = jj_input_stream.getBeginOffset(); + errorEnd = jj_input_stream.getEndOffset(); errorMessage = e.getMessage(); errorLevel = ERROR; {if (true) throw generateParseException();} @@ -426,7 +430,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon * or * or */ - static final public void PhpBlock() throws ParseException { + final public void PhpBlock() throws ParseException { final PHPEchoBlock phpEchoBlock; final Token token,phpEnd; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -510,7 +514,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon jj_la1[2] = jj_gen; ; } - PHPParser.createNewHTMLCode(); + createNewHTMLCode(); Php(); try { phpEnd = jj_consume_token(PHPEND); @@ -518,8 +522,8 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } catch (ParseException e) { errorMessage = "'?>' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = e.currentToken.sourceStart; + errorEnd = e.currentToken.sourceEnd; processParseExceptionDebug(e); } break; @@ -530,12 +534,12 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } } - static final public PHPEchoBlock phpEchoBlock() throws ParseException { + final public PHPEchoBlock phpEchoBlock() throws ParseException { final Expression expr; final PHPEchoBlock echoBlock; final Token token, token2; token = jj_consume_token(PHPECHOSTART); - PHPParser.createNewHTMLCode(); + createNewHTMLCode(); expr = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SEMICOLON: @@ -554,7 +558,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon throw new Error("Missing return statement in function"); } - static final public void Php() throws ParseException { + final public void Php() throws ParseException { label_2: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -611,7 +615,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } } - static final public ClassDeclaration ClassDeclaration() throws ParseException { + final public ClassDeclaration ClassDeclaration() throws ParseException { final ClassDeclaration classDeclaration; Token className = null; final Token superclassName, token, extendsToken; @@ -679,15 +683,15 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon throw new Error("Missing return statement in function"); } - static final public int ClassBody(final ClassDeclaration classDeclaration) throws ParseException { + final public int ClassBody(final ClassDeclaration classDeclaration) throws ParseException { Token token; try { jj_consume_token(LBRACE); } 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 = e.currentToken.sourceStart; + errorEnd = e.currentToken.sourceEnd; processParseExceptionDebug(e); } label_3: @@ -709,10 +713,10 @@ Token token; } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. 'var', 'function' or '}' expected"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = e.currentToken.sourceStart; + errorEnd = e.currentToken.sourceEnd; processParseExceptionDebug(e); - {if (true) return PHPParser.token.sourceEnd;} + {if (true) return this.token.sourceEnd;} } throw new Error("Missing return statement in function"); } @@ -720,7 +724,7 @@ Token token; /** * A class can contain only methods and fields. */ - static final public void ClassBodyDeclaration(final ClassDeclaration classDeclaration) throws ParseException { + final public void ClassBodyDeclaration(final ClassDeclaration classDeclaration) throws ParseException { final MethodDeclaration method; final FieldDeclaration field; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -744,7 +748,7 @@ Token token; * A class field declaration : it's var VariableDeclarator() (, VariableDeclarator())*;. * it is only used by ClassBodyDeclaration() */ - static final public FieldDeclaration FieldDeclaration() throws ParseException { + final public FieldDeclaration FieldDeclaration() throws ParseException { VariableDeclaration variableDeclaration; final VariableDeclaration[] list; final ArrayList arrayList = new ArrayList(); @@ -754,7 +758,6 @@ Token token; token = jj_consume_token(VAR); variableDeclaration = VariableDeclaratorNoSuffix(); arrayList.add(variableDeclaration); - outlineInfo.addVariable(variableDeclaration.name()); pos = variableDeclaration.sourceEnd; label_4: while (true) { @@ -800,7 +803,7 @@ Token token; * a strict variable declarator : there cannot be a suffix here. * It will be used by fields and formal parameters */ - static final public VariableDeclaration VariableDeclaratorNoSuffix() throws ParseException { + final public VariableDeclaration VariableDeclaratorNoSuffix() throws ParseException { final Token token, lbrace,rbrace; Expression expr, initializer = null; Token assignToken; @@ -856,7 +859,7 @@ Token token; /** * this will be used by static statement */ - static final public VariableDeclaration VariableDeclarator() throws ParseException { + final public VariableDeclaration VariableDeclarator() throws ParseException { final AbstractVariable variable; Expression initializer = null; final Token token; @@ -896,9 +899,8 @@ Token token; * A Variable name. * @return the variable name (with suffix) */ - static final public AbstractVariable VariableDeclaratorId() throws ParseException { - final Variable var; - AbstractVariable expression = null; + final public AbstractVariable VariableDeclaratorId() throws ParseException { + AbstractVariable var; try { var = Variable(); label_5: @@ -908,23 +910,20 @@ Token token; } else { break label_5; } - expression = VariableSuffix(var); + var = VariableSuffix(var); } - if (expression == null) { - {if (true) return var;} - } - {if (true) return expression;} + {if (true) return var;} } catch (ParseException e) { errorMessage = "'$' expected for variable identifier"; errorLevel = ERROR; - errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = SimpleCharStream.getPosition() + 1; + errorStart = e.currentToken.sourceStart; + errorEnd = e.currentToken.sourceEnd; {if (true) throw e;} } throw new Error("Missing return statement in function"); } - static final public Variable Variable() throws ParseException { + final public Variable Variable() throws ParseException { Variable variable = null; final Token token; token = jj_consume_token(DOLLAR); @@ -933,7 +932,7 @@ Token token; throw new Error("Missing return statement in function"); } - static final public Variable Var() throws ParseException { + final public Variable Var() throws ParseException { Variable variable = null; final Token token,token2; ConstantIdentifier constant; @@ -954,6 +953,7 @@ Token token; break; case IDENTIFIER: token = jj_consume_token(IDENTIFIER); + outlineInfo.addVariable('$' + token.image); {if (true) return new Variable(token.image,token.sourceStart,token.sourceEnd);} break; default: @@ -964,7 +964,7 @@ Token token; throw new Error("Missing return statement in function"); } - static final public Expression VariableInitializer() throws ParseException { + final public Expression VariableInitializer() throws ParseException { final Expression expr; final Token token, token2; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -1030,7 +1030,7 @@ Token token; throw new Error("Missing return statement in function"); } - static final public ArrayVariableDeclaration ArrayVariable() throws ParseException { + final public ArrayVariableDeclaration ArrayVariable() throws ParseException { final Expression expr,expr2; expr = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -1043,11 +1043,11 @@ final Expression expr,expr2; jj_la1[17] = jj_gen; ; } - {if (true) return new ArrayVariableDeclaration(expr,SimpleCharStream.getPosition());} + {if (true) return new ArrayVariableDeclaration(expr,jj_input_stream.getPosition());} throw new Error("Missing return statement in function"); } - static final public ArrayVariableDeclaration[] ArrayInitializer() throws ParseException { + final public ArrayVariableDeclaration[] ArrayInitializer() throws ParseException { ArrayVariableDeclaration expr; final ArrayList list = new ArrayList(); jj_consume_token(LPAREN); @@ -1112,7 +1112,7 @@ final Expression expr,expr2; * A Method Declaration. * function MetodDeclarator() Block() */ - static final public MethodDeclaration MethodDeclaration() throws ParseException { + final public MethodDeclaration MethodDeclaration() throws ParseException { final MethodDeclaration functionDeclaration; final Block block; final OutlineableWithChildren seg = currentSegment; @@ -1125,8 +1125,8 @@ final Expression expr,expr2; if (errorMessage != null) {if (true) throw 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.sourceStart; + errorEnd = e.currentToken.sourceEnd; {if (true) throw e;} } currentSegment = functionDeclaration; @@ -1142,10 +1142,10 @@ final Expression expr,expr2; * [&] IDENTIFIER(parameters ...). * @return a function description for the outline */ - static final public MethodDeclaration MethodDeclarator(final int start) throws ParseException { + final public MethodDeclaration MethodDeclarator(final int start) throws ParseException { Token identifier = null; Token reference = null; - final Hashtable formalParameters = new Hashtable(); + final ArrayList formalParameters = new ArrayList(); String identifierChar = SYNTAX_ERROR_CHAR; int end = start; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -1197,10 +1197,10 @@ final Expression expr,expr2; * FormalParameters follows method identifier. * (FormalParameter()) */ - static final public int FormalParameters(final Hashtable parameters) throws ParseException { + final public int FormalParameters(final ArrayList parameters) throws ParseException { VariableDeclaration var; final Token token; - Token tok = PHPParser.token; + Token tok = this.token; int end = tok.sourceEnd; try { tok = jj_consume_token(LPAREN); @@ -1216,7 +1216,7 @@ final Expression expr,expr2; case BIT_AND: case DOLLAR: var = FormalParameter(); - parameters.put(var.name(),var);end = var.sourceEnd; + parameters.add(var);end = var.sourceEnd; label_7: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -1229,7 +1229,7 @@ final Expression expr,expr2; } jj_consume_token(COMMA); var = FormalParameter(); - parameters.put(var.name(),var);end = var.sourceEnd; + parameters.add(var);end = var.sourceEnd; } break; default: @@ -1254,7 +1254,7 @@ final Expression expr,expr2; * A formal parameter. * $varname[=value] (,$varname[=value]) */ - static final public VariableDeclaration FormalParameter() throws ParseException { + final public VariableDeclaration FormalParameter() throws ParseException { final VariableDeclaration variableDeclaration; Token token = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -1266,6 +1266,7 @@ final Expression expr,expr2; ; } variableDeclaration = VariableDeclaratorNoSuffix(); + outlineInfo.addVariable('$'+variableDeclaration.name()); if (token != null) { variableDeclaration.setReference(true); } @@ -1273,7 +1274,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - static final public ConstantIdentifier Type() throws ParseException { + final public ConstantIdentifier Type() throws ParseException { final Token token; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STRING: @@ -1320,7 +1321,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - static final public Expression Expression() throws ParseException { + final public Expression Expression() throws ParseException { final Expression expr; Expression initializer = null; int assignOperator = -1; @@ -1369,7 +1370,7 @@ final Expression expr,expr2; } errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression expected"; errorLevel = ERROR; - errorEnd = SimpleCharStream.getPosition(); + errorEnd = jj_input_stream.getPosition(); {if (true) throw e;} } break; @@ -1408,7 +1409,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - static final public Expression ExpressionWBang() throws ParseException { + final public Expression ExpressionWBang() throws ParseException { final Expression expr; final Token token; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -1430,7 +1431,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - static final public Expression ExpressionNoBang() throws ParseException { + final public Expression ExpressionNoBang() throws ParseException { Expression expr; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LIST: @@ -1453,7 +1454,7 @@ final Expression expr,expr2; * Any assignement operator. * @return the assignement operator id */ - static final public int AssignmentOperator() throws ParseException { + final public int AssignmentOperator() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ASSIGN: jj_consume_token(ASSIGN); @@ -1515,7 +1516,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - static final public Expression ConditionalExpression() throws ParseException { + final public Expression ConditionalExpression() throws ParseException { final Expression expr; Expression expr2 = null; Expression expr3 = null; @@ -1538,7 +1539,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - static final public Expression ConditionalOrExpression() throws ParseException { + final public Expression ConditionalOrExpression() throws ParseException { Expression expr,expr2; int operator; expr = ConditionalAndExpression(); @@ -1574,7 +1575,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - static final public Expression ConditionalAndExpression() throws ParseException { + final public Expression ConditionalAndExpression() throws ParseException { Expression expr,expr2; int operator; expr = ConcatExpression(); @@ -1610,7 +1611,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - static final public Expression ConcatExpression() throws ParseException { + final public Expression ConcatExpression() throws ParseException { Expression expr,expr2; expr = InclusiveOrExpression(); label_10: @@ -1631,7 +1632,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - static final public Expression InclusiveOrExpression() throws ParseException { + final public Expression InclusiveOrExpression() throws ParseException { Expression expr,expr2; expr = ExclusiveOrExpression(); label_11: @@ -1652,7 +1653,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - static final public Expression ExclusiveOrExpression() throws ParseException { + final public Expression ExclusiveOrExpression() throws ParseException { Expression expr,expr2; expr = AndExpression(); label_12: @@ -1673,7 +1674,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - static final public Expression AndExpression() throws ParseException { + final public Expression AndExpression() throws ParseException { Expression expr,expr2; expr = EqualityExpression(); label_13: @@ -1694,7 +1695,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - static final public Expression EqualityExpression() throws ParseException { + final public Expression EqualityExpression() throws ParseException { Expression expr,expr2; int operator; Token token; @@ -1758,7 +1759,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - static final public Expression RelationalExpression() throws ParseException { + final public Expression RelationalExpression() throws ParseException { Expression expr,expr2; int operator; expr = ShiftExpression(); @@ -1804,7 +1805,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - static final public Expression ShiftExpression() throws ParseException { + final public Expression ShiftExpression() throws ParseException { Expression expr,expr2; int operator; expr = AdditiveExpression(); @@ -1845,7 +1846,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - static final public Expression AdditiveExpression() throws ParseException { + final public Expression AdditiveExpression() throws ParseException { Expression expr,expr2; int operator; expr = MultiplicativeExpression(); @@ -1881,17 +1882,17 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - static final public Expression MultiplicativeExpression() throws ParseException { + final public Expression MultiplicativeExpression() throws ParseException { Expression expr,expr2; int operator; try { expr = UnaryExpression(); } catch (ParseException e) { if (errorMessage != null) {if (true) throw e;} - errorMessage = "unexpected token '"+e.currentToken.next.image+"'"; + errorMessage = "unexpected token '"+e.currentToken.next.image+'\''; errorLevel = ERROR; - errorStart = PHPParser.token.sourceStart; - errorEnd = PHPParser.token.sourceEnd; + errorStart = this.token.sourceStart; + errorEnd = this.token.sourceEnd; {if (true) throw e;} } label_18: @@ -1934,7 +1935,7 @@ final Expression expr,expr2; /** * An unary expression starting with @, & or nothing */ - static final public Expression UnaryExpression() throws ParseException { + final public Expression UnaryExpression() throws ParseException { final Expression expr; /* expr = UnaryExpressionNoPrefix() //why did I had that ? {return new PrefixedUnaryExpression(expr,OperatorIds.AND,pos);} @@ -1944,7 +1945,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - static final public Expression AtNotTildeUnaryExpression() throws ParseException { + final public Expression AtNotTildeUnaryExpression() throws ParseException { final Expression expr; final Token token; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -1995,7 +1996,7 @@ final Expression expr,expr2; * An expression prefixed (or not) by one or more @ and !. * @return the expression */ - static final public Expression AtNotUnaryExpression() throws ParseException { + final public Expression AtNotUnaryExpression() throws ParseException { final Expression expr; final Token token; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -2037,7 +2038,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - static final public Expression UnaryExpressionNoPrefix() throws ParseException { + final public Expression UnaryExpressionNoPrefix() throws ParseException { final Expression expr; final Token token; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -2084,7 +2085,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - static final public Expression PreIncDecExpression() throws ParseException { + final public Expression PreIncDecExpression() throws ParseException { final Expression expr; final int operator; final Token token; @@ -2107,7 +2108,7 @@ final Token token; throw new Error("Missing return statement in function"); } - static final public Expression UnaryExpressionNotPlusMinus() throws ParseException { + final public Expression UnaryExpressionNotPlusMinus() throws ParseException { final Expression expr; if (jj_2_3(2147483647)) { expr = CastExpression(); @@ -2155,7 +2156,7 @@ final Token token; throw new Error("Missing return statement in function"); } - static final public CastExpression CastExpression() throws ParseException { + final public CastExpression CastExpression() throws ParseException { final ConstantIdentifier type; final Expression expr; final Token token,token1; @@ -2187,7 +2188,7 @@ final Token token,token1; throw new Error("Missing return statement in function"); } - static final public Expression PostfixExpression() throws ParseException { + final public Expression PostfixExpression() throws ParseException { final Expression expr; int operator = -1; Token token = null; @@ -2221,7 +2222,7 @@ final Token token,token1; throw new Error("Missing return statement in function"); } - static final public Expression PrimaryExpression() throws ParseException { + final public Expression PrimaryExpression() throws ParseException { Expression expr; Token token = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -2252,7 +2253,7 @@ final Token token,token1; throw new Error("Missing return statement in function"); } - static final public Expression refPrimaryExpression(final Token reference) throws ParseException { + final public Expression refPrimaryExpression(final Token reference) throws ParseException { Expression expr; Expression expr2 = null; final Token identifier; @@ -2344,18 +2345,18 @@ final Token token,token1; * array(vars) * @return an array */ - static final public ArrayInitializer ArrayDeclarator() throws ParseException { + final public ArrayInitializer ArrayDeclarator() throws ParseException { final ArrayVariableDeclaration[] vars; final Token token; token = jj_consume_token(ARRAY); vars = ArrayInitializer(); {if (true) return new ArrayInitializer(vars, token.sourceStart, - PHPParser.token.sourceEnd);} + this.token.sourceEnd);} throw new Error("Missing return statement in function"); } - static final public Expression ClassIdentifier() throws ParseException { + final public Expression ClassIdentifier() throws ParseException { final Expression expr; final Token token; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -2390,7 +2391,7 @@ final Token token,token1; /** * Used by Variabledeclaratorid and primarysuffix */ - static final public AbstractVariable VariableSuffix(final AbstractVariable prefix) throws ParseException { + final public AbstractVariable VariableSuffix(final AbstractVariable prefix) throws ParseException { Expression expression = null; final Token classAccessToken,lbrace,rbrace; Token token; @@ -2629,7 +2630,7 @@ final Token token,token1; throw new Error("Missing return statement in function"); } - static final public Literal Literal() throws ParseException { + final public Literal Literal() throws ParseException { final Token token; StringLiteral literal; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -2669,7 +2670,7 @@ final Token token,token1; throw new Error("Missing return statement in function"); } - static final public StringLiteral evaluableString() throws ParseException { + final public StringLiteral evaluableString() throws ParseException { ArrayList list = new ArrayList(); Token start,end; Token token,lbrace,rbrace; @@ -2711,17 +2712,17 @@ final Token token,token1; end = jj_consume_token(DOUBLEQUOTE2); AbstractVariable[] vars = new AbstractVariable[list.size()]; list.toArray(vars); - {if (true) return new StringLiteral(SimpleCharStream.currentBuffer.substring(start.sourceEnd,end.sourceStart), + {if (true) return new StringLiteral(jj_input_stream.getCurrentBuffer().substring(start.sourceEnd,end.sourceStart), start.sourceStart, end.sourceEnd, vars);} throw new Error("Missing return statement in function"); } - static final public FunctionCall Arguments(final Expression func) throws ParseException { + final public FunctionCall Arguments(final Expression func) throws ParseException { Expression[] args = null; -final Token token; - jj_consume_token(LPAREN); +final Token token,lparen; + lparen = jj_consume_token(LPAREN); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ARRAY: case LIST: @@ -2757,11 +2758,17 @@ final Token token; } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected to close the argument list"; errorLevel = ERROR; - errorStart = args[args.length-1].sourceEnd+1; - errorEnd = args[args.length-1].sourceEnd+1; + if (args == null) { + errorStart = lparen.sourceEnd+1; + errorEnd = lparen.sourceEnd+2; + } else { + errorStart = args[args.length-1].sourceEnd+1; + errorEnd = args[args.length-1].sourceEnd+2; + } processParseExceptionDebug(e); } - {if (true) return new FunctionCall(func,args,args[args.length-1].sourceEnd);} + int sourceEnd = (args == null && args.length != 0) ? lparen.sourceEnd+1 : args[args.length-1].sourceEnd; + {if (true) return new FunctionCall(func,args,sourceEnd);} throw new Error("Missing return statement in function"); } @@ -2770,7 +2777,7 @@ final Token token; * argumentDeclaration() (, argumentDeclaration)* * @return an array of arguments */ - static final public Expression[] ArgumentList() throws ParseException { + final public Expression[] ArgumentList() throws ParseException { Expression arg; final ArrayList list = new ArrayList(); int pos; @@ -2811,7 +2818,7 @@ Token token; * A Statement without break. * @return a statement */ - static final public Statement StatementNoBreak() throws ParseException { + final public Statement StatementNoBreak() throws ParseException { final Statement statement; Token token = null; if (jj_2_4(2)) { @@ -2913,7 +2920,7 @@ Token token; * expression ; * @return an expression */ - static final public Statement expressionStatement() throws ParseException { + final public Statement expressionStatement() throws ParseException { final Statement statement; final Token token; statement = Expression(); @@ -2933,7 +2940,7 @@ Token token; throw new Error("Missing return statement in function"); } - static final public Define defineStatement() throws ParseException { + final public Define defineStatement() throws ParseException { Expression defineName,defineValue; final Token defineToken; Token token; @@ -3003,7 +3010,7 @@ Token token; /** * A Normal statement. */ - static final public Statement Statement() throws ParseException { + final public Statement Statement() throws ParseException { final Statement statement; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IF: @@ -3064,7 +3071,7 @@ Token token; /** * An html block inside a php syntax. */ - static final public HTMLBlock htmlBlock() throws ParseException { + final public HTMLBlock htmlBlock() throws ParseException { final int startIndex = nodePtr; final AstNode[] blockNodes; final int nbNodes; @@ -3096,12 +3103,12 @@ Token token; jj_consume_token(-1); throw new ParseException(); } - PHPParser.createNewHTMLCode(); + createNewHTMLCode(); } catch (ParseException e) { errorMessage = "unexpected end of file , '= 100) return; if (pos == jj_endpos + 1) { jj_lasttokens[jj_endpos++] = kind; @@ -7475,7 +7462,7 @@ final ArrayList list = new ArrayList(); } } - static public ParseException generateParseException() { + public ParseException generateParseException() { jj_expentries.removeAllElements(); boolean[] la1tokens = new boolean[160]; for (int i = 0; i < 160; i++) { @@ -7523,13 +7510,13 @@ final ArrayList list = new ArrayList(); return new ParseException(token, exptokseq, tokenImage); } - static final public void enable_tracing() { + final public void enable_tracing() { } - static final public void disable_tracing() { + final public void disable_tracing() { } - static final private void jj_rescan_token() { + final private void jj_rescan_token() { jj_rescan = true; for (int i = 0; i < 5; i++) { JJCalls p = jj_2_rtns[i]; @@ -7550,7 +7537,7 @@ final ArrayList list = new ArrayList(); jj_rescan = false; } - static final private void jj_save(int index, int xla) { + final private void jj_save(int index, int xla) { JJCalls p = jj_2_rtns[index]; while (p.gen > jj_gen) { if (p.next == null) { p = p.next = new JJCalls(); break; }