From 67e371920331b00158611b35c5daf538bcfa2b90 Mon Sep 17 00:00:00 2001 From: kpouer Date: Thu, 9 Oct 2003 13:12:35 +0000 Subject: [PATCH 1/1] a bug fixed in the switch labels parsing --- net.sourceforge.phpeclipse/src/test/PHPParser.java | 16 +++++++++------- net.sourceforge.phpeclipse/src/test/PHPParser.jj | 4 +++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.java b/net.sourceforge.phpeclipse/src/test/PHPParser.java index 219e662..07c6773 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.java +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.java @@ -4005,6 +4005,7 @@ Token token; Statement statement; final ArrayList stmts = new ArrayList(); final Token token = PHPParser.token; + final int start = PHPParser.token.next.sourceStart; expr = SwitchLabel(); label_31: while (true) { @@ -4123,7 +4124,8 @@ Token token; final Statement[] stmtsArray = new Statement[listSize]; stmts.toArray(stmtsArray); if (expr == null) {//it's a default - {if (true) return new DefaultCase(stmtsArray,token.sourceStart,stmtsArray[listSize-1].sourceEnd);} + final int end = PHPParser.token.next.sourceStart; + {if (true) return new DefaultCase(stmtsArray,start,end);} } if (listSize != 0) { {if (true) return new Case(expr,stmtsArray,expr.sourceStart,stmtsArray[listSize-1].sourceEnd);} @@ -5963,6 +5965,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_186() { if (jj_scan_token(BIT_AND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6002,12 +6010,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_94() { if (jj_scan_token(ORASSIGN)) 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 14f1716..f2cd08d 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.jj +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.jj @@ -2803,6 +2803,7 @@ AbstractCase switchLabel0() : Statement statement; final ArrayList stmts = new ArrayList(); final Token token = PHPParser.token; + final int start = PHPParser.token.next.sourceStart; } { expr = SwitchLabel() @@ -2815,7 +2816,8 @@ AbstractCase switchLabel0() : final Statement[] stmtsArray = new Statement[listSize]; stmts.toArray(stmtsArray); if (expr == null) {//it's a default - return new DefaultCase(stmtsArray,token.sourceStart,stmtsArray[listSize-1].sourceEnd); + final int end = PHPParser.token.next.sourceStart; + return new DefaultCase(stmtsArray,start,end); } if (listSize != 0) { return new Case(expr,stmtsArray,expr.sourceStart,stmtsArray[listSize-1].sourceEnd); -- 1.7.1