X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.jj b/net.sourceforge.phpeclipse/src/test/PHPParser.jj index 0d76a4c..438fa59 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParser.jj +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.jj @@ -122,41 +122,6 @@ public final class PHPParser extends PHPParserSuperclass { } } - public static final void phpParserTester(final String strEval) throws CoreException, ParseException { - PHPParserTokenManager.SwitchTo(PHPParserTokenManager.PHPPARSING); - final StringReader stream = new StringReader(strEval); - if (jj_input_stream == null) { - jj_input_stream = new SimpleCharStream(stream, 1, 1); - } - ReInit(new StringReader(strEval)); - init(); - phpTest(); - } - - public static final void htmlParserTester(final File fileName) throws CoreException, ParseException { - try { - final Reader stream = new FileReader(fileName); - if (jj_input_stream == null) { - jj_input_stream = new SimpleCharStream(stream, 1, 1); - } - ReInit(stream); - init(); - phpFile(); - } catch (FileNotFoundException e) { - e.printStackTrace(); //To change body of catch statement use Options | File Templates. - } - } - - public static final void htmlParserTester(final String strEval) throws CoreException, ParseException { - final StringReader stream = new StringReader(strEval); - if (jj_input_stream == null) { - jj_input_stream = new SimpleCharStream(stream, 1, 1); - } - ReInit(stream); - init(); - phpFile(); - } - public final PHPOutlineInfo parseInfo(final Object parent, final String s) { currentSegment = new PHPDocument(parent); outlineInfo = new PHPOutlineInfo(parent); @@ -169,7 +134,8 @@ public final class PHPParser extends PHPParserSuperclass { try { parse(); phpDocument = new PHPDocument(null); - phpDocument.nodes = nodes; + 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); @@ -331,7 +297,7 @@ public final class PHPParser extends PHPParserSuperclass { if (currentPosition == htmlStart) { return; } - final char[] chars = SimpleCharStream.currentBuffer.substring(htmlStart,currentPosition).toCharArray(); + final char[] chars = SimpleCharStream.currentBuffer.substring(htmlStart,currentPosition+1).toCharArray(); pushOnAstNodes(new HTMLCode(chars, htmlStart,currentPosition)); } @@ -642,14 +608,6 @@ MORE : < DOLLAR_ID: > } -void phpTest() : -{} -{ - Php() - - {PHPParser.createNewHTMLCode();} -} - void phpFile() : {} { @@ -785,8 +743,8 @@ void ClassBody(ClassDeclaration classDeclaration) : } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image + "', '{' expected"; errorLevel = ERROR; - errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = jj_input_stream.getPosition() + 1; + errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; + errorEnd = SimpleCharStream.getPosition() + 1; throw e; } ( ClassBodyDeclaration(classDeclaration) )* @@ -795,8 +753,8 @@ void ClassBody(ClassDeclaration classDeclaration) : } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', 'var', 'function' or '}' expected"; errorLevel = ERROR; - errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = jj_input_stream.getPosition() + 1; + errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; + errorEnd = SimpleCharStream.getPosition() + 1; throw e; } } @@ -839,8 +797,8 @@ FieldDeclaration FieldDeclaration() : } catch (ParseException e) { errorMessage = "unexpected token : '"+ e.currentToken.next.image +"'. A ';' was expected after variable declaration"; errorLevel = ERROR; - errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1; - errorEnd = jj_input_stream.getPosition() + 1; + errorStart = SimpleCharStream.getPosition() - e.currentToken.next.image.length() + 1; + errorEnd = SimpleCharStream.getPosition() + 1; throw e; } @@ -1164,31 +1122,31 @@ ConstantIdentifier Type() : { {pos = SimpleCharStream.getPosition(); return new ConstantIdentifier(Types.STRING, - pos,pos-6);} + pos,pos-6);} | {pos = SimpleCharStream.getPosition(); return new ConstantIdentifier(Types.BOOL, - pos,pos-4);} + pos,pos-4);} | {pos = SimpleCharStream.getPosition(); return new ConstantIdentifier(Types.BOOLEAN, - pos,pos-7);} + pos,pos-7);} | {pos = SimpleCharStream.getPosition(); return new ConstantIdentifier(Types.REAL, - pos,pos-4);} + pos,pos-4);} | {pos = SimpleCharStream.getPosition(); return new ConstantIdentifier(Types.DOUBLE, - pos,pos-5);} + pos,pos-5);} | {pos = SimpleCharStream.getPosition(); return new ConstantIdentifier(Types.FLOAT, - pos,pos-5);} + pos,pos-5);} | {pos = SimpleCharStream.getPosition(); return new ConstantIdentifier(Types.INT, - pos,pos-3);} + pos,pos-3);} | {pos = SimpleCharStream.getPosition(); return new ConstantIdentifier(Types.INTEGER, - pos,pos-7);} + pos,pos-7);} | {pos = SimpleCharStream.getPosition(); return new ConstantIdentifier(Types.OBJECT, - pos,pos-6);} + pos,pos-6);} } Expression Expression() :