use of org.antlr.runtime.tree.RewriteRuleTokenStream in project freud by LMAX-Exchange.
the class JavaParser method unaryExpressionAll.
// $ANTLR start "unaryExpressionAll"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1029:1: unaryExpressionAll : ( PLUS unaryExpressionAll -> ^( UNARY_PLUS[$PLUS, \"UNARY_PLUS\"] unaryExpressionAll ) | MINUS unaryExpressionAll -> ^( UNARY_MINUS[$MINUS, \"UNARY_MINUS\"] unaryExpressionAll ) | INC postfixedExpression -> ^( PRE_INC[$INC, \"PRE_INC\"] postfixedExpression ) | DEC postfixedExpression -> ^( PRE_DEC[$DEC, \"PRE_DEC\"] postfixedExpression ) | unaryExpressionRest );
public final JavaParser.unaryExpressionAll_return unaryExpressionAll() throws RecognitionException {
JavaParser.unaryExpressionAll_return retval = new JavaParser.unaryExpressionAll_return();
retval.start = input.LT(1);
int unaryExpressionAll_StartIndex = input.index();
CommonTree root_0 = null;
Token PLUS427 = null;
Token MINUS429 = null;
Token INC431 = null;
Token DEC433 = null;
JavaParser.unaryExpressionAll_return unaryExpressionAll428 = null;
JavaParser.unaryExpressionAll_return unaryExpressionAll430 = null;
JavaParser.postfixedExpression_return postfixedExpression432 = null;
JavaParser.postfixedExpression_return postfixedExpression434 = null;
JavaParser.unaryExpressionRest_return unaryExpressionRest435 = null;
CommonTree PLUS427_tree = null;
CommonTree MINUS429_tree = null;
CommonTree INC431_tree = null;
CommonTree DEC433_tree = null;
RewriteRuleTokenStream stream_DEC = new RewriteRuleTokenStream(adaptor, "token DEC");
RewriteRuleTokenStream stream_INC = new RewriteRuleTokenStream(adaptor, "token INC");
RewriteRuleTokenStream stream_PLUS = new RewriteRuleTokenStream(adaptor, "token PLUS");
RewriteRuleTokenStream stream_MINUS = new RewriteRuleTokenStream(adaptor, "token MINUS");
RewriteRuleSubtreeStream stream_postfixedExpression = new RewriteRuleSubtreeStream(adaptor, "rule postfixedExpression");
RewriteRuleSubtreeStream stream_unaryExpressionAll = new RewriteRuleSubtreeStream(adaptor, "rule unaryExpressionAll");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 102)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1030:5: ( PLUS unaryExpressionAll -> ^( UNARY_PLUS[$PLUS, \"UNARY_PLUS\"] unaryExpressionAll ) | MINUS unaryExpressionAll -> ^( UNARY_MINUS[$MINUS, \"UNARY_MINUS\"] unaryExpressionAll ) | INC postfixedExpression -> ^( PRE_INC[$INC, \"PRE_INC\"] postfixedExpression ) | DEC postfixedExpression -> ^( PRE_DEC[$DEC, \"PRE_DEC\"] postfixedExpression ) | unaryExpressionRest )
int alt127 = 5;
switch(input.LA(1)) {
case PLUS:
{
alt127 = 1;
}
break;
case MINUS:
{
alt127 = 2;
}
break;
case INC:
{
alt127 = 3;
}
break;
case DEC:
{
alt127 = 4;
}
break;
case LESS_THAN:
case LOGICAL_NOT:
case LPAREN:
case NOT:
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case FALSE:
case FLOAT:
case INT:
case LONG:
case NEW:
case NULL:
case SHORT:
case SUPER:
case THIS:
case TRUE:
case VOID:
case IDENT:
case HEX_LITERAL:
case OCTAL_LITERAL:
case DECIMAL_LITERAL:
case FLOATING_POINT_LITERAL:
case CHARACTER_LITERAL:
case STRING_LITERAL:
{
alt127 = 5;
}
break;
default:
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 127, 0, input);
throw nvae;
}
switch(alt127) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1030:9: PLUS unaryExpressionAll
{
PLUS427 = (Token) match(input, PLUS, FOLLOW_PLUS_in_unaryExpressionAll11271);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_PLUS.add(PLUS427);
}
pushFollow(FOLLOW_unaryExpressionAll_in_unaryExpressionAll11273);
unaryExpressionAll428 = unaryExpressionAll();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_unaryExpressionAll.add(unaryExpressionAll428.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();
// 1030:37: -> ^( UNARY_PLUS[$PLUS, \"UNARY_PLUS\"] unaryExpressionAll )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1030:41: ^( UNARY_PLUS[$PLUS, \"UNARY_PLUS\"] unaryExpressionAll )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(UNARY_PLUS, PLUS427, "UNARY_PLUS"), 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:1031:9: MINUS unaryExpressionAll
{
MINUS429 = (Token) match(input, MINUS, FOLLOW_MINUS_in_unaryExpressionAll11297);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_MINUS.add(MINUS429);
}
pushFollow(FOLLOW_unaryExpressionAll_in_unaryExpressionAll11299);
unaryExpressionAll430 = unaryExpressionAll();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_unaryExpressionAll.add(unaryExpressionAll430.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();
// 1031:37: -> ^( UNARY_MINUS[$MINUS, \"UNARY_MINUS\"] unaryExpressionAll )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1031:41: ^( UNARY_MINUS[$MINUS, \"UNARY_MINUS\"] unaryExpressionAll )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(UNARY_MINUS, MINUS429, "UNARY_MINUS"), 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:1032:9: INC postfixedExpression
{
INC431 = (Token) match(input, INC, FOLLOW_INC_in_unaryExpressionAll11322);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_INC.add(INC431);
}
pushFollow(FOLLOW_postfixedExpression_in_unaryExpressionAll11324);
postfixedExpression432 = postfixedExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_postfixedExpression.add(postfixedExpression432.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();
// 1032:37: -> ^( PRE_INC[$INC, \"PRE_INC\"] postfixedExpression )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1032:41: ^( PRE_INC[$INC, \"PRE_INC\"] postfixedExpression )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(PRE_INC, INC431, "PRE_INC"), root_1);
adaptor.addChild(root_1, stream_postfixedExpression.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 4:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1033:9: DEC postfixedExpression
{
DEC433 = (Token) match(input, DEC, FOLLOW_DEC_in_unaryExpressionAll11348);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_DEC.add(DEC433);
}
pushFollow(FOLLOW_postfixedExpression_in_unaryExpressionAll11350);
postfixedExpression434 = postfixedExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_postfixedExpression.add(postfixedExpression434.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();
// 1033:37: -> ^( PRE_DEC[$DEC, \"PRE_DEC\"] postfixedExpression )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1033:41: ^( PRE_DEC[$DEC, \"PRE_DEC\"] postfixedExpression )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(PRE_DEC, DEC433, "PRE_DEC"), root_1);
adaptor.addChild(root_1, stream_postfixedExpression.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 5:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1034:9: unaryExpressionRest
{
root_0 = (CommonTree) adaptor.nil();
pushFollow(FOLLOW_unaryExpressionRest_in_unaryExpressionAll11374);
unaryExpressionRest435 = unaryExpressionRest();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, unaryExpressionRest435.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, 102, unaryExpressionAll_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleTokenStream in project freud by LMAX-Exchange.
the class JavaParser method primaryExpression.
// $ANTLR start "primaryExpression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1073:1: primaryExpression : ( parenthesizedExpression | literal | newExpression | qualifiedIdentExpression | genericTypeArgumentListSimplified ( SUPER ( arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) | DOT IDENT arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments ) ) | IDENT arguments -> ^( METHOD_CALL IDENT genericTypeArgumentListSimplified arguments ) | THIS arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) ) | ( THIS -> THIS ) ( arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] arguments ) )? | SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] arguments ) | ( SUPER DOT IDENT ) ( arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) arguments ) | -> ^( DOT SUPER IDENT ) ) | ( primitiveType -> primitiveType ) ( arrayDeclarator -> ^( arrayDeclarator $primaryExpression) )* DOT CLASS -> ^( DOT $primaryExpression CLASS ) | VOID DOT CLASS -> ^( DOT VOID CLASS ) );
public final JavaParser.primaryExpression_return primaryExpression() throws RecognitionException {
JavaParser.primaryExpression_return retval = new JavaParser.primaryExpression_return();
retval.start = input.LT(1);
int primaryExpression_StartIndex = input.index();
CommonTree root_0 = null;
Token SUPER469 = null;
Token DOT471 = null;
Token IDENT472 = null;
Token IDENT474 = null;
Token THIS476 = null;
Token THIS478 = null;
Token SUPER480 = null;
Token SUPER482 = null;
Token DOT483 = null;
Token IDENT484 = null;
Token DOT488 = null;
Token CLASS489 = null;
Token VOID490 = null;
Token DOT491 = null;
Token CLASS492 = null;
JavaParser.parenthesizedExpression_return parenthesizedExpression464 = null;
JavaParser.literal_return literal465 = null;
JavaParser.newExpression_return newExpression466 = null;
JavaParser.qualifiedIdentExpression_return qualifiedIdentExpression467 = null;
JavaParser.genericTypeArgumentListSimplified_return genericTypeArgumentListSimplified468 = null;
JavaParser.arguments_return arguments470 = null;
JavaParser.arguments_return arguments473 = null;
JavaParser.arguments_return arguments475 = null;
JavaParser.arguments_return arguments477 = null;
JavaParser.arguments_return arguments479 = null;
JavaParser.arguments_return arguments481 = null;
JavaParser.arguments_return arguments485 = null;
JavaParser.primitiveType_return primitiveType486 = null;
JavaParser.arrayDeclarator_return arrayDeclarator487 = null;
CommonTree SUPER469_tree = null;
CommonTree DOT471_tree = null;
CommonTree IDENT472_tree = null;
CommonTree IDENT474_tree = null;
CommonTree THIS476_tree = null;
CommonTree THIS478_tree = null;
CommonTree SUPER480_tree = null;
CommonTree SUPER482_tree = null;
CommonTree DOT483_tree = null;
CommonTree IDENT484_tree = null;
CommonTree DOT488_tree = null;
CommonTree CLASS489_tree = null;
CommonTree VOID490_tree = null;
CommonTree DOT491_tree = null;
CommonTree CLASS492_tree = null;
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
RewriteRuleTokenStream stream_CLASS = new RewriteRuleTokenStream(adaptor, "token CLASS");
RewriteRuleTokenStream stream_VOID = new RewriteRuleTokenStream(adaptor, "token VOID");
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_arrayDeclarator = new RewriteRuleSubtreeStream(adaptor, "rule arrayDeclarator");
RewriteRuleSubtreeStream stream_arguments = new RewriteRuleSubtreeStream(adaptor, "rule arguments");
RewriteRuleSubtreeStream stream_primitiveType = new RewriteRuleSubtreeStream(adaptor, "rule primitiveType");
RewriteRuleSubtreeStream stream_genericTypeArgumentListSimplified = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeArgumentListSimplified");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 105)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1074:5: ( parenthesizedExpression | literal | newExpression | qualifiedIdentExpression | genericTypeArgumentListSimplified ( SUPER ( arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) | DOT IDENT arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments ) ) | IDENT arguments -> ^( METHOD_CALL IDENT genericTypeArgumentListSimplified arguments ) | THIS arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) ) | ( THIS -> THIS ) ( arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] arguments ) )? | SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] arguments ) | ( SUPER DOT IDENT ) ( arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) arguments ) | -> ^( DOT SUPER IDENT ) ) | ( primitiveType -> primitiveType ) ( arrayDeclarator -> ^( arrayDeclarator $primaryExpression) )* DOT CLASS -> ^( DOT $primaryExpression CLASS ) | VOID DOT CLASS -> ^( DOT VOID CLASS ) )
int alt140 = 10;
alt140 = dfa140.predict(input);
switch(alt140) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1074:9: parenthesizedExpression
{
root_0 = (CommonTree) adaptor.nil();
pushFollow(FOLLOW_parenthesizedExpression_in_primaryExpression12338);
parenthesizedExpression464 = parenthesizedExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, parenthesizedExpression464.getTree());
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1075:9: literal
{
root_0 = (CommonTree) adaptor.nil();
pushFollow(FOLLOW_literal_in_primaryExpression12348);
literal465 = literal();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, literal465.getTree());
}
}
break;
case 3:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1076:9: newExpression
{
root_0 = (CommonTree) adaptor.nil();
pushFollow(FOLLOW_newExpression_in_primaryExpression12358);
newExpression466 = newExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, newExpression466.getTree());
}
}
break;
case 4:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1077:9: qualifiedIdentExpression
{
root_0 = (CommonTree) adaptor.nil();
pushFollow(FOLLOW_qualifiedIdentExpression_in_primaryExpression12368);
qualifiedIdentExpression467 = qualifiedIdentExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, qualifiedIdentExpression467.getTree());
}
}
break;
case 5:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1078:9: genericTypeArgumentListSimplified ( SUPER ( arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) | DOT IDENT arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments ) ) | IDENT arguments -> ^( METHOD_CALL IDENT genericTypeArgumentListSimplified arguments ) | THIS arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) )
{
pushFollow(FOLLOW_genericTypeArgumentListSimplified_in_primaryExpression12378);
genericTypeArgumentListSimplified468 = genericTypeArgumentListSimplified();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericTypeArgumentListSimplified.add(genericTypeArgumentListSimplified468.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1079:9: ( SUPER ( arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) | DOT IDENT arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments ) ) | IDENT arguments -> ^( METHOD_CALL IDENT genericTypeArgumentListSimplified arguments ) | THIS arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) )
int alt136 = 3;
switch(input.LA(1)) {
case SUPER:
{
alt136 = 1;
}
break;
case IDENT:
{
alt136 = 2;
}
break;
case THIS:
{
alt136 = 3;
}
break;
default:
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 136, 0, input);
throw nvae;
}
switch(alt136) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1079:13: SUPER ( arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) | DOT IDENT arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments ) )
{
SUPER469 = (Token) match(input, SUPER, FOLLOW_SUPER_in_primaryExpression12392);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SUPER.add(SUPER469);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1080:13: ( arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) | DOT IDENT arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments ) )
int alt135 = 2;
int LA135_0 = input.LA(1);
if ((LA135_0 == LPAREN)) {
alt135 = 1;
} else if ((LA135_0 == DOT)) {
alt135 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 135, 0, input);
throw nvae;
}
switch(alt135) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1080:17: arguments
{
pushFollow(FOLLOW_arguments_in_primaryExpression12410);
arguments470 = arguments();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arguments.add(arguments470.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();
// 1080:57: -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1080:61: ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(SUPER_CONSTRUCTOR_CALL, SUPER469, "SUPER_CONSTRUCTOR_CALL"), root_1);
adaptor.addChild(root_1, stream_genericTypeArgumentListSimplified.nextTree());
adaptor.addChild(root_1, stream_arguments.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1081:17: DOT IDENT arguments
{
DOT471 = (Token) match(input, DOT, FOLLOW_DOT_in_primaryExpression12470);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_DOT.add(DOT471);
}
IDENT472 = (Token) match(input, IDENT, FOLLOW_IDENT_in_primaryExpression12472);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT472);
}
pushFollow(FOLLOW_arguments_in_primaryExpression12474);
arguments473 = arguments();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arguments.add(arguments473.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();
// 1081:57: -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1081:61: ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(METHOD_CALL, "METHOD_CALL"), root_1);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1081:75: ^( DOT SUPER IDENT )
{
CommonTree root_2 = (CommonTree) adaptor.nil();
root_2 = (CommonTree) adaptor.becomeRoot(stream_DOT.nextNode(), root_2);
adaptor.addChild(root_2, stream_SUPER.nextNode());
adaptor.addChild(root_2, stream_IDENT.nextNode());
adaptor.addChild(root_1, root_2);
}
adaptor.addChild(root_1, stream_genericTypeArgumentListSimplified.nextTree());
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:1083:13: IDENT arguments
{
IDENT474 = (Token) match(input, IDENT, FOLLOW_IDENT_in_primaryExpression12541);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT474);
}
pushFollow(FOLLOW_arguments_in_primaryExpression12543);
arguments475 = arguments();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arguments.add(arguments475.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();
// 1083:57: -> ^( METHOD_CALL IDENT genericTypeArgumentListSimplified arguments )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1083:61: ^( METHOD_CALL IDENT 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_IDENT.nextNode());
adaptor.addChild(root_1, stream_genericTypeArgumentListSimplified.nextTree());
adaptor.addChild(root_1, stream_arguments.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 3:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1084:13: THIS arguments
{
THIS476 = (Token) match(input, THIS, FOLLOW_THIS_in_primaryExpression12598);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_THIS.add(THIS476);
}
pushFollow(FOLLOW_arguments_in_primaryExpression12600);
arguments477 = arguments();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arguments.add(arguments477.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();
// 1084:57: -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1084:61: ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(THIS_CONSTRUCTOR_CALL, THIS476, "THIS_CONSTRUCTOR_CALL"), root_1);
adaptor.addChild(root_1, stream_genericTypeArgumentListSimplified.nextTree());
adaptor.addChild(root_1, stream_arguments.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
}
}
break;
case 6:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1086:9: ( THIS -> THIS ) ( arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] arguments ) )?
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1086:9: ( THIS -> THIS )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1086:13: THIS
{
THIS478 = (Token) match(input, THIS, FOLLOW_THIS_in_primaryExpression12665);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_THIS.add(THIS478);
}
// 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();
// 1086:57: -> THIS
{
adaptor.addChild(root_0, stream_THIS.nextNode());
}
retval.tree = root_0;
}
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1088:9: ( arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] arguments ) )?
int alt137 = 2;
int LA137_0 = input.LA(1);
if ((LA137_0 == LPAREN)) {
alt137 = 1;
}
switch(alt137) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1088:13: arguments
{
pushFollow(FOLLOW_arguments_in_primaryExpression12733);
arguments479 = arguments();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arguments.add(arguments479.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();
// 1088:57: -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] arguments )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1088:61: ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] arguments )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(THIS_CONSTRUCTOR_CALL, THIS478, "THIS_CONSTRUCTOR_CALL"), root_1);
adaptor.addChild(root_1, stream_arguments.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
}
}
break;
case 7:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1090:9: SUPER arguments
{
SUPER480 = (Token) match(input, SUPER, FOLLOW_SUPER_in_primaryExpression12798);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SUPER.add(SUPER480);
}
pushFollow(FOLLOW_arguments_in_primaryExpression12800);
arguments481 = arguments();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arguments.add(arguments481.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();
// 1090:57: -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] arguments )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1090:61: ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] arguments )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(SUPER_CONSTRUCTOR_CALL, SUPER480, "SUPER_CONSTRUCTOR_CALL"), root_1);
adaptor.addChild(root_1, stream_arguments.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 8:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1091:9: ( SUPER DOT IDENT ) ( arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) arguments ) | -> ^( DOT SUPER IDENT ) )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1091:9: ( SUPER DOT IDENT )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1091:13: SUPER DOT IDENT
{
SUPER482 = (Token) match(input, SUPER, FOLLOW_SUPER_in_primaryExpression12856);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SUPER.add(SUPER482);
}
DOT483 = (Token) match(input, DOT, FOLLOW_DOT_in_primaryExpression12858);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_DOT.add(DOT483);
}
IDENT484 = (Token) match(input, IDENT, FOLLOW_IDENT_in_primaryExpression12860);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT484);
}
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1093:9: ( arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) arguments ) | -> ^( DOT SUPER IDENT ) )
int alt138 = 2;
int LA138_0 = input.LA(1);
if ((LA138_0 == LPAREN)) {
alt138 = 1;
} else if ((LA138_0 == EOF || (LA138_0 >= AND && LA138_0 <= ASSIGN) || (LA138_0 >= BIT_SHIFT_RIGHT && LA138_0 <= DOT) || (LA138_0 >= EQUAL && LA138_0 <= LBRACK) || (LA138_0 >= LESS_OR_EQUAL && LA138_0 <= LOGICAL_AND) || LA138_0 == LOGICAL_OR || (LA138_0 >= MINUS && LA138_0 <= MOD_ASSIGN) || (LA138_0 >= NOT_EQUAL && LA138_0 <= XOR_ASSIGN) || LA138_0 == INSTANCEOF)) {
alt138 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 138, 0, input);
throw nvae;
}
switch(alt138) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1093:13: arguments
{
pushFollow(FOLLOW_arguments_in_primaryExpression12884);
arguments485 = arguments();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arguments.add(arguments485.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();
// 1093:57: -> ^( METHOD_CALL ^( DOT SUPER IDENT ) arguments )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1093:61: ^( METHOD_CALL ^( DOT SUPER IDENT ) arguments )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(METHOD_CALL, "METHOD_CALL"), root_1);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1093:75: ^( DOT SUPER IDENT )
{
CommonTree root_2 = (CommonTree) adaptor.nil();
root_2 = (CommonTree) adaptor.becomeRoot(stream_DOT.nextNode(), root_2);
adaptor.addChild(root_2, stream_SUPER.nextNode());
adaptor.addChild(root_2, stream_IDENT.nextNode());
adaptor.addChild(root_1, root_2);
}
adaptor.addChild(root_1, stream_arguments.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1094:57:
{
// 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();
// 1094:57: -> ^( DOT SUPER IDENT )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1094:61: ^( DOT SUPER IDENT )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_DOT.nextNode(), root_1);
adaptor.addChild(root_1, stream_SUPER.nextNode());
adaptor.addChild(root_1, stream_IDENT.nextNode());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
}
}
break;
case 9:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1096:9: ( primitiveType -> primitiveType ) ( arrayDeclarator -> ^( arrayDeclarator $primaryExpression) )* DOT CLASS
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1096:9: ( primitiveType -> primitiveType )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1096:13: primitiveType
{
pushFollow(FOLLOW_primitiveType_in_primaryExpression13026);
primitiveType486 = primitiveType();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_primitiveType.add(primitiveType486.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();
// 1096:57: -> primitiveType
{
adaptor.addChild(root_0, stream_primitiveType.nextTree());
}
retval.tree = root_0;
}
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1098:9: ( arrayDeclarator -> ^( arrayDeclarator $primaryExpression) )*
loop139: do {
int alt139 = 2;
int LA139_0 = input.LA(1);
if ((LA139_0 == LBRACK)) {
alt139 = 1;
}
switch(alt139) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1098:13: arrayDeclarator
{
pushFollow(FOLLOW_arrayDeclarator_in_primaryExpression13085);
arrayDeclarator487 = arrayDeclarator();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arrayDeclarator.add(arrayDeclarator487.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();
// 1098:57: -> ^( arrayDeclarator $primaryExpression)
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1098:61: ^( arrayDeclarator $primaryExpression)
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_arrayDeclarator.nextNode(), root_1);
adaptor.addChild(root_1, stream_retval.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
default:
break loop139;
}
} while (true);
DOT488 = (Token) match(input, DOT, FOLLOW_DOT_in_primaryExpression13144);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_DOT.add(DOT488);
}
CLASS489 = (Token) match(input, CLASS, FOLLOW_CLASS_in_primaryExpression13146);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_CLASS.add(CLASS489);
}
// 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();
// 1100:57: -> ^( DOT $primaryExpression CLASS )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1100:61: ^( DOT $primaryExpression CLASS )
{
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_CLASS.nextNode());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 10:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1101:9: VOID DOT CLASS
{
VOID490 = (Token) match(input, VOID, FOLLOW_VOID_in_primaryExpression13206);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_VOID.add(VOID490);
}
DOT491 = (Token) match(input, DOT, FOLLOW_DOT_in_primaryExpression13208);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_DOT.add(DOT491);
}
CLASS492 = (Token) match(input, CLASS, FOLLOW_CLASS_in_primaryExpression13210);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_CLASS.add(CLASS492);
}
// 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();
// 1101:57: -> ^( DOT VOID CLASS )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1101:61: ^( DOT VOID CLASS )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_DOT.nextNode(), root_1);
adaptor.addChild(root_1, stream_VOID.nextNode());
adaptor.addChild(root_1, stream_CLASS.nextNode());
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, 105, primaryExpression_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleTokenStream in project freud by LMAX-Exchange.
the class JavaParser method arrayDeclarator.
// $ANTLR start "arrayDeclarator"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:598:1: arrayDeclarator : LBRACK RBRACK -> ^( ARRAY_DECLARATOR ) ;
public final JavaParser.arrayDeclarator_return arrayDeclarator() throws RecognitionException {
JavaParser.arrayDeclarator_return retval = new JavaParser.arrayDeclarator_return();
retval.start = input.LT(1);
int arrayDeclarator_StartIndex = input.index();
CommonTree root_0 = null;
Token LBRACK140 = null;
Token RBRACK141 = null;
CommonTree LBRACK140_tree = null;
CommonTree RBRACK141_tree = null;
RewriteRuleTokenStream stream_RBRACK = new RewriteRuleTokenStream(adaptor, "token RBRACK");
RewriteRuleTokenStream stream_LBRACK = new RewriteRuleTokenStream(adaptor, "token LBRACK");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 33)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:599:5: ( LBRACK RBRACK -> ^( ARRAY_DECLARATOR ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:599:9: LBRACK RBRACK
{
LBRACK140 = (Token) match(input, LBRACK, FOLLOW_LBRACK_in_arrayDeclarator6453);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LBRACK.add(LBRACK140);
}
RBRACK141 = (Token) match(input, RBRACK, FOLLOW_RBRACK_in_arrayDeclarator6455);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_RBRACK.add(RBRACK141);
}
// 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();
// 600:9: -> ^( ARRAY_DECLARATOR )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:600:13: ^( ARRAY_DECLARATOR )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ARRAY_DECLARATOR, "ARRAY_DECLARATOR"), root_1);
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, 33, arrayDeclarator_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleTokenStream in project freud by LMAX-Exchange.
the class JavaParser method genericTypeArgumentList.
// $ANTLR start "genericTypeArgumentList"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:696:1: genericTypeArgumentList : LESS_THAN genericTypeArgument ( COMMA genericTypeArgument )* genericTypeListClosing -> ^( GENERIC_TYPE_ARG_LIST[$LESS_THAN, \"GENERIC_TYPE_ARG_LIST\"] ( genericTypeArgument )+ ) ;
public final JavaParser.genericTypeArgumentList_return genericTypeArgumentList() throws RecognitionException {
JavaParser.genericTypeArgumentList_return retval = new JavaParser.genericTypeArgumentList_return();
retval.start = input.LT(1);
int genericTypeArgumentList_StartIndex = input.index();
CommonTree root_0 = null;
Token LESS_THAN185 = null;
Token COMMA187 = null;
JavaParser.genericTypeArgument_return genericTypeArgument186 = null;
JavaParser.genericTypeArgument_return genericTypeArgument188 = null;
JavaParser.genericTypeListClosing_return genericTypeListClosing189 = null;
CommonTree LESS_THAN185_tree = null;
CommonTree COMMA187_tree = null;
RewriteRuleTokenStream stream_COMMA = new RewriteRuleTokenStream(adaptor, "token COMMA");
RewriteRuleTokenStream stream_LESS_THAN = new RewriteRuleTokenStream(adaptor, "token LESS_THAN");
RewriteRuleSubtreeStream stream_genericTypeArgument = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeArgument");
RewriteRuleSubtreeStream stream_genericTypeListClosing = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeListClosing");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 50)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:697:5: ( LESS_THAN genericTypeArgument ( COMMA genericTypeArgument )* genericTypeListClosing -> ^( GENERIC_TYPE_ARG_LIST[$LESS_THAN, \"GENERIC_TYPE_ARG_LIST\"] ( genericTypeArgument )+ ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:697:9: LESS_THAN genericTypeArgument ( COMMA genericTypeArgument )* genericTypeListClosing
{
LESS_THAN185 = (Token) match(input, LESS_THAN, FOLLOW_LESS_THAN_in_genericTypeArgumentList7224);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LESS_THAN.add(LESS_THAN185);
}
pushFollow(FOLLOW_genericTypeArgument_in_genericTypeArgumentList7226);
genericTypeArgument186 = genericTypeArgument();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericTypeArgument.add(genericTypeArgument186.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:697:39: ( COMMA genericTypeArgument )*
loop66: do {
int alt66 = 2;
int LA66_0 = input.LA(1);
if ((LA66_0 == COMMA)) {
int LA66_2 = input.LA(2);
if ((synpred91_Java())) {
alt66 = 1;
}
}
switch(alt66) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:697:40: COMMA genericTypeArgument
{
COMMA187 = (Token) match(input, COMMA, FOLLOW_COMMA_in_genericTypeArgumentList7229);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_COMMA.add(COMMA187);
}
pushFollow(FOLLOW_genericTypeArgument_in_genericTypeArgumentList7231);
genericTypeArgument188 = genericTypeArgument();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericTypeArgument.add(genericTypeArgument188.getTree());
}
}
break;
default:
break loop66;
}
} while (true);
pushFollow(FOLLOW_genericTypeListClosing_in_genericTypeArgumentList7235);
genericTypeListClosing189 = genericTypeListClosing();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericTypeListClosing.add(genericTypeListClosing189.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();
// 698:9: -> ^( GENERIC_TYPE_ARG_LIST[$LESS_THAN, \"GENERIC_TYPE_ARG_LIST\"] ( genericTypeArgument )+ )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:698:13: ^( GENERIC_TYPE_ARG_LIST[$LESS_THAN, \"GENERIC_TYPE_ARG_LIST\"] ( genericTypeArgument )+ )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(GENERIC_TYPE_ARG_LIST, LESS_THAN185, "GENERIC_TYPE_ARG_LIST"), root_1);
if (!(stream_genericTypeArgument.hasNext())) {
throw new RewriteEarlyExitException();
}
while (stream_genericTypeArgument.hasNext()) {
adaptor.addChild(root_1, stream_genericTypeArgument.nextTree());
}
stream_genericTypeArgument.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, 50, genericTypeArgumentList_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleTokenStream in project freud by LMAX-Exchange.
the class CssParser method importRule.
// $ANTLR start "importRule"
// /home/langera/dev/freud/src/grammar/Css.g:44:1: importRule : ( '@import' | '@include' ) IDENT -> ^( IMPORT IDENT ) ;
public final CssParser.importRule_return importRule() throws RecognitionException {
CssParser.importRule_return retval = new CssParser.importRule_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token string_literal4 = null;
Token string_literal5 = null;
Token IDENT6 = null;
CommonTree string_literal4_tree = null;
CommonTree string_literal5_tree = null;
CommonTree IDENT6_tree = null;
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
RewriteRuleTokenStream stream_26 = new RewriteRuleTokenStream(adaptor, "token 26");
RewriteRuleTokenStream stream_27 = new RewriteRuleTokenStream(adaptor, "token 27");
try {
// /home/langera/dev/freud/src/grammar/Css.g:45:2: ( ( '@import' | '@include' ) IDENT -> ^( IMPORT IDENT ) )
// /home/langera/dev/freud/src/grammar/Css.g:45:4: ( '@import' | '@include' ) IDENT
{
// /home/langera/dev/freud/src/grammar/Css.g:45:4: ( '@import' | '@include' )
int alt3 = 2;
int LA3_0 = input.LA(1);
if ((LA3_0 == 26)) {
alt3 = 1;
} else if ((LA3_0 == 27)) {
alt3 = 2;
} else {
NoViableAltException nvae = new NoViableAltException("", 3, 0, input);
throw nvae;
}
switch(alt3) {
case 1:
// /home/langera/dev/freud/src/grammar/Css.g:45:5: '@import'
{
string_literal4 = (Token) match(input, 26, FOLLOW_26_in_importRule153);
stream_26.add(string_literal4);
}
break;
case 2:
// /home/langera/dev/freud/src/grammar/Css.g:45:17: '@include'
{
string_literal5 = (Token) match(input, 27, FOLLOW_27_in_importRule157);
stream_27.add(string_literal5);
}
break;
}
IDENT6 = (Token) match(input, IDENT, FOLLOW_IDENT_in_importRule161);
stream_IDENT.add(IDENT6);
// AST REWRITE
// elements: IDENT
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 45:36: -> ^( IMPORT IDENT )
{
// /home/langera/dev/freud/src/grammar/Css.g:45:39: ^( IMPORT IDENT )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(IMPORT, "IMPORT"), root_1);
adaptor.addChild(root_1, stream_IDENT.nextNode());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
} catch (RecognitionException re) {
reportError(re);
recover(input, re);
retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
} finally {
}
return retval;
}
Aggregations