3 CHOICE_AMBIGUITY_CHECK = 2;
4 OTHER_AMBIGUITY_CHECK = 1;
7 DEBUG_LOOKAHEAD = false;
8 DEBUG_TOKEN_MANAGER = false;
9 OPTIMIZE_TOKEN_MANAGER = false;
10 ERROR_REPORTING = true;
11 JAVA_UNICODE_ESCAPE = false;
12 UNICODE_INPUT = false;
14 USER_TOKEN_MANAGER = false;
15 USER_CHAR_STREAM = false;
17 BUILD_TOKEN_MANAGER = true;
19 FORCE_LA_CHECK = false;
22 PARSER_BEGIN(PHPParser)
25 import org.eclipse.core.resources.IFile;
26 import org.eclipse.core.resources.IMarker;
27 import org.eclipse.core.runtime.CoreException;
28 import org.eclipse.ui.texteditor.MarkerUtilities;
29 import org.eclipse.jface.preference.IPreferenceStore;
31 import java.util.Hashtable;
32 import java.util.ArrayList;
33 import java.util.Enumeration;
34 import java.io.StringReader;
36 import java.text.MessageFormat;
38 import net.sourceforge.phpeclipse.actions.PHPStartApacheAction;
39 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
40 import net.sourceforge.phpdt.internal.compiler.parser.*;
44 * This php parser is inspired by the Java 1.2 grammar example
45 * given with JavaCC. You can get JavaCC at http://www.webgain.com
46 * You can test the parser with the PHPParserTestCase2.java
47 * @author Matthieu Casanova
49 public final class PHPParser extends PHPParserSuperclass {
51 /** The file that is parsed. */
52 private static IFile fileToParse;
54 /** The current segment */
55 private static PHPSegmentWithChildren currentSegment;
57 private static final String PARSE_ERROR_STRING = "Parse error"; //$NON-NLS-1$
58 private static final String PARSE_WARNING_STRING = "Warning"; //$NON-NLS-1$
59 PHPOutlineInfo outlineInfo;
61 private static PHPFunctionDeclaration currentFunction;
63 /** The error level of the current ParseException. */
64 private static int errorLevel = ERROR;
65 /** The message of the current ParseException. If it's null it's because the parse exception wasn't handled */
66 private static String errorMessage;
68 private static int errorStart = -1;
69 private static int errorEnd = -1;
74 public final void setFileToParse(final IFile fileToParse) {
75 this.fileToParse = fileToParse;
78 public PHPParser(final IFile fileToParse) {
79 this(new StringReader(""));
80 this.fileToParse = fileToParse;
83 public static final void phpParserTester(final String strEval) throws CoreException, ParseException {
84 PHPParserTokenManager.SwitchTo(PHPParserTokenManager.PHPPARSING);
85 final StringReader stream = new StringReader(strEval);
86 if (jj_input_stream == null) {
87 jj_input_stream = new SimpleCharStream(stream, 1, 1);
89 ReInit(new StringReader(strEval));
93 public static final void htmlParserTester(final File fileName) throws CoreException, ParseException {
95 final Reader stream = new FileReader(fileName);
96 if (jj_input_stream == null) {
97 jj_input_stream = new SimpleCharStream(stream, 1, 1);
101 } catch (FileNotFoundException e) {
102 e.printStackTrace(); //To change body of catch statement use Options | File Templates.
106 public static final void htmlParserTester(final String strEval) throws CoreException, ParseException {
107 final StringReader stream = new StringReader(strEval);
108 if (jj_input_stream == null) {
109 jj_input_stream = new SimpleCharStream(stream, 1, 1);
115 public final PHPOutlineInfo parseInfo(final Object parent, final String s) {
116 outlineInfo = new PHPOutlineInfo(parent);
117 currentSegment = outlineInfo.getDeclarations();
118 final StringReader stream = new StringReader(s);
119 if (jj_input_stream == null) {
120 jj_input_stream = new SimpleCharStream(stream, 1, 1);
125 } catch (ParseException e) {
126 processParseException(e);
132 * This method will process the parse exception.
133 * If the error message is null, the parse exception wasn't catched and a trace is written in the log
134 * @param e the ParseException
136 private static void processParseException(final ParseException e) {
137 if (errorMessage == null) {
138 PHPeclipsePlugin.log(e);
139 errorMessage = "this exception wasn't handled by the parser please tell us how to reproduce it";
140 errorStart = jj_input_stream.getPosition();
141 errorEnd = errorStart + 1;
148 * Create marker for the parse error
149 * @param e the ParseException
151 private static void setMarker(final ParseException e) {
153 if (errorStart == -1) {
154 setMarker(fileToParse,
156 jj_input_stream.tokenBegin,
157 jj_input_stream.tokenBegin + e.currentToken.image.length(),
159 "Line " + e.currentToken.beginLine);
161 setMarker(fileToParse,
166 "Line " + e.currentToken.beginLine);
170 } catch (CoreException e2) {
171 PHPeclipsePlugin.log(e2);
176 * Create markers according to the external parser output
178 private static void createMarkers(final String output, final IFile file) throws CoreException {
179 // delete all markers
180 file.deleteMarkers(IMarker.PROBLEM, false, 0);
185 while ((brIndx = output.indexOf("<br />", indx)) != -1) {
186 // newer php error output (tested with 4.2.3)
187 scanLine(output, file, indx, brIndx);
192 while ((brIndx = output.indexOf("<br>", indx)) != -1) {
193 // older php error output (tested with 4.2.3)
194 scanLine(output, file, indx, brIndx);
200 private static void scanLine(final String output,
203 final int brIndx) throws CoreException {
205 StringBuffer lineNumberBuffer = new StringBuffer(10);
207 current = output.substring(indx, brIndx);
209 if (current.indexOf(PARSE_WARNING_STRING) != -1 || current.indexOf(PARSE_ERROR_STRING) != -1) {
210 int onLine = current.indexOf("on line <b>");
212 lineNumberBuffer.delete(0, lineNumberBuffer.length());
213 for (int i = onLine; i < current.length(); i++) {
214 ch = current.charAt(i);
215 if ('0' <= ch && '9' >= ch) {
216 lineNumberBuffer.append(ch);
220 int lineNumber = Integer.parseInt(lineNumberBuffer.toString());
222 Hashtable attributes = new Hashtable();
224 current = current.replaceAll("\n", "");
225 current = current.replaceAll("<b>", "");
226 current = current.replaceAll("</b>", "");
227 MarkerUtilities.setMessage(attributes, current);
229 if (current.indexOf(PARSE_ERROR_STRING) != -1)
230 attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR));
231 else if (current.indexOf(PARSE_WARNING_STRING) != -1)
232 attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING));
234 attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO));
235 MarkerUtilities.setLineNumber(attributes, lineNumber);
236 MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM);
241 public final void parse(final String s) throws CoreException {
242 final StringReader stream = new StringReader(s);
243 if (jj_input_stream == null) {
244 jj_input_stream = new SimpleCharStream(stream, 1, 1);
249 } catch (ParseException e) {
250 processParseException(e);
255 * Call the php parse command ( php -l -f <filename> )
256 * and create markers according to the external parser output
258 public static void phpExternalParse(final IFile file) {
259 final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
260 final String filename = file.getLocation().toString();
262 final String[] arguments = { filename };
263 final MessageFormat form = new MessageFormat(store.getString(PHPeclipsePlugin.EXTERNAL_PARSER_PREF));
264 final String command = form.format(arguments);
266 final String parserResult = PHPStartApacheAction.getParserOutput(command, "External parser: ");
269 // parse the buffer to find the errors and warnings
270 createMarkers(parserResult, file);
271 } catch (CoreException e) {
272 PHPeclipsePlugin.log(e);
276 public static final void parse() throws ParseException {
281 PARSER_END(PHPParser)
285 <PHPSTARTSHORT : "<?"> : PHPPARSING
286 | <PHPSTARTLONG : "<?php"> : PHPPARSING
287 | <PHPECHOSTART : "<?="> : PHPPARSING
292 <PHPEND :"?>"> : DEFAULT
295 /* Skip any character if we are not in php mode */
313 <PHPPARSING> SPECIAL_TOKEN :
315 "//" : IN_SINGLE_LINE_COMMENT
317 "#" : IN_SINGLE_LINE_COMMENT
319 <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT
321 "/*" : IN_MULTI_LINE_COMMENT
324 <IN_SINGLE_LINE_COMMENT> SPECIAL_TOKEN :
326 <SINGLE_LINE_COMMENT: "\n" | "\r" | "\r\n" > : PHPPARSING
329 <IN_SINGLE_LINE_COMMENT> SPECIAL_TOKEN :
331 <SINGLE_LINE_COMMENT_PHPEND : "?>" > : DEFAULT
337 <FORMAL_COMMENT: "*/" > : PHPPARSING
340 <IN_MULTI_LINE_COMMENT>
343 <MULTI_LINE_COMMENT: "*/" > : PHPPARSING
346 <IN_SINGLE_LINE_COMMENT,IN_FORMAL_COMMENT,IN_MULTI_LINE_COMMENT>
356 | <FUNCTION : "function">
359 | <ELSEIF : "elseif">
366 /* LANGUAGE CONSTRUCT */
371 | <INCLUDE : "include">
372 | <REQUIRE : "require">
373 | <INCLUDE_ONCE : "include_once">
374 | <REQUIRE_ONCE : "require_once">
375 | <GLOBAL : "global">
376 | <STATIC : "static">
377 | <CLASSACCESS : "->">
378 | <STATICCLASSACCESS : "::">
379 | <ARRAYASSIGN : "=>">
382 /* RESERVED WORDS AND LITERALS */
388 | <CONTINUE : "continue">
389 | <_DEFAULT : "default">
391 | <EXTENDS : "extends">
396 | <RETURN : "return">
398 | <SWITCH : "switch">
403 | <ENDWHILE : "endwhile">
404 | <ENDSWITCH: "endswitch">
406 | <ENDFOR : "endfor">
407 | <FOREACH : "foreach">
415 | <OBJECT : "object">
417 | <BOOLEAN : "boolean">
419 | <DOUBLE : "double">
422 | <INTEGER : "integer">
435 <DECIMAL_LITERAL> (["l","L"])?
436 | <HEX_LITERAL> (["l","L"])?
437 | <OCTAL_LITERAL> (["l","L"])?
440 < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* >
442 < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ >
444 < #OCTAL_LITERAL: "0" (["0"-"7"])* >
446 < FLOATING_POINT_LITERAL:
447 (["0"-"9"])+ "." (["0"-"9"])* (<EXPONENT>)? (["f","F","d","D"])?
448 | "." (["0"-"9"])+ (<EXPONENT>)? (["f","F","d","D"])?
449 | (["0"-"9"])+ <EXPONENT> (["f","F","d","D"])?
450 | (["0"-"9"])+ (<EXPONENT>)? ["f","F","d","D"]
453 < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
455 < STRING_LITERAL: (<STRING_1> | <STRING_2> | <STRING_3>)>
491 < IDENTIFIER: (<LETTER>|<SPECIAL>) (<LETTER>|<DIGIT>|<SPECIAL>)* >
494 ["a"-"z"] | ["A"-"Z"]
502 "_" | ["\u007f"-"\u00ff"]
532 | <BANGDOUBLEEQUAL : "!==">
533 | <TRIPLEEQUAL : "===">
540 | <PLUSASSIGN : "+=">
541 | <MINUSASSIGN : "-=">
542 | <STARASSIGN : "*=">
543 | <SLASHASSIGN : "/=">
549 | <TILDEEQUAL : "~=">
574 | <RSIGNEDSHIFT : ">>">
575 | <RUNSIGNEDSHIFT : ">>>">
576 | <LSHIFTASSIGN : "<<=">
577 | <RSIGNEDSHIFTASSIGN : ">>=">
582 < DOLLAR_ID: <DOLLAR> <IDENTIFIER> >
598 } catch (TokenMgrError e) {
599 PHPeclipsePlugin.log(e);
600 errorStart = SimpleCharStream.getPosition();
601 errorEnd = errorStart + 1;
602 errorMessage = e.getMessage();
604 throw generateParseException();
609 * A php block is a <?= expression [;]?>
610 * or <?php somephpcode ?>
611 * or <? somephpcode ?>
615 final int start = jj_input_stream.getPosition();
623 setMarker(fileToParse,
624 "You should use '<?php' instead of '<?' it will avoid some problems with XML",
626 jj_input_stream.getPosition(),
628 "Line " + token.beginLine);
629 } catch (CoreException e) {
630 PHPeclipsePlugin.log(e);
636 } catch (ParseException e) {
637 errorMessage = "'?>' expected";
639 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
640 errorEnd = jj_input_stream.getPosition() + 1;
645 void phpEchoBlock() :
648 <PHPECHOSTART> Expression() [ <SEMICOLON> ] <PHPEND>
657 void ClassDeclaration() :
659 final PHPClassDeclaration classDeclaration;
660 final Token className;
666 {pos = jj_input_stream.getPosition();}
667 className = <IDENTIFIER>
668 } catch (ParseException e) {
669 errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier expected";
671 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
672 errorEnd = jj_input_stream.getPosition() + 1;
679 } catch (ParseException e) {
680 errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier expected";
682 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
683 errorEnd = jj_input_stream.getPosition() + 1;
688 if (currentSegment != null) {
689 classDeclaration = new PHPClassDeclaration(currentSegment,className.image,pos);
690 currentSegment.add(classDeclaration);
691 currentSegment = classDeclaration;
696 if (currentSegment != null) {
697 currentSegment = (PHPSegmentWithChildren) currentSegment.getParent();
707 } catch (ParseException e) {
708 errorMessage = "unexpected token : '"+ e.currentToken.next.image + "', '{' expected";
710 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
711 errorEnd = jj_input_stream.getPosition() + 1;
714 ( ClassBodyDeclaration() )*
717 } catch (ParseException e) {
718 errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', 'var', 'function' or '}' expected";
720 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
721 errorEnd = jj_input_stream.getPosition() + 1;
727 * A class can contain only methods and fields.
729 void ClassBodyDeclaration() :
738 * A class field declaration : it's var VariableDeclarator() (, VariableDeclarator())*;.
740 void FieldDeclaration() :
742 PHPVarDeclaration variableDeclaration;
745 <VAR> variableDeclaration = VariableDeclarator()
747 if (currentSegment != null) {
748 currentSegment.add(variableDeclaration);
752 variableDeclaration = VariableDeclarator()
754 if (currentSegment != null) {
755 currentSegment.add(variableDeclaration);
761 } catch (ParseException e) {
762 errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected after variable declaration";
764 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
765 errorEnd = jj_input_stream.getPosition() + 1;
770 PHPVarDeclaration VariableDeclarator() :
772 final String varName, varValue;
773 final int pos = jj_input_stream.getPosition();
776 varName = VariableDeclaratorId()
780 varValue = VariableInitializer()
781 {return new PHPVarDeclaration(currentSegment,varName.substring(1),pos,varValue);}
782 } catch (ParseException e) {
783 errorMessage = "Literal expression expected in variable initializer";
785 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
786 errorEnd = jj_input_stream.getPosition() + 1;
790 {return new PHPVarDeclaration(currentSegment,varName,pos);}
793 String VariableDeclaratorId() :
796 final StringBuffer buff = new StringBuffer();
802 ( LOOKAHEAD(2) expr = VariableSuffix()
805 {return buff.toString();}
806 } catch (ParseException e) {
807 errorMessage = "'$' expected for variable identifier";
809 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
810 errorEnd = jj_input_stream.getPosition() + 1;
821 token = <DOLLAR_ID> [<LBRACE> expr = Expression() <RBRACE>]
824 if (currentFunction != null) {
825 PHPVarDeclaration var = currentFunction.getParameter(token.image.substring(1));
827 var.getVariable().setUsed(true);
832 return token + "{" + expr + "}";
835 <DOLLAR> expr = VariableName()
839 String VariableName():
845 <LBRACE> expr = Expression() <RBRACE>
846 {return "{"+expr+"}";}
848 token = <IDENTIFIER> [<LBRACE> expr = Expression() <RBRACE>]
851 if (currentFunction != null) {
852 PHPVarDeclaration var = currentFunction.getParameter(token.image);
854 var.getVariable().setUsed(true);
859 return token + "{" + expr + "}";
862 <DOLLAR> expr = VariableName()
864 if (currentFunction != null) {
865 PHPVarDeclaration var = currentFunction.getParameter(expr);
867 var.getVariable().setUsed(true);
875 if (currentFunction != null) {
876 PHPVarDeclaration var = currentFunction.getParameter(token.image.substring(1));
878 var.getVariable().setUsed(true);
881 return token.image + expr;
884 token = <DOLLAR_ID> [expr = VariableName()]
889 return token.image + expr;
893 String VariableInitializer() :
902 <MINUS> (token = <INTEGER_LITERAL> | token = <FLOATING_POINT_LITERAL>)
903 {return "-" + token.image;}
905 <PLUS> (token = <INTEGER_LITERAL> | token = <FLOATING_POINT_LITERAL>)
906 {return "+" + token.image;}
908 expr = ArrayDeclarator()
912 {return token.image;}
915 String ArrayVariable() :
918 final StringBuffer buff = new StringBuffer();
923 [<ARRAYASSIGN> expr = Expression()
924 {buff.append("=>").append(expr);}]
925 {return buff.toString();}
928 String ArrayInitializer() :
931 final StringBuffer buff = new StringBuffer("(");
934 <LPAREN> [ expr = ArrayVariable()
936 ( LOOKAHEAD(2) <COMMA> expr = ArrayVariable()
937 {buff.append(",").append(expr);}
940 [<COMMA> {buff.append(",");}]
944 return buff.toString();
949 * A Method Declaration.
950 * <b>function</b> MetodDeclarator() Block()
952 void MethodDeclaration() :
954 final PHPFunctionDeclaration functionDeclaration;
958 functionToken = <FUNCTION>
960 functionDeclaration = MethodDeclarator()
961 } catch (ParseException e) {
962 if (errorMessage != null) {
965 errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function identifier expected";
967 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
968 errorEnd = jj_input_stream.getPosition() + 1;
972 if (currentSegment != null) {
973 currentSegment.add(functionDeclaration);
974 currentSegment = functionDeclaration;
976 currentFunction = functionDeclaration;
980 Hashtable parameters = currentFunction.getParameters();
981 Enumeration vars = parameters.elements();
982 while (vars.hasMoreElements()) {
983 PHPVarDeclaration o = (PHPVarDeclaration) vars.nextElement();
984 if (!o.getVariable().isUsed()) {
986 setMarker(fileToParse,
987 "Parameter "+o.getVariable().getName()+" is never used in function",
988 functionToken.beginLine,
990 "Line " + token.beginLine);
991 } catch (CoreException e) {
992 PHPeclipsePlugin.log(e);
996 currentFunction = null;
997 if (currentSegment != null) {
998 currentSegment = (PHPSegmentWithChildren) currentSegment.getParent();
1004 * A MethodDeclarator.
1005 * [&] IDENTIFIER(parameters ...).
1006 * @return a function description for the outline
1008 PHPFunctionDeclaration MethodDeclarator() :
1010 final Token identifier;
1011 final StringBuffer methodDeclaration = new StringBuffer();
1012 final Hashtable formalParameters;
1013 final int pos = jj_input_stream.getPosition();
1016 [ <BIT_AND> {methodDeclaration.append("&");} ]
1017 identifier = <IDENTIFIER>
1018 formalParameters = FormalParameters()
1020 methodDeclaration.append(identifier);
1021 return new PHPFunctionDeclaration(currentSegment,methodDeclaration.toString(),pos,formalParameters);
1026 * FormalParameters follows method identifier.
1027 * (FormalParameter())
1029 Hashtable FormalParameters() :
1032 final StringBuffer buff = new StringBuffer("(");
1033 PHPVarDeclaration var;
1034 final Hashtable parameters = new Hashtable();
1039 } catch (ParseException e) {
1040 errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', '(' expected after function identifier";
1042 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1043 errorEnd = jj_input_stream.getPosition() + 1;
1046 [ var = FormalParameter()
1047 {parameters.put(var.getVariable().getName(),var);}
1049 <COMMA> var = FormalParameter()
1050 {parameters.put(var.getVariable().getName(),var);}
1055 } catch (ParseException e) {
1056 errorMessage = "')' expected";
1058 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1059 errorEnd = jj_input_stream.getPosition() + 1;
1062 {return parameters;}
1066 * A formal parameter.
1067 * $varname[=value] (,$varname[=value])
1069 PHPVarDeclaration FormalParameter() :
1071 final PHPVarDeclaration variableDeclaration;
1075 [token = <BIT_AND>] variableDeclaration = VariableDeclarator()
1077 if (token != null) {
1078 variableDeclaration.getVariable().setPrefix("@");
1080 return variableDeclaration;
1115 String Expression() :
1118 final String assignOperator;
1122 expr = PrintExpression()
1125 expr = ListExpression()
1128 expr = ConditionalExpression()
1130 assignOperator = AssignmentOperator()
1132 expr2 = Expression()
1133 {return expr + assignOperator + expr2;}
1134 } catch (ParseException e) {
1135 if (errorMessage != null) {
1138 errorMessage = "expression expected";
1140 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1141 errorEnd = jj_input_stream.getPosition() + 1;
1148 String AssignmentOperator() :
1165 | <RSIGNEDSHIFTASSIGN>
1179 String ConditionalExpression() :
1182 String expr2 = null;
1183 String expr3 = null;
1186 expr = ConditionalOrExpression() [ <HOOK> expr2 = Expression() <COLON> expr3 = ConditionalExpression() ]
1188 if (expr3 == null) {
1191 return expr + "?" + expr2 + ":" + expr3;
1196 String ConditionalOrExpression() :
1200 final StringBuffer buff = new StringBuffer();
1203 expr = ConditionalAndExpression()
1204 {buff.append(expr);}
1206 (operator = <SC_OR> | operator = <_ORL>) expr = ConditionalAndExpression()
1208 buff.append(operator.image);
1213 return buff.toString();
1217 String ConditionalAndExpression() :
1221 final StringBuffer buff = new StringBuffer();
1224 expr = ConcatExpression()
1225 {buff.append(expr);}
1227 (operator = <SC_AND> | operator = <_ANDL>) expr = ConcatExpression()
1229 buff.append(operator.image);
1233 {return buff.toString();}
1236 String ConcatExpression() :
1239 final StringBuffer buff = new StringBuffer();
1242 expr = InclusiveOrExpression()
1243 {buff.append(expr);}
1245 <DOT> expr = InclusiveOrExpression()
1246 {buff.append(".").append(expr);}
1248 {return buff.toString();}
1251 String InclusiveOrExpression() :
1254 final StringBuffer buff = new StringBuffer();
1257 expr = ExclusiveOrExpression()
1258 {buff.append(expr);}
1260 <BIT_OR> expr = ExclusiveOrExpression()
1261 {buff.append("|").append(expr);}
1263 {return buff.toString();}
1266 String ExclusiveOrExpression() :
1269 final StringBuffer buff = new StringBuffer();
1272 expr = AndExpression()
1277 <XOR> expr = AndExpression()
1284 return buff.toString();
1288 String AndExpression() :
1291 final StringBuffer buff = new StringBuffer();
1294 expr = EqualityExpression()
1299 <BIT_AND> expr = EqualityExpression()
1301 buff.append("&").append(expr);
1304 {return buff.toString();}
1307 String EqualityExpression() :
1311 final StringBuffer buff = new StringBuffer();
1314 expr = RelationalExpression()
1315 {buff.append(expr);}
1320 | operator = <BANGDOUBLEEQUAL>
1321 | operator = <TRIPLEEQUAL>
1324 expr = RelationalExpression()
1325 } catch (ParseException e) {
1326 errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression expected after '"+operator.image+"'";
1328 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1329 errorEnd = jj_input_stream.getPosition() + 1;
1333 buff.append(operator.image);
1337 {return buff.toString();}
1340 String RelationalExpression() :
1344 final StringBuffer buff = new StringBuffer();
1347 expr = ShiftExpression()
1348 {buff.append(expr);}
1350 ( operator = <LT> | operator = <GT> | operator = <LE> | operator = <GE> ) expr = ShiftExpression()
1351 {buff.append(operator.image).append(expr);}
1353 {return buff.toString();}
1356 String ShiftExpression() :
1360 final StringBuffer buff = new StringBuffer();
1363 expr = AdditiveExpression()
1364 {buff.append(expr);}
1366 (operator = <LSHIFT> | operator = <RSIGNEDSHIFT> | operator = <RUNSIGNEDSHIFT> ) expr = AdditiveExpression()
1368 buff.append(operator.image);
1372 {return buff.toString();}
1375 String AdditiveExpression() :
1379 final StringBuffer buff = new StringBuffer();
1382 expr = MultiplicativeExpression()
1383 {buff.append(expr);}
1385 ( operator = <PLUS> | operator = <MINUS> ) expr = MultiplicativeExpression()
1387 buff.append(operator.image);
1391 {return buff.toString();}
1394 String MultiplicativeExpression() :
1398 final StringBuffer buff = new StringBuffer();}
1401 expr = UnaryExpression()
1402 } catch (ParseException e) {
1403 errorMessage = "unexpected token '"+e.currentToken.next.image+"'";
1405 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1406 errorEnd = jj_input_stream.getPosition() + 1;
1409 {buff.append(expr);}
1411 ( operator = <STAR> | operator = <SLASH> | operator = <REM> ) expr = UnaryExpression()
1413 buff.append(operator.image);
1417 {return buff.toString();}
1421 * An unary expression starting with @, & or nothing
1423 String UnaryExpression() :
1427 final StringBuffer buff = new StringBuffer();
1430 token = <BIT_AND> expr = UnaryExpressionNoPrefix()
1432 if (token == null) {
1435 return token.image + expr;
1438 (<AT> {buff.append("@");})* expr = UnaryExpressionNoPrefix()
1439 {return buff.append(expr).toString();}
1442 String UnaryExpressionNoPrefix() :
1448 ( token = <PLUS> | token = <MINUS> ) expr = UnaryExpression()
1450 return token.image + expr;
1453 expr = PreIncDecExpression()
1456 expr = UnaryExpressionNotPlusMinus()
1461 String PreIncDecExpression() :
1467 (token = <INCR> | token = <DECR>) expr = PrimaryExpression()
1468 {return token.image + expr;}
1471 String UnaryExpressionNotPlusMinus() :
1476 <BANG> expr = UnaryExpression()
1477 {return "!" + expr;}
1479 LOOKAHEAD( <LPAREN> (Type() | <ARRAY>) <RPAREN> )
1480 expr = CastExpression()
1483 expr = PostfixExpression()
1489 <LPAREN> expr = Expression()
1492 } catch (ParseException e) {
1493 errorMessage = "')' expected";
1495 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1496 errorEnd = jj_input_stream.getPosition() + 1;
1499 {return "("+expr+")";}
1502 String CastExpression() :
1504 final String type, expr;
1507 <LPAREN> (type = Type() | <ARRAY> {type = "array";}) <RPAREN> expr = UnaryExpression()
1508 {return "(" + type + ")" + expr;}
1511 String PostfixExpression() :
1514 Token operator = null;
1517 expr = PrimaryExpression() [ operator = <INCR> | operator = <DECR> ]
1519 if (operator == null) {
1522 return expr + operator.image;
1526 String PrimaryExpression() :
1528 final Token identifier;
1530 final StringBuffer buff = new StringBuffer();
1534 identifier = <IDENTIFIER> <STATICCLASSACCESS> expr = ClassIdentifier()
1535 {buff.append(identifier.image).append("::").append(expr);}
1537 expr = PrimarySuffix()
1538 {buff.append(expr);}
1540 {return buff.toString();}
1542 expr = PrimaryPrefix() {buff.append(expr);}
1543 ( expr = PrimarySuffix() {buff.append(expr);} )*
1544 {return buff.toString();}
1546 expr = ArrayDeclarator()
1547 {return "array" + expr;}
1550 String ArrayDeclarator() :
1555 <ARRAY> expr = ArrayInitializer()
1556 {return "array" + expr;}
1559 String PrimaryPrefix() :
1565 token = <IDENTIFIER>
1566 {return token.image;}
1568 <NEW> expr = ClassIdentifier()
1570 return "new " + expr;
1573 expr = VariableDeclaratorId()
1577 String classInstantiation() :
1580 final StringBuffer buff = new StringBuffer("new ");
1583 <NEW> expr = ClassIdentifier()
1584 {buff.append(expr);}
1586 expr = PrimaryExpression()
1587 {buff.append(expr);}
1589 {return buff.toString();}
1592 String ClassIdentifier():
1598 token = <IDENTIFIER>
1599 {return token.image;}
1601 expr = VariableDeclaratorId()
1605 String PrimarySuffix() :
1613 expr = VariableSuffix()
1617 String VariableSuffix() :
1624 expr = VariableName()
1625 } catch (ParseException e) {
1626 errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function call or field access expected";
1628 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1629 errorEnd = jj_input_stream.getPosition() + 1;
1632 {return "->" + expr;}
1634 <LBRACKET> [ expr = Expression() | expr = Type() ] //Not good
1637 } catch (ParseException e) {
1638 errorMessage = "']' expected";
1640 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1641 errorEnd = jj_input_stream.getPosition() + 1;
1648 return "[" + expr + "]";
1658 token = <INTEGER_LITERAL>
1659 {return token.image;}
1661 token = <FLOATING_POINT_LITERAL>
1662 {return token.image;}
1664 token = <STRING_LITERAL>
1665 {return token.image;}
1667 expr = BooleanLiteral()
1674 String BooleanLiteral() :
1684 String Arguments() :
1689 <LPAREN> [ expr = ArgumentList() ]
1692 } catch (ParseException e) {
1693 errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected to close the argument list";
1695 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1696 errorEnd = jj_input_stream.getPosition() + 1;
1703 return "(" + expr + ")";
1707 String ArgumentList() :
1710 final StringBuffer buff = new StringBuffer();
1714 {buff.append(expr);}
1718 } catch (ParseException e) {
1719 errorMessage = "expression expected after a comma in argument list";
1721 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1722 errorEnd = jj_input_stream.getPosition() + 1;
1726 buff.append(",").append(expr);
1729 {return buff.toString();}
1733 * A Statement without break
1735 void StatementNoBreak() :
1742 } catch (ParseException e) {
1743 if (e.currentToken.next.kind != 4) {
1744 errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected";
1746 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1747 errorEnd = jj_input_stream.getPosition() + 1;
1759 StatementExpression()
1762 } catch (ParseException e) {
1763 errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected";
1765 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1766 errorEnd = jj_input_stream.getPosition() + 1;
1788 [<AT>] IncludeStatement()
1796 * A Normal statement
1809 <PHPEND> (phpEchoBlock())* (<PHPSTARTLONG> | <PHPSTARTSHORT>)
1813 * An include statement. It's "include" an expression;
1815 void IncludeStatement() :
1819 final int pos = jj_input_stream.getPosition();
1823 | token = <REQUIRE_ONCE>
1825 | token = <INCLUDE_ONCE> )
1828 if (currentSegment != null) {
1829 currentSegment.add(new PHPReqIncDeclaration(currentSegment, token.image,pos,expr));
1834 } catch (ParseException e) {
1835 errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected";
1837 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1838 errorEnd = jj_input_stream.getPosition() + 1;
1843 String PrintExpression() :
1845 final StringBuffer buff = new StringBuffer("print ");
1849 <PRINT> expr = Expression()
1852 return buff.toString();
1856 String ListExpression() :
1858 final StringBuffer buff = new StringBuffer("list(");
1865 } catch (ParseException e) {
1866 errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', '(' expected";
1868 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1869 errorEnd = jj_input_stream.getPosition() + 1;
1873 expr = VariableDeclaratorId()
1874 {buff.append(expr);}
1879 } catch (ParseException e) {
1880 errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ',' expected";
1882 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1883 errorEnd = jj_input_stream.getPosition() + 1;
1886 expr = VariableDeclaratorId()
1887 {buff.append(",").append(expr);}
1892 } catch (ParseException e) {
1893 errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected";
1895 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1896 errorEnd = jj_input_stream.getPosition() + 1;
1899 [ <ASSIGN> expr = Expression() {buff.append("(").append(expr);}]
1900 {return buff.toString();}
1904 * An echo statement is like this : echo anyexpression (, otherexpression)*
1906 void EchoStatement() :
1909 <ECHO> Expression() (<COMMA> Expression())*
1912 } catch (ParseException e) {
1913 if (e.currentToken.next.kind != 4) {
1914 errorMessage = "';' expected after 'echo' statement";
1916 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1917 errorEnd = jj_input_stream.getPosition() + 1;
1923 void GlobalStatement() :
1925 final int pos = jj_input_stream.getPosition();
1930 expr = VariableDeclaratorId()
1931 {if (currentSegment != null) {
1932 currentSegment.add(new PHPGlobalDeclaration(currentSegment, "global",pos,expr));
1935 expr = VariableDeclaratorId()
1936 {if (currentSegment != null) {
1937 currentSegment.add(new PHPGlobalDeclaration(currentSegment, "global",pos,expr));
1942 } catch (ParseException e) {
1943 errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected";
1945 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1946 errorEnd = jj_input_stream.getPosition() + 1;
1951 void StaticStatement() :
1954 <STATIC> VariableDeclarator() (<COMMA> VariableDeclarator())*
1957 } catch (ParseException e) {
1958 errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected";
1960 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1961 errorEnd = jj_input_stream.getPosition() + 1;
1966 void LabeledStatement() :
1969 <IDENTIFIER> <COLON> Statement()
1977 } catch (ParseException e) {
1978 errorMessage = "'{' expected";
1980 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1981 errorEnd = jj_input_stream.getPosition() + 1;
1984 ( BlockStatement() | htmlBlock())*
1987 } catch (ParseException e) {
1988 errorMessage = "unexpected token : '"+ e.currentToken.image +"', '}' expected";
1990 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
1991 errorEnd = jj_input_stream.getPosition() + 1;
1996 void BlockStatement() :
2007 * A Block statement that will not contain any 'break'
2009 void BlockStatementNoBreak() :
2019 void LocalVariableDeclaration() :
2022 LocalVariableDeclarator() ( <COMMA> LocalVariableDeclarator() )*
2025 void LocalVariableDeclarator() :
2028 VariableDeclaratorId() [ <ASSIGN> Expression() ]
2031 void EmptyStatement() :
2037 void StatementExpression() :
2040 PreIncDecExpression()
2048 AssignmentOperator() Expression()
2052 void SwitchStatement() :
2054 final int pos = jj_input_stream.getPosition();
2060 } catch (ParseException e) {
2061 errorMessage = "'(' expected after 'switch'";
2063 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2064 errorEnd = jj_input_stream.getPosition() + 1;
2070 } catch (ParseException e) {
2071 errorMessage = "')' expected";
2073 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2074 errorEnd = jj_input_stream.getPosition() + 1;
2077 (switchStatementBrace() | switchStatementColon(pos, pos + 6))
2080 void switchStatementBrace() :
2087 } catch (ParseException e) {
2088 errorMessage = "'}' expected";
2090 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2091 errorEnd = jj_input_stream.getPosition() + 1;
2096 * A Switch statement with : ... endswitch;
2097 * @param start the begin offset of the switch
2098 * @param end the end offset of the switch
2100 void switchStatementColon(final int start, final int end) :
2105 setMarker(fileToParse,
2106 "Ugly syntax detected, you should switch () {...} instead of switch (): ... enswitch;",
2110 "Line " + token.beginLine);
2111 } catch (CoreException e) {
2112 PHPeclipsePlugin.log(e);
2117 } catch (ParseException e) {
2118 errorMessage = "'endswitch' expected";
2120 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2121 errorEnd = jj_input_stream.getPosition() + 1;
2126 } catch (ParseException e) {
2127 errorMessage = "';' expected after 'endswitch' keyword";
2129 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2130 errorEnd = jj_input_stream.getPosition() + 1;
2135 void switchLabel0() :
2137 Token breakToken = null;
2141 line = SwitchLabel()
2142 ( BlockStatementNoBreak() | htmlBlock() )*
2143 [ breakToken = BreakStatement() ]
2146 if (breakToken == null) {
2147 setMarker(fileToParse,
2148 "You should use put a 'break' at the end of your statement",
2153 } catch (CoreException e) {
2154 PHPeclipsePlugin.log(e);
2159 Token BreakStatement() :
2164 token = <BREAK> [ Expression() ]
2167 } catch (ParseException e) {
2168 errorMessage = "';' expected after 'break' keyword";
2170 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2171 errorEnd = jj_input_stream.getPosition() + 1;
2185 } catch (ParseException e) {
2186 if (errorMessage != null) throw e;
2187 errorMessage = "expression expected after 'case' keyword";
2189 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2190 errorEnd = jj_input_stream.getPosition() + 1;
2195 } catch (ParseException e) {
2196 errorMessage = "':' expected after case expression";
2198 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2199 errorEnd = jj_input_stream.getPosition() + 1;
2202 {return token.beginLine;}
2207 } catch (ParseException e) {
2208 errorMessage = "':' expected after 'default' keyword";
2210 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2211 errorEnd = jj_input_stream.getPosition() + 1;
2214 {return token.beginLine;}
2217 void IfStatement() :
2220 final int pos = jj_input_stream.getPosition();
2223 token = <IF> Condition("if") IfStatement0(pos,pos+token.image.length())
2226 void Condition(final String keyword) :
2231 } catch (ParseException e) {
2232 errorMessage = "'(' expected after " + keyword + " keyword";
2234 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length();
2235 errorEnd = errorStart +1;
2236 processParseException(e);
2241 } catch (ParseException e) {
2242 errorMessage = "')' expected after " + keyword + " keyword";
2244 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2245 errorEnd = jj_input_stream.getPosition() + 1;
2250 void IfStatement0(final int start,final int end) :
2253 <COLON> (Statement() | htmlBlock())* (ElseIfStatementColon())* [ElseStatementColon()]
2256 setMarker(fileToParse,
2257 "Ugly syntax detected, you should if () {...} instead of if (): ... endif;",
2261 "Line " + token.beginLine);
2262 } catch (CoreException e) {
2263 PHPeclipsePlugin.log(e);
2267 } catch (ParseException e) {
2268 errorMessage = "'endif' expected";
2270 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2271 errorEnd = jj_input_stream.getPosition() + 1;
2276 } catch (ParseException e) {
2277 errorMessage = "';' expected after 'endif' keyword";
2279 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2280 errorEnd = jj_input_stream.getPosition() + 1;
2284 (Statement() | htmlBlock())
2285 ( LOOKAHEAD(1) ElseIfStatement() )*
2290 } catch (ParseException e) {
2291 if (errorMessage != null) {
2294 errorMessage = "unexpected token '"+e.currentToken.next.image+"', a statement was expected";
2296 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2297 errorEnd = jj_input_stream.getPosition() + 1;
2303 void ElseIfStatementColon() :
2306 <ELSEIF> Condition("elseif") <COLON> (Statement() | htmlBlock())*
2309 void ElseStatementColon() :
2312 <ELSE> <COLON> (Statement() | htmlBlock())*
2315 void ElseIfStatement() :
2318 <ELSEIF> Condition("elseif") Statement()
2321 void WhileStatement() :
2324 final int pos = jj_input_stream.getPosition();
2327 token = <WHILE> Condition("while") WhileStatement0(pos,pos + token.image.length())
2330 void WhileStatement0(final int start, final int end) :
2333 <COLON> (Statement())*
2335 setMarker(fileToParse,
2336 "Ugly syntax detected, you should while () {...} instead of while (): ... endwhile;",
2340 "Line " + token.beginLine);
2341 } catch (CoreException e) {
2342 PHPeclipsePlugin.log(e);
2346 } catch (ParseException e) {
2347 errorMessage = "'endwhile' expected";
2349 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2350 errorEnd = jj_input_stream.getPosition() + 1;
2355 } catch (ParseException e) {
2356 errorMessage = "';' expected after 'endwhile' keyword";
2358 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2359 errorEnd = jj_input_stream.getPosition() + 1;
2366 void DoStatement() :
2369 <DO> Statement() <WHILE> Condition("while")
2372 } catch (ParseException e) {
2373 errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected";
2375 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2376 errorEnd = jj_input_stream.getPosition() + 1;
2381 void ForeachStatement() :
2387 } catch (ParseException e) {
2388 errorMessage = "'(' expected after 'foreach' keyword";
2390 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2391 errorEnd = jj_input_stream.getPosition() + 1;
2396 } catch (ParseException e) {
2397 errorMessage = "variable expected";
2399 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2400 errorEnd = jj_input_stream.getPosition() + 1;
2403 ( VariableSuffix() )*
2406 } catch (ParseException e) {
2407 errorMessage = "'as' expected";
2409 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2410 errorEnd = jj_input_stream.getPosition() + 1;
2415 } catch (ParseException e) {
2416 errorMessage = "variable expected";
2418 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2419 errorEnd = jj_input_stream.getPosition() + 1;
2422 [ <ARRAYASSIGN> Expression() ]
2425 } catch (ParseException e) {
2426 errorMessage = "')' expected after 'foreach' keyword";
2428 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2429 errorEnd = jj_input_stream.getPosition() + 1;
2434 } catch (ParseException e) {
2435 if (errorMessage != null) throw e;
2436 errorMessage = "statement expected";
2438 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2439 errorEnd = jj_input_stream.getPosition() + 1;
2444 void ForStatement() :
2447 final int pos = jj_input_stream.getPosition();
2453 } catch (ParseException e) {
2454 errorMessage = "'(' expected after 'for' keyword";
2456 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2457 errorEnd = jj_input_stream.getPosition() + 1;
2460 [ ForInit() ] <SEMICOLON> [ Expression() ] <SEMICOLON> [ StatementExpressionList() ] <RPAREN>
2464 <COLON> (Statement())*
2467 setMarker(fileToParse,
2468 "Ugly syntax detected, you should for () {...} instead of for (): ... endfor;",
2470 pos+token.image.length(),
2472 "Line " + token.beginLine);
2473 } catch (CoreException e) {
2474 PHPeclipsePlugin.log(e);
2479 } catch (ParseException e) {
2480 errorMessage = "'endfor' expected";
2482 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2483 errorEnd = jj_input_stream.getPosition() + 1;
2488 } catch (ParseException e) {
2489 errorMessage = "';' expected after 'endfor' keyword";
2491 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2492 errorEnd = jj_input_stream.getPosition() + 1;
2501 LOOKAHEAD(LocalVariableDeclaration())
2502 LocalVariableDeclaration()
2504 StatementExpressionList()
2507 void StatementExpressionList() :
2510 StatementExpression() ( <COMMA> StatementExpression() )*
2513 void ContinueStatement() :
2516 <CONTINUE> [ Expression() ]
2519 } catch (ParseException e) {
2520 errorMessage = "';' expected after 'continue' statement";
2522 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2523 errorEnd = jj_input_stream.getPosition() + 1;
2528 void ReturnStatement() :
2531 <RETURN> [ Expression() ]
2534 } catch (ParseException e) {
2535 errorMessage = "';' expected after 'return' statement";
2537 errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
2538 errorEnd = jj_input_stream.getPosition() + 1;