From 8e8f39de2fceb543bcc1227892385d1396b74abb Mon Sep 17 00:00:00 2001 From: kpouer Date: Sat, 26 Jul 2003 18:22:21 +0000 Subject: [PATCH] *** empty log message *** --- net.sourceforge.phpeclipse/src/test/PHPParser.java | 358 ++++++++++---------- net.sourceforge.phpeclipse/src/test/PHPParser.jj | 39 +-- 2 files changed, 195 insertions(+), 202 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.java b/net.sourceforge.phpeclipse/src/test/PHPParser.java index 6e836fc..76619da 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.java +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.java @@ -138,11 +138,11 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } setMarker(e); errorMessage = null; - if (PHPeclipsePlugin.DEBUG) PHPeclipsePlugin.log(e); + // if (PHPeclipsePlugin.DEBUG) PHPeclipsePlugin.log(e); } /** - * Create marker for the parse error + * Create marker for the parse error. * @param e the ParseException */ private static void setMarker(final ParseException e) { @@ -174,12 +174,12 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon final int indx, final int brIndx) throws CoreException { String current; - StringBuffer lineNumberBuffer = new StringBuffer(10); + final StringBuffer lineNumberBuffer = new StringBuffer(10); char ch; current = output.substring(indx, brIndx); if (current.indexOf(PARSE_WARNING_STRING) != -1 || current.indexOf(PARSE_ERROR_STRING) != -1) { - int onLine = current.indexOf("on line "); + final int onLine = current.indexOf("on line "); if (onLine != -1) { lineNumberBuffer.delete(0, lineNumberBuffer.length()); for (int i = onLine; i < current.length(); i++) { @@ -189,9 +189,9 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } } - int lineNumber = Integer.parseInt(lineNumberBuffer.toString()); + final int lineNumber = Integer.parseInt(lineNumberBuffer.toString()); - Hashtable attributes = new Hashtable(); + final Hashtable attributes = new Hashtable(); current = current.replaceAll("\n", ""); current = current.replaceAll("", ""); @@ -258,17 +258,16 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon pushOnAstNodes(new HTMLCode(chars, htmlStart,currentPosition)); } - /** - * Create a new task. - */ + /** Create a new task. */ public static final void createNewTask() { final int currentPosition = SimpleCharStream.getPosition(); - final String todo = SimpleCharStream.currentBuffer.substring(currentPosition+1, + final String todo = SimpleCharStream.currentBuffer.substring(currentPosition-3, SimpleCharStream.currentBuffer.indexOf("\n", currentPosition)-1); + PHPeclipsePlugin.log(1,SimpleCharStream.currentBuffer.toString()); try { setMarker(fileToParse, - "todo : " + todo, + todo, SimpleCharStream.getBeginLine(), TASK, "Line "+SimpleCharStream.getBeginLine()); @@ -597,11 +596,11 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon try { jj_consume_token(LBRACE); } catch (ParseException e) { - errorMessage = "unexpected token : '"+ e.currentToken.next.image + "', '{' expected"; + errorMessage = "unexpected token : '"+ e.currentToken.next.image + "'. '{' expected"; errorLevel = ERROR; errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + processParseException(e); } label_3: while (true) { @@ -619,11 +618,11 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon try { jj_consume_token(RBRACE); } catch (ParseException e) { - errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', 'var', 'function' or '}' expected"; + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. 'var', 'function' or '}' expected"; errorLevel = ERROR; errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; errorEnd = SimpleCharStream.getPosition() + 1; - {if (true) throw e;} + processParseException(e); } } @@ -709,7 +708,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: @@ -1258,7 +1257,6 @@ final Expression expr,expr2; case RSIGNEDSHIFTASSIGN: assignOperator = AssignmentOperator(); try { - final int errorStart = SimpleCharStream.getPosition(); initializer = Expression(); } catch (ParseException e) { if (errorMessage != null) { @@ -2090,9 +2088,7 @@ final int pos = SimpleCharStream.getPosition(); } static final public Expression PrimaryExpression() throws ParseException { - final Token identifier; Expression expr; - final int pos = SimpleCharStream.getPosition(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case NEW: case DOLLAR: @@ -5142,13 +5138,26 @@ final int startBlock, endBlock; return retval; } - static final private boolean jj_3R_183() { - if (jj_3R_185()) return true; + static final private boolean jj_3R_203() { + if (jj_scan_token(MINUS_MINUS)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_202() { + if (jj_scan_token(PLUS_PLUS)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_198() { Token xsp; xsp = jj_scanpos; - if (jj_3R_198()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_202()) { + jj_scanpos = xsp; + if (jj_3R_203()) 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; } @@ -5160,6 +5169,16 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_183() { + if (jj_3R_185()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_198()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_44() { Token xsp; xsp = jj_scanpos; @@ -5652,22 +5671,16 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3_5() { - if (jj_3R_44()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - 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_153() { if (jj_scan_token(RSIGNEDSHIFT)) 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(LSHIFT)) return true; + static final private boolean jj_3_5() { + if (jj_3R_44()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(SEMICOLON)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -5684,6 +5697,12 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_152() { + if (jj_scan_token(LSHIFT)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_145() { Token xsp; xsp = jj_scanpos; @@ -5778,6 +5797,14 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_208() { + if (jj_scan_token(ARRAYASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_44()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_131() { if (jj_3R_136()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5790,11 +5817,13 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_208() { - if (jj_scan_token(ARRAYASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + static final private boolean jj_3R_40() { if (jj_3R_44()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_208()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -5806,16 +5835,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_40() { - if (jj_3R_44()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_208()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3_7() { if (jj_3R_46()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5864,14 +5883,14 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_80() { - if (jj_3R_49()) return true; + static final private boolean jj_3R_138() { + if (jj_scan_token(EQUAL_EQUAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_138() { - if (jj_scan_token(EQUAL_EQUAL)) return true; + static final private boolean jj_3R_80() { + if (jj_3R_49()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -5922,12 +5941,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_191() { - 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_118() { if (jj_scan_token(LBRACE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5938,14 +5951,14 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_190() { - if (jj_scan_token(FALSE)) return true; + static final private boolean jj_3R_191() { + 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_189() { - if (jj_scan_token(TRUE)) return true; + static final private boolean jj_3R_190() { + if (jj_scan_token(FALSE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -5956,6 +5969,12 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_189() { + if (jj_scan_token(TRUE)) 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(BIT_AND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5988,6 +6007,14 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_77() { + if (jj_scan_token(DOLLAR)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_57()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_186() { if (jj_scan_token(INTEGER_LITERAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6017,14 +6044,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_77() { - if (jj_scan_token(DOLLAR)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_57()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_79() { if (jj_3R_44()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6050,6 +6069,16 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_76() { + 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_118()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_125() { if (jj_3R_127()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6062,16 +6091,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_76() { - 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_118()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_75() { if (jj_scan_token(LBRACE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6149,6 +6168,14 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_109() { + if (jj_scan_token(DOLLAR)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_57()) 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(CLASSACCESS)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6168,14 +6195,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_109() { - if (jj_scan_token(DOLLAR)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_57()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_111() { if (jj_3R_119()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6194,24 +6213,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_84() { - if (jj_3R_73()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_121() { - if (jj_scan_token(AND_AND)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_83() { - if (jj_3R_49()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_90() { Token xsp; xsp = jj_scanpos; @@ -6233,6 +6234,24 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_121() { + if (jj_scan_token(AND_AND)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_84() { + if (jj_3R_73()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_83() { + if (jj_3R_49()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_112() { Token xsp; xsp = jj_scanpos; @@ -6246,6 +6265,18 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_86() { + if (jj_scan_token(HOOK)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_44()) 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; + if (jj_3R_70()) 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(IDENTIFIER)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6266,18 +6297,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_86() { - if (jj_scan_token(HOOK)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_44()) 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; - if (jj_3R_70()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_92() { if (jj_3R_111()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6335,22 +6354,14 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_143() { - if (jj_3R_73()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3_1() { if (jj_3R_39()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_195() { - if (jj_scan_token(ARRAY)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_205()) return true; + static final private boolean jj_3R_143() { + if (jj_3R_73()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -6367,13 +6378,11 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_134() { - if (jj_scan_token(COMMA)) return true; + static final private boolean jj_3R_195() { + if (jj_scan_token(ARRAY)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_205()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_143()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -6387,6 +6396,16 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_134() { + 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_143()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_133() { if (jj_3R_73()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6429,6 +6448,12 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_100() { + if (jj_scan_token(LSHIFTASSIGN)) 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(STATICCLASSACCESS)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6437,8 +6462,8 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_100() { - if (jj_scan_token(LSHIFTASSIGN)) return true; + static final private boolean jj_3R_99() { + if (jj_scan_token(MINUSASSIGN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -6449,8 +6474,8 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_99() { - if (jj_scan_token(MINUSASSIGN)) return true; + static final private boolean jj_3R_98() { + if (jj_scan_token(PLUSASSIGN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -6497,12 +6522,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_98() { - if (jj_scan_token(PLUSASSIGN)) 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(REMASSIGN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6585,16 +6604,16 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_200() { - if (jj_scan_token(NEW)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_69()) return true; + static final private boolean jj_3R_116() { + if (jj_3R_124()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_116() { - if (jj_3R_124()) return true; + static final private boolean jj_3R_200() { + if (jj_scan_token(NEW)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_69()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -6642,12 +6661,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3_4() { - if (jj_3R_43()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_88() { if (jj_scan_token(BANG)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6667,14 +6680,14 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_193() { - if (jj_3R_195()) return true; + static final private boolean jj_3_4() { + if (jj_3R_43()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_204() { - if (jj_3R_43()) return true; + static final private boolean jj_3R_193() { + if (jj_3R_195()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -6685,6 +6698,12 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_204() { + if (jj_3R_43()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_192() { if (jj_3R_194()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6708,29 +6727,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_203() { - if (jj_scan_token(MINUS_MINUS)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_202() { - if (jj_scan_token(PLUS_PLUS)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - - static final private boolean jj_3R_198() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_202()) { - jj_scanpos = xsp; - if (jj_3R_203()) 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 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 0f04260..3156846 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.jj +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.jj @@ -159,11 +159,11 @@ public final class PHPParser extends PHPParserSuperclass { } setMarker(e); errorMessage = null; - if (PHPeclipsePlugin.DEBUG) PHPeclipsePlugin.log(e); + // if (PHPeclipsePlugin.DEBUG) PHPeclipsePlugin.log(e); } /** - * Create marker for the parse error + * Create marker for the parse error. * @param e the ParseException */ private static void setMarker(final ParseException e) { @@ -195,12 +195,12 @@ public final class PHPParser extends PHPParserSuperclass { final int indx, final int brIndx) throws CoreException { String current; - StringBuffer lineNumberBuffer = new StringBuffer(10); + final StringBuffer lineNumberBuffer = new StringBuffer(10); char ch; current = output.substring(indx, brIndx); if (current.indexOf(PARSE_WARNING_STRING) != -1 || current.indexOf(PARSE_ERROR_STRING) != -1) { - int onLine = current.indexOf("on line "); + final int onLine = current.indexOf("on line "); if (onLine != -1) { lineNumberBuffer.delete(0, lineNumberBuffer.length()); for (int i = onLine; i < current.length(); i++) { @@ -210,9 +210,9 @@ public final class PHPParser extends PHPParserSuperclass { } } - int lineNumber = Integer.parseInt(lineNumberBuffer.toString()); + final int lineNumber = Integer.parseInt(lineNumberBuffer.toString()); - Hashtable attributes = new Hashtable(); + final Hashtable attributes = new Hashtable(); current = current.replaceAll("\n", ""); current = current.replaceAll("", ""); @@ -279,17 +279,16 @@ public final class PHPParser extends PHPParserSuperclass { pushOnAstNodes(new HTMLCode(chars, htmlStart,currentPosition)); } - /** - * Create a new task. - */ + /** Create a new task. */ public static final void createNewTask() { final int currentPosition = SimpleCharStream.getPosition(); - final String todo = SimpleCharStream.currentBuffer.substring(currentPosition+1, + final String todo = SimpleCharStream.currentBuffer.substring(currentPosition-3, SimpleCharStream.currentBuffer.indexOf("\n", currentPosition)-1); + PHPeclipsePlugin.log(1,SimpleCharStream.currentBuffer.toString()); try { setMarker(fileToParse, - "todo : " + todo, + todo, SimpleCharStream.getBeginLine(), TASK, "Line "+SimpleCharStream.getBeginLine()); @@ -718,21 +717,21 @@ void ClassBody(final ClassDeclaration classDeclaration) : try { } catch (ParseException e) { - errorMessage = "unexpected token : '"+ e.currentToken.next.image + "', '{' expected"; + errorMessage = "unexpected token : '"+ e.currentToken.next.image + "'. '{' expected"; errorLevel = ERROR; errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + processParseException(e); } ( ClassBodyDeclaration(classDeclaration) )* try { } catch (ParseException e) { - errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', 'var', 'function' or '}' expected"; + errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. 'var', 'function' or '}' expected"; errorLevel = ERROR; errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + processParseException(e); } } @@ -802,7 +801,7 @@ VariableDeclaration VariableDeclarator() : errorLevel = ERROR; errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + processParseException(e); } ] { @@ -1140,8 +1139,7 @@ Expression Expression() : expr = ConditionalExpression() [ assignOperator = AssignmentOperator() try { - {final int errorStart = SimpleCharStream.getPosition();} - initializer = Expression() + initializer = Expression() } catch (ParseException e) { if (errorMessage != null) { throw e; @@ -1536,15 +1534,14 @@ Expression PostfixExpression() : Expression PrimaryExpression() : { - final Token identifier; Expression expr; - final int pos = SimpleCharStream.getPosition(); } { expr = PrimaryPrefix() ( LOOKAHEAD(PrimarySuffix()) - expr = PrimarySuffix(expr))* + expr = PrimarySuffix(expr) + )* {return expr;} | expr = ArrayDeclarator() -- 1.7.1