From 8ff1cd9e0f975e27ee090802eb52df9bef06ca86 Mon Sep 17 00:00:00 2001 From: kpouer Date: Wed, 3 Sep 2003 11:53:58 +0000 Subject: [PATCH] little bugfixes --- net.sourceforge.phpeclipse/src/test/PHPParser.java | 201 ++++++++++---------- net.sourceforge.phpeclipse/src/test/PHPParser.jj | 15 +- 2 files changed, 113 insertions(+), 103 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.java b/net.sourceforge.phpeclipse/src/test/PHPParser.java index d559705..41ebfce 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.java +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.java @@ -2720,8 +2720,8 @@ final Token token,token1; static final public FunctionCall Arguments(final Expression func) throws ParseException { Expression[] args = null; -final Token token; - jj_consume_token(LPAREN); +final Token token,lparen; + lparen = jj_consume_token(LPAREN); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ARRAY: case LIST: @@ -2757,8 +2757,13 @@ final Token token; } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected to close the argument list"; errorLevel = ERROR; - errorStart = args[args.length-1].sourceEnd+1; - errorEnd = args[args.length-1].sourceEnd+1; + if (args == null) { + errorStart = lparen.sourceEnd+1; + errorEnd = lparen.sourceEnd+2; + } else { + errorStart = args[args.length-1].sourceEnd+1; + errorEnd = args[args.length-1].sourceEnd+2; + } processParseExceptionDebug(e); } {if (true) return new FunctionCall(func,args,args[args.length-1].sourceEnd);} @@ -4162,7 +4167,6 @@ Token token; token = jj_consume_token(_DEFAULT); try { jj_consume_token(COLON); - {if (true) return null;} } catch (ParseException e) { errorMessage = "':' expected after 'default' keyword"; errorLevel = ERROR; @@ -4170,6 +4174,7 @@ Token token; errorEnd = token.sourceEnd+1; processParseExceptionDebug(e); } + {if (true) return null;} break; default: jj_la1[103] = jj_gen; @@ -5907,6 +5912,18 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3R_45() { + if (jj_3R_49()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_51()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + static final private boolean jj_3R_193() { if (jj_scan_token(IDENTIFIER)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5946,18 +5963,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_45() { - if (jj_3R_49()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_51()) { jj_scanpos = xsp; break; } - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - } - return false; - } - static final private boolean jj_3R_178() { if (jj_3R_188()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6015,6 +6020,12 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3_5() { + if (jj_3R_45()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_92() { if (jj_scan_token(ANDASSIGN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6045,12 +6056,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3_5() { - if (jj_3R_45()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_87() { if (jj_scan_token(REMASSIGN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6313,6 +6318,14 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3R_44() { + if (jj_3R_49()) 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_167() { if (jj_scan_token(PLUS_PLUS)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6327,14 +6340,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_44() { - if (jj_3R_49()) 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_165() { Token xsp; xsp = jj_scanpos; @@ -6500,14 +6505,14 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_164() { - if (jj_3R_156()) return true; + static final private boolean jj_3_4() { + if (jj_3R_44()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3_4() { - if (jj_3R_44()) return true; + static final private boolean jj_3R_164() { + if (jj_3R_156()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -6548,14 +6553,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_154() { - if (jj_scan_token(BANG)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_157()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_216() { if (jj_scan_token(COMMA)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6564,10 +6561,10 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_153() { - if (jj_scan_token(TILDE)) return true; + static final private boolean jj_3R_154() { + if (jj_scan_token(BANG)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_148()) return true; + if (jj_3R_157()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -6584,6 +6581,14 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3R_153() { + if (jj_scan_token(TILDE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_148()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_148() { Token xsp; xsp = jj_scanpos; @@ -6609,14 +6614,14 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_144() { - if (jj_3R_148()) return true; + static final private boolean jj_3R_213() { + if (jj_3R_215()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } - static final private boolean jj_3R_213() { - if (jj_3R_215()) return true; + static final private boolean jj_3R_144() { + if (jj_3R_148()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -6759,6 +6764,14 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3R_113() { + if (jj_scan_token(ASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_49()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_143() { if (jj_scan_token(RUNSIGNEDSHIFT)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6805,14 +6818,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_113() { - if (jj_scan_token(ASSIGN)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_49()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_183() { if (jj_scan_token(FALSE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6911,6 +6916,16 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3R_112() { + 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_117()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_124() { Token xsp; xsp = jj_scanpos; @@ -6948,13 +6963,9 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_112() { - if (jj_scan_token(COMMA)) return true; + static final private boolean jj_3R_111() { + if (jj_3R_116()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_117()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -6987,15 +6998,31 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_111() { - if (jj_3R_116()) return true; + static final private boolean jj_3R_206() { + 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_206() { - if (jj_scan_token(COMMA)) return true; + static final private boolean jj_3R_104() { + 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_111()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + while (true) { + xsp = jj_scanpos; + if (jj_3R_112()) { 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_113()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -7030,28 +7057,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_104() { - 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_111()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - while (true) { - xsp = jj_scanpos; - if (jj_3R_112()) { 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_113()) jj_scanpos = xsp; - else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_205() { if (jj_3R_41()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -7127,6 +7132,14 @@ final ArrayList list = new ArrayList(); return false; } + static final private boolean jj_3R_105() { + if (jj_scan_token(PRINT)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_49()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_121() { Token xsp; xsp = jj_scanpos; @@ -7167,14 +7180,6 @@ final ArrayList list = new ArrayList(); return false; } - static final private boolean jj_3R_105() { - if (jj_scan_token(PRINT)) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - if (jj_3R_49()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_214() { if (jj_scan_token(ARRAYASSIGN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.jj b/net.sourceforge.phpeclipse/src/test/PHPParser.jj index 0637cf1..16847d8 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.jj +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.jj @@ -2029,18 +2029,23 @@ StringLiteral evaluableString() : FunctionCall Arguments(final Expression func) : { Expression[] args = null; -final Token token; +final Token token,lparen; } { - [ args = ArgumentList() ] + lparen = [ args = ArgumentList() ] try { token = {return new FunctionCall(func,args,token.sourceEnd);} } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected to close the argument list"; errorLevel = ERROR; - errorStart = args[args.length-1].sourceEnd+1; - errorEnd = args[args.length-1].sourceEnd+1; + if (args == null) { + errorStart = lparen.sourceEnd+1; + errorEnd = lparen.sourceEnd+2; + } else { + errorStart = args[args.length-1].sourceEnd+1; + errorEnd = args[args.length-1].sourceEnd+2; + } processParseExceptionDebug(e); } {return new FunctionCall(func,args,args[args.length-1].sourceEnd);} @@ -2851,7 +2856,6 @@ Expression SwitchLabel() : token = <_DEFAULT> try { - {return null;} } catch (ParseException e) { errorMessage = "':' expected after 'default' keyword"; errorLevel = ERROR; @@ -2859,6 +2863,7 @@ Expression SwitchLabel() : errorEnd = token.sourceEnd+1; processParseExceptionDebug(e); } + {return null;} } Break BreakStatement() : -- 1.7.1