}
}
- 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);
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);
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));
}
< DOLLAR_ID: <DOLLAR> <IDENTIFIER> >
}
-void phpTest() :
-{}
-{
- Php()
- <EOF>
- {PHPParser.createNewHTMLCode();}
-}
-
void phpFile() :
{}
{
} 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) )*
} 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;
}
}
} 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;
}
{
<STRING> {pos = SimpleCharStream.getPosition();
return new ConstantIdentifier(Types.STRING,
- pos,pos-6);}
+ pos,pos-6);}
| <BOOL> {pos = SimpleCharStream.getPosition();
return new ConstantIdentifier(Types.BOOL,
- pos,pos-4);}
+ pos,pos-4);}
| <BOOLEAN> {pos = SimpleCharStream.getPosition();
return new ConstantIdentifier(Types.BOOLEAN,
- pos,pos-7);}
+ pos,pos-7);}
| <REAL> {pos = SimpleCharStream.getPosition();
return new ConstantIdentifier(Types.REAL,
- pos,pos-4);}
+ pos,pos-4);}
| <DOUBLE> {pos = SimpleCharStream.getPosition();
return new ConstantIdentifier(Types.DOUBLE,
- pos,pos-5);}
+ pos,pos-5);}
| <FLOAT> {pos = SimpleCharStream.getPosition();
return new ConstantIdentifier(Types.FLOAT,
- pos,pos-5);}
+ pos,pos-5);}
| <INT> {pos = SimpleCharStream.getPosition();
return new ConstantIdentifier(Types.INT,
- pos,pos-3);}
+ pos,pos-3);}
| <INTEGER> {pos = SimpleCharStream.getPosition();
return new ConstantIdentifier(Types.INTEGER,
- pos,pos-7);}
+ pos,pos-7);}
| <OBJECT> {pos = SimpleCharStream.getPosition();
return new ConstantIdentifier(Types.OBJECT,
- pos,pos-6);}
+ pos,pos-6);}
}
Expression Expression() :