From: kpouer Date: Wed, 7 May 2003 15:47:50 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.phpeclipse.com *** empty log message *** --- diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayVariableDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayVariableDeclaration.java index b9a0d6b..14413e5 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayVariableDeclaration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayVariableDeclaration.java @@ -15,6 +15,10 @@ public class ArrayVariableDeclaration extends Expression { this.value = value; } + public ArrayVariableDeclaration(Expression key,int sourceEnd) { + super(key.sourceStart, sourceEnd); + this.key = key; + } /** * Return the expression as String. * @return the expression diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OperatorExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OperatorExpression.java index 5112a4f..deacaf5 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OperatorExpression.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OperatorExpression.java @@ -5,82 +5,85 @@ package net.sourceforge.phpdt.internal.compiler.ast; * @author Matthieu Casanova */ public abstract class OperatorExpression - extends Expression - implements OperatorIds { + extends Expression + implements OperatorIds { - public int operator; + public int operator; - public OperatorExpression(int operator, int sourceStart, int sourceEnd) { - super(sourceStart, sourceEnd); - this.operator = operator; - } + public OperatorExpression(int operator, int sourceStart, int sourceEnd) { + super(sourceStart, sourceEnd); + this.operator = operator; + } - public String operatorToString() { - switch (operator) { - case EQUAL_EQUAL : - return "=="; //$NON-NLS-1$ - case LESS_EQUAL : - return "<="; //$NON-NLS-1$ - case GREATER_EQUAL : - return ">="; //$NON-NLS-1$ - case NOT_EQUAL : - return "!="; //$NON-NLS-1$ - case LEFT_SHIFT : - return "<<"; //$NON-NLS-1$ - case RIGHT_SHIFT : - return ">>"; //$NON-NLS-1$ - case UNSIGNED_RIGHT_SHIFT : - return ">>>"; //$NON-NLS-1$ - case OR_OR : - return "||"; //$NON-NLS-1$ - case AND_AND : - return "&&"; //$NON-NLS-1$ - case PLUS : - return "+"; //$NON-NLS-1$ - case MINUS : - return "-"; //$NON-NLS-1$ - case NOT : - return "!"; //$NON-NLS-1$ - case REMAINDER : - return "%"; //$NON-NLS-1$ - case XOR : - return "^"; //$NON-NLS-1$ - case AND : - return "&"; //$NON-NLS-1$ - case MULTIPLY : - return "*"; //$NON-NLS-1$ - case OR : - return "|"; //$NON-NLS-1$ - case TWIDDLE : - return "~"; //$NON-NLS-1$ - case DIVIDE : - return "/"; //$NON-NLS-1$ - case GREATER : - return ">"; //$NON-NLS-1$ - case LESS : - return "<"; //$NON-NLS-1$ - case ORL : - return "OR"; //$NON-NLS-1$ - case ANDL : - return "AND"; //$NON-NLS-1$ - case DOT : - return "."; //$NON-NLS-1$ - case DIF : - return "<>"; //$NON-NLS-1$ - case BANG_EQUAL_EQUAL : - return "!=="; //$NON-NLS-1$ - case EQUAL_EQUAL_EQUAL : - return "==="; //$NON-NLS-1$ - case AT : - return "@"; //$NON-NLS-1$ - }; - return "unknown operator"; //$NON-NLS-1$ - } + public String operatorToString() { + switch (operator) { + case EQUAL_EQUAL: + return "=="; //$NON-NLS-1$ + case LESS_EQUAL: + return "<="; //$NON-NLS-1$ + case GREATER_EQUAL: + return ">="; //$NON-NLS-1$ + case NOT_EQUAL: + return "!="; //$NON-NLS-1$ + case LEFT_SHIFT: + return "<<"; //$NON-NLS-1$ + case RIGHT_SHIFT: + return ">>"; //$NON-NLS-1$ + case UNSIGNED_RIGHT_SHIFT: + return ">>>"; //$NON-NLS-1$ + case OR_OR: + return "||"; //$NON-NLS-1$ + case AND_AND: + return "&&"; //$NON-NLS-1$ + case PLUS: + return "+"; //$NON-NLS-1$ + case MINUS: + return "-"; //$NON-NLS-1$ + case NOT: + return "!"; //$NON-NLS-1$ + case REMAINDER: + return "%"; //$NON-NLS-1$ + case XOR: + return "^"; //$NON-NLS-1$ + case AND: + return "&"; //$NON-NLS-1$ + case MULTIPLY: + return "*"; //$NON-NLS-1$ + case OR: + return "|"; //$NON-NLS-1$ + case TWIDDLE: + return "~"; //$NON-NLS-1$ + case DIVIDE: + return "/"; //$NON-NLS-1$ + case GREATER: + return ">"; //$NON-NLS-1$ + case LESS: + return "<"; //$NON-NLS-1$ + case ORL: + return "OR"; //$NON-NLS-1$ + case ANDL: + return "AND"; //$NON-NLS-1$ + case DOT: + return "."; //$NON-NLS-1$ + case DIF: + return "<>"; //$NON-NLS-1$ + case BANG_EQUAL_EQUAL: + return "!=="; //$NON-NLS-1$ + case EQUAL_EQUAL_EQUAL: + return "==="; //$NON-NLS-1$ + case EQUAL: + return "="; //$NON-NLS-1$ + case AT: + return "@"; //$NON-NLS-1$ + } + ; + return "unknown operator"; //$NON-NLS-1$ + } - public String toStringExpression(){ - //subclass redefine toStringExpressionNoParenthesis() - return "(" + toStringExpressionNoParenthesis() + ")"; //$NON-NLS-2$ //$NON-NLS-1$ - } + public String toStringExpression() { + //subclass redefine toStringExpressionNoParenthesis() + return "(" + toStringExpressionNoParenthesis() + ")"; //$NON-NLS-2$ //$NON-NLS-1$ + } - public abstract String toStringExpressionNoParenthesis(); + public abstract String toStringExpressionNoParenthesis(); } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OperatorIds.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OperatorIds.java index 59d1694..20b8dc1 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OperatorIds.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/OperatorIds.java @@ -38,4 +38,5 @@ public interface OperatorIds { static final int PLUS_PLUS = 32; // "++" static final int MINUS_MINUS = 33; // "--" static final int NEW = 34; // "new " + static final int EQUAL = 35; // "=" } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/VariableDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/VariableDeclaration.java index eef7d94..46340d1 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/VariableDeclaration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/VariableDeclaration.java @@ -35,7 +35,6 @@ public class VariableDeclaration extends AbstractVariableDeclaration implements /** * Create a variable. - * @param initialization the initialization * @param name the name of the variable * @param sourceStart the start point */ @@ -44,7 +43,6 @@ public class VariableDeclaration extends AbstractVariableDeclaration implements int sourceStart, int sourceEnd) { super(name, sourceStart, sourceEnd); - this.initialization = initialization; this.parent = parent; } @@ -73,7 +71,6 @@ public class VariableDeclaration extends AbstractVariableDeclaration implements public VariableDeclaration(char[] name, int sourceStart) { super(name, sourceStart, sourceStart + name.length); - this.initialization = initialization; } /** diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.java b/net.sourceforge.phpeclipse/src/test/PHPParser.java index dd592a2..b0edb74 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.java +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.java @@ -198,7 +198,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon parse(); phpDocument = new PHPDocument(null); phpDocument.nodes = nodes; - //PHPeclipsePlugin.log(1,phpDocument.toString()); + PHPeclipsePlugin.log(1,phpDocument.toString()); } catch (ParseException e) { processParseException(e); } @@ -737,15 +737,14 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon */ static final public FieldDeclaration FieldDeclaration() throws ParseException { VariableDeclaration variableDeclaration; - variableDeclarationPtr = 0; - variableDeclarationStack = new VariableDeclaration[AstStackIncrement]; VariableDeclaration[] list; + final ArrayList arrayList = new ArrayList(); final int pos = SimpleCharStream.getPosition(); jj_consume_token(VAR); variableDeclaration = VariableDeclarator(); - pushOnVariableDeclarationStack(variableDeclaration); - outlineInfo.addVariable(new String(variableDeclaration.name)); - currentSegment.add(variableDeclaration); + arrayList.add(variableDeclaration); + outlineInfo.addVariable(new String(variableDeclaration.name)); + currentSegment.add(variableDeclaration); label_4: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -758,7 +757,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } jj_consume_token(COMMA); variableDeclaration = VariableDeclarator(); - pushOnVariableDeclarationStack(variableDeclaration); + arrayList.add(variableDeclaration); outlineInfo.addVariable(new String(variableDeclaration.name)); currentSegment.add(variableDeclaration); } @@ -771,8 +770,8 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon errorEnd = jj_input_stream.getPosition() + 1; {if (true) throw e;} } - list = new VariableDeclaration[variableDeclarationPtr]; - System.arraycopy(variableDeclarationStack,0,list,0,variableDeclarationPtr); + list = new VariableDeclaration[arrayList.size()]; + arrayList.toArray(list); {if (true) return new FieldDeclaration(list, pos, SimpleCharStream.getPosition());} @@ -1017,19 +1016,19 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } static final public ArrayVariableDeclaration ArrayVariable() throws ParseException { -Expression expr; -Expression expr2 = null; +Expression expr,expr2; expr = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ARRAYASSIGN: jj_consume_token(ARRAYASSIGN); expr2 = Expression(); + {if (true) return new ArrayVariableDeclaration(expr,expr2);} break; default: jj_la1[18] = jj_gen; ; } - {if (true) return new ArrayVariableDeclaration(expr,expr2);} + {if (true) return new ArrayVariableDeclaration(expr,SimpleCharStream.getPosition());} throw new Error("Missing return statement in function"); } @@ -3105,10 +3104,8 @@ ArgumentDeclaration argument; */ static final public Block Block() throws ParseException { final int pos = SimpleCharStream.getPosition(); - Statement[] statements; + final ArrayList list = new ArrayList(); Statement statement; - final int startingPtr = statementPtr; - final int length; try { jj_consume_token(LBRACE); } catch (ParseException e) { @@ -3212,11 +3209,11 @@ ArgumentDeclaration argument; case SEMICOLON: case DOLLAR_ID: statement = BlockStatement(); - pushOnStatementStack(statement); + list.add(statement); break; case PHPEND: statement = htmlBlock(); - pushOnStatementStack(statement); + list.add(statement); break; default: jj_la1[86] = jj_gen; @@ -3233,10 +3230,8 @@ ArgumentDeclaration argument; errorEnd = jj_input_stream.getPosition() + 1; {if (true) throw e;} } - length = statementPtr-startingPtr+1; - statements = new Statement[length]; - System.arraycopy(variableDeclarationStack,startingPtr+1,statements,0,length); - statementPtr = startingPtr; + Statement[] statements = new Statement[list.size()]; + list.toArray(statements); {if (true) return new Block(statements,pos,SimpleCharStream.getPosition());} throw new Error("Missing return statement in function"); } @@ -3426,7 +3421,8 @@ ArgumentDeclaration argument; } static final public Statement StatementExpression() throws ParseException { - Expression expr; + Expression expr,expr2; + int operator; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INCR: case DECR: @@ -3458,15 +3454,15 @@ ArgumentDeclaration argument; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INCR: jj_consume_token(INCR); - expr = new PostfixedUnaryExpression(expr, + {if (true) return new PostfixedUnaryExpression(expr, OperatorIds.PLUS_PLUS, - SimpleCharStream.getPosition()); + SimpleCharStream.getPosition());} break; case DECR: jj_consume_token(DECR); - expr = new PostfixedUnaryExpression(expr, + {if (true) return new PostfixedUnaryExpression(expr, OperatorIds.MINUS_MINUS, - SimpleCharStream.getPosition()); + SimpleCharStream.getPosition());} break; case ASSIGN: case PLUSASSIGN: @@ -3481,8 +3477,9 @@ ArgumentDeclaration argument; case TILDEEQUAL: case LSHIFTASSIGN: case RSIGNEDSHIFTASSIGN: - AssignmentOperator(); - Expression(); + operator = AssignmentOperator(); + expr2 = Expression(); + {if (true) return new BinaryExpression(expr,expr2,operator);} break; default: jj_la1[91] = jj_gen; @@ -3494,6 +3491,7 @@ ArgumentDeclaration argument; jj_la1[92] = jj_gen; ; } + {if (true) return expr;} break; default: jj_la1[93] = jj_gen; @@ -5186,14 +5184,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_58() { - if (jj_scan_token(COMMA)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_57()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3_6() { if (jj_3R_45()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5214,6 +5204,14 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_58() { + if (jj_scan_token(COMMA)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_57()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_47() { if (jj_3R_57()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5303,14 +5301,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_201() { - if (jj_scan_token(ARRAYASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_45()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_197() { if (jj_3R_41()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5376,12 +5366,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_214() { - 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_192() { if (jj_scan_token(LPAREN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5397,6 +5381,12 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_214() { + 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_133() { if (jj_scan_token(GE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5452,6 +5442,14 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_201() { + if (jj_scan_token(ARRAYASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_45()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_41() { if (jj_3R_45()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5470,12 +5468,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_212() { - 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_202() { if (jj_3R_203()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5488,6 +5480,12 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_212() { + 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_215() { if (jj_scan_token(INTEGER_LITERAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5500,14 +5498,14 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_213() { - if (jj_scan_token(INTEGER_LITERAL)) return true; + static final private boolean jj_3R_200() { + if (jj_3R_202()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_200() { - if (jj_3R_202()) return true; + static final private boolean jj_3R_213() { + if (jj_scan_token(INTEGER_LITERAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -5555,19 +5553,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_209() { - if (jj_scan_token(MINUS)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_213()) { - jj_scanpos = xsp; - if (jj_3R_214()) 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_93() { if (jj_3R_52()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5582,29 +5567,16 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_208() { - if (jj_3R_169()) return true; + static final private boolean jj_3R_209() { + if (jj_scan_token(MINUS)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_207() { Token xsp; xsp = jj_scanpos; - if (jj_3R_208()) { - jj_scanpos = xsp; - if (jj_3R_209()) { - jj_scanpos = xsp; - if (jj_3R_210()) { - jj_scanpos = xsp; - if (jj_3R_211()) { + if (jj_3R_213()) { jj_scanpos = xsp; - if (jj_3R_212()) return true; + if (jj_3R_214()) 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; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -5642,6 +5614,32 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_208() { + if (jj_3R_169()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_207() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_208()) { + jj_scanpos = xsp; + if (jj_3R_209()) { + jj_scanpos = xsp; + if (jj_3R_210()) { + jj_scanpos = xsp; + if (jj_3R_211()) { + jj_scanpos = xsp; + if (jj_3R_212()) 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; + } 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_117() { if (jj_3R_119()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5660,6 +5658,12 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_177() { + 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_108() { if (jj_scan_token(LBRACE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5670,8 +5674,8 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_177() { - if (jj_scan_token(NULL)) return true; + static final private boolean jj_3R_176() { + if (jj_scan_token(FALSE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -5682,12 +5686,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_176() { - if (jj_scan_token(FALSE)) return true; - 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; @@ -5720,16 +5718,16 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_90() { - if (jj_scan_token(DOLLAR)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_59()) return true; + static final private boolean jj_3R_173() { + 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_173() { - if (jj_scan_token(FLOATING_POINT_LITERAL)) return true; + static final private boolean jj_3R_90() { + if (jj_scan_token(DOLLAR)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_59()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -5788,16 +5786,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_89() { - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_108()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_113() { if (jj_3R_115()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5810,6 +5798,16 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_89() { + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_108()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_88() { if (jj_scan_token(LBRACE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5837,16 +5835,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_98() { - if (jj_scan_token(LBRACE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_45()) 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_49() { if (jj_scan_token(LBRACKET)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5867,6 +5855,16 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_98() { + if (jj_scan_token(LBRACE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_45()) 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_109() { if (jj_3R_113()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6073,25 +6071,25 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_50() { - if (jj_3R_61()) return true; + static final private boolean jj_3R_96() { + if (jj_3R_102()) 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_3R_103()) { jj_scanpos = xsp; break; } if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } return false; } - static final private boolean jj_3R_96() { - if (jj_3R_102()) return true; + static final private boolean jj_3R_50() { + if (jj_3R_61()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_103()) { jj_scanpos = xsp; break; } + if (jj_3_1()) { jj_scanpos = xsp; break; } if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } return false; @@ -6747,16 +6745,16 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_87() { - if (jj_scan_token(ASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_45()) return true; + static final private boolean jj_3R_154() { + if (jj_3R_148()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_154() { - if (jj_3R_148()) return true; + static final private boolean jj_3R_87() { + if (jj_scan_token(ASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_45()) return true; 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 d3b3e59..23b070d 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.jj +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.jj @@ -870,21 +870,17 @@ void ClassBodyDeclaration(ClassDeclaration classDeclaration) : FieldDeclaration FieldDeclaration() : { VariableDeclaration variableDeclaration; - variableDeclarationPtr = 0; - variableDeclarationStack = new VariableDeclaration[AstStackIncrement]; VariableDeclaration[] list; + final ArrayList arrayList = new ArrayList(); final int pos = SimpleCharStream.getPosition(); } { variableDeclaration = VariableDeclarator() - { - pushOnVariableDeclarationStack(variableDeclaration); - outlineInfo.addVariable(new String(variableDeclaration.name)); - currentSegment.add(variableDeclaration); - } - ( - variableDeclaration = VariableDeclarator() - {pushOnVariableDeclarationStack(variableDeclaration); + {arrayList.add(variableDeclaration); + outlineInfo.addVariable(new String(variableDeclaration.name)); + currentSegment.add(variableDeclaration);} + ( variableDeclaration = VariableDeclarator() + {arrayList.add(variableDeclaration); outlineInfo.addVariable(new String(variableDeclaration.name)); currentSegment.add(variableDeclaration);} )* @@ -898,8 +894,8 @@ FieldDeclaration FieldDeclaration() : throw e; } - {list = new VariableDeclaration[variableDeclarationPtr]; - System.arraycopy(variableDeclarationStack,0,list,0,variableDeclarationPtr); + {list = new VariableDeclaration[arrayList.size()]; + arrayList.toArray(list); return new FieldDeclaration(list, pos, SimpleCharStream.getPosition());} @@ -1064,12 +1060,14 @@ Expression VariableInitializer() : ArrayVariableDeclaration ArrayVariable() : { -Expression expr; -Expression expr2 = null; +Expression expr,expr2; } { - expr = Expression() [ expr2 = Expression()] + expr = Expression() + [ expr2 = Expression() {return new ArrayVariableDeclaration(expr,expr2);} + ] + {return new ArrayVariableDeclaration(expr,SimpleCharStream.getPosition());} } ArrayVariableDeclaration[] ArrayInitializer() : @@ -2204,10 +2202,8 @@ LabeledStatement LabeledStatement() : Block Block() : { final int pos = SimpleCharStream.getPosition(); - Statement[] statements; + final ArrayList list = new ArrayList(); Statement statement; - final int startingPtr = statementPtr; - final int length; } { try { @@ -2219,8 +2215,8 @@ Block Block() : errorEnd = jj_input_stream.getPosition() + 1; throw e; } - ( statement = BlockStatement() {pushOnStatementStack(statement);} - | statement = htmlBlock() {pushOnStatementStack(statement);})* + ( statement = BlockStatement() {list.add(statement);} + | statement = htmlBlock() {list.add(statement);})* try { } catch (ParseException e) { @@ -2231,10 +2227,8 @@ Block Block() : throw e; } { - length = statementPtr-startingPtr+1; - statements = new Statement[length]; - System.arraycopy(variableDeclarationStack,startingPtr+1,statements,0,length); - statementPtr = startingPtr; + Statement[] statements = new Statement[list.size()]; + list.toArray(statements); return new Block(statements,pos,SimpleCharStream.getPosition());} } @@ -2310,19 +2304,23 @@ EmptyStatement EmptyStatement() : Statement StatementExpression() : { - Expression expr; + Expression expr,expr2; + int operator; } { expr = PreIncDecExpression() {return expr;} | expr = PrimaryExpression() - [ {expr = new PostfixedUnaryExpression(expr, + [ {return new PostfixedUnaryExpression(expr, OperatorIds.PLUS_PLUS, SimpleCharStream.getPosition());} - | {expr = new PostfixedUnaryExpression(expr, + | {return new PostfixedUnaryExpression(expr, OperatorIds.MINUS_MINUS, SimpleCharStream.getPosition());} - | AssignmentOperator() Expression() ] + | operator = AssignmentOperator() expr2 = Expression() + {return new BinaryExpression(expr,expr2,operator);} + ] + {return expr;} } SwitchStatement SwitchStatement() :