}
}
- public static final void phpParserTester(final String strEval) throws CoreException, ParseException {
- PHPParserTokenManager.SwitchTo(PHPParserTokenManager.PHPPARSING);
- final StringReader stream = new StringReader(strEval);
- if (jj_input_stream == null) {
- jj_input_stream = new SimpleCharStream(stream, 1, 1);
- }
- ReInit(new StringReader(strEval));
- init();
- phpTest();
- }
-
- public static final void htmlParserTester(final File fileName) throws CoreException, ParseException {
- try {
- final Reader stream = new FileReader(fileName);
- if (jj_input_stream == null) {
- jj_input_stream = new SimpleCharStream(stream, 1, 1);
- }
- ReInit(stream);
- init();
- phpFile();
- } catch (FileNotFoundException e) {
- e.printStackTrace(); //To change body of catch statement use Options | File Templates.
- }
- }
-
- public static final void htmlParserTester(final String strEval) throws CoreException, ParseException {
- final StringReader stream = new StringReader(strEval);
- if (jj_input_stream == null) {
- jj_input_stream = new SimpleCharStream(stream, 1, 1);
- }
- ReInit(stream);
- init();
- phpFile();
- }
-
public final PHPOutlineInfo parseInfo(final Object parent, final String s) {
currentSegment = new PHPDocument(parent);
outlineInfo = new PHPOutlineInfo(parent);
init();
try {
parse();
- //PHPeclipsePlugin.log(1,phpDocument.toString());
+ phpDocument = new PHPDocument(null);
+ phpDocument.nodes = new AstNode[nodes.length];
+ System.arraycopy(nodes,0,phpDocument.nodes,0,nodes.length);
+ PHPeclipsePlugin.log(1,phpDocument.toString());
} catch (ParseException e) {
processParseException(e);
}
if (currentPosition == htmlStart) {
return;
}
- final char[] chars = SimpleCharStream.currentBuffer.substring(htmlStart,currentPosition).toCharArray();
+ final char[] chars = SimpleCharStream.currentBuffer.substring(htmlStart,currentPosition+1).toCharArray();
pushOnAstNodes(new HTMLCode(chars, htmlStart,currentPosition));
}
/* LITERALS */
<PHPPARSING> TOKEN :
{
- < INTEGER_LITERAL:
+ <INTEGER_LITERAL:
<DECIMAL_LITERAL> (["l","L"])?
| <HEX_LITERAL> (["l","L"])?
| <OCTAL_LITERAL> (["l","L"])?
>
|
- < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
+ <#DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
|
- < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
+ <#HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
|
- < #OCTAL_LITERAL: "0" (["0"-"7"])* >
+ <#OCTAL_LITERAL: "0" (["0"-"7"])* >
|
- < FLOATING_POINT_LITERAL:
+ <FLOATING_POINT_LITERAL:
(["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? (["f","F","d","D"])?
| "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])?
| (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])?
| (["0"-"9"])+ (<EXPONENT>)? ["f","F","d","D"]
>
|
- < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
+ <#EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
|
- < STRING_LITERAL: (<STRING_1> | <STRING_2> | <STRING_3>)>
-| < STRING_1:
+ <STRING_LITERAL: (<STRING_1> | <STRING_2> | <STRING_3>)>
+| <STRING_1:
"\""
(
- ~["\"","{","}"]
+ ~["\""]
| "\\\""
| "\\"
- | "{" ~["\""] "}"
)*
"\""
>
-| < STRING_2:
+| <STRING_2:
"'"
(
~["'"]
"'"
>
-| < STRING_3:
+| <STRING_3:
"`"
(
~["`"]
< DOLLAR_ID: <DOLLAR> <IDENTIFIER> >
}
-void phpTest() :
-{}
-{
- Php()
- <EOF>
- {PHPParser.createNewHTMLCode();}
-}
-
void phpFile() :
{}
{
} catch (ParseException e) {
errorMessage = "unexpected token : '"+ e.currentToken.next.image + "', '{' expected";
errorLevel = ERROR;
- errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
- errorEnd = jj_input_stream.getPosition() + 1;
+ errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = SimpleCharStream.getPosition() + 1;
throw e;
}
( ClassBodyDeclaration(classDeclaration) )*
} catch (ParseException e) {
errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', 'var', 'function' or '}' expected";
errorLevel = ERROR;
- errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
- errorEnd = jj_input_stream.getPosition() + 1;
+ errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = SimpleCharStream.getPosition() + 1;
throw e;
}
}
FieldDeclaration FieldDeclaration() :
{
VariableDeclaration variableDeclaration;
- final ArrayList list = new ArrayList();
+ VariableDeclaration[] list;
+ final ArrayList arrayList = new ArrayList();
final int pos = SimpleCharStream.getPosition();
}
{
<VAR> variableDeclaration = VariableDeclarator()
- {
- list.add(variableDeclaration);
- outlineInfo.addVariable(new String(variableDeclaration.name));
- currentSegment.add(variableDeclaration);
- }
- ( <COMMA>
- variableDeclaration = VariableDeclarator()
- {list.add(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);}
)*
} catch (ParseException e) {
errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected after variable declaration";
errorLevel = ERROR;
- errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
- errorEnd = jj_input_stream.getPosition() + 1;
+ errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = SimpleCharStream.getPosition() + 1;
throw e;
}
- {return new FieldDeclaration((VariableDeclaration[]) list.toArray(),
+
+ {list = new VariableDeclaration[arrayList.size()];
+ arrayList.toArray(list);
+ return new FieldDeclaration(list,
pos,
SimpleCharStream.getPosition());}
}
VariableDeclaration VariableDeclarator() :
{
- final String varName, varValue;
+ final String varName;
Expression initializer = null;
final int pos = jj_input_stream.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() :
]
[<COMMA> {list.add(null);}]
<RPAREN>
- {return (ArrayVariableDeclaration[]) list.toArray();}
+ {
+ ArrayVariableDeclaration[] vars = new ArrayVariableDeclaration[list.size()];
+ list.toArray(vars);
+ return vars;}
}
/**
MethodDeclaration MethodDeclaration() :
{
final MethodDeclaration functionDeclaration;
- Token functionToken;
final Block block;
}
{
- functionToken = <FUNCTION>
+ <FUNCTION>
try {
functionDeclaration = MethodDeclarator()
{outlineInfo.addVariable(new String(functionDeclaration.name));}
} catch (ParseException e) {
- if (errorMessage != null) {
- throw e;
- }
+ if (errorMessage != null) throw e;
errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function identifier expected";
errorLevel = ERROR;
errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
final int pos = SimpleCharStream.getPosition();
}
{
- [ reference = <BIT_AND> ]
- identifier = <IDENTIFIER>
+ [reference = <BIT_AND>] identifier = <IDENTIFIER>
formalParameters = FormalParameters()
{return new MethodDeclaration(currentSegment,
identifier.image.toCharArray(),
*/
Hashtable FormalParameters() :
{
- String expr;
- final StringBuffer buff = new StringBuffer("(");
VariableDeclaration var;
final Hashtable parameters = new Hashtable();
}
{
<STRING> {pos = SimpleCharStream.getPosition();
return new ConstantIdentifier(Types.STRING,
- pos,pos-6);}
+ pos,pos-6);}
| <BOOL> {pos = SimpleCharStream.getPosition();
return new ConstantIdentifier(Types.BOOL,
- pos,pos-4);}
+ pos,pos-4);}
| <BOOLEAN> {pos = SimpleCharStream.getPosition();
return new ConstantIdentifier(Types.BOOLEAN,
- pos,pos-7);}
+ pos,pos-7);}
| <REAL> {pos = SimpleCharStream.getPosition();
return new ConstantIdentifier(Types.REAL,
- pos,pos-4);}
+ pos,pos-4);}
| <DOUBLE> {pos = SimpleCharStream.getPosition();
return new ConstantIdentifier(Types.DOUBLE,
- pos,pos-5);}
+ pos,pos-5);}
| <FLOAT> {pos = SimpleCharStream.getPosition();
return new ConstantIdentifier(Types.FLOAT,
- pos,pos-5);}
+ pos,pos-5);}
| <INT> {pos = SimpleCharStream.getPosition();
return new ConstantIdentifier(Types.INT,
- pos,pos-3);}
+ pos,pos-3);}
| <INTEGER> {pos = SimpleCharStream.getPosition();
return new ConstantIdentifier(Types.INTEGER,
- pos,pos-7);}
+ pos,pos-7);}
| <OBJECT> {pos = SimpleCharStream.getPosition();
return new ConstantIdentifier(Types.OBJECT,
- pos,pos-6);}
+ pos,pos-6);}
}
Expression Expression() :
try {
expr = UnaryExpression()
} catch (ParseException e) {
- if (errorMessage != null) {
- throw e;
- }
+ if (errorMessage != null) throw e;
errorMessage = "unexpected token '"+e.currentToken.next.image+"'";
errorLevel = ERROR;
errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
<BIT_AND> expr = UnaryExpressionNoPrefix()
{return new PrefixedUnaryExpression(expr,OperatorIds.AND,pos);}
|
- expr = AtUnaryExpression()
- {return expr;}
+ expr = AtUnaryExpression() {return expr;}
}
Expression AtUnaryExpression() :
{
final Token identifier;
Expression expr;
- final StringBuffer buff = new StringBuffer();
final int pos = SimpleCharStream.getPosition();
}
{
| token = <FLOATING_POINT_LITERAL> {pos = SimpleCharStream.getPosition();
return new NumberLiteral(token.image.toCharArray(),pos-token.image.length(),pos);}
| token = <STRING_LITERAL> {pos = SimpleCharStream.getPosition();
- return new StringLiteral(token.image.toCharArray(),pos-token.image.length(),pos);}
+ return new StringLiteral(token.image.toCharArray(),pos-token.image.length());}
| <TRUE> {pos = SimpleCharStream.getPosition();
return new TrueLiteral(pos-4,pos);}
| <FALSE> {pos = SimpleCharStream.getPosition();
FunctionCall Arguments(Expression func) :
{
-ArgumentDeclaration[] args = null;
+Expression[] args = null;
}
{
<LPAREN> [ args = ArgumentList() ]
{return new FunctionCall(func,args,SimpleCharStream.getPosition());}
}
-ArgumentDeclaration[] ArgumentList() :
+/**
+ * An argument list is a list of arguments separated by comma :
+ * argumentDeclaration() (, argumentDeclaration)*
+ * @return an array of arguments
+ */
+Expression[] ArgumentList() :
{
-Expression expr;
+Expression arg;
final ArrayList list = new ArrayList();
}
{
- expr = Expression()
- {list.add(expr);}
+ arg = Expression()
+ {list.add(arg);}
( <COMMA>
try {
- expr = Expression()
- {list.add(expr);}
+ arg = Expression()
+ {list.add(arg);}
} catch (ParseException e) {
errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. An expression expected after a comma in argument list";
errorLevel = ERROR;
throw e;
}
)*
- {return (ArgumentDeclaration[]) list.toArray();}
+ {
+ Expression[] arguments = new Expression[list.size()];
+ list.toArray(arguments);
+ return arguments;}
}
/**
throw e;
}
{
- nbNodes = nodePtr-startIndex;
+ nbNodes = nodePtr-startIndex - 1;
blockNodes = new AstNode[nbNodes];
System.arraycopy(nodes,startIndex,blockNodes,0,nbNodes);
return new HTMLBlock(nodes);}
InclusionStatement IncludeStatement() :
{
final Expression expr;
- final Token token;
final int keyword;
final int pos = jj_input_stream.getPosition();
final InclusionStatement inclusionStatement;
throw e;
}
[ <ASSIGN> expression = Expression()
- {return new ListExpression((String[]) list.toArray(),expression,pos,SimpleCharStream.getPosition());}]
- {return new ListExpression((String[]) list.toArray(),null,pos,SimpleCharStream.getPosition());}
+ {
+ String[] strings = new String[list.size()];
+ list.toArray(strings);
+ return new ListExpression(strings,
+ expression,
+ pos,
+ SimpleCharStream.getPosition());}
+ ]
+ {
+ String[] strings = new String[list.size()];
+ list.toArray(strings);
+ return new ListExpression(strings,pos,SimpleCharStream.getPosition());}
}
/**
)*
try {
<SEMICOLON>
- {return new EchoStatement((Expression[]) expressions.toArray(),pos);}
+ {
+ Expression[] exprs = new Expression[expressions.size()];
+ expressions.toArray(exprs);
+ return new EchoStatement(exprs,pos);}
} catch (ParseException e) {
if (e.currentToken.next.kind != 4) {
errorMessage = "';' expected after 'echo' statement";
)*
try {
<SEMICOLON>
- {global = new GlobalStatement(currentSegment,
- (String[]) vars.toArray(),
- pos,
- SimpleCharStream.getPosition());
+ {
+ String[] strings = new String[vars.size()];
+ vars.toArray(strings);
+ global = new GlobalStatement(currentSegment,
+ strings,
+ pos,
+ SimpleCharStream.getPosition());
currentSegment.add(global);
return global;}
} catch (ParseException e) {
(<COMMA> expr = VariableDeclarator() {vars.add(new String(expr.name));})*
try {
<SEMICOLON>
- {return new StaticStatement((String[])vars.toArray(),
+ {
+ String[] strings = new String[vars.size()];
+ vars.toArray(strings);
+ return new StaticStatement(strings,
pos,
SimpleCharStream.getPosition());}
} catch (ParseException e) {
Block Block() :
{
final int pos = SimpleCharStream.getPosition();
+ final ArrayList list = new ArrayList();
+ Statement statement;
}
{
try {
errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
- ( BlockStatement() | htmlBlock())*
+ ( statement = BlockStatement() {list.add(statement);}
+ | statement = htmlBlock() {list.add(statement);})*
try {
<RBRACE>
} catch (ParseException e) {
errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
+ {
+ Statement[] statements = new Statement[list.size()];
+ list.toArray(statements);
+ return new Block(statements,pos,SimpleCharStream.getPosition());}
}
Statement BlockStatement() :
var = LocalVariableDeclarator()
{list.add(var);}
( <COMMA> var = LocalVariableDeclarator() {list.add(var);})*
- {return (VariableDeclaration[]) list.toArray();}
+ {
+ VariableDeclaration[] vars = new VariableDeclaration[list.size()];
+ list.toArray(vars);
+ return vars;}
}
VariableDeclaration LocalVariableDeclarator() :
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() :
( cas = switchLabel0() {cases.add(cas);})*
try {
<RBRACE>
- {return (AbstractCase[]) cases.toArray();}
+ {
+ AbstractCase[] abcase = new AbstractCase[cases.size()];
+ cases.toArray(abcase);
+ return abcase;}
} catch (ParseException e) {
errorMessage = "'}' expected";
errorLevel = ERROR;
}
try {
<SEMICOLON>
- {return (AbstractCase[]) cases.toArray();}
+ {
+ AbstractCase[] abcase = new AbstractCase[cases.size()];
+ cases.toArray(abcase);
+ return abcase;}
} catch (ParseException e) {
errorMessage = "';' expected after 'endswitch' keyword";
errorLevel = ERROR;
( statement = BlockStatementNoBreak() {stmts.add(statement);}
| statement = htmlBlock() {stmts.add(statement);})*
[ statement = BreakStatement() {stmts.add(statement);}]
- {if (expr == null) {//it's a default
- return new DefaultCase((Statement[]) stmts.toArray(),pos,SimpleCharStream.getPosition());
+ {
+ Statement[] stmtsArray = new Statement[stmts.size()];
+ stmts.toArray(stmtsArray);
+ if (expr == null) {//it's a default
+ return new DefaultCase(stmtsArray,pos,SimpleCharStream.getPosition());
}
- return new Case(expr,(Statement[]) stmts.toArray(),pos,SimpleCharStream.getPosition());}
+ return new Case(expr,stmtsArray,pos,SimpleCharStream.getPosition());}
}
/**
*/
Expression SwitchLabel() :
{
- final Token token;
final Expression expr;
}
{
IfStatement IfStatement0(Expression condition, final int start,final int end) :
{
Statement statement;
+ Statement stmt;
+ final Statement[] statementsArray;
ElseIf elseifStatement;
Else elseStatement = null;
- ArrayList stmts = new ArrayList();
- ArrayList elseifs = new ArrayList();
+ ArrayList stmts;
+ final ArrayList elseIfList = new ArrayList();
+ ElseIf[] elseIfs;
int pos = SimpleCharStream.getPosition();
+ int endStatements;
}
{
<COLON>
+ {stmts = new ArrayList();}
( statement = Statement() {stmts.add(statement);}
| statement = htmlBlock() {stmts.add(statement);})*
- (elseifStatement = ElseIfStatementColon() {elseifs.add(elseifStatement);})*
+ {endStatements = SimpleCharStream.getPosition();}
+ (elseifStatement = ElseIfStatementColon() {elseIfList.add(elseifStatement);})*
[elseStatement = ElseStatementColon()]
{try {
}
try {
<SEMICOLON>
- {return new IfStatement(condition,
- (ElseIf[]) elseifs.toArray(),
- elseStatement,
- pos,
- SimpleCharStream.getPosition());}
} catch (ParseException e) {
errorMessage = "';' expected after 'endif' keyword";
errorLevel = ERROR;
errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
+ {
+ elseIfs = new ElseIf[elseIfList.size()];
+ elseIfList.toArray(elseIfs);
+ if (stmts.size() == 1) {
+ return new IfStatement(condition,
+ (Statement) stmts.get(0),
+ elseIfs,
+ elseStatement,
+ pos,
+ SimpleCharStream.getPosition());
+ } else {
+ statementsArray = new Statement[stmts.size()];
+ stmts.toArray(statementsArray);
+ return new IfStatement(condition,
+ new Block(statementsArray,pos,endStatements),
+ elseIfs,
+ elseStatement,
+ pos,
+ SimpleCharStream.getPosition());
+ }
+ }
+
|
- (statement = Statement() | statement = htmlBlock())
- {stmts.add(statement);}
- ( LOOKAHEAD(1) elseifStatement = ElseIfStatement() {elseifs.add(elseifStatement);})*
+ (stmt = Statement() | stmt = htmlBlock())
+ ( LOOKAHEAD(1) elseifStatement = ElseIfStatement() {elseIfList.add(elseifStatement);})*
[ LOOKAHEAD(1)
<ELSE>
try {
throw e;
}
]
- {return new IfStatement(condition,
- (ElseIf[]) elseifs.toArray(),
- elseStatement,
- pos,
- SimpleCharStream.getPosition());}
+ {
+ elseIfs = new ElseIf[elseIfList.size()];
+ elseIfList.toArray(elseIfs);
+ return new IfStatement(condition,
+ stmt,
+ elseIfs,
+ elseStatement,
+ pos,
+ SimpleCharStream.getPosition());}
}
ElseIf ElseIfStatementColon() :
<ELSEIF> condition = Condition("elseif")
<COLON> ( statement = Statement() {list.add(statement);}
| statement = htmlBlock() {list.add(statement);})*
- {return new ElseIf(condition,(Statement[]) list.toArray(),pos,SimpleCharStream.getPosition());}
+ {
+ Statement[] stmtsArray = new Statement[list.size()];
+ list.toArray(stmtsArray);
+ return new ElseIf(condition,stmtsArray ,pos,SimpleCharStream.getPosition());}
}
Else ElseStatementColon() :
{
<ELSE> <COLON> ( statement = Statement() {list.add(statement);}
| statement = htmlBlock() {list.add(statement);})*
- {return new Else((Statement[]) list.toArray(),pos,SimpleCharStream.getPosition());}
+ {
+ Statement[] stmtsArray = new Statement[list.size()];
+ list.toArray(stmtsArray);
+ return new Else(stmtsArray,pos,SimpleCharStream.getPosition());}
}
ElseIf ElseIfStatement() :
}
{
<ELSEIF> condition = Condition("elseif") statement = Statement() {list.add(statement);/*todo:do better*/}
- {return new ElseIf(condition,(Statement[]) list.toArray(),pos,SimpleCharStream.getPosition());}
+ {
+ Statement[] stmtsArray = new Statement[list.size()];
+ list.toArray(stmtsArray);
+ return new ElseIf(condition,stmtsArray,pos,SimpleCharStream.getPosition());}
}
WhileStatement WhileStatement() :
}
try {
<SEMICOLON>
- {return new Block((Statement[]) stmts.toArray(),pos,SimpleCharStream.getPosition());}
+ {
+ Statement[] stmtsArray = new Statement[stmts.size()];
+ stmts.toArray(stmtsArray);
+ return new Block(stmtsArray,pos,SimpleCharStream.getPosition());}
} catch (ParseException e) {
errorMessage = "';' expected after 'endwhile' keyword";
errorLevel = ERROR;
{
Statement statement;
Expression expression;
- final StringBuffer buff = new StringBuffer();
final int pos = SimpleCharStream.getPosition();
ArrayVariableDeclaration variable;
}
}
try {
<SEMICOLON>
- {return new ForStatement(initializations,condition,increments,new Block((Statement[])list.toArray(),startBlock,endBlock),pos,SimpleCharStream.getPosition());}
+ {
+ Statement[] stmtsArray = new Statement[list.size()];
+ list.toArray(stmtsArray);
+ return new ForStatement(initializations,condition,increments,new Block(stmtsArray,startBlock,endBlock),pos,SimpleCharStream.getPosition());}
} catch (ParseException e) {
errorMessage = "';' expected after 'endfor' keyword";
errorLevel = ERROR;
{
expr = StatementExpression() {list.add(expr);}
(<COMMA> StatementExpression() {list.add(expr);})*
- {return (Statement[]) list.toArray();}
+ {
+ Statement[] stmtsArray = new Statement[list.size()];
+ list.toArray(stmtsArray);
+ return stmtsArray;}
}
Continue ContinueStatement() :