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() :