use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project binnavi by google.
the class FilterParser method primaryExpression.
// $ANTLR start "primaryExpression"
// C:\\Dokumente und
// Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:30:1:
// primaryExpression : ( PREDICATE | '(' expression ')' -> ^( SUB_EXPRESSION expression ) );
public final FilterParser.primaryExpression_return primaryExpression() throws RecognitionException {
final FilterParser.primaryExpression_return retval = new FilterParser.primaryExpression_return();
retval.start = input.LT(1);
Object root_0 = null;
Token PREDICATE8 = null;
Token char_literal9 = null;
Token char_literal11 = null;
FilterParser.expression_return expression10 = null;
Object PREDICATE8_tree = null;
final Object char_literal9_tree = null;
final Object char_literal11_tree = null;
final RewriteRuleTokenStream stream_10 = new RewriteRuleTokenStream(adaptor, "token 10");
final RewriteRuleTokenStream stream_9 = new RewriteRuleTokenStream(adaptor, "token 9");
final RewriteRuleSubtreeStream stream_expression = new RewriteRuleSubtreeStream(adaptor, "rule expression");
try {
// C:\\Dokumente und
// Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:31:3:
// ( PREDICATE | '(' expression ')' -> ^( SUB_EXPRESSION expression ) )
int alt3 = 2;
final int LA3_0 = input.LA(1);
if ((LA3_0 == PREDICATE)) {
alt3 = 1;
} else if ((LA3_0 == 9)) {
alt3 = 2;
} else {
final NoViableAltException nvae = new NoViableAltException("", 3, 0, input);
throw nvae;
}
switch(alt3) {
case 1:
// C:\\Dokumente und
// Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:31:5:
// PREDICATE
{
root_0 = adaptor.nil();
PREDICATE8 = (Token) match(input, PREDICATE, FOLLOW_PREDICATE_in_primaryExpression183);
PREDICATE8_tree = adaptor.create(PREDICATE8);
adaptor.addChild(root_0, PREDICATE8_tree);
}
break;
case 2:
// C:\\Dokumente und
// Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:32:5:
// '(' expression ')'
{
char_literal9 = (Token) match(input, 9, FOLLOW_9_in_primaryExpression189);
stream_9.add(char_literal9);
pushFollow(FOLLOW_expression_in_primaryExpression191);
expression10 = expression();
state._fsp--;
stream_expression.add(expression10.getTree());
char_literal11 = (Token) match(input, 10, FOLLOW_10_in_primaryExpression193);
stream_10.add(char_literal11);
// AST REWRITE
// elements: expression
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
final RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = adaptor.nil();
// 32:24: -> ^( SUB_EXPRESSION expression )
{
// C:\\Dokumente und
// Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\filter\\Filter.g:32:27:
// ^( SUB_EXPRESSION expression )
{
Object root_1 = adaptor.nil();
root_1 = adaptor.becomeRoot(adaptor.create(SUB_EXPRESSION, "SUB_EXPRESSION"), root_1);
adaptor.addChild(root_1, stream_expression.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
}
retval.stop = input.LT(-1);
retval.tree = adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
} catch (final RecognitionException re) {
reportError(re);
recover(input, re);
retval.tree = adaptor.errorNode(input, retval.start, input.LT(-1), re);
} finally {
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project binnavi by google.
the class MemoryExpressionParser method primaryExpression.
// $ANTLR end "multExpression"
// $ANTLR start "primaryExpression"
// C:\\Dokumente und
// Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:46:1:
// primaryExpression : ( REGISTER | NUMBER | HEX_NUMBER | '[' expression ']' -> ^( MEM_EXPRESSION
// expression ) | '(' expression ')' -> ^( SUB_EXPRESSION expression ) );
public final MemoryExpressionParser.primaryExpression_return primaryExpression() throws RecognitionException {
final MemoryExpressionParser.primaryExpression_return retval = new MemoryExpressionParser.primaryExpression_return();
retval.start = input.LT(1);
Object root_0 = null;
Token REGISTER11 = null;
Token NUMBER12 = null;
Token HEX_NUMBER13 = null;
Token char_literal14 = null;
Token char_literal16 = null;
Token char_literal17 = null;
Token char_literal19 = null;
MemoryExpressionParser.expression_return expression15 = null;
MemoryExpressionParser.expression_return expression18 = null;
Object REGISTER11_tree = null;
Object NUMBER12_tree = null;
Object HEX_NUMBER13_tree = null;
final Object char_literal14_tree = null;
final Object char_literal16_tree = null;
final Object char_literal17_tree = null;
final Object char_literal19_tree = null;
final RewriteRuleTokenStream stream_21 = new RewriteRuleTokenStream(adaptor, "token 21");
final RewriteRuleTokenStream stream_20 = new RewriteRuleTokenStream(adaptor, "token 20");
final RewriteRuleTokenStream stream_19 = new RewriteRuleTokenStream(adaptor, "token 19");
final RewriteRuleTokenStream stream_18 = new RewriteRuleTokenStream(adaptor, "token 18");
final RewriteRuleSubtreeStream stream_expression = new RewriteRuleSubtreeStream(adaptor, "rule expression");
try {
// C:\\Dokumente und
// Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:47:3:
// ( REGISTER | NUMBER | HEX_NUMBER | '[' expression ']' -> ^( MEM_EXPRESSION expression ) |
// '(' expression ')' -> ^( SUB_EXPRESSION expression ) )
int alt4 = 5;
switch(input.LA(1)) {
case REGISTER:
{
alt4 = 1;
}
break;
case NUMBER:
{
alt4 = 2;
}
break;
case HEX_NUMBER:
{
alt4 = 3;
}
break;
case 18:
{
alt4 = 4;
}
break;
case 20:
{
alt4 = 5;
}
break;
default:
final NoViableAltException nvae = new NoViableAltException("", 4, 0, input);
throw nvae;
}
switch(alt4) {
case 1:
// C:\\Dokumente und
// Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:47:5:
// REGISTER
{
root_0 = (Object) adaptor.nil();
REGISTER11 = (Token) match(input, REGISTER, FOLLOW_REGISTER_in_primaryExpression260);
REGISTER11_tree = (Object) adaptor.create(REGISTER11);
adaptor.addChild(root_0, REGISTER11_tree);
}
break;
case 2:
// C:\\Dokumente und
// Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:48:5:
// NUMBER
{
root_0 = (Object) adaptor.nil();
NUMBER12 = (Token) match(input, NUMBER, FOLLOW_NUMBER_in_primaryExpression266);
NUMBER12_tree = (Object) adaptor.create(NUMBER12);
adaptor.addChild(root_0, NUMBER12_tree);
}
break;
case 3:
// C:\\Dokumente und
// Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:49:5:
// HEX_NUMBER
{
root_0 = (Object) adaptor.nil();
HEX_NUMBER13 = (Token) match(input, HEX_NUMBER, FOLLOW_HEX_NUMBER_in_primaryExpression272);
HEX_NUMBER13_tree = (Object) adaptor.create(HEX_NUMBER13);
adaptor.addChild(root_0, HEX_NUMBER13_tree);
}
break;
case 4:
// C:\\Dokumente und
// Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:50:5:
// '[' expression ']'
{
char_literal14 = (Token) match(input, 18, FOLLOW_18_in_primaryExpression278);
stream_18.add(char_literal14);
pushFollow(FOLLOW_expression_in_primaryExpression280);
expression15 = expression();
state._fsp--;
stream_expression.add(expression15.getTree());
char_literal16 = (Token) match(input, 19, FOLLOW_19_in_primaryExpression282);
stream_19.add(char_literal16);
// AST REWRITE
// elements: expression
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
final RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (Object) adaptor.nil();
// 50:24: -> ^( MEM_EXPRESSION expression )
{
// C:\\Dokumente und
// Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:50:27:
// ^( MEM_EXPRESSION expression )
{
Object root_1 = (Object) adaptor.nil();
root_1 = (Object) adaptor.becomeRoot((Object) adaptor.create(MEM_EXPRESSION, "MEM_EXPRESSION"), root_1);
adaptor.addChild(root_1, stream_expression.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
case 5:
// C:\\Dokumente und
// Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:51:5:
// '(' expression ')'
{
char_literal17 = (Token) match(input, 20, FOLLOW_20_in_primaryExpression296);
stream_20.add(char_literal17);
pushFollow(FOLLOW_expression_in_primaryExpression298);
expression18 = expression();
state._fsp--;
stream_expression.add(expression18.getTree());
char_literal19 = (Token) match(input, 21, FOLLOW_21_in_primaryExpression300);
stream_21.add(char_literal19);
// AST REWRITE
// elements: expression
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
final RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (Object) adaptor.nil();
// 51:24: -> ^( SUB_EXPRESSION expression )
{
// C:\\Dokumente und
// Einstellungen\\sp\\workspace\\com.google.security.zynamics.binnavi-Trunk\\src\\com.google.security.zynamics.binnavi\\parsers\\gotomem\\MemoryExpression.g:51:27:
// ^( SUB_EXPRESSION expression )
{
Object root_1 = (Object) adaptor.nil();
root_1 = (Object) adaptor.becomeRoot((Object) adaptor.create(SUB_EXPRESSION, "SUB_EXPRESSION"), root_1);
adaptor.addChild(root_1, stream_expression.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
}
retval.stop = input.LT(-1);
retval.tree = (Object) adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
} catch (final RecognitionException e) {
throw e;
} finally {
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream 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.RewriteRuleSubtreeStream 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.RewriteRuleSubtreeStream 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;
}
Aggregations