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 c4cc3b5..4030cca 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.java +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.java @@ -1,25 +1,83 @@ /* Generated By:JavaCC: Do not edit this line. PHPParser.java */ package test; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.ui.texteditor.MarkerUtilities; -import org.eclipse.jface.preference.IPreferenceStore; - -import java.util.Hashtable; -import java.util.ArrayList; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.Reader; import java.io.StringReader; -import java.io.*; import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Hashtable; -import net.sourceforge.phpeclipse.actions.PHPStartApacheAction; -import net.sourceforge.phpeclipse.PHPeclipsePlugin; -import net.sourceforge.phpdt.internal.compiler.ast.*; -import net.sourceforge.phpdt.internal.compiler.parser.OutlineableWithChildren; +import net.sourceforge.phpdt.core.IJavaModelMarker; +import net.sourceforge.phpdt.internal.compiler.ast.AbstractCase; +import net.sourceforge.phpdt.internal.compiler.ast.AbstractVariable; +import net.sourceforge.phpdt.internal.compiler.ast.ArrayDeclarator; +import net.sourceforge.phpdt.internal.compiler.ast.ArrayInitializer; +import net.sourceforge.phpdt.internal.compiler.ast.ArrayVariableDeclaration; +import net.sourceforge.phpdt.internal.compiler.ast.AstNode; +import net.sourceforge.phpdt.internal.compiler.ast.BinaryExpression; +import net.sourceforge.phpdt.internal.compiler.ast.Block; +import net.sourceforge.phpdt.internal.compiler.ast.Break; +import net.sourceforge.phpdt.internal.compiler.ast.Case; +import net.sourceforge.phpdt.internal.compiler.ast.CastExpression; +import net.sourceforge.phpdt.internal.compiler.ast.ClassAccess; +import net.sourceforge.phpdt.internal.compiler.ast.ClassDeclaration; +import net.sourceforge.phpdt.internal.compiler.ast.ClassInstantiation; +import net.sourceforge.phpdt.internal.compiler.ast.ConditionalExpression; +import net.sourceforge.phpdt.internal.compiler.ast.ConstantIdentifier; +import net.sourceforge.phpdt.internal.compiler.ast.Continue; +import net.sourceforge.phpdt.internal.compiler.ast.DefaultCase; +import net.sourceforge.phpdt.internal.compiler.ast.Define; +import net.sourceforge.phpdt.internal.compiler.ast.DoStatement; +import net.sourceforge.phpdt.internal.compiler.ast.EchoStatement; +import net.sourceforge.phpdt.internal.compiler.ast.Else; +import net.sourceforge.phpdt.internal.compiler.ast.ElseIf; +import net.sourceforge.phpdt.internal.compiler.ast.EmptyStatement; +import net.sourceforge.phpdt.internal.compiler.ast.Expression; +import net.sourceforge.phpdt.internal.compiler.ast.FalseLiteral; +import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration; +import net.sourceforge.phpdt.internal.compiler.ast.ForStatement; +import net.sourceforge.phpdt.internal.compiler.ast.ForeachStatement; +import net.sourceforge.phpdt.internal.compiler.ast.FunctionCall; +import net.sourceforge.phpdt.internal.compiler.ast.GlobalStatement; +import net.sourceforge.phpdt.internal.compiler.ast.HTMLBlock; +import net.sourceforge.phpdt.internal.compiler.ast.HTMLCode; +import net.sourceforge.phpdt.internal.compiler.ast.IfStatement; +import net.sourceforge.phpdt.internal.compiler.ast.InclusionStatement; +import net.sourceforge.phpdt.internal.compiler.ast.LabeledStatement; +import net.sourceforge.phpdt.internal.compiler.ast.ListExpression; +import net.sourceforge.phpdt.internal.compiler.ast.Literal; +import net.sourceforge.phpdt.internal.compiler.ast.MethodDeclaration; +import net.sourceforge.phpdt.internal.compiler.ast.NullLiteral; +import net.sourceforge.phpdt.internal.compiler.ast.NumberLiteral; +import net.sourceforge.phpdt.internal.compiler.ast.OperatorIds; +import net.sourceforge.phpdt.internal.compiler.ast.PHPDocument; +import net.sourceforge.phpdt.internal.compiler.ast.PHPEchoBlock; +import net.sourceforge.phpdt.internal.compiler.ast.PostfixedUnaryExpression; +import net.sourceforge.phpdt.internal.compiler.ast.PrefixedUnaryExpression; +import net.sourceforge.phpdt.internal.compiler.ast.PrintExpression; +import net.sourceforge.phpdt.internal.compiler.ast.ReturnStatement; +import net.sourceforge.phpdt.internal.compiler.ast.Statement; +import net.sourceforge.phpdt.internal.compiler.ast.StaticStatement; +import net.sourceforge.phpdt.internal.compiler.ast.StringLiteral; +import net.sourceforge.phpdt.internal.compiler.ast.SwitchStatement; +import net.sourceforge.phpdt.internal.compiler.ast.TrueLiteral; +import net.sourceforge.phpdt.internal.compiler.ast.Variable; +import net.sourceforge.phpdt.internal.compiler.ast.VariableDeclaration; +import net.sourceforge.phpdt.internal.compiler.ast.WhileStatement; import net.sourceforge.phpdt.internal.compiler.parser.Outlineable; +import net.sourceforge.phpdt.internal.compiler.parser.OutlineableWithChildren; import net.sourceforge.phpdt.internal.compiler.parser.PHPOutlineInfo; -import net.sourceforge.phpdt.internal.corext.Assert; +import net.sourceforge.phpeclipse.PHPeclipsePlugin; +import net.sourceforge.phpeclipse.actions.PHPStartApacheAction; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.ui.texteditor.MarkerUtilities; /** * A new php parser. @@ -28,7 +86,7 @@ import net.sourceforge.phpdt.internal.corext.Assert; * You can test the parser with the PHPParserTestCase2.java * @author Matthieu Casanova */ -public final class PHPParser extends PHPParserSuperclass implements PHPParserConstants { +public class PHPParser extends PHPParserSuperclass implements PHPParserConstants { //todo : fix the variables names bug //todo : handle tilde operator @@ -60,7 +118,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon //ast stack private final static int AstStackIncrement = 100; /** The stack of node. */ - private static AstNode[] nodes; + protected static AstNode[] nodes; /** The cursor in expression stack. */ private static int nodePtr; @@ -78,26 +136,24 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon PHPParser.fileToParse = fileToParse; } - public final void phpParserTester(final String strEval) throws ParseException { + public static 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); - token_source.SwitchTo(PHPParserTokenManager.PHPPARSING); + PHPParserTokenManager.SwitchTo(PHPParserTokenManager.PHPPARSING); phpTest(); } - public final void htmlParserTester(final File fileName) throws FileNotFoundException, ParseException { + public static 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(); @@ -107,11 +163,10 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon phpFile(); } - public final void htmlParserTester(final String strEval) throws ParseException { + public static 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(); @@ -124,7 +179,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon /** * Reinitialize the parser. */ - private static final void init() { + protected static final void init() { nodes = new AstNode[AstStackIncrement]; nodePtr = -1; htmlStart = 0; @@ -154,7 +209,6 @@ 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(); @@ -265,7 +319,8 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon else attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO)); MarkerUtilities.setLineNumber(attributes, lineNumber); - MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM); +// MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM); + MarkerUtilities.createMarker(file, attributes, IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); } } } @@ -274,7 +329,6 @@ 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(); @@ -310,51 +364,51 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon /** * Put a new html block in the stack. */ - public final void createNewHTMLCode() { + public static final void createNewHTMLCode() { final int currentPosition = token.sourceStart; if (currentPosition == htmlStart || currentPosition < htmlStart || - currentPosition > jj_input_stream.getCurrentBuffer().length()) { + currentPosition > SimpleCharStream.currentBuffer.length()) { return; } - final String html = jj_input_stream.getCurrentBuffer().substring(htmlStart, currentPosition); + final String html = SimpleCharStream.currentBuffer.substring(htmlStart, currentPosition); pushOnAstNodes(new HTMLCode(html, htmlStart,currentPosition)); } /** Create a new task. */ - public final void createNewTask(final int todoStart) { - final String todo = jj_input_stream.getCurrentBuffer().substring(todoStart, - jj_input_stream.getCurrentBuffer().indexOf("\n", + public static final void createNewTask(final int todoStart) { + final String todo = SimpleCharStream.currentBuffer.substring(todoStart, + SimpleCharStream.currentBuffer.indexOf("\n", todoStart)-1); if (!PARSER_DEBUG) { try { setMarker(fileToParse, todo, - jj_input_stream.getBeginLine(), + SimpleCharStream.getBeginLine(), TASK, - "Line "+jj_input_stream.getBeginLine()); + "Line "+SimpleCharStream.getBeginLine()); } catch (CoreException e) { PHPeclipsePlugin.log(e); } } } - private final void parse() throws ParseException { + protected static final void parse() throws ParseException { phpFile(); } - final public void todo() throws ParseException { + static final public void todo() throws ParseException { Token todoToken; todoToken = jj_consume_token(23); createNewTask(todoToken.sourceStart); } - final public void phpTest() throws ParseException { + static final public void phpTest() throws ParseException { Php(); jj_consume_token(0); } - final public void phpFile() throws ParseException { + static final public void phpFile() throws ParseException { try { label_1: while (true) { @@ -414,11 +468,11 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } PhpBlock(); } - createNewHTMLCode(); + PHPParser.createNewHTMLCode(); } catch (TokenMgrError e) { PHPeclipsePlugin.log(e); - errorStart = jj_input_stream.getBeginOffset(); - errorEnd = jj_input_stream.getEndOffset(); + errorStart = SimpleCharStream.beginOffset; + errorEnd = SimpleCharStream.endOffset; errorMessage = e.getMessage(); errorLevel = ERROR; {if (true) throw generateParseException();} @@ -430,7 +484,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon * or * or */ - final public void PhpBlock() throws ParseException { + static final public void PhpBlock() throws ParseException { final PHPEchoBlock phpEchoBlock; final Token token,phpEnd; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -514,7 +568,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon jj_la1[2] = jj_gen; ; } - createNewHTMLCode(); + PHPParser.createNewHTMLCode(); Php(); try { phpEnd = jj_consume_token(PHPEND); @@ -534,12 +588,12 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } } - final public PHPEchoBlock phpEchoBlock() throws ParseException { + static final public PHPEchoBlock phpEchoBlock() throws ParseException { final Expression expr; final PHPEchoBlock echoBlock; final Token token, token2; token = jj_consume_token(PHPECHOSTART); - createNewHTMLCode(); + PHPParser.createNewHTMLCode(); expr = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SEMICOLON: @@ -558,7 +612,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon throw new Error("Missing return statement in function"); } - final public void Php() throws ParseException { + static final public void Php() throws ParseException { label_2: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -615,7 +669,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } } - final public ClassDeclaration ClassDeclaration() throws ParseException { + static final public ClassDeclaration ClassDeclaration() throws ParseException { final ClassDeclaration classDeclaration; Token className = null; final Token superclassName, token, extendsToken; @@ -683,7 +737,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon throw new Error("Missing return statement in function"); } - final public int ClassBody(final ClassDeclaration classDeclaration) throws ParseException { + static final public int ClassBody(final ClassDeclaration classDeclaration) throws ParseException { Token token; try { jj_consume_token(LBRACE); @@ -716,7 +770,7 @@ Token token; errorStart = e.currentToken.sourceStart; errorEnd = e.currentToken.sourceEnd; processParseExceptionDebug(e); - {if (true) return this.token.sourceEnd;} + {if (true) return PHPParser.token.sourceEnd;} } throw new Error("Missing return statement in function"); } @@ -724,7 +778,7 @@ Token token; /** * A class can contain only methods and fields. */ - final public void ClassBodyDeclaration(final ClassDeclaration classDeclaration) throws ParseException { + static final public void ClassBodyDeclaration(final ClassDeclaration classDeclaration) throws ParseException { final MethodDeclaration method; final FieldDeclaration field; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -748,7 +802,7 @@ Token token; * A class field declaration : it's var VariableDeclarator() (, VariableDeclarator())*;. * it is only used by ClassBodyDeclaration() */ - final public FieldDeclaration FieldDeclaration() throws ParseException { + static final public FieldDeclaration FieldDeclaration() throws ParseException { VariableDeclaration variableDeclaration; final VariableDeclaration[] list; final ArrayList arrayList = new ArrayList(); @@ -803,7 +857,7 @@ Token token; * a strict variable declarator : there cannot be a suffix here. * It will be used by fields and formal parameters */ - final public VariableDeclaration VariableDeclaratorNoSuffix() throws ParseException { + static final public VariableDeclaration VariableDeclaratorNoSuffix() throws ParseException { final Token token, lbrace,rbrace; Expression expr, initializer = null; Token assignToken; @@ -859,7 +913,7 @@ Token token; /** * this will be used by static statement */ - final public VariableDeclaration VariableDeclarator() throws ParseException { + static final public VariableDeclaration VariableDeclarator() throws ParseException { final AbstractVariable variable; Expression initializer = null; final Token token; @@ -899,8 +953,9 @@ Token token; * A Variable name. * @return the variable name (with suffix) */ - final public AbstractVariable VariableDeclaratorId() throws ParseException { - AbstractVariable var; + static final public AbstractVariable VariableDeclaratorId() throws ParseException { + final Variable var; + AbstractVariable expression = null; try { var = Variable(); label_5: @@ -910,9 +965,12 @@ Token token; } else { break label_5; } - var = VariableSuffix(var); + expression = VariableSuffix(var); } - {if (true) return var;} + if (expression == null) { + {if (true) return var;} + } + {if (true) return expression;} } catch (ParseException e) { errorMessage = "'$' expected for variable identifier"; errorLevel = ERROR; @@ -923,7 +981,7 @@ Token token; throw new Error("Missing return statement in function"); } - final public Variable Variable() throws ParseException { + static final public Variable Variable() throws ParseException { Variable variable = null; final Token token; token = jj_consume_token(DOLLAR); @@ -932,7 +990,7 @@ Token token; throw new Error("Missing return statement in function"); } - final public Variable Var() throws ParseException { + static final public Variable Var() throws ParseException { Variable variable = null; final Token token,token2; ConstantIdentifier constant; @@ -964,7 +1022,7 @@ Token token; throw new Error("Missing return statement in function"); } - final public Expression VariableInitializer() throws ParseException { + static final public Expression VariableInitializer() throws ParseException { final Expression expr; final Token token, token2; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -1030,7 +1088,7 @@ Token token; throw new Error("Missing return statement in function"); } - final public ArrayVariableDeclaration ArrayVariable() throws ParseException { + static final public ArrayVariableDeclaration ArrayVariable() throws ParseException { final Expression expr,expr2; expr = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -1043,11 +1101,11 @@ final Expression expr,expr2; jj_la1[17] = jj_gen; ; } - {if (true) return new ArrayVariableDeclaration(expr,jj_input_stream.getPosition());} + {if (true) return new ArrayVariableDeclaration(expr,SimpleCharStream.getPosition());} throw new Error("Missing return statement in function"); } - final public ArrayVariableDeclaration[] ArrayInitializer() throws ParseException { + static final public ArrayVariableDeclaration[] ArrayInitializer() throws ParseException { ArrayVariableDeclaration expr; final ArrayList list = new ArrayList(); jj_consume_token(LPAREN); @@ -1112,7 +1170,7 @@ final Expression expr,expr2; * A Method Declaration. * function MetodDeclarator() Block() */ - final public MethodDeclaration MethodDeclaration() throws ParseException { + static final public MethodDeclaration MethodDeclaration() throws ParseException { final MethodDeclaration functionDeclaration; final Block block; final OutlineableWithChildren seg = currentSegment; @@ -1142,7 +1200,7 @@ final Expression expr,expr2; * [&] IDENTIFIER(parameters ...). * @return a function description for the outline */ - final public MethodDeclaration MethodDeclarator(final int start) throws ParseException { + static final public MethodDeclaration MethodDeclarator(final int start) throws ParseException { Token identifier = null; Token reference = null; final ArrayList formalParameters = new ArrayList(); @@ -1197,10 +1255,10 @@ final Expression expr,expr2; * FormalParameters follows method identifier. * (FormalParameter()) */ - final public int FormalParameters(final ArrayList parameters) throws ParseException { + static final public int FormalParameters(final ArrayList parameters) throws ParseException { VariableDeclaration var; final Token token; - Token tok = this.token; + Token tok = PHPParser.token; int end = tok.sourceEnd; try { tok = jj_consume_token(LPAREN); @@ -1254,7 +1312,7 @@ final Expression expr,expr2; * A formal parameter. * $varname[=value] (,$varname[=value]) */ - final public VariableDeclaration FormalParameter() throws ParseException { + static final public VariableDeclaration FormalParameter() throws ParseException { final VariableDeclaration variableDeclaration; Token token = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -1274,7 +1332,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - final public ConstantIdentifier Type() throws ParseException { + static final public ConstantIdentifier Type() throws ParseException { final Token token; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STRING: @@ -1321,7 +1379,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - final public Expression Expression() throws ParseException { + static final public Expression Expression() throws ParseException { final Expression expr; Expression initializer = null; int assignOperator = -1; @@ -1370,7 +1428,7 @@ final Expression expr,expr2; } errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression expected"; errorLevel = ERROR; - errorEnd = jj_input_stream.getPosition(); + errorEnd = SimpleCharStream.getPosition(); {if (true) throw e;} } break; @@ -1409,7 +1467,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - final public Expression ExpressionWBang() throws ParseException { + static final public Expression ExpressionWBang() throws ParseException { final Expression expr; final Token token; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -1431,7 +1489,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - final public Expression ExpressionNoBang() throws ParseException { + static final public Expression ExpressionNoBang() throws ParseException { Expression expr; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LIST: @@ -1454,7 +1512,7 @@ final Expression expr,expr2; * Any assignement operator. * @return the assignement operator id */ - final public int AssignmentOperator() throws ParseException { + static final public int AssignmentOperator() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ASSIGN: jj_consume_token(ASSIGN); @@ -1516,7 +1574,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - final public Expression ConditionalExpression() throws ParseException { + static final public Expression ConditionalExpression() throws ParseException { final Expression expr; Expression expr2 = null; Expression expr3 = null; @@ -1539,7 +1597,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - final public Expression ConditionalOrExpression() throws ParseException { + static final public Expression ConditionalOrExpression() throws ParseException { Expression expr,expr2; int operator; expr = ConditionalAndExpression(); @@ -1575,7 +1633,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - final public Expression ConditionalAndExpression() throws ParseException { + static final public Expression ConditionalAndExpression() throws ParseException { Expression expr,expr2; int operator; expr = ConcatExpression(); @@ -1611,7 +1669,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - final public Expression ConcatExpression() throws ParseException { + static final public Expression ConcatExpression() throws ParseException { Expression expr,expr2; expr = InclusiveOrExpression(); label_10: @@ -1632,7 +1690,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - final public Expression InclusiveOrExpression() throws ParseException { + static final public Expression InclusiveOrExpression() throws ParseException { Expression expr,expr2; expr = ExclusiveOrExpression(); label_11: @@ -1653,7 +1711,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - final public Expression ExclusiveOrExpression() throws ParseException { + static final public Expression ExclusiveOrExpression() throws ParseException { Expression expr,expr2; expr = AndExpression(); label_12: @@ -1674,7 +1732,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - final public Expression AndExpression() throws ParseException { + static final public Expression AndExpression() throws ParseException { Expression expr,expr2; expr = EqualityExpression(); label_13: @@ -1695,7 +1753,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - final public Expression EqualityExpression() throws ParseException { + static final public Expression EqualityExpression() throws ParseException { Expression expr,expr2; int operator; Token token; @@ -1759,7 +1817,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - final public Expression RelationalExpression() throws ParseException { + static final public Expression RelationalExpression() throws ParseException { Expression expr,expr2; int operator; expr = ShiftExpression(); @@ -1805,7 +1863,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - final public Expression ShiftExpression() throws ParseException { + static final public Expression ShiftExpression() throws ParseException { Expression expr,expr2; int operator; expr = AdditiveExpression(); @@ -1846,7 +1904,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - final public Expression AdditiveExpression() throws ParseException { + static final public Expression AdditiveExpression() throws ParseException { Expression expr,expr2; int operator; expr = MultiplicativeExpression(); @@ -1882,7 +1940,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - final public Expression MultiplicativeExpression() throws ParseException { + static final public Expression MultiplicativeExpression() throws ParseException { Expression expr,expr2; int operator; try { @@ -1891,8 +1949,8 @@ final Expression expr,expr2; if (errorMessage != null) {if (true) throw e;} errorMessage = "unexpected token '"+e.currentToken.next.image+'\''; errorLevel = ERROR; - errorStart = this.token.sourceStart; - errorEnd = this.token.sourceEnd; + errorStart = PHPParser.token.sourceStart; + errorEnd = PHPParser.token.sourceEnd; {if (true) throw e;} } label_18: @@ -1935,7 +1993,7 @@ final Expression expr,expr2; /** * An unary expression starting with @, & or nothing */ - final public Expression UnaryExpression() throws ParseException { + static final public Expression UnaryExpression() throws ParseException { final Expression expr; /* expr = UnaryExpressionNoPrefix() //why did I had that ? {return new PrefixedUnaryExpression(expr,OperatorIds.AND,pos);} @@ -1945,7 +2003,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - final public Expression AtNotTildeUnaryExpression() throws ParseException { + static final public Expression AtNotTildeUnaryExpression() throws ParseException { final Expression expr; final Token token; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -1996,7 +2054,7 @@ final Expression expr,expr2; * An expression prefixed (or not) by one or more @ and !. * @return the expression */ - final public Expression AtNotUnaryExpression() throws ParseException { + static final public Expression AtNotUnaryExpression() throws ParseException { final Expression expr; final Token token; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -2038,7 +2096,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - final public Expression UnaryExpressionNoPrefix() throws ParseException { + static final public Expression UnaryExpressionNoPrefix() throws ParseException { final Expression expr; final Token token; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -2085,7 +2143,7 @@ final Expression expr,expr2; throw new Error("Missing return statement in function"); } - final public Expression PreIncDecExpression() throws ParseException { + static final public Expression PreIncDecExpression() throws ParseException { final Expression expr; final int operator; final Token token; @@ -2108,7 +2166,7 @@ final Token token; throw new Error("Missing return statement in function"); } - final public Expression UnaryExpressionNotPlusMinus() throws ParseException { + static final public Expression UnaryExpressionNotPlusMinus() throws ParseException { final Expression expr; if (jj_2_3(2147483647)) { expr = CastExpression(); @@ -2156,7 +2214,7 @@ final Token token; throw new Error("Missing return statement in function"); } - final public CastExpression CastExpression() throws ParseException { + static final public CastExpression CastExpression() throws ParseException { final ConstantIdentifier type; final Expression expr; final Token token,token1; @@ -2188,7 +2246,7 @@ final Token token,token1; throw new Error("Missing return statement in function"); } - final public Expression PostfixExpression() throws ParseException { + static final public Expression PostfixExpression() throws ParseException { final Expression expr; int operator = -1; Token token = null; @@ -2222,7 +2280,7 @@ final Token token,token1; throw new Error("Missing return statement in function"); } - final public Expression PrimaryExpression() throws ParseException { + static final public Expression PrimaryExpression() throws ParseException { Expression expr; Token token = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -2253,7 +2311,7 @@ final Token token,token1; throw new Error("Missing return statement in function"); } - final public Expression refPrimaryExpression(final Token reference) throws ParseException { + static final public Expression refPrimaryExpression(final Token reference) throws ParseException { Expression expr; Expression expr2 = null; final Token identifier; @@ -2345,18 +2403,18 @@ final Token token,token1; * array(vars) * @return an array */ - final public ArrayInitializer ArrayDeclarator() throws ParseException { + static 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, - this.token.sourceEnd);} + PHPParser.token.sourceEnd);} throw new Error("Missing return statement in function"); } - final public Expression ClassIdentifier() throws ParseException { + static final public Expression ClassIdentifier() throws ParseException { final Expression expr; final Token token; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -2391,7 +2449,7 @@ final Token token,token1; /** * Used by Variabledeclaratorid and primarysuffix */ - final public AbstractVariable VariableSuffix(final AbstractVariable prefix) throws ParseException { + static final public AbstractVariable VariableSuffix(final AbstractVariable prefix) throws ParseException { Expression expression = null; final Token classAccessToken,lbrace,rbrace; Token token; @@ -2630,7 +2688,7 @@ final Token token,token1; throw new Error("Missing return statement in function"); } - final public Literal Literal() throws ParseException { + static final public Literal Literal() throws ParseException { final Token token; StringLiteral literal; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -2670,7 +2728,7 @@ final Token token,token1; throw new Error("Missing return statement in function"); } - final public StringLiteral evaluableString() throws ParseException { + static final public StringLiteral evaluableString() throws ParseException { ArrayList list = new ArrayList(); Token start,end; Token token,lbrace,rbrace; @@ -2712,14 +2770,14 @@ final Token token,token1; end = jj_consume_token(DOUBLEQUOTE2); AbstractVariable[] vars = new AbstractVariable[list.size()]; list.toArray(vars); - {if (true) return new StringLiteral(jj_input_stream.getCurrentBuffer().substring(start.sourceEnd,end.sourceStart), + {if (true) return new StringLiteral(SimpleCharStream.currentBuffer.substring(start.sourceEnd,end.sourceStart), start.sourceStart, end.sourceEnd, vars);} throw new Error("Missing return statement in function"); } - final public FunctionCall Arguments(final Expression func) throws ParseException { + static final public FunctionCall Arguments(final Expression func) throws ParseException { Expression[] args = null; final Token token,lparen; lparen = jj_consume_token(LPAREN); @@ -2777,7 +2835,7 @@ final Token token,lparen; * argumentDeclaration() (, argumentDeclaration)* * @return an array of arguments */ - final public Expression[] ArgumentList() throws ParseException { + static final public Expression[] ArgumentList() throws ParseException { Expression arg; final ArrayList list = new ArrayList(); int pos; @@ -2818,7 +2876,7 @@ Token token; * A Statement without break. * @return a statement */ - final public Statement StatementNoBreak() throws ParseException { + static final public Statement StatementNoBreak() throws ParseException { final Statement statement; Token token = null; if (jj_2_4(2)) { @@ -2920,7 +2978,7 @@ Token token; * expression ; * @return an expression */ - final public Statement expressionStatement() throws ParseException { + static final public Statement expressionStatement() throws ParseException { final Statement statement; final Token token; statement = Expression(); @@ -2940,7 +2998,7 @@ Token token; throw new Error("Missing return statement in function"); } - final public Define defineStatement() throws ParseException { + static final public Define defineStatement() throws ParseException { Expression defineName,defineValue; final Token defineToken; Token token; @@ -3010,7 +3068,7 @@ Token token; /** * A Normal statement. */ - final public Statement Statement() throws ParseException { + static final public Statement Statement() throws ParseException { final Statement statement; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IF: @@ -3071,7 +3129,7 @@ Token token; /** * An html block inside a php syntax. */ - final public HTMLBlock htmlBlock() throws ParseException { + static final public HTMLBlock htmlBlock() throws ParseException { final int startIndex = nodePtr; final AstNode[] blockNodes; final int nbNodes; @@ -3103,7 +3161,7 @@ Token token; jj_consume_token(-1); throw new ParseException(); } - createNewHTMLCode(); + PHPParser.createNewHTMLCode(); } catch (ParseException e) { errorMessage = "unexpected end of file , '= 100) return; if (pos == jj_endpos + 1) { jj_lasttokens[jj_endpos++] = kind; @@ -7462,7 +7542,7 @@ final ArrayList list = new ArrayList(); } } - public ParseException generateParseException() { + static public ParseException generateParseException() { jj_expentries.removeAllElements(); boolean[] la1tokens = new boolean[160]; for (int i = 0; i < 160; i++) { @@ -7510,13 +7590,13 @@ final ArrayList list = new ArrayList(); return new ParseException(token, exptokseq, tokenImage); } - final public void enable_tracing() { + static final public void enable_tracing() { } - final public void disable_tracing() { + static final public void disable_tracing() { } - final private void jj_rescan_token() { + static final private void jj_rescan_token() { jj_rescan = true; for (int i = 0; i < 5; i++) { JJCalls p = jj_2_rtns[i]; @@ -7537,7 +7617,7 @@ final ArrayList list = new ArrayList(); jj_rescan = false; } - final private void jj_save(int index, int xla) { + static 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; } @@ -7553,4 +7633,5 @@ final ArrayList list = new ArrayList(); JJCalls next; } + }