use of org.antlr.runtime.tree.RewriteRuleTokenStream in project freud by LMAX-Exchange.
the class JavaParser method arrayInitializer.
// $ANTLR start "arrayInitializer"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:608:1: arrayInitializer : LCURLY ( variableInitializer ( COMMA variableInitializer )* ( COMMA )? )? RCURLY -> ^( ARRAY_INITIALIZER[$LCURLY, \"ARRAY_INITIALIZER\"] ( variableInitializer )* ) ;
public final JavaParser.arrayInitializer_return arrayInitializer() throws RecognitionException {
JavaParser.arrayInitializer_return retval = new JavaParser.arrayInitializer_return();
retval.start = input.LT(1);
int arrayInitializer_StartIndex = input.index();
CommonTree root_0 = null;
Token LCURLY143 = null;
Token COMMA145 = null;
Token COMMA147 = null;
Token RCURLY148 = null;
JavaParser.variableInitializer_return variableInitializer144 = null;
JavaParser.variableInitializer_return variableInitializer146 = null;
CommonTree LCURLY143_tree = null;
CommonTree COMMA145_tree = null;
CommonTree COMMA147_tree = null;
CommonTree RCURLY148_tree = null;
RewriteRuleTokenStream stream_LCURLY = new RewriteRuleTokenStream(adaptor, "token LCURLY");
RewriteRuleTokenStream stream_COMMA = new RewriteRuleTokenStream(adaptor, "token COMMA");
RewriteRuleTokenStream stream_RCURLY = new RewriteRuleTokenStream(adaptor, "token RCURLY");
RewriteRuleSubtreeStream stream_variableInitializer = new RewriteRuleSubtreeStream(adaptor, "rule variableInitializer");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 35)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:609:5: ( LCURLY ( variableInitializer ( COMMA variableInitializer )* ( COMMA )? )? RCURLY -> ^( ARRAY_INITIALIZER[$LCURLY, \"ARRAY_INITIALIZER\"] ( variableInitializer )* ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:609:9: LCURLY ( variableInitializer ( COMMA variableInitializer )* ( COMMA )? )? RCURLY
{
LCURLY143 = (Token) match(input, LCURLY, FOLLOW_LCURLY_in_arrayInitializer6527);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LCURLY.add(LCURLY143);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:609:16: ( variableInitializer ( COMMA variableInitializer )* ( COMMA )? )?
int alt53 = 2;
int LA53_0 = input.LA(1);
if ((LA53_0 == DEC || LA53_0 == INC || LA53_0 == LCURLY || LA53_0 == LESS_THAN || LA53_0 == LOGICAL_NOT || (LA53_0 >= LPAREN && LA53_0 <= MINUS) || LA53_0 == NOT || LA53_0 == PLUS || LA53_0 == BOOLEAN || LA53_0 == BYTE || LA53_0 == CHAR || LA53_0 == DOUBLE || LA53_0 == FALSE || LA53_0 == FLOAT || (LA53_0 >= INT && LA53_0 <= LONG) || (LA53_0 >= NEW && LA53_0 <= NULL) || LA53_0 == SHORT || LA53_0 == SUPER || LA53_0 == THIS || LA53_0 == TRUE || LA53_0 == VOID || (LA53_0 >= IDENT && LA53_0 <= STRING_LITERAL))) {
alt53 = 1;
}
switch(alt53) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:609:17: variableInitializer ( COMMA variableInitializer )* ( COMMA )?
{
pushFollow(FOLLOW_variableInitializer_in_arrayInitializer6530);
variableInitializer144 = variableInitializer();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_variableInitializer.add(variableInitializer144.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:609:37: ( COMMA variableInitializer )*
loop51: do {
int alt51 = 2;
int LA51_0 = input.LA(1);
if ((LA51_0 == COMMA)) {
int LA51_1 = input.LA(2);
if ((LA51_1 == DEC || LA51_1 == INC || LA51_1 == LCURLY || LA51_1 == LESS_THAN || LA51_1 == LOGICAL_NOT || (LA51_1 >= LPAREN && LA51_1 <= MINUS) || LA51_1 == NOT || LA51_1 == PLUS || LA51_1 == BOOLEAN || LA51_1 == BYTE || LA51_1 == CHAR || LA51_1 == DOUBLE || LA51_1 == FALSE || LA51_1 == FLOAT || (LA51_1 >= INT && LA51_1 <= LONG) || (LA51_1 >= NEW && LA51_1 <= NULL) || LA51_1 == SHORT || LA51_1 == SUPER || LA51_1 == THIS || LA51_1 == TRUE || LA51_1 == VOID || (LA51_1 >= IDENT && LA51_1 <= STRING_LITERAL))) {
alt51 = 1;
}
}
switch(alt51) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:609:38: COMMA variableInitializer
{
COMMA145 = (Token) match(input, COMMA, FOLLOW_COMMA_in_arrayInitializer6533);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_COMMA.add(COMMA145);
}
pushFollow(FOLLOW_variableInitializer_in_arrayInitializer6535);
variableInitializer146 = variableInitializer();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_variableInitializer.add(variableInitializer146.getTree());
}
}
break;
default:
break loop51;
}
} while (true);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:609:66: ( COMMA )?
int alt52 = 2;
int LA52_0 = input.LA(1);
if ((LA52_0 == COMMA)) {
alt52 = 1;
}
switch(alt52) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: COMMA
{
COMMA147 = (Token) match(input, COMMA, FOLLOW_COMMA_in_arrayInitializer6539);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_COMMA.add(COMMA147);
}
}
break;
}
}
break;
}
RCURLY148 = (Token) match(input, RCURLY, FOLLOW_RCURLY_in_arrayInitializer6544);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_RCURLY.add(RCURLY148);
}
// 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();
// 610:9: -> ^( ARRAY_INITIALIZER[$LCURLY, \"ARRAY_INITIALIZER\"] ( variableInitializer )* )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:610:13: ^( ARRAY_INITIALIZER[$LCURLY, \"ARRAY_INITIALIZER\"] ( variableInitializer )* )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ARRAY_INITIALIZER, LCURLY143, "ARRAY_INITIALIZER"), root_1);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:610:63: ( variableInitializer )*
while (stream_variableInitializer.hasNext()) {
adaptor.addChild(root_1, stream_variableInitializer.nextTree());
}
stream_variableInitializer.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
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, 35, arrayInitializer_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleTokenStream in project freud by LMAX-Exchange.
the class JavaParser method block.
// $ANTLR start "block"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:825:1: block : LCURLY ( blockStatement )* RCURLY -> ^( BLOCK_SCOPE[$LCURLY, \"BLOCK_SCOPE\"] ( blockStatement )* ) ;
public final JavaParser.block_return block() throws RecognitionException {
JavaParser.block_return retval = new JavaParser.block_return();
retval.start = input.LT(1);
int block_StartIndex = input.index();
CommonTree root_0 = null;
Token LCURLY265 = null;
Token RCURLY267 = null;
JavaParser.blockStatement_return blockStatement266 = null;
CommonTree LCURLY265_tree = null;
CommonTree RCURLY267_tree = null;
RewriteRuleTokenStream stream_LCURLY = new RewriteRuleTokenStream(adaptor, "token LCURLY");
RewriteRuleTokenStream stream_RCURLY = new RewriteRuleTokenStream(adaptor, "token RCURLY");
RewriteRuleSubtreeStream stream_blockStatement = new RewriteRuleSubtreeStream(adaptor, "rule blockStatement");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 72)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:826:5: ( LCURLY ( blockStatement )* RCURLY -> ^( BLOCK_SCOPE[$LCURLY, \"BLOCK_SCOPE\"] ( blockStatement )* ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:826:9: LCURLY ( blockStatement )* RCURLY
{
LCURLY265 = (Token) match(input, LCURLY, FOLLOW_LCURLY_in_block8413);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LCURLY.add(LCURLY265);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:826:16: ( blockStatement )*
loop88: do {
int alt88 = 2;
int LA88_0 = input.LA(1);
if ((LA88_0 == AT || LA88_0 == DEC || LA88_0 == INC || LA88_0 == LCURLY || LA88_0 == LESS_THAN || LA88_0 == LOGICAL_NOT || (LA88_0 >= LPAREN && LA88_0 <= MINUS) || LA88_0 == NOT || LA88_0 == PLUS || LA88_0 == SEMI || (LA88_0 >= ABSTRACT && LA88_0 <= BYTE) || (LA88_0 >= CHAR && LA88_0 <= CONTINUE) || (LA88_0 >= DO && LA88_0 <= DOUBLE) || LA88_0 == ENUM || (LA88_0 >= FALSE && LA88_0 <= FINAL) || (LA88_0 >= FLOAT && LA88_0 <= IF) || LA88_0 == INTERFACE || (LA88_0 >= INT && LA88_0 <= NULL) || (LA88_0 >= PRIVATE && LA88_0 <= THROW) || (LA88_0 >= TRANSIENT && LA88_0 <= WHILE) || (LA88_0 >= IDENT && LA88_0 <= STRING_LITERAL))) {
alt88 = 1;
}
switch(alt88) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: blockStatement
{
pushFollow(FOLLOW_blockStatement_in_block8415);
blockStatement266 = blockStatement();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_blockStatement.add(blockStatement266.getTree());
}
}
break;
default:
break loop88;
}
} while (true);
RCURLY267 = (Token) match(input, RCURLY, FOLLOW_RCURLY_in_block8418);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_RCURLY.add(RCURLY267);
}
// 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();
// 827:9: -> ^( BLOCK_SCOPE[$LCURLY, \"BLOCK_SCOPE\"] ( blockStatement )* )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:827:13: ^( BLOCK_SCOPE[$LCURLY, \"BLOCK_SCOPE\"] ( blockStatement )* )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(BLOCK_SCOPE, LCURLY265, "BLOCK_SCOPE"), root_1);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:827:51: ( blockStatement )*
while (stream_blockStatement.hasNext()) {
adaptor.addChild(root_1, stream_blockStatement.nextTree());
}
stream_blockStatement.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
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, 72, block_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleTokenStream in project freud by LMAX-Exchange.
the class JavaParser method qualifiedIdentifier.
// $ANTLR start "qualifiedIdentifier"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:749:1: qualifiedIdentifier : ( IDENT -> IDENT ) ( DOT ident= IDENT -> ^( DOT $qualifiedIdentifier $ident) )* ;
public final JavaParser.qualifiedIdentifier_return qualifiedIdentifier() throws RecognitionException {
JavaParser.qualifiedIdentifier_return retval = new JavaParser.qualifiedIdentifier_return();
retval.start = input.LT(1);
int qualifiedIdentifier_StartIndex = input.index();
CommonTree root_0 = null;
Token ident = null;
Token IDENT220 = null;
Token DOT221 = null;
CommonTree ident_tree = null;
CommonTree IDENT220_tree = null;
CommonTree DOT221_tree = null;
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
RewriteRuleTokenStream stream_DOT = new RewriteRuleTokenStream(adaptor, "token DOT");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 59)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:750:5: ( ( IDENT -> IDENT ) ( DOT ident= IDENT -> ^( DOT $qualifiedIdentifier $ident) )* )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:750:9: ( IDENT -> IDENT ) ( DOT ident= IDENT -> ^( DOT $qualifiedIdentifier $ident) )*
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:750:9: ( IDENT -> IDENT )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:750:13: IDENT
{
IDENT220 = (Token) match(input, IDENT, FOLLOW_IDENT_in_qualifiedIdentifier7738);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT220);
}
// 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();
// 750:33: -> IDENT
{
adaptor.addChild(root_0, stream_IDENT.nextNode());
}
retval.tree = root_0;
}
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:752:9: ( DOT ident= IDENT -> ^( DOT $qualifiedIdentifier $ident) )*
loop75: do {
int alt75 = 2;
int LA75_0 = input.LA(1);
if ((LA75_0 == DOT)) {
int LA75_2 = input.LA(2);
if ((LA75_2 == IDENT)) {
int LA75_3 = input.LA(3);
if ((synpred102_Java())) {
alt75 = 1;
}
}
}
switch(alt75) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:752:13: DOT ident= IDENT
{
DOT221 = (Token) match(input, DOT, FOLLOW_DOT_in_qualifiedIdentifier7781);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_DOT.add(DOT221);
}
ident = (Token) match(input, IDENT, FOLLOW_IDENT_in_qualifiedIdentifier7785);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(ident);
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleTokenStream stream_ident = new RewriteRuleTokenStream(adaptor, "token ident", ident);
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 752:33: -> ^( DOT $qualifiedIdentifier $ident)
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:752:37: ^( DOT $qualifiedIdentifier $ident)
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_DOT.nextNode(), root_1);
adaptor.addChild(root_1, stream_retval.nextTree());
adaptor.addChild(root_1, stream_ident.nextNode());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
default:
break loop75;
}
} while (true);
}
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, 59, qualifiedIdentifier_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleTokenStream in project freud by LMAX-Exchange.
the class JavaParser method unaryExpressionRest.
// $ANTLR start "unaryExpressionRest"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1037:1: unaryExpressionRest : ( NOT unaryExpressionAll -> ^( NOT unaryExpressionAll ) | LOGICAL_NOT unaryExpressionAll -> ^( LOGICAL_NOT unaryExpressionAll ) | LPAREN simpleType RPAREN unaryExpressionAll -> ^( CAST_EXPR[$LPAREN, \"CAST_EXPR\"] simpleType unaryExpressionAll ) | LPAREN objectType RPAREN unaryExpressionRest -> ^( CAST_EXPR[$LPAREN, \"CAST_EXPR\"] objectType unaryExpressionRest ) | postfixedExpression );
public final JavaParser.unaryExpressionRest_return unaryExpressionRest() throws RecognitionException {
JavaParser.unaryExpressionRest_return retval = new JavaParser.unaryExpressionRest_return();
retval.start = input.LT(1);
int unaryExpressionRest_StartIndex = input.index();
CommonTree root_0 = null;
Token NOT436 = null;
Token LOGICAL_NOT438 = null;
Token LPAREN440 = null;
Token RPAREN442 = null;
Token LPAREN444 = null;
Token RPAREN446 = null;
JavaParser.unaryExpressionAll_return unaryExpressionAll437 = null;
JavaParser.unaryExpressionAll_return unaryExpressionAll439 = null;
JavaParser.simpleType_return simpleType441 = null;
JavaParser.unaryExpressionAll_return unaryExpressionAll443 = null;
JavaParser.objectType_return objectType445 = null;
JavaParser.unaryExpressionRest_return unaryExpressionRest447 = null;
JavaParser.postfixedExpression_return postfixedExpression448 = null;
CommonTree NOT436_tree = null;
CommonTree LOGICAL_NOT438_tree = null;
CommonTree LPAREN440_tree = null;
CommonTree RPAREN442_tree = null;
CommonTree LPAREN444_tree = null;
CommonTree RPAREN446_tree = null;
RewriteRuleTokenStream stream_RPAREN = new RewriteRuleTokenStream(adaptor, "token RPAREN");
RewriteRuleTokenStream stream_LOGICAL_NOT = new RewriteRuleTokenStream(adaptor, "token LOGICAL_NOT");
RewriteRuleTokenStream stream_NOT = new RewriteRuleTokenStream(adaptor, "token NOT");
RewriteRuleTokenStream stream_LPAREN = new RewriteRuleTokenStream(adaptor, "token LPAREN");
RewriteRuleSubtreeStream stream_simpleType = new RewriteRuleSubtreeStream(adaptor, "rule simpleType");
RewriteRuleSubtreeStream stream_unaryExpressionRest = new RewriteRuleSubtreeStream(adaptor, "rule unaryExpressionRest");
RewriteRuleSubtreeStream stream_objectType = new RewriteRuleSubtreeStream(adaptor, "rule objectType");
RewriteRuleSubtreeStream stream_unaryExpressionAll = new RewriteRuleSubtreeStream(adaptor, "rule unaryExpressionAll");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 103)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1038:5: ( NOT unaryExpressionAll -> ^( NOT unaryExpressionAll ) | LOGICAL_NOT unaryExpressionAll -> ^( LOGICAL_NOT unaryExpressionAll ) | LPAREN simpleType RPAREN unaryExpressionAll -> ^( CAST_EXPR[$LPAREN, \"CAST_EXPR\"] simpleType unaryExpressionAll ) | LPAREN objectType RPAREN unaryExpressionRest -> ^( CAST_EXPR[$LPAREN, \"CAST_EXPR\"] objectType unaryExpressionRest ) | postfixedExpression )
int alt128 = 5;
alt128 = dfa128.predict(input);
switch(alt128) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1038:9: NOT unaryExpressionAll
{
NOT436 = (Token) match(input, NOT, FOLLOW_NOT_in_unaryExpressionRest11393);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_NOT.add(NOT436);
}
pushFollow(FOLLOW_unaryExpressionAll_in_unaryExpressionRest11395);
unaryExpressionAll437 = unaryExpressionAll();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_unaryExpressionAll.add(unaryExpressionAll437.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();
// 1038:57: -> ^( NOT unaryExpressionAll )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1038:61: ^( NOT unaryExpressionAll )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_NOT.nextNode(), root_1);
adaptor.addChild(root_1, stream_unaryExpressionAll.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1039:9: LOGICAL_NOT unaryExpressionAll
{
LOGICAL_NOT438 = (Token) match(input, LOGICAL_NOT, FOLLOW_LOGICAL_NOT_in_unaryExpressionRest11439);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LOGICAL_NOT.add(LOGICAL_NOT438);
}
pushFollow(FOLLOW_unaryExpressionAll_in_unaryExpressionRest11441);
unaryExpressionAll439 = unaryExpressionAll();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_unaryExpressionAll.add(unaryExpressionAll439.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();
// 1039:57: -> ^( LOGICAL_NOT unaryExpressionAll )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1039:61: ^( LOGICAL_NOT unaryExpressionAll )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_LOGICAL_NOT.nextNode(), root_1);
adaptor.addChild(root_1, stream_unaryExpressionAll.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 3:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1040:9: LPAREN simpleType RPAREN unaryExpressionAll
{
LPAREN440 = (Token) match(input, LPAREN, FOLLOW_LPAREN_in_unaryExpressionRest11477);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LPAREN.add(LPAREN440);
}
pushFollow(FOLLOW_simpleType_in_unaryExpressionRest11479);
simpleType441 = simpleType();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_simpleType.add(simpleType441.getTree());
}
RPAREN442 = (Token) match(input, RPAREN, FOLLOW_RPAREN_in_unaryExpressionRest11481);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_RPAREN.add(RPAREN442);
}
pushFollow(FOLLOW_unaryExpressionAll_in_unaryExpressionRest11483);
unaryExpressionAll443 = unaryExpressionAll();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_unaryExpressionAll.add(unaryExpressionAll443.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();
// 1040:57: -> ^( CAST_EXPR[$LPAREN, \"CAST_EXPR\"] simpleType unaryExpressionAll )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1040:61: ^( CAST_EXPR[$LPAREN, \"CAST_EXPR\"] simpleType unaryExpressionAll )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(CAST_EXPR, LPAREN440, "CAST_EXPR"), root_1);
adaptor.addChild(root_1, stream_simpleType.nextTree());
adaptor.addChild(root_1, stream_unaryExpressionAll.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 4:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1041:9: LPAREN objectType RPAREN unaryExpressionRest
{
LPAREN444 = (Token) match(input, LPAREN, FOLLOW_LPAREN_in_unaryExpressionRest11509);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LPAREN.add(LPAREN444);
}
pushFollow(FOLLOW_objectType_in_unaryExpressionRest11511);
objectType445 = objectType();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_objectType.add(objectType445.getTree());
}
RPAREN446 = (Token) match(input, RPAREN, FOLLOW_RPAREN_in_unaryExpressionRest11513);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_RPAREN.add(RPAREN446);
}
pushFollow(FOLLOW_unaryExpressionRest_in_unaryExpressionRest11515);
unaryExpressionRest447 = unaryExpressionRest();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_unaryExpressionRest.add(unaryExpressionRest447.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();
// 1041:57: -> ^( CAST_EXPR[$LPAREN, \"CAST_EXPR\"] objectType unaryExpressionRest )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1041:61: ^( CAST_EXPR[$LPAREN, \"CAST_EXPR\"] objectType unaryExpressionRest )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(CAST_EXPR, LPAREN444, "CAST_EXPR"), root_1);
adaptor.addChild(root_1, stream_objectType.nextTree());
adaptor.addChild(root_1, stream_unaryExpressionRest.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 5:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1042:9: postfixedExpression
{
root_0 = (CommonTree) adaptor.nil();
pushFollow(FOLLOW_postfixedExpression_in_unaryExpressionRest11540);
postfixedExpression448 = postfixedExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, postfixedExpression448.getTree());
}
}
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, 103, unaryExpressionRest_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleTokenStream in project freud by LMAX-Exchange.
the class JavaParser method enumTypeDeclaration.
// $ANTLR start "enumTypeDeclaration"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:489:1: enumTypeDeclaration[CommonTree modifiers] : ENUM IDENT ( implementsClause )? enumBody -> ^( ENUM IDENT ( implementsClause )? enumBody ) ;
public final JavaParser.enumTypeDeclaration_return enumTypeDeclaration(CommonTree modifiers) throws RecognitionException {
JavaParser.enumTypeDeclaration_return retval = new JavaParser.enumTypeDeclaration_return();
retval.start = input.LT(1);
int enumTypeDeclaration_StartIndex = input.index();
CommonTree root_0 = null;
Token ENUM47 = null;
Token IDENT48 = null;
JavaParser.implementsClause_return implementsClause49 = null;
JavaParser.enumBody_return enumBody50 = null;
CommonTree ENUM47_tree = null;
CommonTree IDENT48_tree = null;
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
RewriteRuleTokenStream stream_ENUM = new RewriteRuleTokenStream(adaptor, "token ENUM");
RewriteRuleSubtreeStream stream_implementsClause = new RewriteRuleSubtreeStream(adaptor, "rule implementsClause");
RewriteRuleSubtreeStream stream_enumBody = new RewriteRuleSubtreeStream(adaptor, "rule enumBody");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 15)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:490:5: ( ENUM IDENT ( implementsClause )? enumBody -> ^( ENUM IDENT ( implementsClause )? enumBody ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:490:9: ENUM IDENT ( implementsClause )? enumBody
{
ENUM47 = (Token) match(input, ENUM, FOLLOW_ENUM_in_enumTypeDeclaration5196);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_ENUM.add(ENUM47);
}
IDENT48 = (Token) match(input, IDENT, FOLLOW_IDENT_in_enumTypeDeclaration5198);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT48);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:490:20: ( implementsClause )?
int alt15 = 2;
int LA15_0 = input.LA(1);
if ((LA15_0 == IMPLEMENTS)) {
alt15 = 1;
}
switch(alt15) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: implementsClause
{
pushFollow(FOLLOW_implementsClause_in_enumTypeDeclaration5200);
implementsClause49 = implementsClause();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_implementsClause.add(implementsClause49.getTree());
}
}
break;
}
pushFollow(FOLLOW_enumBody_in_enumTypeDeclaration5203);
enumBody50 = enumBody();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_enumBody.add(enumBody50.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();
// 491:9: -> ^( ENUM IDENT ( implementsClause )? enumBody )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:491:13: ^( ENUM IDENT ( implementsClause )? enumBody )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_ENUM.nextNode(), root_1);
adaptor.addChild(root_1, modifiers);
adaptor.addChild(root_1, stream_IDENT.nextNode());
// /home/langera/dev/freud/trunk/src/grammar/Java.g:491:39: ( implementsClause )?
if (stream_implementsClause.hasNext()) {
adaptor.addChild(root_1, stream_implementsClause.nextTree());
}
stream_implementsClause.reset();
adaptor.addChild(root_1, stream_enumBody.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
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, 15, enumTypeDeclaration_StartIndex);
}
}
return retval;
}
Aggregations