X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.java b/net.sourceforge.phpeclipse/src/test/PHPParser.java index f7bc34d..261d359 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.java +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.java @@ -39,7 +39,6 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon private static final String PARSE_WARNING_STRING = "Warning"; //$NON-NLS-1$ static PHPOutlineInfo outlineInfo; - public static MethodDeclaration currentFunction; private static boolean assigning; /** The error level of the current ParseException. */ @@ -101,44 +100,9 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } } - 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); + outlineInfo = new PHPOutlineInfo(parent, currentSegment); final StringReader stream = new StringReader(s); if (jj_input_stream == null) { jj_input_stream = new SimpleCharStream(stream, 1, 1); @@ -147,7 +111,9 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon 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); } catch (ParseException e) { processParseException(e); } @@ -163,7 +129,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon if (errorMessage == null) { PHPeclipsePlugin.log(e); errorMessage = "this exception wasn't handled by the parser please tell us how to reproduce it"; - errorStart = jj_input_stream.getPosition(); + errorStart = SimpleCharStream.getPosition(); errorEnd = errorStart + 1; } setMarker(e); @@ -308,7 +274,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon 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)); } @@ -316,12 +282,6 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon phpFile(); } - static final public void phpTest() throws ParseException { - Php(); - jj_consume_token(0); - PHPParser.createNewHTMLCode(); - } - static final public void phpFile() throws ParseException { try { label_1: @@ -397,7 +357,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon * or */ static final public void PhpBlock() throws ParseException { - final int start = jj_input_stream.getPosition(); + final int start = SimpleCharStream.getPosition(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PHPECHOSTART: phpEchoBlock(); @@ -459,7 +419,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon setMarker(fileToParse, "You should use '' 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; {if (true) throw e;} } break; @@ -577,13 +537,13 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon final int pos; jj_consume_token(CLASS); try { - pos = jj_input_stream.getPosition(); + pos = SimpleCharStream.getPosition(); className = jj_consume_token(IDENTIFIER); } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier 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; {if (true) throw e;} } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -594,8 +554,8 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier 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; {if (true) throw e;} } break; @@ -606,12 +566,12 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon if (superclassName == null) { classDeclaration = new ClassDeclaration(currentSegment, className.image.toCharArray(), - superclassName.image.toCharArray(), pos, 0); } else { classDeclaration = new ClassDeclaration(currentSegment, className.image.toCharArray(), + superclassName.image.toCharArray(), pos, 0); } @@ -631,8 +591,8 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } 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; {if (true) throw e;} } label_3: @@ -653,8 +613,8 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } 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; {if (true) throw e;} } } @@ -668,6 +628,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case FUNCTION: method = MethodDeclaration(); + method.setParent(classDeclaration); classDeclaration.addMethod(method); break; case VAR: @@ -686,12 +647,14 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon */ static final public FieldDeclaration FieldDeclaration() throws ParseException { VariableDeclaration variableDeclaration; + VariableDeclaration[] list; + final ArrayList arrayList = new ArrayList(); + final int pos = SimpleCharStream.getPosition(); jj_consume_token(VAR); variableDeclaration = VariableDeclarator(); - outlineInfo.addVariable(new String(variableDeclaration.name)); - if (currentSegment != null) { - 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) { @@ -704,26 +667,32 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } jj_consume_token(COMMA); variableDeclaration = VariableDeclarator(); - if (currentSegment != null) { - currentSegment.add(variableDeclaration); - } + arrayList.add(variableDeclaration); + outlineInfo.addVariable(new String(variableDeclaration.name)); + currentSegment.add(variableDeclaration); } try { jj_consume_token(SEMICOLON); } 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; {if (true) throw e;} } + list = new VariableDeclaration[arrayList.size()]; + arrayList.toArray(list); + {if (true) return new FieldDeclaration(list, + pos, + SimpleCharStream.getPosition(), + currentSegment);} throw new Error("Missing return statement in function"); } static final public VariableDeclaration VariableDeclarator() throws ParseException { - final String varName, varValue; + final String varName; Expression initializer = null; - final int pos = jj_input_stream.getPosition(); + final int pos = SimpleCharStream.getPosition(); varName = VariableDeclaratorId(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ASSIGN: @@ -733,8 +702,8 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } catch (ParseException e) { errorMessage = "Literal expression expected in variable initializer"; 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; {if (true) throw e;} } break; @@ -742,10 +711,16 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon jj_la1[10] = jj_gen; ; } - {if (true) return new VariableDeclaration(currentSegment, + if (initializer == null) { + {if (true) return new VariableDeclaration(currentSegment, varName.toCharArray(), - initializer, - pos);} + pos, + SimpleCharStream.getPosition());} + } + {if (true) return new VariableDeclaration(currentSegment, + varName.toCharArray(), + initializer, + pos);} throw new Error("Missing return statement in function"); } @@ -779,8 +754,8 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } catch (ParseException e) { errorMessage = "'$' expected for variable identifier"; 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; {if (true) throw e;} } throw new Error("Missing return statement in function"); @@ -836,9 +811,9 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon jj_consume_token(LBRACE); expression = Expression(); jj_consume_token(RBRACE); - buff = new StringBuffer('{'); + buff = new StringBuffer("{"); buff.append(expression.toStringExpression()); - buff.append('}'); + buff.append("}"); {if (true) return buff.toString();} break; case IDENTIFIER: @@ -952,19 +927,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"); } @@ -1022,7 +997,9 @@ Expression expr2 = null; ; } jj_consume_token(RPAREN); - {if (true) return (ArrayVariableDeclaration[]) list.toArray();} + ArrayVariableDeclaration[] vars = new ArrayVariableDeclaration[list.size()]; + list.toArray(vars); + {if (true) return vars;} throw new Error("Missing return statement in function"); } @@ -1032,30 +1009,25 @@ Expression expr2 = null; */ static final public MethodDeclaration MethodDeclaration() throws ParseException { final MethodDeclaration functionDeclaration; - Token functionToken; final Block block; - functionToken = jj_consume_token(FUNCTION); + jj_consume_token(FUNCTION); try { functionDeclaration = MethodDeclarator(); outlineInfo.addVariable(new String(functionDeclaration.name)); } catch (ParseException e) { - if (errorMessage != null) { - {if (true) throw e;} - } + if (errorMessage != null) {if (true) 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; - errorEnd = jj_input_stream.getPosition() + 1; + errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; + errorEnd = SimpleCharStream.getPosition() + 1; {if (true) throw e;} } if (currentSegment != null) { currentSegment.add(functionDeclaration); currentSegment = functionDeclaration; } - currentFunction = functionDeclaration; block = Block(); functionDeclaration.statements = block.statements; - currentFunction = null; if (currentSegment != null) { currentSegment = (OutlineableWithChildren) currentSegment.getParent(); } @@ -1097,8 +1069,6 @@ Expression expr2 = null; * (FormalParameter()) */ static final public Hashtable FormalParameters() throws ParseException { - String expr; - final StringBuffer buff = new StringBuffer("("); VariableDeclaration var; final Hashtable parameters = new Hashtable(); try { @@ -1106,8 +1076,8 @@ Expression expr2 = null; } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', '(' expected after function identifier"; 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; {if (true) throw e;} } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -1140,8 +1110,8 @@ Expression expr2 = null; } catch (ParseException e) { errorMessage = "')' 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; {if (true) throw e;} } {if (true) return parameters;} @@ -1178,55 +1148,55 @@ Expression expr2 = null; jj_consume_token(STRING); pos = SimpleCharStream.getPosition(); {if (true) return new ConstantIdentifier(Types.STRING, - pos,pos-6);} + pos,pos-6);} break; case BOOL: jj_consume_token(BOOL); pos = SimpleCharStream.getPosition(); {if (true) return new ConstantIdentifier(Types.BOOL, - pos,pos-4);} + pos,pos-4);} break; case BOOLEAN: jj_consume_token(BOOLEAN); pos = SimpleCharStream.getPosition(); {if (true) return new ConstantIdentifier(Types.BOOLEAN, - pos,pos-7);} + pos,pos-7);} break; case REAL: jj_consume_token(REAL); pos = SimpleCharStream.getPosition(); {if (true) return new ConstantIdentifier(Types.REAL, - pos,pos-4);} + pos,pos-4);} break; case DOUBLE: jj_consume_token(DOUBLE); pos = SimpleCharStream.getPosition(); {if (true) return new ConstantIdentifier(Types.DOUBLE, - pos,pos-5);} + pos,pos-5);} break; case FLOAT: jj_consume_token(FLOAT); pos = SimpleCharStream.getPosition(); {if (true) return new ConstantIdentifier(Types.FLOAT, - pos,pos-5);} + pos,pos-5);} break; case INT: jj_consume_token(INT); pos = SimpleCharStream.getPosition(); {if (true) return new ConstantIdentifier(Types.INT, - pos,pos-3);} + pos,pos-3);} break; case INTEGER: jj_consume_token(INTEGER); pos = SimpleCharStream.getPosition(); {if (true) return new ConstantIdentifier(Types.INTEGER, - pos,pos-7);} + pos,pos-7);} break; case OBJECT: jj_consume_token(OBJECT); pos = SimpleCharStream.getPosition(); {if (true) return new ConstantIdentifier(Types.OBJECT, - pos,pos-6);} + pos,pos-6);} break; default: jj_la1[25] = jj_gen; @@ -1305,8 +1275,8 @@ Expression expr2 = null; } errorMessage = "expression 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; {if (true) throw e;} } {if (true) return new VarAssignation(varName.toCharArray(), @@ -1610,8 +1580,8 @@ Expression expr2 = null; } errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression 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; {if (true) throw e;} } expr = new BinaryExpression(expr,expr2,operator); @@ -1749,13 +1719,11 @@ Expression expr2 = null; try { expr = UnaryExpression(); } catch (ParseException e) { - if (errorMessage != null) { - {if (true) throw e;} - } + if (errorMessage != null) {if (true) throw e;} errorMessage = "unexpected token '"+e.currentToken.next.image+"'"; 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; {if (true) throw e;} } label_18: @@ -1826,7 +1794,7 @@ Expression expr2 = null; case LPAREN: case DOLLAR_ID: expr = AtUnaryExpression(); - {if (true) return expr;} + {if (true) return expr;} break; default: jj_la1[48] = jj_gen; @@ -1990,8 +1958,8 @@ final int operator; } catch (ParseException e) { errorMessage = "')' 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; {if (true) throw e;} } {if (true) return expr;} @@ -2075,7 +2043,6 @@ final int pos = SimpleCharStream.getPosition(); static final public Expression PrimaryExpression() throws ParseException { final Token identifier; Expression expr; - final StringBuffer buff = new StringBuffer(); final int pos = SimpleCharStream.getPosition(); if (jj_2_5(2)) { identifier = jj_consume_token(IDENTIFIER); @@ -2267,8 +2234,8 @@ final int pos = SimpleCharStream.getPosition(); } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function call or field access 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; {if (true) throw e;} } {if (true) return new ClassAccess(prefix, @@ -2358,8 +2325,8 @@ final int pos = SimpleCharStream.getPosition(); } catch (ParseException e) { errorMessage = "']' 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; {if (true) throw e;} } {if (true) return new ArrayDeclarator(prefix,expression,SimpleCharStream.getPosition());} @@ -2389,7 +2356,7 @@ final int pos = SimpleCharStream.getPosition(); case STRING_LITERAL: token = jj_consume_token(STRING_LITERAL); pos = SimpleCharStream.getPosition(); - {if (true) return new StringLiteral(token.image.toCharArray(),pos-token.image.length(),pos);} + {if (true) return new StringLiteral(token.image.toCharArray(),pos-token.image.length());} break; case TRUE: jj_consume_token(TRUE); @@ -2415,7 +2382,7 @@ final int pos = SimpleCharStream.getPosition(); } static final public FunctionCall Arguments(Expression func) throws ParseException { -ArgumentDeclaration[] args = null; +Expression[] args = null; jj_consume_token(LPAREN); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ARRAY: @@ -2450,19 +2417,24 @@ ArgumentDeclaration[] args = null; } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected to close the argument list"; 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; {if (true) throw e;} } {if (true) return new FunctionCall(func,args,SimpleCharStream.getPosition());} throw new Error("Missing return statement in function"); } - static final public ArgumentDeclaration[] ArgumentList() throws ParseException { -Expression expr; +/** + * An argument list is a list of arguments separated by comma : + * argumentDeclaration() (, argumentDeclaration)* + * @return an array of arguments + */ + static final public Expression[] ArgumentList() throws ParseException { +Expression arg; final ArrayList list = new ArrayList(); - expr = Expression(); - list.add(expr); + arg = Expression(); + list.add(arg); label_21: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -2475,17 +2447,19 @@ final ArrayList list = new ArrayList(); } jj_consume_token(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; - 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; {if (true) throw e;} } } - {if (true) return (ArgumentDeclaration[]) list.toArray();} + Expression[] arguments = new Expression[list.size()]; + list.toArray(arguments); + {if (true) return arguments;} throw new Error("Missing return statement in function"); } @@ -2503,8 +2477,8 @@ final ArrayList list = new ArrayList(); if (e.currentToken.next.kind != 4) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was 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; {if (true) throw e;} } } @@ -2535,8 +2509,8 @@ final ArrayList list = new ArrayList(); } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was 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; {if (true) throw e;} } {if (true) return statement;} @@ -2708,11 +2682,11 @@ final ArrayList list = new ArrayList(); } catch (ParseException e) { errorMessage = "End of file unexpected, '