import java.util.Hashtable;
import java.io.StringReader;
+import java.io.*;
import java.text.MessageFormat;
import net.sourceforge.phpeclipse.actions.PHPStartApacheAction;
*/
public final class PHPParser extends PHPParserSuperclass {
+ /** The file that is parsed. */
private static IFile fileToParse;
/** The current segment */
private static final String PARSE_ERROR_STRING = "Parse error"; //$NON-NLS-1$
private static final String PARSE_WARNING_STRING = "Warning"; //$NON-NLS-1$
PHPOutlineInfo outlineInfo;
+
+ /** The error level of the current ParseException. */
private static int errorLevel = ERROR;
+ /** The message of the current ParseException. If it's null it's because the parse exception wasn't handled */
private static String errorMessage;
+ private static int errorStart = -1;
+ private static int errorEnd = -1;
+
public PHPParser() {
}
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);
+ phpFile();
+ } catch (FileNotFoundException e) {
+ e.printStackTrace(); //To change body of catch statement use Options | File Templates.
+ } catch (ParseException 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) {
if (errorMessage == null) {
PHPeclipsePlugin.log(e);
errorMessage = "this exception wasn't handled by the parser please tell us how to reproduce it";
+ errorStart = jj_input_stream.getPosition();
+ errorEnd = errorStart + 1;
}
setMarker(e);
errorMessage = null;
*/
private static void setMarker(final ParseException e) {
try {
- setMarker(fileToParse,
- errorMessage,
- jj_input_stream.tokenBegin,
- jj_input_stream.tokenBegin + e.currentToken.image.length(),
- errorLevel,
- "Line " + e.currentToken.beginLine);
+ if (errorStart == -1) {
+ setMarker(fileToParse,
+ errorMessage,
+ jj_input_stream.tokenBegin,
+ jj_input_stream.tokenBegin + e.currentToken.image.length(),
+ errorLevel,
+ "Line " + e.currentToken.beginLine);
+ } else {
+ setMarker(fileToParse,
+ errorMessage,
+ errorStart,
+ errorEnd,
+ errorLevel,
+ "Line " + e.currentToken.beginLine);
+ errorStart = -1;
+ errorEnd = -1;
+ }
} catch (CoreException e2) {
PHPeclipsePlugin.log(e2);
}
<DEFAULT> TOKEN :
{
- <PHPSTARTSHORT : "<?"> : PHPPARSING
+ <PHPSTARTSHORT : "<?"> : PHPPARSING
| <PHPSTARTLONG : "<?php"> : PHPPARSING
-| <PHPECHOSTART : "<?="> : PHPPARSING
+| <PHPECHOSTART : "<?="> : PHPPARSING
}
<PHPPARSING> TOKEN :
{
"//" : IN_SINGLE_LINE_COMMENT
|
+ "#" : IN_SINGLE_LINE_COMMENT
+|
<"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT
|
"/*" : IN_MULTI_LINE_COMMENT
void PhpBlock() :
{
- final int start = jj_input_stream.bufpos;
+ final int start = jj_input_stream.getPosition();
}
{
<PHPECHOSTART> Expression() [ <SEMICOLON> ] <PHPEND>
setMarker(fileToParse,
"You should use '<?php' instead of '<?' it will avoid some problems with XML",
start,
- jj_input_stream.bufpos,
+ jj_input_stream.getPosition(),
INFO,
"Line " + token.beginLine);
} catch (CoreException e) {
} catch (ParseException e) {
errorMessage = "'?>' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
}
{
final PHPClassDeclaration classDeclaration;
final Token className;
- final int pos = jj_input_stream.bufpos;
+ final int pos;
}
{
- <CLASS> className = <IDENTIFIER> [ <EXTENDS> <IDENTIFIER> ]
+ <CLASS>
+ try {
+ {pos = jj_input_stream.getPosition();}
+ className = <IDENTIFIER>
+ } catch (ParseException e) {
+ errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier expected";
+ errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
+ throw e;
+ }
+ [
+ <EXTENDS>
+ try {
+ <IDENTIFIER>
+ } catch (ParseException e) {
+ errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', identifier expected";
+ errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
+ throw e;
+ }
+ ]
{
if (currentSegment != null) {
classDeclaration = new PHPClassDeclaration(currentSegment,className.image,pos);
try {
<LBRACE>
} catch (ParseException e) {
- errorMessage = "'{' expected";
+ 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;
throw e;
}
( ClassBodyDeclaration() )*
try {
<RBRACE>
} catch (ParseException e) {
- errorMessage = "'var', 'function' or '}' expected";
+ 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;
throw e;
}
}
} catch (ParseException e) {
errorMessage = "';' expected after variable declaration";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
}
PHPVarDeclaration VariableDeclarator() :
{
final String varName;
- String varValue;
- final int pos = jj_input_stream.bufpos;
+ final String varValue;
+ final int pos = jj_input_stream.getPosition();
}
{
varName = VariableDeclaratorId()
} catch (ParseException e) {
errorMessage = "Literal expression expected in variable initializer";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
]
} catch (ParseException e) {
errorMessage = "'$' expected for variable identifier";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
}
<DOLLAR> expr = VariableName()
{return "$" + expr;}
|
+ token = <DOLLAR_ID>
+ {return token.image + expr;}
+/*| pas besoin ?
token = <DOLLAR_ID> [expr = VariableName()]
{
if (expr == null) {
return token.image;
}
return token.image + expr;
- }
+ }*/
}
String VariableInitializer() :
final PHPFunctionDeclaration functionDeclaration;
}
{
- <FUNCTION> functionDeclaration = MethodDeclarator()
+ <FUNCTION>
+ try {
+ functionDeclaration = MethodDeclarator()
+ } catch (ParseException e) {
+ if (errorMessage != null) {
+ throw e;
+ }
+ errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function identifier expected";
+ errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
+ throw e;
+ }
{
if (currentSegment != null) {
currentSegment.add(functionDeclaration);
}
}
+/**
+ * A MethodDeclarator contains [&] IDENTIFIER(parameters ...).
+ * @return a function description for the outline
+ */
PHPFunctionDeclaration MethodDeclarator() :
{
final Token identifier;
final StringBuffer methodDeclaration = new StringBuffer();
final String formalParameters;
- final int pos = jj_input_stream.bufpos;
+ final int pos = jj_input_stream.getPosition();
}
{
[ <BIT_AND> {methodDeclaration.append("&");} ]
} catch (ParseException e) {
errorMessage = "Formal parameter expected after function identifier";
errorLevel = ERROR;
- jj_consume_token(token.kind);
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
+ throw e;
}
[ expr = FormalParameter()
{buff.append(expr);}
} catch (ParseException e) {
errorMessage = "')' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
{
} catch (ParseException e) {
errorMessage = "expression expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
]
| operator = <BANGDOUBLEEQUAL>
| operator = <TRIPLEEQUAL>
)
- expr = RelationalExpression()
+ try {
+ expr = RelationalExpression()
+ } catch (ParseException e) {
+ errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', expression expected after '"+operator.image+"'";
+ errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
+ throw e;
+ }
{
buff.append(operator.image);
buff.append(expr);
Token operator;
final StringBuffer buff = new StringBuffer();}
{
- expr = UnaryExpression()
+ try {
+ expr = UnaryExpression()
+ } catch (ParseException e) {
+ errorMessage = "unexpected token '"+e.currentToken.next.image+"'";
+ errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
+ throw e;
+ }
{buff.append(expr);}
(
( operator = <STAR> | operator = <SLASH> | operator = <REM> ) expr = UnaryExpression()
} catch (ParseException e) {
errorMessage = "')' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
{return "("+expr+")";}
{
return "new " + expr;
}
-|
+|
expr = VariableDeclaratorId()
{return expr;}
}
+String classInstantiation() :
+{
+ String expr;
+ final StringBuffer buff = new StringBuffer("new ");
+}
+{
+ <NEW> expr = ClassIdentifier()
+ {buff.append(expr);}
+ [
+ expr = PrimaryExpression()
+ {buff.append(expr);}
+ ]
+ {return buff.toString();}
+}
+
String ClassIdentifier():
{
final String expr;
} catch (ParseException e) {
errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', function call or field access expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
{return "->" + expr;}
} catch (ParseException e) {
errorMessage = "']' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
{
} catch (ParseException e) {
errorMessage = "unexpected token : '"+ e.currentToken.next.image +"', ')' expected to close the argument list";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
{
} catch (ParseException e) {
errorMessage = "expression expected after a comma in argument list";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
{
LOOKAHEAD(2)
Expression()
try {
- (<SEMICOLON> | <PHPEND>)
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
|
} catch (ParseException e) {
errorMessage = "';' expected after expression";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
|
void IncludeStatement() :
{
final String expr;
- final int pos = jj_input_stream.bufpos;
+ final int pos = jj_input_stream.getPosition();
}
{
<REQUIRE>
}
}
try {
- (<SEMICOLON> | "?>")
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
|
}
}
try {
- (<SEMICOLON> | "?>")
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
|
}
}
try {
- (<SEMICOLON> | "?>")
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
|
}
}
try {
- (<SEMICOLON> | "?>")
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
}
} 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;
throw e;
}
[
} 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;
throw e;
}
expr = VariableDeclaratorId()
} 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;
throw e;
}
[ <ASSIGN> expr = Expression() {buff.append("(").append(expr);}]
{
<ECHO> Expression() (<COMMA> Expression())*
try {
- (<SEMICOLON> | "?>")
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected after 'echo' statement";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
}
{
<GLOBAL> VariableDeclaratorId() (<COMMA> VariableDeclaratorId())*
try {
- (<SEMICOLON> | "?>")
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
}
{
<STATIC> VariableDeclarator() (<COMMA> VariableDeclarator())*
try {
- (<SEMICOLON> | "?>")
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
}
} catch (ParseException e) {
errorMessage = "'{' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
( BlockStatement() )*
} catch (ParseException e) {
errorMessage = "unexpected token : '"+ e.currentToken.image +"', '}' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
}
} catch (ParseException e) {
errorMessage = "'(' expected after 'switch'";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
Expression()
} catch (ParseException e) {
errorMessage = "')' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
try {
} catch (ParseException e) {
errorMessage = "'{' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
(
line = SwitchLabel()
( BlockStatementNoBreak() )*
- [ breakToken = <BREAK>
- try {
- <SEMICOLON>
- } catch (ParseException e) {
- errorMessage = "';' expected after 'break' keyword";
- errorLevel = ERROR;
- throw e;
- }
- ]
+ [ breakToken = BreakStatement() ]
{
try {
if (breakToken == null) {
} catch (ParseException e) {
errorMessage = "'}' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
}
+Token BreakStatement() :
+{
+ final Token token;
+}
+{
+ token = <BREAK> [ Expression() ]
+ try {
+ <SEMICOLON>
+ } catch (ParseException e) {
+ errorMessage = "';' expected after 'break' keyword";
+ errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
+ throw e;
+ }
+ {return token;}
+}
+
int SwitchLabel() :
{
final Token token;
if (errorMessage != null) throw e;
errorMessage = "expression expected after 'case' keyword";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
try {
} catch (ParseException e) {
errorMessage = "':' expected after case expression";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
{return token.beginLine;}
} catch (ParseException e) {
errorMessage = "':' expected after 'default' keyword";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
{return token.beginLine;}
void IfStatement() :
{
final Token token;
- final int pos = jj_input_stream.bufpos;
+ final int pos = jj_input_stream.getPosition();
}
{
token = <IF> Condition("if") IfStatement0(pos,pos+token.image.length())
} catch (ParseException e) {
errorMessage = "'(' expected after " + keyword + " keyword";
errorLevel = ERROR;
- throw e;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length();
+ errorEnd = errorStart +1;
+ processParseException(e);
}
Expression()
try {
} catch (ParseException e) {
errorMessage = "')' expected after " + keyword + " keyword";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
}
} catch (ParseException e) {
errorMessage = "'endif' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
try {
} catch (ParseException e) {
errorMessage = "';' expected after 'endif' keyword";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
|
void WhileStatement() :
{
final Token token;
- final int pos = jj_input_stream.bufpos;
+ final int pos = jj_input_stream.getPosition();
}
{
token = <WHILE> Condition("while") WhileStatement0(pos,pos + token.image.length())
} catch (ParseException e) {
errorMessage = "'endwhile' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
try {
- (<SEMICOLON> | "?>")
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected after 'endwhile' keyword";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
|
{
<DO> Statement() <WHILE> Condition("while")
try {
- (<SEMICOLON> | "?>")
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
}
} catch (ParseException e) {
errorMessage = "'(' expected after 'foreach' keyword";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
try {
} catch (ParseException e) {
errorMessage = "variable expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
[ VariableSuffix() ]
} catch (ParseException e) {
errorMessage = "'as' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
try {
} catch (ParseException e) {
errorMessage = "variable expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
[ <ARRAYASSIGN> Expression() ]
} catch (ParseException e) {
errorMessage = "')' expected after 'foreach' keyword";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
try {
if (errorMessage != null) throw e;
errorMessage = "statement expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
}
void ForStatement() :
{
final Token token;
-final int pos = jj_input_stream.bufpos;
+final int pos = jj_input_stream.getPosition();
}
{
token = <FOR>
} catch (ParseException e) {
errorMessage = "'(' expected after 'for' keyword";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
[ ForInit() ] <SEMICOLON> [ Expression() ] <SEMICOLON> [ StatementExpressionList() ] <RPAREN>
} catch (ParseException e) {
errorMessage = "'endfor' expected";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
try {
} catch (ParseException e) {
errorMessage = "';' expected after 'endfor' keyword";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
)
StatementExpression() ( <COMMA> StatementExpression() )*
}
-void BreakStatement() :
-{}
-{
- <BREAK> [ <IDENTIFIER> ]
- try {
- <SEMICOLON>
- } catch (ParseException e) {
- errorMessage = "';' expected after 'break' statement";
- errorLevel = ERROR;
- throw e;
- }
-}
-
void ContinueStatement() :
{}
{
} catch (ParseException e) {
errorMessage = "';' expected after 'continue' statement";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
}
} catch (ParseException e) {
errorMessage = "';' expected after 'return' statement";
errorLevel = ERROR;
+ errorStart = jj_input_stream.getPosition() - e.currentToken.next.image.length() + 1;
+ errorEnd = jj_input_stream.getPosition() + 1;
throw e;
}
}
\ No newline at end of file