X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.java b/net.sourceforge.phpeclipse/src/test/PHPParser.java index 261d359..1f9b39e 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.java +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.java @@ -101,7 +101,8 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon } public final PHPOutlineInfo parseInfo(final Object parent, final String s) { - currentSegment = new PHPDocument(parent); + phpDocument = new PHPDocument(parent,"_root".toCharArray()); + currentSegment = phpDocument; outlineInfo = new PHPOutlineInfo(parent, currentSegment); final StringReader stream = new StringReader(s); if (jj_input_stream == null) { @@ -111,9 +112,9 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon init(); try { parse(); - phpDocument = new PHPDocument(null); phpDocument.nodes = new AstNode[nodes.length]; System.arraycopy(nodes,0,phpDocument.nodes,0,nodes.length); + PHPeclipsePlugin.log(1,phpDocument.toString()); } catch (ParseException e) { processParseException(e); } @@ -145,8 +146,8 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon if (errorStart == -1) { setMarker(fileToParse, errorMessage, - jj_input_stream.tokenBegin, - jj_input_stream.tokenBegin + e.currentToken.image.length(), + SimpleCharStream.tokenBegin, + SimpleCharStream.tokenBegin + e.currentToken.image.length(), errorLevel, "Line " + e.currentToken.beginLine); } else { @@ -629,11 +630,9 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon case FUNCTION: method = MethodDeclaration(); method.setParent(classDeclaration); - classDeclaration.addMethod(method); break; case VAR: field = FieldDeclaration(); - classDeclaration.addVariable(field); break; default: jj_la1[8] = jj_gen; @@ -678,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); @@ -783,15 +782,15 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon {if (true) return token.image.substring(1);} } buff = new StringBuffer(token.image); - buff.append('{'); + buff.append("{"); buff.append(expression.toStringExpression()); - buff.append('}'); + buff.append("}"); {if (true) return buff.toString();} break; case DOLLAR: jj_consume_token(DOLLAR); expr = VariableName(); - {if (true) return expr;} + {if (true) return "$" + expr;} break; default: jj_la1[12] = jj_gen; @@ -832,15 +831,15 @@ public final class PHPParser extends PHPParserSuperclass implements PHPParserCon {if (true) return token.image;} } buff = new StringBuffer(token.image); - buff.append('{'); + buff.append("{"); buff.append(expression.toStringExpression()); - buff.append('}'); + buff.append("}"); {if (true) return buff.toString();} break; case DOLLAR: jj_consume_token(DOLLAR); expr = VariableName(); - buff = new StringBuffer('$'); + buff = new StringBuffer("$"); buff.append(expr); {if (true) return buff.toString();} break; @@ -2686,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"); } @@ -3157,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: @@ -3165,6 +3166,7 @@ final ArrayList list = new ArrayList(); break; case FUNCTION: statement = MethodDeclaration(); + if (phpDocument == currentSegment) pushOnAstNodes(statement); {if (true) return statement;} break; default: @@ -5046,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; @@ -5074,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; @@ -5382,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; @@ -5398,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; @@ -5475,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; @@ -5487,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; @@ -5944,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; @@ -5954,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; } @@ -6002,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; @@ -6416,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; @@ -6430,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; @@ -6548,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; @@ -6558,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;