From 2807e2bacbb7193c0e56d7e240c4556346b86dfe Mon Sep 17 00:00:00 2001 From: kpouer Date: Thu, 12 Jun 2003 16:01:14 +0000 Subject: [PATCH] *** empty log message *** --- net.sourceforge.phpeclipse/src/test/PHPParser.java | 587 ++++++++++---------- net.sourceforge.phpeclipse/src/test/PHPParser.jj | 42 +- 2 files changed, 332 insertions(+), 297 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.java b/net.sourceforge.phpeclipse/src/test/PHPParser.java index 84c63af..b5b0024 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.java +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.java @@ -49,6 +49,8 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon private static int errorStart = -1; private static int errorEnd = -1; private static PHPDocument phpDocument; + + private static final char[] SYNTAX_ERROR_CHAR = {'s','y','n','t','a','x',' ','e','r','r','o','r'}; /** * The point where html starts. * It will be used by the token manager to create HTMLCode objects @@ -447,7 +449,7 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon errorLevel = ERROR; errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + processParseException(e); } break; default: @@ -538,43 +540,48 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon final Token className; Token superclassName = null; final int pos; + char[] classNameImage = SYNTAX_ERROR_CHAR; + char[] superclassNameImage = null; jj_consume_token(CLASS); + pos = SimpleCharStream.getPosition(); try { - pos = SimpleCharStream.getPosition(); className = jj_consume_token(IDENTIFIER); + classNameImage = className.image.toCharArray(); } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier expected"; errorLevel = ERROR; errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + processParseException(e); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case EXTENDS: jj_consume_token(EXTENDS); try { superclassName = jj_consume_token(IDENTIFIER); + superclassNameImage = superclassName .image.toCharArray(); } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier expected"; errorLevel = ERROR; errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + processParseException(e); + superclassNameImage = SYNTAX_ERROR_CHAR; } break; default: jj_la1[6] = jj_gen; ; } - if (superclassName == null) { + if (superclassNameImage == null) { classDeclaration = new ClassDeclaration(currentSegment, - className.image.toCharArray(), + classNameImage, pos, 0); } else { classDeclaration = new ClassDeclaration(currentSegment, - className.image.toCharArray(), - superclassName.image.toCharArray(), + classNameImage, + superclassNameImage, pos, 0); } @@ -1046,6 +1053,7 @@ Expression expr,expr2; Token reference = null; final Hashtable formalParameters; final int pos = SimpleCharStream.getPosition(); + char[] identifierChar = SYNTAX_ERROR_CHAR; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BIT_AND: reference = jj_consume_token(BIT_AND); @@ -1054,10 +1062,19 @@ Expression expr,expr2; jj_la1[21] = jj_gen; ; } - identifier = jj_consume_token(IDENTIFIER); + try { + identifier = jj_consume_token(IDENTIFIER); + identifierChar = identifier.image.toCharArray(); + } catch (ParseException e) { + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function identifier expected"; + errorLevel = ERROR; + errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; + errorEnd = SimpleCharStream.getPosition() + 1; + processParseException(e); + } formalParameters = FormalParameters(); {if (true) return new MethodDeclaration(currentSegment, - identifier.image.toCharArray(), + identifierChar, formalParameters, reference != null, pos, @@ -3774,14 +3791,14 @@ final ArrayList list = new ArrayList(); condition = Expression(); try { jj_consume_token(RPAREN); - {if (true) return condition;} } catch (ParseException e) { errorMessage = "')' expected after " + keyword + " keyword"; errorLevel = ERROR; errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + processParseException(e); } + {if (true) return condition;} throw new Error("Missing return statement in function"); } @@ -5013,132 +5030,6 @@ final int startBlock, endBlock; return retval; } - static final private boolean jj_3R_193() { - if (jj_scan_token(INCR)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_185() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_193()) { - jj_scanpos = xsp; - if (jj_3R_194()) 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_99() { - if (jj_3R_50()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_168() { - if (jj_3R_166()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_185()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_83() { - if (jj_scan_token(OBJECT)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_82() { - if (jj_scan_token(INTEGER)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_81() { - 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_44() { - if (jj_scan_token(ARRAY)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_80() { - 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_184() { - if (jj_scan_token(ARRAY)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_79() { - if (jj_scan_token(DOUBLE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_183() { - if (jj_3R_52()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_85() { - 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_99()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - while (true) { - xsp = jj_scanpos; - if (jj_3R_100()) { jj_scanpos = xsp; break; } - 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_101()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_78() { - if (jj_scan_token(REAL)) 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(LPAREN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_183()) { - jj_scanpos = xsp; - if (jj_3R_184()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } 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; - if (jj_3R_139()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_77() { if (jj_scan_token(BOOLEAN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5454,26 +5345,12 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_198() { - 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_142() { if (jj_scan_token(MINUS)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3_2() { - 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_141() { if (jj_scan_token(PLUS)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5493,18 +5370,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_197() { - if (jj_3R_41()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3_2()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } - return false; - } - static final private boolean jj_3R_57() { if (jj_3R_50()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5533,21 +5398,32 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_192() { - if (jj_scan_token(LPAREN)) return true; + static final private boolean jj_3R_198() { + if (jj_scan_token(COMMA)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_197()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - xsp = jj_scanpos; - if (jj_3R_198()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(RPAREN)) return true; + return false; + } + + static final private boolean jj_3_2() { + 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_197() { + if (jj_3R_41()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3_2()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + static final private boolean jj_3R_138() { if (jj_scan_token(RUNSIGNEDSHIFT)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5622,21 +5498,18 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_201() { - if (jj_scan_token(ARRAYASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_45()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_41() { - if (jj_3R_45()) return true; + static final private boolean jj_3R_192() { + 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_201()) jj_scanpos = xsp; + if (jj_3R_197()) jj_scanpos = xsp; else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + xsp = jj_scanpos; + if (jj_3R_198()) 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; return false; } @@ -5658,12 +5531,30 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_201() { + if (jj_scan_token(ARRAYASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_45()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_130() { if (jj_scan_token(LT)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } + static final private boolean jj_3R_41() { + if (jj_3R_45()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_201()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_122() { Token xsp; xsp = jj_scanpos; @@ -5715,16 +5606,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_108() { - if (jj_scan_token(LBRACE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_45()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(RBRACE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_127() { if (jj_scan_token(TRIPLEEQUAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5749,12 +5630,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_91() { - if (jj_scan_token(DOLLAR_ID)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_124() { if (jj_scan_token(DIF)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5795,14 +5670,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_90() { - if (jj_scan_token(DOLLAR)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_59()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_117() { if (jj_3R_119()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5815,6 +5682,16 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_108() { + if (jj_scan_token(LBRACE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_45()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RBRACE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_199() { if (jj_scan_token(LPAREN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5827,6 +5704,12 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_91() { + if (jj_scan_token(DOLLAR_ID)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_118() { if (jj_scan_token(BIT_AND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5841,13 +5724,11 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_89() { - if (jj_scan_token(IDENTIFIER)) return true; + static final private boolean jj_3R_90() { + if (jj_scan_token(DOLLAR)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_59()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_108()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -5881,49 +5762,12 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_88() { - if (jj_scan_token(LBRACE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_45()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(RBRACE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_59() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_88()) { - jj_scanpos = xsp; - if (jj_3R_89()) { - jj_scanpos = xsp; - if (jj_3R_90()) { - jj_scanpos = xsp; - if (jj_3R_91()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } else 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_173() { 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_98() { - if (jj_scan_token(LBRACE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_45()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_scan_token(RBRACE)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_169() { Token xsp; xsp = jj_scanpos; @@ -5953,6 +5797,16 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_89() { + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_108()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_116() { if (jj_scan_token(XOR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5990,14 +5844,33 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_95() { - if (jj_scan_token(DOLLAR)) return true; + static final private boolean jj_3R_88() { + if (jj_scan_token(LBRACE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_59()) return true; + if (jj_3R_45()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RBRACE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } + static final private boolean jj_3R_59() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_88()) { + jj_scanpos = xsp; + if (jj_3R_89()) { + jj_scanpos = xsp; + if (jj_3R_90()) { + jj_scanpos = xsp; + if (jj_3R_91()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else 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_46() { if (jj_scan_token(IDENTIFIER)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6012,6 +5885,16 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_98() { + if (jj_scan_token(LBRACE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_45()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RBRACE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_114() { if (jj_scan_token(BIT_OR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6044,24 +5927,11 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_94() { - if (jj_scan_token(DOLLAR_ID)) return true; + static final private boolean jj_3R_95() { + if (jj_scan_token(DOLLAR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_98()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_61() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_94()) { - jj_scanpos = xsp; - if (jj_3R_95()) return true; + if (jj_3R_59()) 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; } @@ -6085,6 +5955,27 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_94() { + if (jj_scan_token(DOLLAR_ID)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_98()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_61() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_94()) { + jj_scanpos = xsp; + if (jj_3R_95()) 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_48() { if (jj_scan_token(CLASSACCESS)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6116,12 +6007,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3_1() { - if (jj_3R_40()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_196() { if (jj_3R_40()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6182,15 +6067,9 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_50() { - if (jj_3R_61()) return true; + static final private boolean jj_3_1() { + if (jj_3R_40()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3_1()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } return false; } @@ -6229,6 +6108,18 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_50() { + if (jj_3R_61()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3_1()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + static final private boolean jj_3R_103() { Token xsp; xsp = jj_scanpos; @@ -6567,6 +6458,132 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_193() { + if (jj_scan_token(INCR)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_185() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_193()) { + jj_scanpos = xsp; + if (jj_3R_194()) 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_99() { + if (jj_3R_50()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_168() { + if (jj_3R_166()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_185()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_83() { + if (jj_scan_token(OBJECT)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_82() { + if (jj_scan_token(INTEGER)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_81() { + 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_44() { + if (jj_scan_token(ARRAY)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_80() { + 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_184() { + if (jj_scan_token(ARRAY)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_79() { + if (jj_scan_token(DOUBLE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_183() { + if (jj_3R_52()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_85() { + 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_99()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + while (true) { + xsp = jj_scanpos; + if (jj_3R_100()) { jj_scanpos = xsp; break; } + 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_101()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_78() { + if (jj_scan_token(REAL)) 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(LPAREN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_183()) { + jj_scanpos = xsp; + if (jj_3R_184()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } 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; + if (jj_3R_139()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static private boolean jj_initialized_once = false; static public PHPParserTokenManager token_source; static SimpleCharStream jj_input_stream; diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.jj b/net.sourceforge.phpeclipse/src/test/PHPParser.jj index ac77fff..cb90b27 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.jj +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.jj @@ -70,6 +70,8 @@ public final class PHPParser extends PHPParserSuperclass { private static int errorStart = -1; private static int errorEnd = -1; private static PHPDocument phpDocument; + + private static final char[] SYNTAX_ERROR_CHAR = {'s','y','n','t','a','x',' ','e','r','r','o','r'}; /** * The point where html starts. * It will be used by the token manager to create HTMLCode objects @@ -658,7 +660,7 @@ void PhpBlock() : errorLevel = ERROR; errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + processParseException(e); } } @@ -688,41 +690,46 @@ ClassDeclaration ClassDeclaration() : final Token className; Token superclassName = null; final int pos; + char[] classNameImage = SYNTAX_ERROR_CHAR; + char[] superclassNameImage = null; } { + {pos = SimpleCharStream.getPosition();} try { - {pos = SimpleCharStream.getPosition();} className = + {classNameImage = className.image.toCharArray();} } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier expected"; errorLevel = ERROR; errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + processParseException(e); } [ try { superclassName = + {superclassNameImage = superclassName .image.toCharArray();} } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier expected"; errorLevel = ERROR; errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + processParseException(e); + superclassNameImage = SYNTAX_ERROR_CHAR; } ] { - if (superclassName == null) { + if (superclassNameImage == null) { classDeclaration = new ClassDeclaration(currentSegment, - className.image.toCharArray(), + classNameImage, pos, 0); } else { classDeclaration = new ClassDeclaration(currentSegment, - className.image.toCharArray(), - superclassName.image.toCharArray(), + classNameImage, + superclassNameImage, pos, 0); } @@ -1049,12 +1056,23 @@ MethodDeclaration MethodDeclarator() : Token reference = null; final Hashtable formalParameters; final int pos = SimpleCharStream.getPosition(); + char[] identifierChar = SYNTAX_ERROR_CHAR; } { - [reference = ] identifier = + [reference = ] + try { + identifier = + {identifierChar = identifier.image.toCharArray();} + } catch (ParseException e) { + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function identifier expected"; + errorLevel = ERROR; + errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; + errorEnd = SimpleCharStream.getPosition() + 1; + processParseException(e); + } formalParameters = FormalParameters() {return new MethodDeclaration(currentSegment, - identifier.image.toCharArray(), + identifierChar, formalParameters, reference != null, pos, @@ -2417,14 +2435,14 @@ Expression Condition(final String keyword) : condition = Expression() try { - {return condition;} } catch (ParseException e) { errorMessage = "')' expected after " + keyword + " keyword"; errorLevel = ERROR; errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + processParseException(e); } + {return condition;} } IfStatement IfStatement0(Expression condition, final int start,final int end) : -- 1.7.1