From 3160eef5aee2f0d9aaba7ae098ccea9ea8b10d6e Mon Sep 17 00:00:00 2001 From: kpouer Date: Tue, 25 Mar 2003 16:59:57 +0000 Subject: [PATCH] *** empty log message *** --- .../sourceforge/phpeclipse/PHPeclipsePlugin.java | 2 +- net.sourceforge.phpeclipse/src/test/PHPParser.java | 416 +++++++++++--------- net.sourceforge.phpeclipse/src/test/PHPParser.jj | 52 ++- 3 files changed, 264 insertions(+), 206 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java index 24e9395..d296c9b 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/PHPeclipsePlugin.java @@ -69,7 +69,7 @@ public class PHPeclipsePlugin "net.sourceforge.phpdt.internal.compiler.parser.Parser"; /** Change this if you want to switch PHP Parser) */ - public static final String PHPPARSER = PHPPARSER_ORIGINAL; + public static final String PHPPARSER = PHPPARSER_NEW; //The shared instance. private static PHPeclipsePlugin plugin; diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.java b/net.sourceforge.phpeclipse/src/test/PHPParser.java index 773f40e..dc5e797 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.java +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.java @@ -1878,7 +1878,13 @@ final String type, expr; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case CLASSACCESS: jj_consume_token(CLASSACCESS); - expr = VariableName(); + try { + expr = VariableName(); + } catch (ParseException e) { + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function call or field access expected"; + errorLevel = ERROR; + {if (true) throw e;} + } {if (true) return "->" + expr;} break; case LBRACKET: @@ -2022,7 +2028,7 @@ String expr = null; try { jj_consume_token(RPAREN); } catch (ParseException e) { - errorMessage = "')' expected to close the argument list"; + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected to close the argument list"; errorLevel = ERROR; {if (true) throw e;} } @@ -2062,8 +2068,8 @@ final StringBuffer buff = new StringBuffer(); throw new Error("Missing return statement in function"); } -/* - * Statement syntax follows. +/** + * A Statement without break */ static final public void StatementNoBreak() throws ParseException { if (jj_2_5(2)) { @@ -2168,6 +2174,9 @@ final StringBuffer buff = new StringBuffer(); } } +/** + * A Normal statement + */ static final public void Statement() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IF: @@ -2345,7 +2354,13 @@ final StringBuffer buff = new StringBuffer(); final StringBuffer buff = new StringBuffer("list("); String expr; jj_consume_token(LIST); - jj_consume_token(LPAREN); + try { + jj_consume_token(LPAREN); + } catch (ParseException e) { + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', '(' expected"; + errorLevel = ERROR; + {if (true) throw e;} + } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case DOLLAR: case DOLLAR_ID: @@ -2356,20 +2371,30 @@ final StringBuffer buff = new StringBuffer(); jj_la1[77] = jj_gen; ; } - jj_consume_token(COMMA); - buff.append(","); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case DOLLAR: - case DOLLAR_ID: + case COMMA: + try { + jj_consume_token(COMMA); + } catch (ParseException e) { + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ',' expected"; + errorLevel = ERROR; + {if (true) throw e;} + } expr = VariableDeclaratorId(); - buff.append(expr); + buff.append(",").append(expr); break; default: jj_la1[78] = jj_gen; ; } buff.append(")"); - jj_consume_token(RPAREN); + try { + jj_consume_token(RPAREN); + } catch (ParseException e) { + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected"; + errorLevel = ERROR; + {if (true) throw e;} + } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ASSIGN: jj_consume_token(ASSIGN); @@ -2561,7 +2586,7 @@ final StringBuffer buff = new StringBuffer(); try { jj_consume_token(RBRACE); } catch (ParseException e) { - errorMessage = "unexpected token : "+ e.currentToken.image +", '}' expected"; + errorMessage = "unexpected token : '"+ e.currentToken.image +"', '}' expected"; errorLevel = ERROR; {if (true) throw e;} } @@ -2623,6 +2648,9 @@ final StringBuffer buff = new StringBuffer(); } } +/** + * A Block statement that will not contain any 'break' + */ static final public void BlockStatementNoBreak() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IF: @@ -3911,6 +3939,14 @@ final int pos = jj_input_stream.bufpos; return false; } + static final private boolean jj_3R_197() { + if (jj_scan_token(COMMA)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_41()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_70() { if (jj_scan_token(LBRACE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -3938,14 +3974,6 @@ final int pos = jj_input_stream.bufpos; return false; } - static final private boolean jj_3R_197() { - if (jj_scan_token(COMMA)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_41()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_196() { if (jj_3R_41()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -3974,6 +4002,12 @@ final int pos = jj_input_stream.bufpos; return false; } + static final private boolean jj_3R_194() { + if (jj_3R_196()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_93() { if (jj_scan_token(DOLLAR_ID)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -4007,18 +4041,6 @@ final int pos = jj_input_stream.bufpos; return false; } - static final private boolean jj_3R_194() { - if (jj_3R_196()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3_1() { - if (jj_3R_38()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_192() { if (jj_scan_token(LPAREN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -4031,6 +4053,12 @@ final int pos = jj_input_stream.bufpos; return false; } + static final private boolean jj_3_1() { + if (jj_3R_38()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_112() { if (jj_scan_token(XOR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -4039,6 +4067,12 @@ final int pos = jj_input_stream.bufpos; return false; } + static final private boolean jj_3R_175() { + if (jj_scan_token(NULL)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_68() { if (jj_3R_77()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -4063,12 +4097,6 @@ final int pos = jj_input_stream.bufpos; return false; } - static final private boolean jj_3R_175() { - if (jj_scan_token(NULL)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_182() { if (jj_scan_token(FALSE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -4092,6 +4120,12 @@ final int pos = jj_input_stream.bufpos; return false; } + static final private boolean jj_3R_170() { + if (jj_3R_175()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_108() { if (jj_scan_token(BIT_OR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -4100,6 +4134,12 @@ final int pos = jj_input_stream.bufpos; return false; } + static final private boolean jj_3R_169() { + if (jj_3R_174()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_100() { if (jj_3R_107()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -4112,53 +4152,37 @@ final int pos = jj_input_stream.bufpos; return false; } - static final private boolean jj_3R_170() { - if (jj_3R_175()) return true; + static final private boolean jj_3R_168() { + if (jj_scan_token(STRING_LITERAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_169() { - if (jj_3R_174()) return true; + static final private boolean jj_3R_69() { + if (jj_scan_token(ASSIGN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_103() { - if (jj_scan_token(_ANDL)) return true; + if (jj_3R_41()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_168() { - if (jj_scan_token(STRING_LITERAL)) return true; + static final private boolean jj_3R_167() { + if (jj_scan_token(FLOATING_POINT_LITERAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_101() { - if (jj_scan_token(DOT)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_100()) return true; + static final private boolean jj_3R_61() { + if (jj_scan_token(COMMA)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_167() { - if (jj_scan_token(FLOATING_POINT_LITERAL)) return true; + if (jj_3R_60()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_95() { - if (jj_3R_100()) return true; + static final private boolean jj_3R_103() { + if (jj_scan_token(_ANDL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_101()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } return false; } @@ -4188,6 +4212,26 @@ final int pos = jj_input_stream.bufpos; return false; } + static final private boolean jj_3R_101() { + if (jj_scan_token(DOT)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_100()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_95() { + if (jj_3R_100()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_101()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + static final private boolean jj_3R_63() { if (jj_3R_41()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -4200,6 +4244,16 @@ final int pos = jj_input_stream.bufpos; return false; } + static final private boolean jj_3R_60() { + if (jj_3R_68()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_69()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_102() { if (jj_scan_token(SC_AND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -4219,6 +4273,18 @@ final int pos = jj_input_stream.bufpos; return false; } + static final private boolean jj_3R_47() { + if (jj_scan_token(LBRACKET)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_63()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RBRACKET)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_78() { if (jj_3R_95()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -4231,11 +4297,15 @@ final int pos = jj_input_stream.bufpos; return false; } - static final private boolean jj_3R_69() { - if (jj_scan_token(ASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_41()) return true; + static final private boolean jj_3R_45() { + if (jj_3R_60()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_61()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } return false; } @@ -4251,26 +4321,6 @@ final int pos = jj_input_stream.bufpos; return false; } - static final private boolean jj_3R_61() { - if (jj_scan_token(COMMA)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_60()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_47() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_63()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(RBRACKET)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_46() { if (jj_scan_token(CLASSACCESS)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -4290,6 +4340,12 @@ final int pos = jj_input_stream.bufpos; return false; } + static final private boolean jj_3_7() { + if (jj_3R_45()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_97() { if (jj_scan_token(SC_OR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -4344,16 +4400,6 @@ final int pos = jj_input_stream.bufpos; return false; } - static final private boolean jj_3R_60() { - if (jj_3R_68()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_69()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_191() { if (jj_3R_68()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -4377,18 +4423,6 @@ final int pos = jj_input_stream.bufpos; return false; } - static final private boolean jj_3R_45() { - if (jj_3R_60()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_61()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } - return false; - } - static final private boolean jj_3R_66() { if (jj_3R_74()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -4399,12 +4433,6 @@ final int pos = jj_input_stream.bufpos; return false; } - static final private boolean jj_3_7() { - if (jj_3R_45()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_178() { if (jj_3R_68()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -4451,6 +4479,14 @@ final int pos = jj_input_stream.bufpos; return false; } + static final private boolean jj_3R_44() { + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(COLON)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_91() { if (jj_scan_token(DOTASSIGN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -4622,14 +4658,6 @@ final int pos = jj_input_stream.bufpos; return false; } - static final private boolean jj_3R_44() { - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(COLON)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3_4() { if (jj_scan_token(IDENTIFIER)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -4684,6 +4712,14 @@ final int pos = jj_input_stream.bufpos; return false; } + static final private boolean jj_3R_106() { + if (jj_scan_token(ASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_41()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_41() { Token xsp; xsp = jj_scanpos; @@ -4738,28 +4774,34 @@ final int pos = jj_input_stream.bufpos; return false; } + static final private boolean jj_3R_105() { + if (jj_scan_token(COMMA)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_68()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_54() { if (jj_scan_token(INT)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_53() { - if (jj_scan_token(FLOAT)) return true; + static final private boolean jj_3R_104() { + if (jj_3R_68()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_52() { - if (jj_scan_token(DOUBLE)) return true; + static final private boolean jj_3R_53() { + if (jj_scan_token(FLOAT)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_106() { - if (jj_scan_token(ASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_41()) return true; + static final private boolean jj_3R_52() { + if (jj_scan_token(DOUBLE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -4802,9 +4844,23 @@ final int pos = jj_input_stream.bufpos; return false; } - static final private boolean jj_3R_105() { - if (jj_3R_68()) return true; + static final private boolean jj_3R_65() { + if (jj_scan_token(LIST)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(LPAREN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_104()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + xsp = jj_scanpos; + if (jj_3R_105()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RPAREN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + xsp = jj_scanpos; + if (jj_3R_106()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -4858,12 +4914,6 @@ final int pos = jj_input_stream.bufpos; return false; } - static final private boolean jj_3R_104() { - if (jj_3R_68()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_156() { if (jj_3R_161()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -4898,25 +4948,11 @@ final int pos = jj_input_stream.bufpos; return false; } - static final private boolean jj_3R_65() { - if (jj_scan_token(LIST)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(LPAREN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_104()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(COMMA)) return true; + static final private boolean jj_3R_64() { + if (jj_scan_token(PRINT)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - xsp = jj_scanpos; - if (jj_3R_105()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(RPAREN)) return true; + if (jj_3R_41()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - xsp = jj_scanpos; - if (jj_3R_106()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -4928,14 +4964,6 @@ final int pos = jj_input_stream.bufpos; return false; } - static final private boolean jj_3R_64() { - if (jj_scan_token(PRINT)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_41()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_152() { if (jj_scan_token(INCR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5238,14 +5266,14 @@ final int pos = jj_input_stream.bufpos; return false; } - static final private boolean jj_3R_110() { - if (jj_3R_62()) return true; + static final private boolean jj_3R_43() { + if (jj_scan_token(PHPEND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_43() { - if (jj_scan_token(PHPEND)) return true; + static final private boolean jj_3R_110() { + if (jj_3R_62()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -5275,6 +5303,12 @@ final int pos = jj_input_stream.bufpos; return false; } + static final private boolean jj_3_6() { + if (jj_3R_44()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_115() { if (jj_3R_117()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5287,6 +5321,12 @@ final int pos = jj_input_stream.bufpos; return false; } + static final private boolean jj_3R_42() { + if (jj_scan_token(SEMICOLON)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_109() { if (jj_scan_token(LBRACE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5297,15 +5337,16 @@ final int pos = jj_input_stream.bufpos; return false; } - static final private boolean jj_3_6() { - if (jj_3R_44()) return true; + static final private boolean jj_3_5() { + if (jj_3R_41()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_42() { - if (jj_scan_token(SEMICOLON)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_42()) { + jj_scanpos = xsp; + if (jj_3R_43()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -5319,19 +5360,6 @@ final int pos = jj_input_stream.bufpos; return false; } - static final private boolean jj_3_5() { - if (jj_3R_41()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_42()) { - jj_scanpos = xsp; - if (jj_3R_43()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_123() { if (jj_scan_token(TRIPLEEQUAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5400,13 +5428,13 @@ final int pos = jj_input_stream.bufpos; jj_la1_1 = new int[] {0x8ebaa47,0x0,0x0,0x0,0x8ebaa47,0x8ebaa47,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x610000,0x20,0x618040,0x0,0x0,0x0,0x0,0xe0000000,0x0,0x618040,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x618000,0x0,0x618000,0x0,0x618000,0x0,0x0,0x8,0x8,0x8000,0x8000,0x0,0x8,0x618040,0x8,0x610000,0x600000,0x618040,0x0,0x0,0x0,0x88aaa07,0x8ebaa47,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8ebaa47,0x8ebaa47,0x8ebaa47,0x0,0x0,0x0,0x0,0x8000,0x480,0x8ebaa47,0x0,0x480,0x8ebaa47,0x0,0x0,0x0,0x0,0x8ebaa47,0x8ebaa47,0x8ebaa47,0x8ebaa47,0x0,0x8ebaa47,0x0,0x8,0x20,0x8000,0x618040,0x8000,0x8ebaa47,0x8ebaa47,0x8000,0x0,0x0,0x0,0x618040,}; } private static void jj_la1_2() { - jj_la1_2 = new int[] {0x11445100,0x10000000,0x0,0x0,0x11445100,0x11445100,0x0,0x0,0x0,0x20000000,0x0,0x1000000,0x0,0x1000000,0x1040000,0x1040000,0x1100,0x1100,0x45100,0x0,0x445100,0x0,0x20000000,0x0,0x0,0x3f,0x0,0x445100,0x0,0x0,0x40,0x40,0x80,0x80,0x40000000,0x0,0x0,0x0,0x0,0x0,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x445100,0x0,0x445100,0x0,0x445100,0x0,0x0,0x4400000,0x4400000,0x40000,0x40000,0x40000,0x4400000,0x445100,0x4000000,0x5100,0x0,0x445100,0x20000000,0x10000000,0x0,0x11040000,0x11445100,0x10000000,0x10000000,0x10000000,0x10000000,0x0,0x0,0x0,0x0,0x20000000,0x10000000,0x20000000,0x10000000,0x20000000,0x10000000,0x11445100,0x11445100,0x11445100,0x20000000,0x0,0x0,0x0,0x40000,0x0,0x11445100,0x0,0x0,0x11445100,0x0,0x0,0x0,0x0,0x11445100,0x11445100,0x11445100,0x11445100,0x10000000,0x11445100,0x10000000,0x4000000,0x0,0x40000,0x445100,0x40000,0x11445100,0x11445100,0x40000,0x20000000,0x40000,0x40000,0x445100,}; + jj_la1_2 = new int[] {0x11445100,0x10000000,0x0,0x0,0x11445100,0x11445100,0x0,0x0,0x0,0x20000000,0x0,0x1000000,0x0,0x1000000,0x1040000,0x1040000,0x1100,0x1100,0x45100,0x0,0x445100,0x0,0x20000000,0x0,0x0,0x3f,0x0,0x445100,0x0,0x0,0x40,0x40,0x80,0x80,0x40000000,0x0,0x0,0x0,0x0,0x0,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x445100,0x0,0x445100,0x0,0x445100,0x0,0x0,0x4400000,0x4400000,0x40000,0x40000,0x40000,0x4400000,0x445100,0x4000000,0x5100,0x0,0x445100,0x20000000,0x10000000,0x0,0x11040000,0x11445100,0x10000000,0x10000000,0x10000000,0x10000000,0x0,0x0,0x20000000,0x0,0x20000000,0x10000000,0x20000000,0x10000000,0x20000000,0x10000000,0x11445100,0x11445100,0x11445100,0x20000000,0x0,0x0,0x0,0x40000,0x0,0x11445100,0x0,0x0,0x11445100,0x0,0x0,0x0,0x0,0x11445100,0x11445100,0x11445100,0x11445100,0x10000000,0x11445100,0x10000000,0x4000000,0x0,0x40000,0x445100,0x40000,0x11445100,0x11445100,0x40000,0x20000000,0x40000,0x40000,0x445100,}; } private static void jj_la1_3() { - jj_la1_3 = new int[] {0x3c380000,0x0,0x0,0x0,0x3c380000,0x3c380000,0x0,0x0,0x0,0x0,0x100,0x0,0x100000,0x0,0x100000,0x100000,0x0,0x0,0x30000000,0x0,0x3c380000,0x0,0x0,0x100000,0x0,0x0,0x7ff00,0x3c380000,0x7ff00,0x400000,0x1000000,0x1000000,0x2000000,0x2000000,0x0,0x0,0x0,0x0,0xf2,0xf2,0xd,0xd,0x0,0x0,0x30000000,0x30000000,0xc0000000,0xc0000000,0x80000,0x3c380000,0x30000000,0x3c300000,0x200000,0x100000,0xc000000,0xc000000,0x0,0x0,0x100000,0x100000,0x100000,0x0,0x3c380000,0x0,0x0,0x0,0x3c380000,0x0,0x0,0x80000,0xc180000,0x3c380000,0x0,0x0,0x0,0x0,0x0,0x100000,0x100000,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x3c380000,0x3c380000,0x3c380000,0x0,0x100,0xc07ff00,0xc07ff00,0xc100000,0x0,0x3c380000,0x0,0x0,0x3c380000,0x0,0x0,0x0,0x0,0x3cb80000,0x3c380000,0x3c380000,0x3c380000,0x0,0x3cb80000,0x0,0x0,0x0,0xc100000,0x3c380000,0xc100000,0x3c380000,0x3cb80000,0xc100000,0x0,0x0,0x0,0x3c380000,}; + jj_la1_3 = new int[] {0x3c380000,0x0,0x0,0x0,0x3c380000,0x3c380000,0x0,0x0,0x0,0x0,0x100,0x0,0x100000,0x0,0x100000,0x100000,0x0,0x0,0x30000000,0x0,0x3c380000,0x0,0x0,0x100000,0x0,0x0,0x7ff00,0x3c380000,0x7ff00,0x400000,0x1000000,0x1000000,0x2000000,0x2000000,0x0,0x0,0x0,0x0,0xf2,0xf2,0xd,0xd,0x0,0x0,0x30000000,0x30000000,0xc0000000,0xc0000000,0x80000,0x3c380000,0x30000000,0x3c300000,0x200000,0x100000,0xc000000,0xc000000,0x0,0x0,0x100000,0x100000,0x100000,0x0,0x3c380000,0x0,0x0,0x0,0x3c380000,0x0,0x0,0x80000,0xc180000,0x3c380000,0x0,0x0,0x0,0x0,0x0,0x100000,0x0,0x100,0x0,0x0,0x0,0x0,0x0,0x0,0x3c380000,0x3c380000,0x3c380000,0x0,0x100,0xc07ff00,0xc07ff00,0xc100000,0x0,0x3c380000,0x0,0x0,0x3c380000,0x0,0x0,0x0,0x0,0x3cb80000,0x3c380000,0x3c380000,0x3c380000,0x0,0x3cb80000,0x0,0x0,0x0,0xc100000,0x3c380000,0xc100000,0x3c380000,0x3cb80000,0xc100000,0x0,0x0,0x0,0x3c380000,}; } private static void jj_la1_4() { - jj_la1_4 = new int[] {0x201,0x0,0x0,0x0,0x201,0x201,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x200,0x200,0x0,0x0,0x0,0x0,0x201,0x1,0x0,0x201,0x1,0x0,0x180,0x201,0x180,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x4,0x1,0x0,0x0,0x0,0x0,0x70,0x70,0x0,0x0,0x8,0x8,0x0,0x201,0x0,0x200,0x0,0x200,0x0,0x0,0x0,0x0,0x200,0x200,0x200,0x0,0x201,0x0,0x0,0x0,0x201,0x0,0x0,0x0,0x200,0x201,0x400,0x400,0x400,0x400,0x0,0x200,0x200,0x0,0x0,0x400,0x0,0x400,0x0,0x400,0x201,0x201,0x201,0x0,0x0,0x180,0x180,0x200,0x0,0x201,0x0,0x0,0x201,0x0,0x0,0x0,0x0,0x201,0x201,0x201,0x201,0x400,0x201,0x400,0x0,0x0,0x200,0x201,0x200,0x201,0x201,0x200,0x0,0x0,0x0,0x201,}; + jj_la1_4 = new int[] {0x201,0x0,0x0,0x0,0x201,0x201,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x200,0x200,0x0,0x0,0x0,0x0,0x201,0x1,0x0,0x201,0x1,0x0,0x180,0x201,0x180,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x4,0x1,0x0,0x0,0x0,0x0,0x70,0x70,0x0,0x0,0x8,0x8,0x0,0x201,0x0,0x200,0x0,0x200,0x0,0x0,0x0,0x0,0x200,0x200,0x200,0x0,0x201,0x0,0x0,0x0,0x201,0x0,0x0,0x0,0x200,0x201,0x400,0x400,0x400,0x400,0x0,0x200,0x0,0x0,0x0,0x400,0x0,0x400,0x0,0x400,0x201,0x201,0x201,0x0,0x0,0x180,0x180,0x200,0x0,0x201,0x0,0x0,0x201,0x0,0x0,0x0,0x0,0x201,0x201,0x201,0x201,0x400,0x201,0x400,0x0,0x0,0x200,0x201,0x200,0x201,0x201,0x200,0x0,0x0,0x0,0x201,}; } static final private JJCalls[] jj_2_rtns = new JJCalls[7]; static private boolean jj_rescan = false; diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.jj b/net.sourceforge.phpeclipse/src/test/PHPParser.jj index 2de24e2..9327af8 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.jj +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.jj @@ -1422,7 +1422,14 @@ String VariableSuffix() : String expr = null; } { - expr = VariableName() + + try { + expr = VariableName() + } catch (ParseException e) { + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function call or field access expected"; + errorLevel = ERROR; + throw e; + } {return "->" + expr;} | [ expr = Expression() ] @@ -1489,7 +1496,7 @@ String expr = null; try { } catch (ParseException e) { - errorMessage = "')' expected to close the argument list"; + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected to close the argument list"; errorLevel = ERROR; throw e; } @@ -1524,10 +1531,9 @@ final StringBuffer buff = new StringBuffer(); {return buff.toString();} } -/* - * Statement syntax follows. +/** + * A Statement without break */ - void StatementNoBreak() : {} { @@ -1582,6 +1588,9 @@ void StatementNoBreak() : GlobalStatement() } +/** + * A Normal statement + */ void Statement() : {} { @@ -1676,19 +1685,37 @@ String ListExpression() : String expr; } { - + + try { + + } catch (ParseException e) { + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', '(' expected"; + errorLevel = ERROR; + throw e; + } [ expr = VariableDeclaratorId() {buff.append(expr);} ] - - {buff.append(",");} [ + try { + + } catch (ParseException e) { + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ',' expected"; + errorLevel = ERROR; + throw e; + } expr = VariableDeclaratorId() - {buff.append(expr);} + {buff.append(",").append(expr);} ] {buff.append(")");} - + try { + + } catch (ParseException e) { + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected"; + errorLevel = ERROR; + throw e; + } [ expr = Expression() {buff.append("(").append(expr);}] {return buff.toString();} } @@ -1752,7 +1779,7 @@ void Block() : try { } catch (ParseException e) { - errorMessage = "unexpected token : "+ e.currentToken.image +", '}' expected"; + errorMessage = "unexpected token : '"+ e.currentToken.image +"', '}' expected"; errorLevel = ERROR; throw e; } @@ -1768,6 +1795,9 @@ void BlockStatement() : MethodDeclaration() } +/** + * A Block statement that will not contain any 'break' + */ void BlockStatementNoBreak() : {} { -- 1.7.1