* @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();
}
parse();
phpDocument = new PHPDocument(null);
phpDocument.nodes = nodes;
- //PHPeclipsePlugin.log(1,phpDocument.toString());
+ PHPeclipsePlugin.log(1,phpDocument.toString());
} catch (ParseException e) {
processParseException(e);
}
*/
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) {
}
jj_consume_token(COMMA);
variableDeclaration = VariableDeclarator();
- pushOnVariableDeclarationStack(variableDeclaration);
+ arrayList.add(variableDeclaration);
outlineInfo.addVariable(new String(variableDeclaration.name));
currentSegment.add(variableDeclaration);
}
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());}
}
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");
}
*/
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) {
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;
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");
}
}
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:
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:
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;
jj_la1[92] = jj_gen;
;
}
+ {if (true) return expr;}
break;
default:
jj_la1[93] = jj_gen;
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;
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;
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;
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;
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;
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;
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;
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;
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;
}
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;
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;
}
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;
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;
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;
}
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;
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;
}
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;
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;
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;
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;
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;
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;
}
FieldDeclaration FieldDeclaration() :
{
VariableDeclaration variableDeclaration;
- variableDeclarationPtr = 0;
- variableDeclarationStack = new VariableDeclaration[AstStackIncrement];
VariableDeclaration[] list;
+ final ArrayList arrayList = new ArrayList();
final int pos = SimpleCharStream.getPosition();
}
{
<VAR> variableDeclaration = VariableDeclarator()
- {
- pushOnVariableDeclarationStack(variableDeclaration);
- outlineInfo.addVariable(new String(variableDeclaration.name));
- currentSegment.add(variableDeclaration);
- }
- ( <COMMA>
- variableDeclaration = VariableDeclarator()
- {pushOnVariableDeclarationStack(variableDeclaration);
+ {arrayList.add(variableDeclaration);
+ outlineInfo.addVariable(new String(variableDeclaration.name));
+ currentSegment.add(variableDeclaration);}
+ ( <COMMA> variableDeclaration = VariableDeclarator()
+ {arrayList.add(variableDeclaration);
outlineInfo.addVariable(new String(variableDeclaration.name));
currentSegment.add(variableDeclaration);}
)*
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());}
ArrayVariableDeclaration ArrayVariable() :
{
-Expression expr;
-Expression expr2 = null;
+Expression expr,expr2;
}
{
- expr = Expression() [<ARRAYASSIGN> expr2 = Expression()]
+ expr = Expression()
+ [<ARRAYASSIGN> expr2 = Expression()
{return new ArrayVariableDeclaration(expr,expr2);}
+ ]
+ {return new ArrayVariableDeclaration(expr,SimpleCharStream.getPosition());}
}
ArrayVariableDeclaration[] ArrayInitializer() :
Block Block() :
{
final int pos = SimpleCharStream.getPosition();
- Statement[] statements;
+ final ArrayList list = new ArrayList();
Statement statement;
- final int startingPtr = statementPtr;
- final int length;
}
{
try {
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 {
<RBRACE>
} catch (ParseException e) {
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());}
}
Statement StatementExpression() :
{
- Expression expr;
+ Expression expr,expr2;
+ int operator;
}
{
expr = PreIncDecExpression() {return expr;}
|
expr = PrimaryExpression()
- [ <INCR> {expr = new PostfixedUnaryExpression(expr,
+ [ <INCR> {return new PostfixedUnaryExpression(expr,
OperatorIds.PLUS_PLUS,
SimpleCharStream.getPosition());}
- | <DECR> {expr = new PostfixedUnaryExpression(expr,
+ | <DECR> {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() :