use of org.antlr.runtime.Token in project freud by LMAX-Exchange.
the class JavaParser method postfixedExpression.
// $ANTLR start "postfixedExpression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1045:1: postfixedExpression : ( primaryExpression -> primaryExpression ) (outerDot= DOT ( ( ( genericTypeArgumentListSimplified )? IDENT -> ^( DOT $postfixedExpression IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments ) )? | THIS -> ^( DOT $postfixedExpression THIS ) | Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] $postfixedExpression arguments ) | ( SUPER innerDot= DOT IDENT -> ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression arguments ) )? | innerNewExpression -> ^( DOT $postfixedExpression innerNewExpression ) ) | LBRACK expression RBRACK -> ^( ARRAY_ELEMENT_ACCESS $postfixedExpression expression ) )* ( INC -> ^( POST_INC[$INC, \"POST_INC\"] $postfixedExpression) | DEC -> ^( POST_DEC[$DEC, \"POST_DEC\"] $postfixedExpression) )? ;
public final JavaParser.postfixedExpression_return postfixedExpression() throws RecognitionException {
JavaParser.postfixedExpression_return retval = new JavaParser.postfixedExpression_return();
retval.start = input.LT(1);
int postfixedExpression_StartIndex = input.index();
CommonTree root_0 = null;
Token outerDot = null;
Token Super = null;
Token innerDot = null;
Token IDENT451 = null;
Token THIS453 = null;
Token SUPER455 = null;
Token IDENT456 = null;
Token LBRACK459 = null;
Token RBRACK461 = null;
Token INC462 = null;
Token DEC463 = null;
JavaParser.primaryExpression_return primaryExpression449 = null;
JavaParser.genericTypeArgumentListSimplified_return genericTypeArgumentListSimplified450 = null;
JavaParser.arguments_return arguments452 = null;
JavaParser.arguments_return arguments454 = null;
JavaParser.arguments_return arguments457 = null;
JavaParser.innerNewExpression_return innerNewExpression458 = null;
JavaParser.expression_return expression460 = null;
CommonTree outerDot_tree = null;
CommonTree Super_tree = null;
CommonTree innerDot_tree = null;
CommonTree IDENT451_tree = null;
CommonTree THIS453_tree = null;
CommonTree SUPER455_tree = null;
CommonTree IDENT456_tree = null;
CommonTree LBRACK459_tree = null;
CommonTree RBRACK461_tree = null;
CommonTree INC462_tree = null;
CommonTree DEC463_tree = null;
RewriteRuleTokenStream stream_RBRACK = new RewriteRuleTokenStream(adaptor, "token RBRACK");
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
RewriteRuleTokenStream stream_INC = new RewriteRuleTokenStream(adaptor, "token INC");
RewriteRuleTokenStream stream_DEC = new RewriteRuleTokenStream(adaptor, "token DEC");
RewriteRuleTokenStream stream_LBRACK = new RewriteRuleTokenStream(adaptor, "token LBRACK");
RewriteRuleTokenStream stream_SUPER = new RewriteRuleTokenStream(adaptor, "token SUPER");
RewriteRuleTokenStream stream_DOT = new RewriteRuleTokenStream(adaptor, "token DOT");
RewriteRuleTokenStream stream_THIS = new RewriteRuleTokenStream(adaptor, "token THIS");
RewriteRuleSubtreeStream stream_expression = new RewriteRuleSubtreeStream(adaptor, "rule expression");
RewriteRuleSubtreeStream stream_arguments = new RewriteRuleSubtreeStream(adaptor, "rule arguments");
RewriteRuleSubtreeStream stream_primaryExpression = new RewriteRuleSubtreeStream(adaptor, "rule primaryExpression");
RewriteRuleSubtreeStream stream_genericTypeArgumentListSimplified = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeArgumentListSimplified");
RewriteRuleSubtreeStream stream_innerNewExpression = new RewriteRuleSubtreeStream(adaptor, "rule innerNewExpression");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 104)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1047:5: ( ( primaryExpression -> primaryExpression ) (outerDot= DOT ( ( ( genericTypeArgumentListSimplified )? IDENT -> ^( DOT $postfixedExpression IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments ) )? | THIS -> ^( DOT $postfixedExpression THIS ) | Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] $postfixedExpression arguments ) | ( SUPER innerDot= DOT IDENT -> ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression arguments ) )? | innerNewExpression -> ^( DOT $postfixedExpression innerNewExpression ) ) | LBRACK expression RBRACK -> ^( ARRAY_ELEMENT_ACCESS $postfixedExpression expression ) )* ( INC -> ^( POST_INC[$INC, \"POST_INC\"] $postfixedExpression) | DEC -> ^( POST_DEC[$DEC, \"POST_DEC\"] $postfixedExpression) )? )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1047:9: ( primaryExpression -> primaryExpression ) (outerDot= DOT ( ( ( genericTypeArgumentListSimplified )? IDENT -> ^( DOT $postfixedExpression IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments ) )? | THIS -> ^( DOT $postfixedExpression THIS ) | Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] $postfixedExpression arguments ) | ( SUPER innerDot= DOT IDENT -> ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression arguments ) )? | innerNewExpression -> ^( DOT $postfixedExpression innerNewExpression ) ) | LBRACK expression RBRACK -> ^( ARRAY_ELEMENT_ACCESS $postfixedExpression expression ) )* ( INC -> ^( POST_INC[$INC, \"POST_INC\"] $postfixedExpression) | DEC -> ^( POST_DEC[$DEC, \"POST_DEC\"] $postfixedExpression) )?
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1047:9: ( primaryExpression -> primaryExpression )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1047:13: primaryExpression
{
pushFollow(FOLLOW_primaryExpression_in_postfixedExpression11572);
primaryExpression449 = primaryExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_primaryExpression.add(primaryExpression449.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();
// 1047:53: -> primaryExpression
{
adaptor.addChild(root_0, stream_primaryExpression.nextTree());
}
retval.tree = root_0;
}
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1050:9: (outerDot= DOT ( ( ( genericTypeArgumentListSimplified )? IDENT -> ^( DOT $postfixedExpression IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments ) )? | THIS -> ^( DOT $postfixedExpression THIS ) | Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] $postfixedExpression arguments ) | ( SUPER innerDot= DOT IDENT -> ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression arguments ) )? | innerNewExpression -> ^( DOT $postfixedExpression innerNewExpression ) ) | LBRACK expression RBRACK -> ^( ARRAY_ELEMENT_ACCESS $postfixedExpression expression ) )*
loop133: do {
int alt133 = 3;
int LA133_0 = input.LA(1);
if ((LA133_0 == DOT)) {
alt133 = 1;
} else if ((LA133_0 == LBRACK)) {
alt133 = 2;
}
switch(alt133) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1050:13: outerDot= DOT ( ( ( genericTypeArgumentListSimplified )? IDENT -> ^( DOT $postfixedExpression IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments ) )? | THIS -> ^( DOT $postfixedExpression THIS ) | Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] $postfixedExpression arguments ) | ( SUPER innerDot= DOT IDENT -> ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression arguments ) )? | innerNewExpression -> ^( DOT $postfixedExpression innerNewExpression ) )
{
outerDot = (Token) match(input, DOT, FOLLOW_DOT_in_postfixedExpression11634);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_DOT.add(outerDot);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1051:13: ( ( ( genericTypeArgumentListSimplified )? IDENT -> ^( DOT $postfixedExpression IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments ) )? | THIS -> ^( DOT $postfixedExpression THIS ) | Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] $postfixedExpression arguments ) | ( SUPER innerDot= DOT IDENT -> ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression arguments ) )? | innerNewExpression -> ^( DOT $postfixedExpression innerNewExpression ) )
int alt132 = 5;
switch(input.LA(1)) {
case LESS_THAN:
case IDENT:
{
alt132 = 1;
}
break;
case THIS:
{
alt132 = 2;
}
break;
case SUPER:
{
int LA132_3 = input.LA(2);
if ((LA132_3 == DOT)) {
alt132 = 4;
} else if ((LA132_3 == LPAREN)) {
alt132 = 3;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 132, 3, input);
throw nvae;
}
}
break;
case NEW:
{
alt132 = 5;
}
break;
default:
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 132, 0, input);
throw nvae;
}
switch(alt132) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1051:17: ( ( genericTypeArgumentListSimplified )? IDENT -> ^( DOT $postfixedExpression IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments ) )?
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1051:17: ( ( genericTypeArgumentListSimplified )? IDENT -> ^( DOT $postfixedExpression IDENT ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1051:21: ( genericTypeArgumentListSimplified )? IDENT
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1051:21: ( genericTypeArgumentListSimplified )?
int alt129 = 2;
int LA129_0 = input.LA(1);
if ((LA129_0 == LESS_THAN)) {
alt129 = 1;
}
switch(alt129) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: genericTypeArgumentListSimplified
{
pushFollow(FOLLOW_genericTypeArgumentListSimplified_in_postfixedExpression11656);
genericTypeArgumentListSimplified450 = genericTypeArgumentListSimplified();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericTypeArgumentListSimplified.add(genericTypeArgumentListSimplified450.getTree());
}
}
break;
}
IDENT451 = (Token) match(input, IDENT, FOLLOW_IDENT_in_postfixedExpression11738);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT451);
}
// 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();
// 1053:53: -> ^( DOT $postfixedExpression IDENT )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1053:57: ^( DOT $postfixedExpression 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;
}
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1055:17: ( arguments -> ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments ) )?
int alt130 = 2;
int LA130_0 = input.LA(1);
if ((LA130_0 == LPAREN)) {
alt130 = 1;
}
switch(alt130) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1055:21: arguments
{
pushFollow(FOLLOW_arguments_in_postfixedExpression11816);
arguments452 = arguments();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arguments.add(arguments452.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();
// 1055:53: -> ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1055:57: ^( METHOD_CALL $postfixedExpression ( genericTypeArgumentListSimplified )? arguments )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(METHOD_CALL, "METHOD_CALL"), root_1);
adaptor.addChild(root_1, stream_retval.nextTree());
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1055:92: ( genericTypeArgumentListSimplified )?
if (stream_genericTypeArgumentListSimplified.hasNext()) {
adaptor.addChild(root_1, stream_genericTypeArgumentListSimplified.nextTree());
}
stream_genericTypeArgumentListSimplified.reset();
adaptor.addChild(root_1, stream_arguments.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1057:17: THIS
{
THIS453 = (Token) match(input, THIS, FOLLOW_THIS_in_postfixedExpression11890);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_THIS.add(THIS453);
}
// 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();
// 1057:53: -> ^( DOT $postfixedExpression THIS )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1057:57: ^( DOT $postfixedExpression THIS )
{
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_THIS.nextNode());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 3:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1058:17: Super= SUPER arguments
{
Super = (Token) match(input, SUPER, FOLLOW_SUPER_in_postfixedExpression11953);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SUPER.add(Super);
}
pushFollow(FOLLOW_arguments_in_postfixedExpression11955);
arguments454 = arguments();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arguments.add(arguments454.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();
// 1058:57: -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] $postfixedExpression arguments )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1058:61: ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] $postfixedExpression arguments )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(SUPER_CONSTRUCTOR_CALL, Super, "SUPER_CONSTRUCTOR_CALL"), root_1);
adaptor.addChild(root_1, stream_retval.nextTree());
adaptor.addChild(root_1, stream_arguments.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 4:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1059:17: ( SUPER innerDot= DOT IDENT -> ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT ) ) ( arguments -> ^( METHOD_CALL $postfixedExpression arguments ) )?
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1059:17: ( SUPER innerDot= DOT IDENT -> ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1059:21: SUPER innerDot= DOT IDENT
{
SUPER455 = (Token) match(input, SUPER, FOLLOW_SUPER_in_postfixedExpression12008);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SUPER.add(SUPER455);
}
innerDot = (Token) match(input, DOT, FOLLOW_DOT_in_postfixedExpression12012);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_DOT.add(innerDot);
}
IDENT456 = (Token) match(input, IDENT, FOLLOW_IDENT_in_postfixedExpression12014);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT456);
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleTokenStream stream_outerDot = new RewriteRuleTokenStream(adaptor, "token outerDot", outerDot);
RewriteRuleTokenStream stream_innerDot = new RewriteRuleTokenStream(adaptor, "token innerDot", innerDot);
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 1059:53: -> ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1059:57: ^( $innerDot ^( $outerDot $postfixedExpression SUPER ) IDENT )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_innerDot.nextNode(), root_1);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1059:69: ^( $outerDot $postfixedExpression SUPER )
{
CommonTree root_2 = (CommonTree) adaptor.nil();
root_2 = (CommonTree) adaptor.becomeRoot(stream_outerDot.nextNode(), root_2);
adaptor.addChild(root_2, stream_retval.nextTree());
adaptor.addChild(root_2, stream_SUPER.nextNode());
adaptor.addChild(root_1, root_2);
}
adaptor.addChild(root_1, stream_IDENT.nextNode());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1061:17: ( arguments -> ^( METHOD_CALL $postfixedExpression arguments ) )?
int alt131 = 2;
int LA131_0 = input.LA(1);
if ((LA131_0 == LPAREN)) {
alt131 = 1;
}
switch(alt131) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1061:21: arguments
{
pushFollow(FOLLOW_arguments_in_postfixedExpression12081);
arguments457 = arguments();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arguments.add(arguments457.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();
// 1061:53: -> ^( METHOD_CALL $postfixedExpression arguments )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1061:57: ^( METHOD_CALL $postfixedExpression arguments )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(METHOD_CALL, "METHOD_CALL"), root_1);
adaptor.addChild(root_1, stream_retval.nextTree());
adaptor.addChild(root_1, stream_arguments.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
}
}
break;
case 5:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1063:17: innerNewExpression
{
pushFollow(FOLLOW_innerNewExpression_in_postfixedExpression12152);
innerNewExpression458 = innerNewExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_innerNewExpression.add(innerNewExpression458.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();
// 1063:53: -> ^( DOT $postfixedExpression innerNewExpression )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1063:57: ^( DOT $postfixedExpression innerNewExpression )
{
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_innerNewExpression.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1065:13: LBRACK expression RBRACK
{
LBRACK459 = (Token) match(input, LBRACK, FOLLOW_LBRACK_in_postfixedExpression12209);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LBRACK.add(LBRACK459);
}
pushFollow(FOLLOW_expression_in_postfixedExpression12211);
expression460 = expression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_expression.add(expression460.getTree());
}
RBRACK461 = (Token) match(input, RBRACK, FOLLOW_RBRACK_in_postfixedExpression12213);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_RBRACK.add(RBRACK461);
}
// 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();
// 1065:53: -> ^( ARRAY_ELEMENT_ACCESS $postfixedExpression expression )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1065:57: ^( ARRAY_ELEMENT_ACCESS $postfixedExpression expression )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ARRAY_ELEMENT_ACCESS, "ARRAY_ELEMENT_ACCESS"), root_1);
adaptor.addChild(root_1, stream_retval.nextTree());
adaptor.addChild(root_1, stream_expression.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
default:
break loop133;
}
} while (true);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1068:9: ( INC -> ^( POST_INC[$INC, \"POST_INC\"] $postfixedExpression) | DEC -> ^( POST_DEC[$DEC, \"POST_DEC\"] $postfixedExpression) )?
int alt134 = 3;
int LA134_0 = input.LA(1);
if ((LA134_0 == INC)) {
alt134 = 1;
} else if ((LA134_0 == DEC)) {
alt134 = 2;
}
switch(alt134) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1068:13: INC
{
INC462 = (Token) match(input, INC, FOLLOW_INC_in_postfixedExpression12274);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_INC.add(INC462);
}
// 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();
// 1068:17: -> ^( POST_INC[$INC, \"POST_INC\"] $postfixedExpression)
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1068:20: ^( POST_INC[$INC, \"POST_INC\"] $postfixedExpression)
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(POST_INC, INC462, "POST_INC"), root_1);
adaptor.addChild(root_1, stream_retval.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1069:13: DEC
{
DEC463 = (Token) match(input, DEC, FOLLOW_DEC_in_postfixedExpression12298);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_DEC.add(DEC463);
}
// 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();
// 1069:17: -> ^( POST_DEC[$DEC, \"POST_DEC\"] $postfixedExpression)
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1069:20: ^( POST_DEC[$DEC, \"POST_DEC\"] $postfixedExpression)
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(POST_DEC, DEC463, "POST_DEC"), root_1);
adaptor.addChild(root_1, stream_retval.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
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, 104, postfixedExpression_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.Token in project freud by LMAX-Exchange.
the class JavaParser method modifier.
// $ANTLR start "modifier"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:623:1: modifier : ( PUBLIC | PROTECTED | PRIVATE | STATIC | ABSTRACT | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE | STRICTFP | localModifier );
public final JavaParser.modifier_return modifier() throws RecognitionException {
JavaParser.modifier_return retval = new JavaParser.modifier_return();
retval.start = input.LT(1);
int modifier_StartIndex = input.index();
CommonTree root_0 = null;
Token PUBLIC152 = null;
Token PROTECTED153 = null;
Token PRIVATE154 = null;
Token STATIC155 = null;
Token ABSTRACT156 = null;
Token NATIVE157 = null;
Token SYNCHRONIZED158 = null;
Token TRANSIENT159 = null;
Token VOLATILE160 = null;
Token STRICTFP161 = null;
JavaParser.localModifier_return localModifier162 = null;
CommonTree PUBLIC152_tree = null;
CommonTree PROTECTED153_tree = null;
CommonTree PRIVATE154_tree = null;
CommonTree STATIC155_tree = null;
CommonTree ABSTRACT156_tree = null;
CommonTree NATIVE157_tree = null;
CommonTree SYNCHRONIZED158_tree = null;
CommonTree TRANSIENT159_tree = null;
CommonTree VOLATILE160_tree = null;
CommonTree STRICTFP161_tree = null;
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 38)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:624:5: ( PUBLIC | PROTECTED | PRIVATE | STATIC | ABSTRACT | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE | STRICTFP | localModifier )
int alt55 = 11;
switch(input.LA(1)) {
case PUBLIC:
{
alt55 = 1;
}
break;
case PROTECTED:
{
alt55 = 2;
}
break;
case PRIVATE:
{
alt55 = 3;
}
break;
case STATIC:
{
alt55 = 4;
}
break;
case ABSTRACT:
{
alt55 = 5;
}
break;
case NATIVE:
{
alt55 = 6;
}
break;
case SYNCHRONIZED:
{
alt55 = 7;
}
break;
case TRANSIENT:
{
alt55 = 8;
}
break;
case VOLATILE:
{
alt55 = 9;
}
break;
case STRICTFP:
{
alt55 = 10;
}
break;
case AT:
case FINAL:
{
alt55 = 11;
}
break;
default:
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 55, 0, input);
throw nvae;
}
switch(alt55) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:624:9: PUBLIC
{
root_0 = (CommonTree) adaptor.nil();
PUBLIC152 = (Token) match(input, PUBLIC, FOLLOW_PUBLIC_in_modifier6659);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
PUBLIC152_tree = (CommonTree) adaptor.create(PUBLIC152);
adaptor.addChild(root_0, PUBLIC152_tree);
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:625:9: PROTECTED
{
root_0 = (CommonTree) adaptor.nil();
PROTECTED153 = (Token) match(input, PROTECTED, FOLLOW_PROTECTED_in_modifier6669);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
PROTECTED153_tree = (CommonTree) adaptor.create(PROTECTED153);
adaptor.addChild(root_0, PROTECTED153_tree);
}
}
break;
case 3:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:626:9: PRIVATE
{
root_0 = (CommonTree) adaptor.nil();
PRIVATE154 = (Token) match(input, PRIVATE, FOLLOW_PRIVATE_in_modifier6679);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
PRIVATE154_tree = (CommonTree) adaptor.create(PRIVATE154);
adaptor.addChild(root_0, PRIVATE154_tree);
}
}
break;
case 4:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:627:9: STATIC
{
root_0 = (CommonTree) adaptor.nil();
STATIC155 = (Token) match(input, STATIC, FOLLOW_STATIC_in_modifier6689);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
STATIC155_tree = (CommonTree) adaptor.create(STATIC155);
adaptor.addChild(root_0, STATIC155_tree);
}
}
break;
case 5:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:628:9: ABSTRACT
{
root_0 = (CommonTree) adaptor.nil();
ABSTRACT156 = (Token) match(input, ABSTRACT, FOLLOW_ABSTRACT_in_modifier6699);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
ABSTRACT156_tree = (CommonTree) adaptor.create(ABSTRACT156);
adaptor.addChild(root_0, ABSTRACT156_tree);
}
}
break;
case 6:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:629:9: NATIVE
{
root_0 = (CommonTree) adaptor.nil();
NATIVE157 = (Token) match(input, NATIVE, FOLLOW_NATIVE_in_modifier6709);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
NATIVE157_tree = (CommonTree) adaptor.create(NATIVE157);
adaptor.addChild(root_0, NATIVE157_tree);
}
}
break;
case 7:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:630:9: SYNCHRONIZED
{
root_0 = (CommonTree) adaptor.nil();
SYNCHRONIZED158 = (Token) match(input, SYNCHRONIZED, FOLLOW_SYNCHRONIZED_in_modifier6719);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
SYNCHRONIZED158_tree = (CommonTree) adaptor.create(SYNCHRONIZED158);
adaptor.addChild(root_0, SYNCHRONIZED158_tree);
}
}
break;
case 8:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:631:9: TRANSIENT
{
root_0 = (CommonTree) adaptor.nil();
TRANSIENT159 = (Token) match(input, TRANSIENT, FOLLOW_TRANSIENT_in_modifier6729);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
TRANSIENT159_tree = (CommonTree) adaptor.create(TRANSIENT159);
adaptor.addChild(root_0, TRANSIENT159_tree);
}
}
break;
case 9:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:632:9: VOLATILE
{
root_0 = (CommonTree) adaptor.nil();
VOLATILE160 = (Token) match(input, VOLATILE, FOLLOW_VOLATILE_in_modifier6739);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
VOLATILE160_tree = (CommonTree) adaptor.create(VOLATILE160);
adaptor.addChild(root_0, VOLATILE160_tree);
}
}
break;
case 10:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:633:9: STRICTFP
{
root_0 = (CommonTree) adaptor.nil();
STRICTFP161 = (Token) match(input, STRICTFP, FOLLOW_STRICTFP_in_modifier6749);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
STRICTFP161_tree = (CommonTree) adaptor.create(STRICTFP161);
adaptor.addChild(root_0, STRICTFP161_tree);
}
}
break;
case 11:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:634:9: localModifier
{
root_0 = (CommonTree) adaptor.nil();
pushFollow(FOLLOW_localModifier_in_modifier6759);
localModifier162 = localModifier();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, localModifier162.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, 38, modifier_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.Token in project freud by LMAX-Exchange.
the class JavaParser method classFieldDeclaratorList.
// $ANTLR start "classFieldDeclaratorList"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:569:1: classFieldDeclaratorList : classFieldDeclarator ( COMMA classFieldDeclarator )* -> ^( VAR_DECLARATOR_LIST ( classFieldDeclarator )+ ) ;
public final JavaParser.classFieldDeclaratorList_return classFieldDeclaratorList() throws RecognitionException {
JavaParser.classFieldDeclaratorList_return retval = new JavaParser.classFieldDeclaratorList_return();
retval.start = input.LT(1);
int classFieldDeclaratorList_StartIndex = input.index();
CommonTree root_0 = null;
Token COMMA125 = null;
JavaParser.classFieldDeclarator_return classFieldDeclarator124 = null;
JavaParser.classFieldDeclarator_return classFieldDeclarator126 = null;
CommonTree COMMA125_tree = null;
RewriteRuleTokenStream stream_COMMA = new RewriteRuleTokenStream(adaptor, "token COMMA");
RewriteRuleSubtreeStream stream_classFieldDeclarator = new RewriteRuleSubtreeStream(adaptor, "rule classFieldDeclarator");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 27)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:570:5: ( classFieldDeclarator ( COMMA classFieldDeclarator )* -> ^( VAR_DECLARATOR_LIST ( classFieldDeclarator )+ ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:570:9: classFieldDeclarator ( COMMA classFieldDeclarator )*
{
pushFollow(FOLLOW_classFieldDeclarator_in_classFieldDeclaratorList6225);
classFieldDeclarator124 = classFieldDeclarator();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_classFieldDeclarator.add(classFieldDeclarator124.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:570:30: ( COMMA classFieldDeclarator )*
loop45: do {
int alt45 = 2;
int LA45_0 = input.LA(1);
if ((LA45_0 == COMMA)) {
alt45 = 1;
}
switch(alt45) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:570:31: COMMA classFieldDeclarator
{
COMMA125 = (Token) match(input, COMMA, FOLLOW_COMMA_in_classFieldDeclaratorList6228);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_COMMA.add(COMMA125);
}
pushFollow(FOLLOW_classFieldDeclarator_in_classFieldDeclaratorList6230);
classFieldDeclarator126 = classFieldDeclarator();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_classFieldDeclarator.add(classFieldDeclarator126.getTree());
}
}
break;
default:
break loop45;
}
} while (true);
// 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();
// 571:9: -> ^( VAR_DECLARATOR_LIST ( classFieldDeclarator )+ )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:571:13: ^( VAR_DECLARATOR_LIST ( classFieldDeclarator )+ )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(VAR_DECLARATOR_LIST, "VAR_DECLARATOR_LIST"), root_1);
if (!(stream_classFieldDeclarator.hasNext())) {
throw new RewriteEarlyExitException();
}
while (stream_classFieldDeclarator.hasNext()) {
adaptor.addChild(root_1, stream_classFieldDeclarator.nextTree());
}
stream_classFieldDeclarator.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, 27, classFieldDeclaratorList_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.Token in project freud by LMAX-Exchange.
the class JavaParser method genericTypeArgument.
// $ANTLR start "genericTypeArgument"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:701:1: genericTypeArgument : ( type | QUESTION ( genericWildcardBoundType )? -> ^( QUESTION ( genericWildcardBoundType )? ) );
public final JavaParser.genericTypeArgument_return genericTypeArgument() throws RecognitionException {
JavaParser.genericTypeArgument_return retval = new JavaParser.genericTypeArgument_return();
retval.start = input.LT(1);
int genericTypeArgument_StartIndex = input.index();
CommonTree root_0 = null;
Token QUESTION191 = null;
JavaParser.type_return type190 = null;
JavaParser.genericWildcardBoundType_return genericWildcardBoundType192 = null;
CommonTree QUESTION191_tree = null;
RewriteRuleTokenStream stream_QUESTION = new RewriteRuleTokenStream(adaptor, "token QUESTION");
RewriteRuleSubtreeStream stream_genericWildcardBoundType = new RewriteRuleSubtreeStream(adaptor, "rule genericWildcardBoundType");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 51)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:702:5: ( type | QUESTION ( genericWildcardBoundType )? -> ^( QUESTION ( genericWildcardBoundType )? ) )
int alt68 = 2;
int LA68_0 = input.LA(1);
if ((LA68_0 == BOOLEAN || LA68_0 == BYTE || LA68_0 == CHAR || LA68_0 == DOUBLE || LA68_0 == FLOAT || (LA68_0 >= INT && LA68_0 <= LONG) || LA68_0 == SHORT || LA68_0 == IDENT)) {
alt68 = 1;
} else if ((LA68_0 == QUESTION)) {
alt68 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 68, 0, input);
throw nvae;
}
switch(alt68) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:702:9: type
{
root_0 = (CommonTree) adaptor.nil();
pushFollow(FOLLOW_type_in_genericTypeArgument7273);
type190 = type();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, type190.getTree());
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:703:9: QUESTION ( genericWildcardBoundType )?
{
QUESTION191 = (Token) match(input, QUESTION, FOLLOW_QUESTION_in_genericTypeArgument7283);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_QUESTION.add(QUESTION191);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:703:18: ( genericWildcardBoundType )?
int alt67 = 2;
int LA67_0 = input.LA(1);
if ((LA67_0 == EXTENDS)) {
int LA67_1 = input.LA(2);
if ((LA67_1 == BOOLEAN || LA67_1 == BYTE || LA67_1 == CHAR || LA67_1 == DOUBLE || LA67_1 == FLOAT || (LA67_1 >= INT && LA67_1 <= LONG) || LA67_1 == SHORT)) {
int LA67_4 = input.LA(3);
if ((synpred93_Java())) {
alt67 = 1;
}
} else if ((LA67_1 == IDENT)) {
int LA67_5 = input.LA(3);
if ((synpred93_Java())) {
alt67 = 1;
}
}
} else if ((LA67_0 == SUPER)) {
int LA67_3 = input.LA(2);
if ((LA67_3 == BOOLEAN || LA67_3 == BYTE || LA67_3 == CHAR || LA67_3 == DOUBLE || LA67_3 == FLOAT || (LA67_3 >= INT && LA67_3 <= LONG) || LA67_3 == SHORT || LA67_3 == IDENT)) {
alt67 = 1;
}
}
switch(alt67) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: genericWildcardBoundType
{
pushFollow(FOLLOW_genericWildcardBoundType_in_genericTypeArgument7285);
genericWildcardBoundType192 = genericWildcardBoundType();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericWildcardBoundType.add(genericWildcardBoundType192.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();
// 704:9: -> ^( QUESTION ( genericWildcardBoundType )? )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:704:13: ^( QUESTION ( genericWildcardBoundType )? )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_QUESTION.nextNode(), root_1);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:704:24: ( genericWildcardBoundType )?
if (stream_genericWildcardBoundType.hasNext()) {
adaptor.addChild(root_1, stream_genericWildcardBoundType.nextTree());
}
stream_genericWildcardBoundType.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
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, 51, genericTypeArgument_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.Token in project freud by LMAX-Exchange.
the class JavaParser method throwsClause.
// $ANTLR start "throwsClause"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:613:1: throwsClause : THROWS qualifiedIdentList -> ^( THROWS_CLAUSE[$THROWS, \"THROWS_CLAUSE\"] qualifiedIdentList ) ;
public final JavaParser.throwsClause_return throwsClause() throws RecognitionException {
JavaParser.throwsClause_return retval = new JavaParser.throwsClause_return();
retval.start = input.LT(1);
int throwsClause_StartIndex = input.index();
CommonTree root_0 = null;
Token THROWS149 = null;
JavaParser.qualifiedIdentList_return qualifiedIdentList150 = null;
CommonTree THROWS149_tree = null;
RewriteRuleTokenStream stream_THROWS = new RewriteRuleTokenStream(adaptor, "token THROWS");
RewriteRuleSubtreeStream stream_qualifiedIdentList = new RewriteRuleSubtreeStream(adaptor, "rule qualifiedIdentList");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 36)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:614:5: ( THROWS qualifiedIdentList -> ^( THROWS_CLAUSE[$THROWS, \"THROWS_CLAUSE\"] qualifiedIdentList ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:614:9: THROWS qualifiedIdentList
{
THROWS149 = (Token) match(input, THROWS, FOLLOW_THROWS_in_throwsClause6582);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_THROWS.add(THROWS149);
}
pushFollow(FOLLOW_qualifiedIdentList_in_throwsClause6584);
qualifiedIdentList150 = qualifiedIdentList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_qualifiedIdentList.add(qualifiedIdentList150.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();
// 615:9: -> ^( THROWS_CLAUSE[$THROWS, \"THROWS_CLAUSE\"] qualifiedIdentList )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:615:13: ^( THROWS_CLAUSE[$THROWS, \"THROWS_CLAUSE\"] qualifiedIdentList )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(THROWS_CLAUSE, THROWS149, "THROWS_CLAUSE"), root_1);
adaptor.addChild(root_1, stream_qualifiedIdentList.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, 36, throwsClause_StartIndex);
}
}
return retval;
}
Aggregations