use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class CssParser method elem.
// $ANTLR start "elem"
// /home/langera/dev/freud/src/grammar/Css.g:81:1: elem : ( '*' -> ^( UNIVERSAL ) | '#' IDENT -> ^( ID IDENT ) | '.' IDENT -> ^( CLASS IDENT ) | IDENT -> ^( TAG IDENT ) );
public final CssParser.elem_return elem() throws RecognitionException {
CssParser.elem_return retval = new CssParser.elem_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token char_literal34 = null;
Token char_literal35 = null;
Token IDENT36 = null;
Token char_literal37 = null;
Token IDENT38 = null;
Token IDENT39 = null;
CommonTree char_literal34_tree = null;
CommonTree char_literal35_tree = null;
CommonTree IDENT36_tree = null;
CommonTree char_literal37_tree = null;
CommonTree IDENT38_tree = null;
CommonTree IDENT39_tree = null;
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
RewriteRuleTokenStream stream_35 = new RewriteRuleTokenStream(adaptor, "token 35");
RewriteRuleTokenStream stream_36 = new RewriteRuleTokenStream(adaptor, "token 36");
RewriteRuleTokenStream stream_37 = new RewriteRuleTokenStream(adaptor, "token 37");
try {
// /home/langera/dev/freud/src/grammar/Css.g:82:2: ( '*' -> ^( UNIVERSAL ) | '#' IDENT -> ^( ID IDENT ) | '.' IDENT -> ^( CLASS IDENT ) | IDENT -> ^( TAG IDENT ) )
int alt17 = 4;
switch(input.LA(1)) {
case 35:
{
alt17 = 1;
}
break;
case 36:
{
alt17 = 2;
}
break;
case 37:
{
alt17 = 3;
}
break;
case IDENT:
{
alt17 = 4;
}
break;
default:
NoViableAltException nvae = new NoViableAltException("", 17, 0, input);
throw nvae;
}
switch(alt17) {
case 1:
// /home/langera/dev/freud/src/grammar/Css.g:82:4: '*'
{
char_literal34 = (Token) match(input, 35, FOLLOW_35_in_elem421);
stream_35.add(char_literal34);
// AST REWRITE
// elements:
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 82:8: -> ^( UNIVERSAL )
{
// /home/langera/dev/freud/src/grammar/Css.g:82:11: ^( UNIVERSAL )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(UNIVERSAL, "UNIVERSAL"), root_1);
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
case 2:
// /home/langera/dev/freud/src/grammar/Css.g:83:4: '#' IDENT
{
char_literal35 = (Token) match(input, 36, FOLLOW_36_in_elem434);
stream_36.add(char_literal35);
IDENT36 = (Token) match(input, IDENT, FOLLOW_IDENT_in_elem436);
stream_IDENT.add(IDENT36);
// AST REWRITE
// elements: IDENT
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 83:14: -> ^( ID IDENT )
{
// /home/langera/dev/freud/src/grammar/Css.g:83:17: ^( ID IDENT )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ID, "ID"), root_1);
adaptor.addChild(root_1, stream_IDENT.nextNode());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
case 3:
// /home/langera/dev/freud/src/grammar/Css.g:84:4: '.' IDENT
{
char_literal37 = (Token) match(input, 37, FOLLOW_37_in_elem451);
stream_37.add(char_literal37);
IDENT38 = (Token) match(input, IDENT, FOLLOW_IDENT_in_elem453);
stream_IDENT.add(IDENT38);
// AST REWRITE
// elements: IDENT
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 84:14: -> ^( CLASS IDENT )
{
// /home/langera/dev/freud/src/grammar/Css.g:84:17: ^( CLASS IDENT )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(CLASS, "CLASS"), root_1);
adaptor.addChild(root_1, stream_IDENT.nextNode());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
case 4:
// /home/langera/dev/freud/src/grammar/Css.g:85:4: IDENT
{
IDENT39 = (Token) match(input, IDENT, FOLLOW_IDENT_in_elem471);
stream_IDENT.add(IDENT39);
// AST REWRITE
// elements: IDENT
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 85:10: -> ^( TAG IDENT )
{
// /home/langera/dev/freud/src/grammar/Css.g:85:13: ^( TAG IDENT )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(TAG, "TAG"), root_1);
adaptor.addChild(root_1, stream_IDENT.nextNode());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
} catch (RecognitionException re) {
reportError(re);
recover(input, re);
retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
} finally {
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class CssParser method selector.
// $ANTLR start "selector"
// /home/langera/dev/freud/src/grammar/Css.g:64:1: selector : elem ( selectorOperation )* ( attrib )* ( pseudo )? -> elem ( selectorOperation )* ( attrib )* ( pseudo )* ;
public final CssParser.selector_return selector() throws RecognitionException {
CssParser.selector_return retval = new CssParser.selector_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
CssParser.elem_return elem23 = null;
CssParser.selectorOperation_return selectorOperation24 = null;
CssParser.attrib_return attrib25 = null;
CssParser.pseudo_return pseudo26 = null;
RewriteRuleSubtreeStream stream_elem = new RewriteRuleSubtreeStream(adaptor, "rule elem");
RewriteRuleSubtreeStream stream_pseudo = new RewriteRuleSubtreeStream(adaptor, "rule pseudo");
RewriteRuleSubtreeStream stream_selectorOperation = new RewriteRuleSubtreeStream(adaptor, "rule selectorOperation");
RewriteRuleSubtreeStream stream_attrib = new RewriteRuleSubtreeStream(adaptor, "rule attrib");
try {
// /home/langera/dev/freud/src/grammar/Css.g:65:2: ( elem ( selectorOperation )* ( attrib )* ( pseudo )? -> elem ( selectorOperation )* ( attrib )* ( pseudo )* )
// /home/langera/dev/freud/src/grammar/Css.g:65:4: elem ( selectorOperation )* ( attrib )* ( pseudo )?
{
pushFollow(FOLLOW_elem_in_selector308);
elem23 = elem();
state._fsp--;
stream_elem.add(elem23.getTree());
// /home/langera/dev/freud/src/grammar/Css.g:65:9: ( selectorOperation )*
loop10: do {
int alt10 = 2;
alt10 = dfa10.predict(input);
switch(alt10) {
case 1:
// /home/langera/dev/freud/src/grammar/Css.g:65:9: selectorOperation
{
pushFollow(FOLLOW_selectorOperation_in_selector310);
selectorOperation24 = selectorOperation();
state._fsp--;
stream_selectorOperation.add(selectorOperation24.getTree());
}
break;
default:
break loop10;
}
} while (true);
// /home/langera/dev/freud/src/grammar/Css.g:65:28: ( attrib )*
loop11: do {
int alt11 = 2;
int LA11_0 = input.LA(1);
if ((LA11_0 == 40)) {
alt11 = 1;
}
switch(alt11) {
case 1:
// /home/langera/dev/freud/src/grammar/Css.g:65:28: attrib
{
pushFollow(FOLLOW_attrib_in_selector313);
attrib25 = attrib();
state._fsp--;
stream_attrib.add(attrib25.getTree());
}
break;
default:
break loop11;
}
} while (true);
// /home/langera/dev/freud/src/grammar/Css.g:65:36: ( pseudo )?
int alt12 = 2;
int LA12_0 = input.LA(1);
if (((LA12_0 >= 38 && LA12_0 <= 39))) {
alt12 = 1;
}
switch(alt12) {
case 1:
// /home/langera/dev/freud/src/grammar/Css.g:65:36: pseudo
{
pushFollow(FOLLOW_pseudo_in_selector316);
pseudo26 = pseudo();
state._fsp--;
stream_pseudo.add(pseudo26.getTree());
}
break;
}
// AST REWRITE
// elements: elem, pseudo, attrib, selectorOperation
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 65:44: -> elem ( selectorOperation )* ( attrib )* ( pseudo )*
{
adaptor.addChild(root_0, stream_elem.nextTree());
// /home/langera/dev/freud/src/grammar/Css.g:65:53: ( selectorOperation )*
while (stream_selectorOperation.hasNext()) {
adaptor.addChild(root_0, stream_selectorOperation.nextTree());
}
stream_selectorOperation.reset();
// /home/langera/dev/freud/src/grammar/Css.g:65:72: ( attrib )*
while (stream_attrib.hasNext()) {
adaptor.addChild(root_0, stream_attrib.nextTree());
}
stream_attrib.reset();
// /home/langera/dev/freud/src/grammar/Css.g:65:80: ( pseudo )*
while (stream_pseudo.hasNext()) {
adaptor.addChild(root_0, stream_pseudo.nextTree());
}
stream_pseudo.reset();
}
retval.tree = root_0;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
} catch (RecognitionException re) {
reportError(re);
recover(input, re);
retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
} finally {
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class CssParser method properties.
// $ANTLR start "properties"
// /home/langera/dev/freud/src/grammar/Css.g:77:1: properties : declaration ( ';' ( declaration )? )* -> ( declaration )+ ;
public final CssParser.properties_return properties() throws RecognitionException {
CssParser.properties_return retval = new CssParser.properties_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token char_literal32 = null;
CssParser.declaration_return declaration31 = null;
CssParser.declaration_return declaration33 = null;
CommonTree char_literal32_tree = null;
RewriteRuleTokenStream stream_34 = new RewriteRuleTokenStream(adaptor, "token 34");
RewriteRuleSubtreeStream stream_declaration = new RewriteRuleSubtreeStream(adaptor, "rule declaration");
try {
// /home/langera/dev/freud/src/grammar/Css.g:78:2: ( declaration ( ';' ( declaration )? )* -> ( declaration )+ )
// /home/langera/dev/freud/src/grammar/Css.g:78:4: declaration ( ';' ( declaration )? )*
{
pushFollow(FOLLOW_declaration_in_properties395);
declaration31 = declaration();
state._fsp--;
stream_declaration.add(declaration31.getTree());
// /home/langera/dev/freud/src/grammar/Css.g:78:16: ( ';' ( declaration )? )*
loop16: do {
int alt16 = 2;
int LA16_0 = input.LA(1);
if ((LA16_0 == 34)) {
alt16 = 1;
}
switch(alt16) {
case 1:
// /home/langera/dev/freud/src/grammar/Css.g:78:17: ';' ( declaration )?
{
char_literal32 = (Token) match(input, 34, FOLLOW_34_in_properties398);
stream_34.add(char_literal32);
// /home/langera/dev/freud/src/grammar/Css.g:78:21: ( declaration )?
int alt15 = 2;
int LA15_0 = input.LA(1);
if ((LA15_0 == IDENT)) {
alt15 = 1;
}
switch(alt15) {
case 1:
// /home/langera/dev/freud/src/grammar/Css.g:78:21: declaration
{
pushFollow(FOLLOW_declaration_in_properties400);
declaration33 = declaration();
state._fsp--;
stream_declaration.add(declaration33.getTree());
}
break;
}
}
break;
default:
break loop16;
}
} while (true);
// AST REWRITE
// elements: declaration
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 78:36: -> ( declaration )+
{
if (!(stream_declaration.hasNext())) {
throw new RewriteEarlyExitException();
}
while (stream_declaration.hasNext()) {
adaptor.addChild(root_0, stream_declaration.nextTree());
}
stream_declaration.reset();
}
retval.tree = root_0;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
} catch (RecognitionException re) {
reportError(re);
recover(input, re);
retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
} finally {
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class CssParser method args.
// $ANTLR start "args"
// /home/langera/dev/freud/src/grammar/Css.g:107:1: args : expr ( ( ',' )? expr )* -> ( expr )* ;
public final CssParser.args_return args() throws RecognitionException {
CssParser.args_return retval = new CssParser.args_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token char_literal58 = null;
CssParser.expr_return expr57 = null;
CssParser.expr_return expr59 = null;
CommonTree char_literal58_tree = null;
RewriteRuleTokenStream stream_31 = new RewriteRuleTokenStream(adaptor, "token 31");
RewriteRuleSubtreeStream stream_expr = new RewriteRuleSubtreeStream(adaptor, "rule expr");
try {
// /home/langera/dev/freud/src/grammar/Css.g:108:2: ( expr ( ( ',' )? expr )* -> ( expr )* )
// /home/langera/dev/freud/src/grammar/Css.g:108:4: expr ( ( ',' )? expr )*
{
pushFollow(FOLLOW_expr_in_args645);
expr57 = expr();
state._fsp--;
stream_expr.add(expr57.getTree());
// /home/langera/dev/freud/src/grammar/Css.g:108:9: ( ( ',' )? expr )*
loop24: do {
int alt24 = 2;
int LA24_0 = input.LA(1);
if ((LA24_0 == IDENT || LA24_0 == 31 || (LA24_0 >= 36 && LA24_0 <= 37))) {
alt24 = 1;
}
switch(alt24) {
case 1:
// /home/langera/dev/freud/src/grammar/Css.g:108:10: ( ',' )? expr
{
// /home/langera/dev/freud/src/grammar/Css.g:108:10: ( ',' )?
int alt23 = 2;
int LA23_0 = input.LA(1);
if ((LA23_0 == 31)) {
alt23 = 1;
}
switch(alt23) {
case 1:
// /home/langera/dev/freud/src/grammar/Css.g:108:10: ','
{
char_literal58 = (Token) match(input, 31, FOLLOW_31_in_args648);
stream_31.add(char_literal58);
}
break;
}
pushFollow(FOLLOW_expr_in_args651);
expr59 = expr();
state._fsp--;
stream_expr.add(expr59.getTree());
}
break;
default:
break loop24;
}
} while (true);
// AST REWRITE
// elements: expr
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 108:22: -> ( expr )*
{
// /home/langera/dev/freud/src/grammar/Css.g:108:25: ( expr )*
while (stream_expr.hasNext()) {
adaptor.addChild(root_0, stream_expr.nextTree());
}
stream_expr.reset();
}
retval.tree = root_0;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
} catch (RecognitionException re) {
reportError(re);
recover(input, re);
retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
} finally {
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method statement.
// $ANTLR start "statement"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:842:1: statement : ( block | ASSERT expr1= expression ( COLON expr2= expression SEMI -> ^( ASSERT $expr1 $expr2) | SEMI -> ^( ASSERT $expr1) ) | IF parenthesizedExpression ifStat= statement ( ELSE elseStat= statement -> ^( IF parenthesizedExpression $ifStat $elseStat) | -> ^( IF parenthesizedExpression $ifStat) ) | FOR LPAREN ( forInit SEMI forCondition SEMI forUpdater RPAREN statement -> ^( FOR forInit forCondition forUpdater statement ) | localModifierList type IDENT COLON expression RPAREN statement -> ^( FOR_EACH[$FOR, \"FOR_EACH\"] localModifierList type IDENT expression statement ) ) | WHILE parenthesizedExpression statement -> ^( WHILE parenthesizedExpression statement ) | DO statement WHILE parenthesizedExpression SEMI -> ^( DO statement parenthesizedExpression ) | TRY block ( catches ( finallyClause )? | finallyClause ) -> ^( TRY block ( catches )? ( finallyClause )? ) | SWITCH parenthesizedExpression LCURLY switchBlockLabels RCURLY -> ^( SWITCH parenthesizedExpression switchBlockLabels ) | SYNCHRONIZED parenthesizedExpression block -> ^( SYNCHRONIZED parenthesizedExpression block ) | RETURN ( expression )? SEMI -> ^( RETURN ( expression )? ) | THROW expression SEMI -> ^( THROW expression ) | BREAK ( IDENT )? SEMI -> ^( BREAK ( IDENT )? ) | CONTINUE ( IDENT )? SEMI -> ^( CONTINUE ( IDENT )? ) | IDENT COLON statement -> ^( LABELED_STATEMENT IDENT statement ) | expression SEMI | SEMI );
public final JavaParser.statement_return statement() throws RecognitionException {
JavaParser.statement_return retval = new JavaParser.statement_return();
retval.start = input.LT(1);
int statement_StartIndex = input.index();
CommonTree root_0 = null;
Token ASSERT276 = null;
Token COLON277 = null;
Token SEMI278 = null;
Token SEMI279 = null;
Token IF280 = null;
Token ELSE282 = null;
Token FOR283 = null;
Token LPAREN284 = null;
Token SEMI286 = null;
Token SEMI288 = null;
Token RPAREN290 = null;
Token IDENT294 = null;
Token COLON295 = null;
Token RPAREN297 = null;
Token WHILE299 = null;
Token DO302 = null;
Token WHILE304 = null;
Token SEMI306 = null;
Token TRY307 = null;
Token SWITCH312 = null;
Token LCURLY314 = null;
Token RCURLY316 = null;
Token SYNCHRONIZED317 = null;
Token RETURN320 = null;
Token SEMI322 = null;
Token THROW323 = null;
Token SEMI325 = null;
Token BREAK326 = null;
Token IDENT327 = null;
Token SEMI328 = null;
Token CONTINUE329 = null;
Token IDENT330 = null;
Token SEMI331 = null;
Token IDENT332 = null;
Token COLON333 = null;
Token SEMI336 = null;
Token SEMI337 = null;
JavaParser.expression_return expr1 = null;
JavaParser.expression_return expr2 = null;
JavaParser.statement_return ifStat = null;
JavaParser.statement_return elseStat = null;
JavaParser.block_return block275 = null;
JavaParser.parenthesizedExpression_return parenthesizedExpression281 = null;
JavaParser.forInit_return forInit285 = null;
JavaParser.forCondition_return forCondition287 = null;
JavaParser.forUpdater_return forUpdater289 = null;
JavaParser.statement_return statement291 = null;
JavaParser.localModifierList_return localModifierList292 = null;
JavaParser.type_return type293 = null;
JavaParser.expression_return expression296 = null;
JavaParser.statement_return statement298 = null;
JavaParser.parenthesizedExpression_return parenthesizedExpression300 = null;
JavaParser.statement_return statement301 = null;
JavaParser.statement_return statement303 = null;
JavaParser.parenthesizedExpression_return parenthesizedExpression305 = null;
JavaParser.block_return block308 = null;
JavaParser.catches_return catches309 = null;
JavaParser.finallyClause_return finallyClause310 = null;
JavaParser.finallyClause_return finallyClause311 = null;
JavaParser.parenthesizedExpression_return parenthesizedExpression313 = null;
JavaParser.switchBlockLabels_return switchBlockLabels315 = null;
JavaParser.parenthesizedExpression_return parenthesizedExpression318 = null;
JavaParser.block_return block319 = null;
JavaParser.expression_return expression321 = null;
JavaParser.expression_return expression324 = null;
JavaParser.statement_return statement334 = null;
JavaParser.expression_return expression335 = null;
CommonTree ASSERT276_tree = null;
CommonTree COLON277_tree = null;
CommonTree SEMI278_tree = null;
CommonTree SEMI279_tree = null;
CommonTree IF280_tree = null;
CommonTree ELSE282_tree = null;
CommonTree FOR283_tree = null;
CommonTree LPAREN284_tree = null;
CommonTree SEMI286_tree = null;
CommonTree SEMI288_tree = null;
CommonTree RPAREN290_tree = null;
CommonTree IDENT294_tree = null;
CommonTree COLON295_tree = null;
CommonTree RPAREN297_tree = null;
CommonTree WHILE299_tree = null;
CommonTree DO302_tree = null;
CommonTree WHILE304_tree = null;
CommonTree SEMI306_tree = null;
CommonTree TRY307_tree = null;
CommonTree SWITCH312_tree = null;
CommonTree LCURLY314_tree = null;
CommonTree RCURLY316_tree = null;
CommonTree SYNCHRONIZED317_tree = null;
CommonTree RETURN320_tree = null;
CommonTree SEMI322_tree = null;
CommonTree THROW323_tree = null;
CommonTree SEMI325_tree = null;
CommonTree BREAK326_tree = null;
CommonTree IDENT327_tree = null;
CommonTree SEMI328_tree = null;
CommonTree CONTINUE329_tree = null;
CommonTree IDENT330_tree = null;
CommonTree SEMI331_tree = null;
CommonTree IDENT332_tree = null;
CommonTree COLON333_tree = null;
CommonTree SEMI336_tree = null;
CommonTree SEMI337_tree = null;
RewriteRuleTokenStream stream_COLON = new RewriteRuleTokenStream(adaptor, "token COLON");
RewriteRuleTokenStream stream_RPAREN = new RewriteRuleTokenStream(adaptor, "token RPAREN");
RewriteRuleTokenStream stream_SYNCHRONIZED = new RewriteRuleTokenStream(adaptor, "token SYNCHRONIZED");
RewriteRuleTokenStream stream_WHILE = new RewriteRuleTokenStream(adaptor, "token WHILE");
RewriteRuleTokenStream stream_CONTINUE = new RewriteRuleTokenStream(adaptor, "token CONTINUE");
RewriteRuleTokenStream stream_SWITCH = new RewriteRuleTokenStream(adaptor, "token SWITCH");
RewriteRuleTokenStream stream_RCURLY = new RewriteRuleTokenStream(adaptor, "token RCURLY");
RewriteRuleTokenStream stream_ELSE = new RewriteRuleTokenStream(adaptor, "token ELSE");
RewriteRuleTokenStream stream_RETURN = new RewriteRuleTokenStream(adaptor, "token RETURN");
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
RewriteRuleTokenStream stream_FOR = new RewriteRuleTokenStream(adaptor, "token FOR");
RewriteRuleTokenStream stream_DO = new RewriteRuleTokenStream(adaptor, "token DO");
RewriteRuleTokenStream stream_LCURLY = new RewriteRuleTokenStream(adaptor, "token LCURLY");
RewriteRuleTokenStream stream_SEMI = new RewriteRuleTokenStream(adaptor, "token SEMI");
RewriteRuleTokenStream stream_ASSERT = new RewriteRuleTokenStream(adaptor, "token ASSERT");
RewriteRuleTokenStream stream_BREAK = new RewriteRuleTokenStream(adaptor, "token BREAK");
RewriteRuleTokenStream stream_THROW = new RewriteRuleTokenStream(adaptor, "token THROW");
RewriteRuleTokenStream stream_TRY = new RewriteRuleTokenStream(adaptor, "token TRY");
RewriteRuleTokenStream stream_LPAREN = new RewriteRuleTokenStream(adaptor, "token LPAREN");
RewriteRuleTokenStream stream_IF = new RewriteRuleTokenStream(adaptor, "token IF");
RewriteRuleSubtreeStream stream_statement = new RewriteRuleSubtreeStream(adaptor, "rule statement");
RewriteRuleSubtreeStream stream_expression = new RewriteRuleSubtreeStream(adaptor, "rule expression");
RewriteRuleSubtreeStream stream_finallyClause = new RewriteRuleSubtreeStream(adaptor, "rule finallyClause");
RewriteRuleSubtreeStream stream_catches = new RewriteRuleSubtreeStream(adaptor, "rule catches");
RewriteRuleSubtreeStream stream_forUpdater = new RewriteRuleSubtreeStream(adaptor, "rule forUpdater");
RewriteRuleSubtreeStream stream_block = new RewriteRuleSubtreeStream(adaptor, "rule block");
RewriteRuleSubtreeStream stream_forCondition = new RewriteRuleSubtreeStream(adaptor, "rule forCondition");
RewriteRuleSubtreeStream stream_localModifierList = new RewriteRuleSubtreeStream(adaptor, "rule localModifierList");
RewriteRuleSubtreeStream stream_forInit = new RewriteRuleSubtreeStream(adaptor, "rule forInit");
RewriteRuleSubtreeStream stream_type = new RewriteRuleSubtreeStream(adaptor, "rule type");
RewriteRuleSubtreeStream stream_switchBlockLabels = new RewriteRuleSubtreeStream(adaptor, "rule switchBlockLabels");
RewriteRuleSubtreeStream stream_parenthesizedExpression = new RewriteRuleSubtreeStream(adaptor, "rule parenthesizedExpression");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 75)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:843:5: ( block | ASSERT expr1= expression ( COLON expr2= expression SEMI -> ^( ASSERT $expr1 $expr2) | SEMI -> ^( ASSERT $expr1) ) | IF parenthesizedExpression ifStat= statement ( ELSE elseStat= statement -> ^( IF parenthesizedExpression $ifStat $elseStat) | -> ^( IF parenthesizedExpression $ifStat) ) | FOR LPAREN ( forInit SEMI forCondition SEMI forUpdater RPAREN statement -> ^( FOR forInit forCondition forUpdater statement ) | localModifierList type IDENT COLON expression RPAREN statement -> ^( FOR_EACH[$FOR, \"FOR_EACH\"] localModifierList type IDENT expression statement ) ) | WHILE parenthesizedExpression statement -> ^( WHILE parenthesizedExpression statement ) | DO statement WHILE parenthesizedExpression SEMI -> ^( DO statement parenthesizedExpression ) | TRY block ( catches ( finallyClause )? | finallyClause ) -> ^( TRY block ( catches )? ( finallyClause )? ) | SWITCH parenthesizedExpression LCURLY switchBlockLabels RCURLY -> ^( SWITCH parenthesizedExpression switchBlockLabels ) | SYNCHRONIZED parenthesizedExpression block -> ^( SYNCHRONIZED parenthesizedExpression block ) | RETURN ( expression )? SEMI -> ^( RETURN ( expression )? ) | THROW expression SEMI -> ^( THROW expression ) | BREAK ( IDENT )? SEMI -> ^( BREAK ( IDENT )? ) | CONTINUE ( IDENT )? SEMI -> ^( CONTINUE ( IDENT )? ) | IDENT COLON statement -> ^( LABELED_STATEMENT IDENT statement ) | expression SEMI | SEMI )
int alt98 = 16;
alt98 = dfa98.predict(input);
switch(alt98) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:843:9: block
{
root_0 = (CommonTree) adaptor.nil();
pushFollow(FOLLOW_block_in_statement8543);
block275 = block();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, block275.getTree());
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:844:9: ASSERT expr1= expression ( COLON expr2= expression SEMI -> ^( ASSERT $expr1 $expr2) | SEMI -> ^( ASSERT $expr1) )
{
ASSERT276 = (Token) match(input, ASSERT, FOLLOW_ASSERT_in_statement8553);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_ASSERT.add(ASSERT276);
}
pushFollow(FOLLOW_expression_in_statement8557);
expr1 = expression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_expression.add(expr1.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:845:9: ( COLON expr2= expression SEMI -> ^( ASSERT $expr1 $expr2) | SEMI -> ^( ASSERT $expr1) )
int alt90 = 2;
int LA90_0 = input.LA(1);
if ((LA90_0 == COLON)) {
alt90 = 1;
} else if ((LA90_0 == SEMI)) {
alt90 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 90, 0, input);
throw nvae;
}
switch(alt90) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:845:13: COLON expr2= expression SEMI
{
COLON277 = (Token) match(input, COLON, FOLLOW_COLON_in_statement8571);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_COLON.add(COLON277);
}
pushFollow(FOLLOW_expression_in_statement8575);
expr2 = expression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_expression.add(expr2.getTree());
}
SEMI278 = (Token) match(input, SEMI, FOLLOW_SEMI_in_statement8577);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SEMI.add(SEMI278);
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
RewriteRuleSubtreeStream stream_expr1 = new RewriteRuleSubtreeStream(adaptor, "rule expr1", expr1 != null ? expr1.tree : null);
RewriteRuleSubtreeStream stream_expr2 = new RewriteRuleSubtreeStream(adaptor, "rule expr2", expr2 != null ? expr2.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 845:77: -> ^( ASSERT $expr1 $expr2)
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:845:81: ^( ASSERT $expr1 $expr2)
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_ASSERT.nextNode(), root_1);
adaptor.addChild(root_1, stream_expr1.nextTree());
adaptor.addChild(root_1, stream_expr2.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:846:13: SEMI
{
SEMI279 = (Token) match(input, SEMI, FOLLOW_SEMI_in_statement8640);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SEMI.add(SEMI279);
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
RewriteRuleSubtreeStream stream_expr1 = new RewriteRuleSubtreeStream(adaptor, "rule expr1", expr1 != null ? expr1.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 846:77: -> ^( ASSERT $expr1)
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:846:81: ^( ASSERT $expr1)
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_ASSERT.nextNode(), root_1);
adaptor.addChild(root_1, stream_expr1.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
}
}
break;
case 3:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:848:9: IF parenthesizedExpression ifStat= statement ( ELSE elseStat= statement -> ^( IF parenthesizedExpression $ifStat $elseStat) | -> ^( IF parenthesizedExpression $ifStat) )
{
IF280 = (Token) match(input, IF, FOLLOW_IF_in_statement8729);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IF.add(IF280);
}
pushFollow(FOLLOW_parenthesizedExpression_in_statement8731);
parenthesizedExpression281 = parenthesizedExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_parenthesizedExpression.add(parenthesizedExpression281.getTree());
}
pushFollow(FOLLOW_statement_in_statement8735);
ifStat = statement();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_statement.add(ifStat.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:849:9: ( ELSE elseStat= statement -> ^( IF parenthesizedExpression $ifStat $elseStat) | -> ^( IF parenthesizedExpression $ifStat) )
int alt91 = 2;
int LA91_0 = input.LA(1);
if ((LA91_0 == ELSE)) {
int LA91_1 = input.LA(2);
if ((synpred122_Java())) {
alt91 = 1;
} else if ((true)) {
alt91 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 91, 1, input);
throw nvae;
}
} else if ((LA91_0 == EOF || LA91_0 == AT || LA91_0 == DEC || LA91_0 == INC || LA91_0 == LCURLY || LA91_0 == LESS_THAN || LA91_0 == LOGICAL_NOT || (LA91_0 >= LPAREN && LA91_0 <= MINUS) || LA91_0 == NOT || LA91_0 == PLUS || LA91_0 == RCURLY || LA91_0 == SEMI || (LA91_0 >= ABSTRACT && LA91_0 <= CASE) || (LA91_0 >= CHAR && LA91_0 <= DOUBLE) || LA91_0 == ENUM || (LA91_0 >= FALSE && LA91_0 <= FINAL) || (LA91_0 >= FLOAT && LA91_0 <= IF) || LA91_0 == INTERFACE || (LA91_0 >= INT && LA91_0 <= NULL) || (LA91_0 >= PRIVATE && LA91_0 <= THROW) || (LA91_0 >= TRANSIENT && LA91_0 <= WHILE) || (LA91_0 >= IDENT && LA91_0 <= STRING_LITERAL))) {
alt91 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 91, 0, input);
throw nvae;
}
switch(alt91) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:849:13: ELSE elseStat= statement
{
ELSE282 = (Token) match(input, ELSE, FOLLOW_ELSE_in_statement8749);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_ELSE.add(ELSE282);
}
pushFollow(FOLLOW_statement_in_statement8753);
elseStat = statement();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_statement.add(elseStat.getTree());
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
RewriteRuleSubtreeStream stream_ifStat = new RewriteRuleSubtreeStream(adaptor, "rule ifStat", ifStat != null ? ifStat.tree : null);
RewriteRuleSubtreeStream stream_elseStat = new RewriteRuleSubtreeStream(adaptor, "rule elseStat", elseStat != null ? elseStat.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 849:77: -> ^( IF parenthesizedExpression $ifStat $elseStat)
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:849:81: ^( IF parenthesizedExpression $ifStat $elseStat)
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_IF.nextNode(), root_1);
adaptor.addChild(root_1, stream_parenthesizedExpression.nextTree());
adaptor.addChild(root_1, stream_ifStat.nextTree());
adaptor.addChild(root_1, stream_elseStat.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:850:77:
{
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
RewriteRuleSubtreeStream stream_ifStat = new RewriteRuleSubtreeStream(adaptor, "rule ifStat", ifStat != null ? ifStat.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 850:77: -> ^( IF parenthesizedExpression $ifStat)
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:850:81: ^( IF parenthesizedExpression $ifStat)
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_IF.nextNode(), root_1);
adaptor.addChild(root_1, stream_parenthesizedExpression.nextTree());
adaptor.addChild(root_1, stream_ifStat.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
}
}
break;
case 4:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:852:9: FOR LPAREN ( forInit SEMI forCondition SEMI forUpdater RPAREN statement -> ^( FOR forInit forCondition forUpdater statement ) | localModifierList type IDENT COLON expression RPAREN statement -> ^( FOR_EACH[$FOR, \"FOR_EACH\"] localModifierList type IDENT expression statement ) )
{
FOR283 = (Token) match(input, FOR, FOLLOW_FOR_in_statement8916);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_FOR.add(FOR283);
}
LPAREN284 = (Token) match(input, LPAREN, FOLLOW_LPAREN_in_statement8918);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LPAREN.add(LPAREN284);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:853:9: ( forInit SEMI forCondition SEMI forUpdater RPAREN statement -> ^( FOR forInit forCondition forUpdater statement ) | localModifierList type IDENT COLON expression RPAREN statement -> ^( FOR_EACH[$FOR, \"FOR_EACH\"] localModifierList type IDENT expression statement ) )
int alt92 = 2;
alt92 = dfa92.predict(input);
switch(alt92) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:853:13: forInit SEMI forCondition SEMI forUpdater RPAREN statement
{
pushFollow(FOLLOW_forInit_in_statement8932);
forInit285 = forInit();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_forInit.add(forInit285.getTree());
}
SEMI286 = (Token) match(input, SEMI, FOLLOW_SEMI_in_statement8934);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SEMI.add(SEMI286);
}
pushFollow(FOLLOW_forCondition_in_statement8936);
forCondition287 = forCondition();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_forCondition.add(forCondition287.getTree());
}
SEMI288 = (Token) match(input, SEMI, FOLLOW_SEMI_in_statement8938);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SEMI.add(SEMI288);
}
pushFollow(FOLLOW_forUpdater_in_statement8940);
forUpdater289 = forUpdater();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_forUpdater.add(forUpdater289.getTree());
}
RPAREN290 = (Token) match(input, RPAREN, FOLLOW_RPAREN_in_statement8942);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_RPAREN.add(RPAREN290);
}
pushFollow(FOLLOW_statement_in_statement8944);
statement291 = statement();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_statement.add(statement291.getTree());
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 853:77: -> ^( FOR forInit forCondition forUpdater statement )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:853:81: ^( FOR forInit forCondition forUpdater statement )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_FOR.nextNode(), root_1);
adaptor.addChild(root_1, stream_forInit.nextTree());
adaptor.addChild(root_1, stream_forCondition.nextTree());
adaptor.addChild(root_1, stream_forUpdater.nextTree());
adaptor.addChild(root_1, stream_statement.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:854:13: localModifierList type IDENT COLON expression RPAREN statement
{
pushFollow(FOLLOW_localModifierList_in_statement8978);
localModifierList292 = localModifierList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_localModifierList.add(localModifierList292.getTree());
}
pushFollow(FOLLOW_type_in_statement8980);
type293 = type();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_type.add(type293.getTree());
}
IDENT294 = (Token) match(input, IDENT, FOLLOW_IDENT_in_statement8982);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT294);
}
COLON295 = (Token) match(input, COLON, FOLLOW_COLON_in_statement8984);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_COLON.add(COLON295);
}
pushFollow(FOLLOW_expression_in_statement8986);
expression296 = expression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_expression.add(expression296.getTree());
}
RPAREN297 = (Token) match(input, RPAREN, FOLLOW_RPAREN_in_statement8988);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_RPAREN.add(RPAREN297);
}
pushFollow(FOLLOW_statement_in_statement8990);
statement298 = statement();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_statement.add(statement298.getTree());
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 855:77: -> ^( FOR_EACH[$FOR, \"FOR_EACH\"] localModifierList type IDENT expression statement )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:855:81: ^( FOR_EACH[$FOR, \"FOR_EACH\"] localModifierList type IDENT expression statement )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(FOR_EACH, FOR283, "FOR_EACH"), root_1);
adaptor.addChild(root_1, stream_localModifierList.nextTree());
adaptor.addChild(root_1, stream_type.nextTree());
adaptor.addChild(root_1, stream_IDENT.nextNode());
adaptor.addChild(root_1, stream_expression.nextTree());
adaptor.addChild(root_1, stream_statement.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
}
}
break;
case 5:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:857:9: WHILE parenthesizedExpression statement
{
WHILE299 = (Token) match(input, WHILE, FOLLOW_WHILE_in_statement9104);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_WHILE.add(WHILE299);
}
pushFollow(FOLLOW_parenthesizedExpression_in_statement9106);
parenthesizedExpression300 = parenthesizedExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_parenthesizedExpression.add(parenthesizedExpression300.getTree());
}
pushFollow(FOLLOW_statement_in_statement9108);
statement301 = statement();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_statement.add(statement301.getTree());
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 857:77: -> ^( WHILE parenthesizedExpression statement )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:857:81: ^( WHILE parenthesizedExpression statement )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_WHILE.nextNode(), root_1);
adaptor.addChild(root_1, stream_parenthesizedExpression.nextTree());
adaptor.addChild(root_1, stream_statement.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 6:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:858:9: DO statement WHILE parenthesizedExpression SEMI
{
DO302 = (Token) match(input, DO, FOLLOW_DO_in_statement9157);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_DO.add(DO302);
}
pushFollow(FOLLOW_statement_in_statement9159);
statement303 = statement();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_statement.add(statement303.getTree());
}
WHILE304 = (Token) match(input, WHILE, FOLLOW_WHILE_in_statement9161);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_WHILE.add(WHILE304);
}
pushFollow(FOLLOW_parenthesizedExpression_in_statement9163);
parenthesizedExpression305 = parenthesizedExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_parenthesizedExpression.add(parenthesizedExpression305.getTree());
}
SEMI306 = (Token) match(input, SEMI, FOLLOW_SEMI_in_statement9165);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SEMI.add(SEMI306);
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 858:77: -> ^( DO statement parenthesizedExpression )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:858:81: ^( DO statement parenthesizedExpression )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_DO.nextNode(), root_1);
adaptor.addChild(root_1, stream_statement.nextTree());
adaptor.addChild(root_1, stream_parenthesizedExpression.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 7:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:859:9: TRY block ( catches ( finallyClause )? | finallyClause )
{
TRY307 = (Token) match(input, TRY, FOLLOW_TRY_in_statement9206);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_TRY.add(TRY307);
}
pushFollow(FOLLOW_block_in_statement9208);
block308 = block();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_block.add(block308.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:859:19: ( catches ( finallyClause )? | finallyClause )
int alt94 = 2;
int LA94_0 = input.LA(1);
if ((LA94_0 == CATCH)) {
alt94 = 1;
} else if ((LA94_0 == FINALLY)) {
alt94 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 94, 0, input);
throw nvae;
}
switch(alt94) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:859:20: catches ( finallyClause )?
{
pushFollow(FOLLOW_catches_in_statement9211);
catches309 = catches();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_catches.add(catches309.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:859:28: ( finallyClause )?
int alt93 = 2;
int LA93_0 = input.LA(1);
if ((LA93_0 == FINALLY)) {
alt93 = 1;
}
switch(alt93) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: finallyClause
{
pushFollow(FOLLOW_finallyClause_in_statement9213);
finallyClause310 = finallyClause();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_finallyClause.add(finallyClause310.getTree());
}
}
break;
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:859:45: finallyClause
{
pushFollow(FOLLOW_finallyClause_in_statement9218);
finallyClause311 = finallyClause();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_finallyClause.add(finallyClause311.getTree());
}
}
break;
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 859:77: -> ^( TRY block ( catches )? ( finallyClause )? )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:859:81: ^( TRY block ( catches )? ( finallyClause )? )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_TRY.nextNode(), root_1);
adaptor.addChild(root_1, stream_block.nextTree());
// /home/langera/dev/freud/trunk/src/grammar/Java.g:859:93: ( catches )?
if (stream_catches.hasNext()) {
adaptor.addChild(root_1, stream_catches.nextTree());
}
stream_catches.reset();
// /home/langera/dev/freud/trunk/src/grammar/Java.g:859:102: ( finallyClause )?
if (stream_finallyClause.hasNext()) {
adaptor.addChild(root_1, stream_finallyClause.nextTree());
}
stream_finallyClause.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 8:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:860:9: SWITCH parenthesizedExpression LCURLY switchBlockLabels RCURLY
{
SWITCH312 = (Token) match(input, SWITCH, FOLLOW_SWITCH_in_statement9261);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SWITCH.add(SWITCH312);
}
pushFollow(FOLLOW_parenthesizedExpression_in_statement9263);
parenthesizedExpression313 = parenthesizedExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_parenthesizedExpression.add(parenthesizedExpression313.getTree());
}
LCURLY314 = (Token) match(input, LCURLY, FOLLOW_LCURLY_in_statement9265);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LCURLY.add(LCURLY314);
}
pushFollow(FOLLOW_switchBlockLabels_in_statement9267);
switchBlockLabels315 = switchBlockLabels();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_switchBlockLabels.add(switchBlockLabels315.getTree());
}
RCURLY316 = (Token) match(input, RCURLY, FOLLOW_RCURLY_in_statement9269);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_RCURLY.add(RCURLY316);
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 860:77: -> ^( SWITCH parenthesizedExpression switchBlockLabels )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:860:81: ^( SWITCH parenthesizedExpression switchBlockLabels )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_SWITCH.nextNode(), root_1);
adaptor.addChild(root_1, stream_parenthesizedExpression.nextTree());
adaptor.addChild(root_1, stream_switchBlockLabels.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 9:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:861:9: SYNCHRONIZED parenthesizedExpression block
{
SYNCHRONIZED317 = (Token) match(input, SYNCHRONIZED, FOLLOW_SYNCHRONIZED_in_statement9295);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SYNCHRONIZED.add(SYNCHRONIZED317);
}
pushFollow(FOLLOW_parenthesizedExpression_in_statement9297);
parenthesizedExpression318 = parenthesizedExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_parenthesizedExpression.add(parenthesizedExpression318.getTree());
}
pushFollow(FOLLOW_block_in_statement9299);
block319 = block();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_block.add(block319.getTree());
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 861:77: -> ^( SYNCHRONIZED parenthesizedExpression block )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:861:81: ^( SYNCHRONIZED parenthesizedExpression block )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_SYNCHRONIZED.nextNode(), root_1);
adaptor.addChild(root_1, stream_parenthesizedExpression.nextTree());
adaptor.addChild(root_1, stream_block.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 10:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:862:9: RETURN ( expression )? SEMI
{
RETURN320 = (Token) match(input, RETURN, FOLLOW_RETURN_in_statement9345);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_RETURN.add(RETURN320);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:862:16: ( expression )?
int alt95 = 2;
int LA95_0 = input.LA(1);
if ((LA95_0 == DEC || LA95_0 == INC || LA95_0 == LESS_THAN || LA95_0 == LOGICAL_NOT || (LA95_0 >= LPAREN && LA95_0 <= MINUS) || LA95_0 == NOT || LA95_0 == PLUS || LA95_0 == BOOLEAN || LA95_0 == BYTE || LA95_0 == CHAR || LA95_0 == DOUBLE || LA95_0 == FALSE || LA95_0 == FLOAT || (LA95_0 >= INT && LA95_0 <= LONG) || (LA95_0 >= NEW && LA95_0 <= NULL) || LA95_0 == SHORT || LA95_0 == SUPER || LA95_0 == THIS || LA95_0 == TRUE || LA95_0 == VOID || (LA95_0 >= IDENT && LA95_0 <= STRING_LITERAL))) {
alt95 = 1;
}
switch(alt95) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: expression
{
pushFollow(FOLLOW_expression_in_statement9347);
expression321 = expression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_expression.add(expression321.getTree());
}
}
break;
}
SEMI322 = (Token) match(input, SEMI, FOLLOW_SEMI_in_statement9350);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SEMI.add(SEMI322);
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 862:77: -> ^( RETURN ( expression )? )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:862:81: ^( RETURN ( expression )? )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_RETURN.nextNode(), root_1);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:862:90: ( expression )?
if (stream_expression.hasNext()) {
adaptor.addChild(root_1, stream_expression.nextTree());
}
stream_expression.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 11:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:863:9: THROW expression SEMI
{
THROW323 = (Token) match(input, THROW, FOLLOW_THROW_in_statement9414);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_THROW.add(THROW323);
}
pushFollow(FOLLOW_expression_in_statement9416);
expression324 = expression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_expression.add(expression324.getTree());
}
SEMI325 = (Token) match(input, SEMI, FOLLOW_SEMI_in_statement9418);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SEMI.add(SEMI325);
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 863:77: -> ^( THROW expression )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:863:81: ^( THROW expression )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_THROW.nextNode(), root_1);
adaptor.addChild(root_1, stream_expression.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 12:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:864:9: BREAK ( IDENT )? SEMI
{
BREAK326 = (Token) match(input, BREAK, FOLLOW_BREAK_in_statement9483);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_BREAK.add(BREAK326);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:864:15: ( IDENT )?
int alt96 = 2;
int LA96_0 = input.LA(1);
if ((LA96_0 == IDENT)) {
alt96 = 1;
}
switch(alt96) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: IDENT
{
IDENT327 = (Token) match(input, IDENT, FOLLOW_IDENT_in_statement9485);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT327);
}
}
break;
}
SEMI328 = (Token) match(input, SEMI, FOLLOW_SEMI_in_statement9488);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SEMI.add(SEMI328);
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 864:77: -> ^( BREAK ( IDENT )? )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:864:81: ^( BREAK ( IDENT )? )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_BREAK.nextNode(), root_1);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:864:89: ( IDENT )?
if (stream_IDENT.hasNext()) {
adaptor.addChild(root_1, stream_IDENT.nextNode());
}
stream_IDENT.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 13:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:865:9: CONTINUE ( IDENT )? SEMI
{
CONTINUE329 = (Token) match(input, CONTINUE, FOLLOW_CONTINUE_in_statement9558);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_CONTINUE.add(CONTINUE329);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:865:18: ( IDENT )?
int alt97 = 2;
int LA97_0 = input.LA(1);
if ((LA97_0 == IDENT)) {
alt97 = 1;
}
switch(alt97) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: IDENT
{
IDENT330 = (Token) match(input, IDENT, FOLLOW_IDENT_in_statement9560);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT330);
}
}
break;
}
SEMI331 = (Token) match(input, SEMI, FOLLOW_SEMI_in_statement9563);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SEMI.add(SEMI331);
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 865:77: -> ^( CONTINUE ( IDENT )? )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:865:81: ^( CONTINUE ( IDENT )? )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_CONTINUE.nextNode(), root_1);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:865:92: ( IDENT )?
if (stream_IDENT.hasNext()) {
adaptor.addChild(root_1, stream_IDENT.nextNode());
}
stream_IDENT.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 14:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:866:9: IDENT COLON statement
{
IDENT332 = (Token) match(input, IDENT, FOLLOW_IDENT_in_statement9630);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT332);
}
COLON333 = (Token) match(input, COLON, FOLLOW_COLON_in_statement9632);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_COLON.add(COLON333);
}
pushFollow(FOLLOW_statement_in_statement9634);
statement334 = statement();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_statement.add(statement334.getTree());
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 866:77: -> ^( LABELED_STATEMENT IDENT statement )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:866:81: ^( LABELED_STATEMENT IDENT statement )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(LABELED_STATEMENT, "LABELED_STATEMENT"), root_1);
adaptor.addChild(root_1, stream_IDENT.nextNode());
adaptor.addChild(root_1, stream_statement.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 15:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:867:9: expression SEMI
{
root_0 = (CommonTree) adaptor.nil();
pushFollow(FOLLOW_expression_in_statement9701);
expression335 = expression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, expression335.getTree());
}
SEMI336 = (Token) match(input, SEMI, FOLLOW_SEMI_in_statement9703);
if (state.failed) {
return retval;
}
}
break;
case 16:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:868:9: SEMI
{
root_0 = (CommonTree) adaptor.nil();
SEMI337 = (Token) match(input, SEMI, FOLLOW_SEMI_in_statement9714);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
SEMI337_tree = (CommonTree) adaptor.create(SEMI337);
adaptor.addChild(root_0, SEMI337_tree);
}
}
break;
}
retval.stop = input.LT(-1);
if (state.backtracking == 0) {
retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
} catch (RecognitionException re) {
reportError(re);
recover(input, re);
retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
} finally {
if (state.backtracking > 0) {
memoize(input, 75, statement_StartIndex);
}
}
return retval;
}
Aggregations