use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method interfaceFieldDeclaratorList.
// $ANTLR start "interfaceFieldDeclaratorList"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:579:1: interfaceFieldDeclaratorList : interfaceFieldDeclarator ( COMMA interfaceFieldDeclarator )* -> ^( VAR_DECLARATOR_LIST ( interfaceFieldDeclarator )+ ) ;
public final JavaParser.interfaceFieldDeclaratorList_return interfaceFieldDeclaratorList() throws RecognitionException {
JavaParser.interfaceFieldDeclaratorList_return retval = new JavaParser.interfaceFieldDeclaratorList_return();
retval.start = input.LT(1);
int interfaceFieldDeclaratorList_StartIndex = input.index();
CommonTree root_0 = null;
Token COMMA131 = null;
JavaParser.interfaceFieldDeclarator_return interfaceFieldDeclarator130 = null;
JavaParser.interfaceFieldDeclarator_return interfaceFieldDeclarator132 = null;
CommonTree COMMA131_tree = null;
RewriteRuleTokenStream stream_COMMA = new RewriteRuleTokenStream(adaptor, "token COMMA");
RewriteRuleSubtreeStream stream_interfaceFieldDeclarator = new RewriteRuleSubtreeStream(adaptor, "rule interfaceFieldDeclarator");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 29)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:580:5: ( interfaceFieldDeclarator ( COMMA interfaceFieldDeclarator )* -> ^( VAR_DECLARATOR_LIST ( interfaceFieldDeclarator )+ ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:580:9: interfaceFieldDeclarator ( COMMA interfaceFieldDeclarator )*
{
pushFollow(FOLLOW_interfaceFieldDeclarator_in_interfaceFieldDeclaratorList6315);
interfaceFieldDeclarator130 = interfaceFieldDeclarator();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_interfaceFieldDeclarator.add(interfaceFieldDeclarator130.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:580:34: ( COMMA interfaceFieldDeclarator )*
loop47: do {
int alt47 = 2;
int LA47_0 = input.LA(1);
if ((LA47_0 == COMMA)) {
alt47 = 1;
}
switch(alt47) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:580:35: COMMA interfaceFieldDeclarator
{
COMMA131 = (Token) match(input, COMMA, FOLLOW_COMMA_in_interfaceFieldDeclaratorList6318);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_COMMA.add(COMMA131);
}
pushFollow(FOLLOW_interfaceFieldDeclarator_in_interfaceFieldDeclaratorList6320);
interfaceFieldDeclarator132 = interfaceFieldDeclarator();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_interfaceFieldDeclarator.add(interfaceFieldDeclarator132.getTree());
}
}
break;
default:
break loop47;
}
} 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();
// 581:9: -> ^( VAR_DECLARATOR_LIST ( interfaceFieldDeclarator )+ )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:581:13: ^( VAR_DECLARATOR_LIST ( interfaceFieldDeclarator )+ )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(VAR_DECLARATOR_LIST, "VAR_DECLARATOR_LIST"), root_1);
if (!(stream_interfaceFieldDeclarator.hasNext())) {
throw new RewriteEarlyExitException();
}
while (stream_interfaceFieldDeclarator.hasNext()) {
adaptor.addChild(root_1, stream_interfaceFieldDeclarator.nextTree());
}
stream_interfaceFieldDeclarator.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, 29, interfaceFieldDeclaratorList_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method enumBody.
// $ANTLR start "enumBody"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:494:1: enumBody : LCURLY enumScopeDeclarations RCURLY -> ^( ENUM_TOP_LEVEL_SCOPE[$LCURLY, \"ENUM_TOP_LEVEL_SCOPE\"] enumScopeDeclarations ) ;
public final JavaParser.enumBody_return enumBody() throws RecognitionException {
JavaParser.enumBody_return retval = new JavaParser.enumBody_return();
retval.start = input.LT(1);
int enumBody_StartIndex = input.index();
CommonTree root_0 = null;
Token LCURLY51 = null;
Token RCURLY53 = null;
JavaParser.enumScopeDeclarations_return enumScopeDeclarations52 = null;
CommonTree LCURLY51_tree = null;
CommonTree RCURLY53_tree = null;
RewriteRuleTokenStream stream_LCURLY = new RewriteRuleTokenStream(adaptor, "token LCURLY");
RewriteRuleTokenStream stream_RCURLY = new RewriteRuleTokenStream(adaptor, "token RCURLY");
RewriteRuleSubtreeStream stream_enumScopeDeclarations = new RewriteRuleSubtreeStream(adaptor, "rule enumScopeDeclarations");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 16)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:495:5: ( LCURLY enumScopeDeclarations RCURLY -> ^( ENUM_TOP_LEVEL_SCOPE[$LCURLY, \"ENUM_TOP_LEVEL_SCOPE\"] enumScopeDeclarations ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:495:9: LCURLY enumScopeDeclarations RCURLY
{
LCURLY51 = (Token) match(input, LCURLY, FOLLOW_LCURLY_in_enumBody5246);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LCURLY.add(LCURLY51);
}
pushFollow(FOLLOW_enumScopeDeclarations_in_enumBody5248);
enumScopeDeclarations52 = enumScopeDeclarations();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_enumScopeDeclarations.add(enumScopeDeclarations52.getTree());
}
RCURLY53 = (Token) match(input, RCURLY, FOLLOW_RCURLY_in_enumBody5250);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_RCURLY.add(RCURLY53);
}
// 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();
// 496:9: -> ^( ENUM_TOP_LEVEL_SCOPE[$LCURLY, \"ENUM_TOP_LEVEL_SCOPE\"] enumScopeDeclarations )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:496:13: ^( ENUM_TOP_LEVEL_SCOPE[$LCURLY, \"ENUM_TOP_LEVEL_SCOPE\"] enumScopeDeclarations )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ENUM_TOP_LEVEL_SCOPE, LCURLY51, "ENUM_TOP_LEVEL_SCOPE"), root_1);
adaptor.addChild(root_1, stream_enumScopeDeclarations.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, 16, enumBody_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method classTypeDeclaration.
// $ANTLR start "classTypeDeclaration"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:444:1: classTypeDeclaration[CommonTree modifiers] : CLASS IDENT ( genericTypeParameterList )? ( classExtendsClause )? ( implementsClause )? classBody -> ^( CLASS IDENT ( genericTypeParameterList )? ( classExtendsClause )? ( implementsClause )? classBody ) ;
public final JavaParser.classTypeDeclaration_return classTypeDeclaration(CommonTree modifiers) throws RecognitionException {
JavaParser.classTypeDeclaration_return retval = new JavaParser.classTypeDeclaration_return();
retval.start = input.LT(1);
int classTypeDeclaration_StartIndex = input.index();
CommonTree root_0 = null;
Token CLASS21 = null;
Token IDENT22 = null;
JavaParser.genericTypeParameterList_return genericTypeParameterList23 = null;
JavaParser.classExtendsClause_return classExtendsClause24 = null;
JavaParser.implementsClause_return implementsClause25 = null;
JavaParser.classBody_return classBody26 = null;
CommonTree CLASS21_tree = null;
CommonTree IDENT22_tree = null;
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
RewriteRuleTokenStream stream_CLASS = new RewriteRuleTokenStream(adaptor, "token CLASS");
RewriteRuleSubtreeStream stream_genericTypeParameterList = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeParameterList");
RewriteRuleSubtreeStream stream_classExtendsClause = new RewriteRuleSubtreeStream(adaptor, "rule classExtendsClause");
RewriteRuleSubtreeStream stream_implementsClause = new RewriteRuleSubtreeStream(adaptor, "rule implementsClause");
RewriteRuleSubtreeStream stream_classBody = new RewriteRuleSubtreeStream(adaptor, "rule classBody");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 7)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:445:5: ( CLASS IDENT ( genericTypeParameterList )? ( classExtendsClause )? ( implementsClause )? classBody -> ^( CLASS IDENT ( genericTypeParameterList )? ( classExtendsClause )? ( implementsClause )? classBody ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:445:9: CLASS IDENT ( genericTypeParameterList )? ( classExtendsClause )? ( implementsClause )? classBody
{
CLASS21 = (Token) match(input, CLASS, FOLLOW_CLASS_in_classTypeDeclaration4755);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_CLASS.add(CLASS21);
}
IDENT22 = (Token) match(input, IDENT, FOLLOW_IDENT_in_classTypeDeclaration4757);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT22);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:445:21: ( genericTypeParameterList )?
int alt8 = 2;
int LA8_0 = input.LA(1);
if ((LA8_0 == LESS_THAN)) {
alt8 = 1;
}
switch(alt8) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: genericTypeParameterList
{
pushFollow(FOLLOW_genericTypeParameterList_in_classTypeDeclaration4759);
genericTypeParameterList23 = genericTypeParameterList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericTypeParameterList.add(genericTypeParameterList23.getTree());
}
}
break;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:445:47: ( classExtendsClause )?
int alt9 = 2;
int LA9_0 = input.LA(1);
if ((LA9_0 == EXTENDS)) {
alt9 = 1;
}
switch(alt9) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: classExtendsClause
{
pushFollow(FOLLOW_classExtendsClause_in_classTypeDeclaration4762);
classExtendsClause24 = classExtendsClause();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_classExtendsClause.add(classExtendsClause24.getTree());
}
}
break;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:445:67: ( implementsClause )?
int alt10 = 2;
int LA10_0 = input.LA(1);
if ((LA10_0 == IMPLEMENTS)) {
alt10 = 1;
}
switch(alt10) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: implementsClause
{
pushFollow(FOLLOW_implementsClause_in_classTypeDeclaration4765);
implementsClause25 = implementsClause();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_implementsClause.add(implementsClause25.getTree());
}
}
break;
}
pushFollow(FOLLOW_classBody_in_classTypeDeclaration4768);
classBody26 = classBody();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_classBody.add(classBody26.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();
// 446:9: -> ^( CLASS IDENT ( genericTypeParameterList )? ( classExtendsClause )? ( implementsClause )? classBody )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:446:13: ^( CLASS IDENT ( genericTypeParameterList )? ( classExtendsClause )? ( implementsClause )? classBody )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_CLASS.nextNode(), root_1);
adaptor.addChild(root_1, modifiers);
adaptor.addChild(root_1, stream_IDENT.nextNode());
// /home/langera/dev/freud/trunk/src/grammar/Java.g:446:40: ( genericTypeParameterList )?
if (stream_genericTypeParameterList.hasNext()) {
adaptor.addChild(root_1, stream_genericTypeParameterList.nextTree());
}
stream_genericTypeParameterList.reset();
// /home/langera/dev/freud/trunk/src/grammar/Java.g:446:66: ( classExtendsClause )?
if (stream_classExtendsClause.hasNext()) {
adaptor.addChild(root_1, stream_classExtendsClause.nextTree());
}
stream_classExtendsClause.reset();
// /home/langera/dev/freud/trunk/src/grammar/Java.g:446:86: ( implementsClause )?
if (stream_implementsClause.hasNext()) {
adaptor.addChild(root_1, stream_implementsClause.nextTree());
}
stream_implementsClause.reset();
adaptor.addChild(root_1, stream_classBody.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, 7, classTypeDeclaration_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream 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.RewriteRuleSubtreeStream 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;
}
Aggregations