<DEFAULT> TOKEN :
{
- <PHPSTARTSHORT : "<?"> : PHPPARSING
+ <PHPSTARTSHORT : "<?"> : PHPPARSING
| <PHPSTARTLONG : "<?php"> : PHPPARSING
-| <PHPECHOSTART : "<?="> : PHPPARSING
+| <PHPECHOSTART : "<?="> : PHPPARSING
}
<PHPPARSING> TOKEN :
| 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;
+ throw e;
+ }
{
buff.append(operator.image);
buff.append(expr);
LOOKAHEAD(2)
Expression()
try {
- (<SEMICOLON> | <PHPEND>)
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected";
errorLevel = ERROR;
}
}
try {
- (<SEMICOLON> | "?>")
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected";
errorLevel = ERROR;
}
}
try {
- (<SEMICOLON> | "?>")
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected";
errorLevel = ERROR;
}
}
try {
- (<SEMICOLON> | "?>")
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected";
errorLevel = ERROR;
}
}
try {
- (<SEMICOLON> | "?>")
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected";
errorLevel = ERROR;
{
<ECHO> Expression() (<COMMA> Expression())*
try {
- (<SEMICOLON> | "?>")
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected after 'echo' statement";
errorLevel = ERROR;
{
<GLOBAL> VariableDeclaratorId() (<COMMA> VariableDeclaratorId())*
try {
- (<SEMICOLON> | "?>")
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected";
errorLevel = ERROR;
{
<STATIC> VariableDeclarator() (<COMMA> VariableDeclarator())*
try {
- (<SEMICOLON> | "?>")
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected";
errorLevel = ERROR;
(
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) {
}
}
+Token BreakStatement() :
+{
+ final Token token;
+}
+{
+ token = <BREAK> [ Expression() ]
+ try {
+ <SEMICOLON>
+ } catch (ParseException e) {
+ errorMessage = "';' expected after 'break' keyword";
+ errorLevel = ERROR;
+ throw e;
+ }
+ {return token;}
+}
+
int SwitchLabel() :
{
final Token token;
throw e;
}
try {
- (<SEMICOLON> | "?>")
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected after 'endwhile' keyword";
errorLevel = ERROR;
{
<DO> Statement() <WHILE> Condition("while")
try {
- (<SEMICOLON> | "?>")
+ (<SEMICOLON> | <PHPEND> {PHPParserTokenManager.SwitchTo(PHPParserTokenManager.DEFAULT);})
} catch (ParseException e) {
errorMessage = "';' expected";
errorLevel = ERROR;
StatementExpression() ( <COMMA> StatementExpression() )*
}
-void BreakStatement() :
-{}
-{
- <BREAK> [ <IDENTIFIER> ]
- try {
- <SEMICOLON>
- } catch (ParseException e) {
- errorMessage = "';' expected after 'break' statement";
- errorLevel = ERROR;
- throw e;
- }
-}
-
void ContinueStatement() :
{}
{