From 9c312d6217537424b56f4cb4496c16e3f2e903fd Mon Sep 17 00:00:00 2001 From: kpouer Date: Mon, 9 Jun 2003 22:09:25 +0000 Subject: [PATCH] *** empty log message *** --- .../internal/compiler/ast/ClassDeclaration.java | 12 +- net.sourceforge.phpeclipse/src/test/PHPParser.java | 107 ++++++++++---------- net.sourceforge.phpeclipse/src/test/PHPParser.jj | 15 ++- 3 files changed, 70 insertions(+), 64 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ClassDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ClassDeclaration.java index fccd134..9c5bf07 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ClassDeclaration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ClassDeclaration.java @@ -72,7 +72,7 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr position = new Position(sourceStart, name.length); } - public void addMethod(MethodDeclaration method) { + public void add(MethodDeclaration method) { methods.add(method); add(method); if (method.name.equals(name)) { @@ -80,7 +80,7 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr } } - public void addVariable(FieldDeclaration var) { + public void add(FieldDeclaration var) { for (int i = 0; i < var.vars.length; i++) { VariableDeclaration c = var.vars[i]; children.add(c); @@ -88,6 +88,10 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr fields.add(var); } + public boolean add(Outlineable o) { + return children.add(o); + } + /** * Tell if the class has a constructor. * @return a boolean @@ -154,10 +158,6 @@ public class ClassDeclaration extends Statement implements OutlineableWithChildr return parent; } - public boolean add(Outlineable o) { - return children.add(o); - } - public Outlineable get(int index) { return (Outlineable) children.get(index); } diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.java b/net.sourceforge.phpeclipse/src/test/PHPParser.java index d83a9ce..1f9b39e 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.java +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.java @@ -677,7 +677,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); } list = new VariableDeclaration[arrayList.size()]; arrayList.toArray(list); @@ -2685,10 +2685,11 @@ final ArrayList list = new ArrayList(); errorEnd = SimpleCharStream.getPosition(); {if (true) throw e;} } - nbNodes = nodePtr-startIndex - 1; + nbNodes = nodePtr - startIndex; blockNodes = new AstNode[nbNodes]; System.arraycopy(nodes,startIndex,blockNodes,0,nbNodes); - {if (true) return new HTMLBlock(nodes);} + nodePtr = startIndex; + {if (true) return new HTMLBlock(blockNodes);} throw new Error("Missing return statement in function"); } @@ -3156,6 +3157,7 @@ final ArrayList list = new ArrayList(); case SEMICOLON: case DOLLAR_ID: statement = Statement(); + if (phpDocument == currentSegment) pushOnAstNodes(statement); {if (true) return statement;} break; case CLASS: @@ -3164,6 +3166,7 @@ final ArrayList list = new ArrayList(); break; case FUNCTION: statement = MethodDeclaration(); + if (phpDocument == currentSegment) pushOnAstNodes(statement); {if (true) return statement;} break; default: @@ -5045,12 +5048,6 @@ final int startBlock, endBlock; 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_85() { if (jj_scan_token(LIST)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5073,6 +5070,12 @@ final int startBlock, endBlock; 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_167() { if (jj_scan_token(LPAREN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5381,6 +5384,14 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_87() { + if (jj_scan_token(ASSIGN)) 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_140() { Token xsp; xsp = jj_scanpos; @@ -5397,14 +5408,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_87() { - if (jj_scan_token(ASSIGN)) 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_134() { if (jj_3R_139()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5474,6 +5477,16 @@ final int startBlock, endBlock; 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; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_87()) jj_scanpos = xsp; + else 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; @@ -5486,16 +5499,6 @@ final int startBlock, endBlock; 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; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_87()) jj_scanpos = xsp; - else 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; @@ -5943,6 +5946,14 @@ final int startBlock, endBlock; 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; + 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_98() { if (jj_scan_token(LBRACE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -5953,18 +5964,16 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_46() { - if (jj_scan_token(IDENTIFIER)) return true; + 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; - if (jj_scan_token(COLON)) return true; + if (jj_3R_113()) 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; - if (jj_3R_113()) return true; + static final private boolean jj_3_8() { + if (jj_3R_47()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } @@ -6001,12 +6010,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3_8() { - if (jj_3R_47()) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; - return false; - } - static final private boolean jj_3R_110() { if (jj_scan_token(DOT)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6415,12 +6418,6 @@ final int startBlock, endBlock; return false; } - static final private boolean jj_3R_179() { - if (jj_3R_188()) 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(ASSIGN)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6429,6 +6426,12 @@ final int startBlock, endBlock; return false; } + static final private boolean jj_3R_179() { + if (jj_3R_188()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + static final private boolean jj_3R_42() { if (jj_3R_50()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; @@ -6547,6 +6550,12 @@ final int startBlock, endBlock; 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; @@ -6557,12 +6566,6 @@ final int startBlock, endBlock; 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 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 915c49c..a28acb9 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.jj +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.jj @@ -635,7 +635,7 @@ void PhpBlock() : { phpEchoBlock() | - [ + [ | {try { setMarker(fileToParse, @@ -798,7 +798,7 @@ FieldDeclaration FieldDeclaration() : errorLevel = ERROR; errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; errorEnd = SimpleCharStream.getPosition() + 1; - throw e; + processParseException(e); } {list = new VariableDeclaration[arrayList.size()]; @@ -1831,10 +1831,11 @@ HTMLBlock htmlBlock() : throw e; } { - nbNodes = nodePtr-startIndex - 1; + nbNodes = nodePtr - startIndex; blockNodes = new AstNode[nbNodes]; System.arraycopy(nodes,startIndex,blockNodes,0,nbNodes); - return new HTMLBlock(nodes);} + nodePtr = startIndex; + return new HTMLBlock(blockNodes);} } /** @@ -2102,9 +2103,11 @@ Statement BlockStatement() : final Statement statement; } { - statement = Statement() {return statement;} + statement = Statement() {if (phpDocument == currentSegment) pushOnAstNodes(statement); + return statement;} | statement = ClassDeclaration() {return statement;} -| statement = MethodDeclaration() {return statement;} +| statement = MethodDeclaration() {if (phpDocument == currentSegment) pushOnAstNodes(statement); + return statement;} } /** -- 1.7.1