use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method unaryExpressionRest.
// $ANTLR start "unaryExpressionRest"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1037:1: unaryExpressionRest : ( NOT unaryExpressionAll -> ^( NOT unaryExpressionAll ) | LOGICAL_NOT unaryExpressionAll -> ^( LOGICAL_NOT unaryExpressionAll ) | LPAREN simpleType RPAREN unaryExpressionAll -> ^( CAST_EXPR[$LPAREN, \"CAST_EXPR\"] simpleType unaryExpressionAll ) | LPAREN objectType RPAREN unaryExpressionRest -> ^( CAST_EXPR[$LPAREN, \"CAST_EXPR\"] objectType unaryExpressionRest ) | postfixedExpression );
public final JavaParser.unaryExpressionRest_return unaryExpressionRest() throws RecognitionException {
JavaParser.unaryExpressionRest_return retval = new JavaParser.unaryExpressionRest_return();
retval.start = input.LT(1);
int unaryExpressionRest_StartIndex = input.index();
CommonTree root_0 = null;
Token NOT436 = null;
Token LOGICAL_NOT438 = null;
Token LPAREN440 = null;
Token RPAREN442 = null;
Token LPAREN444 = null;
Token RPAREN446 = null;
JavaParser.unaryExpressionAll_return unaryExpressionAll437 = null;
JavaParser.unaryExpressionAll_return unaryExpressionAll439 = null;
JavaParser.simpleType_return simpleType441 = null;
JavaParser.unaryExpressionAll_return unaryExpressionAll443 = null;
JavaParser.objectType_return objectType445 = null;
JavaParser.unaryExpressionRest_return unaryExpressionRest447 = null;
JavaParser.postfixedExpression_return postfixedExpression448 = null;
CommonTree NOT436_tree = null;
CommonTree LOGICAL_NOT438_tree = null;
CommonTree LPAREN440_tree = null;
CommonTree RPAREN442_tree = null;
CommonTree LPAREN444_tree = null;
CommonTree RPAREN446_tree = null;
RewriteRuleTokenStream stream_RPAREN = new RewriteRuleTokenStream(adaptor, "token RPAREN");
RewriteRuleTokenStream stream_LOGICAL_NOT = new RewriteRuleTokenStream(adaptor, "token LOGICAL_NOT");
RewriteRuleTokenStream stream_NOT = new RewriteRuleTokenStream(adaptor, "token NOT");
RewriteRuleTokenStream stream_LPAREN = new RewriteRuleTokenStream(adaptor, "token LPAREN");
RewriteRuleSubtreeStream stream_simpleType = new RewriteRuleSubtreeStream(adaptor, "rule simpleType");
RewriteRuleSubtreeStream stream_unaryExpressionRest = new RewriteRuleSubtreeStream(adaptor, "rule unaryExpressionRest");
RewriteRuleSubtreeStream stream_objectType = new RewriteRuleSubtreeStream(adaptor, "rule objectType");
RewriteRuleSubtreeStream stream_unaryExpressionAll = new RewriteRuleSubtreeStream(adaptor, "rule unaryExpressionAll");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 103)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1038:5: ( NOT unaryExpressionAll -> ^( NOT unaryExpressionAll ) | LOGICAL_NOT unaryExpressionAll -> ^( LOGICAL_NOT unaryExpressionAll ) | LPAREN simpleType RPAREN unaryExpressionAll -> ^( CAST_EXPR[$LPAREN, \"CAST_EXPR\"] simpleType unaryExpressionAll ) | LPAREN objectType RPAREN unaryExpressionRest -> ^( CAST_EXPR[$LPAREN, \"CAST_EXPR\"] objectType unaryExpressionRest ) | postfixedExpression )
int alt128 = 5;
alt128 = dfa128.predict(input);
switch(alt128) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1038:9: NOT unaryExpressionAll
{
NOT436 = (Token) match(input, NOT, FOLLOW_NOT_in_unaryExpressionRest11393);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_NOT.add(NOT436);
}
pushFollow(FOLLOW_unaryExpressionAll_in_unaryExpressionRest11395);
unaryExpressionAll437 = unaryExpressionAll();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_unaryExpressionAll.add(unaryExpressionAll437.getTree());
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 1038:57: -> ^( NOT unaryExpressionAll )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1038:61: ^( NOT unaryExpressionAll )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_NOT.nextNode(), root_1);
adaptor.addChild(root_1, stream_unaryExpressionAll.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1039:9: LOGICAL_NOT unaryExpressionAll
{
LOGICAL_NOT438 = (Token) match(input, LOGICAL_NOT, FOLLOW_LOGICAL_NOT_in_unaryExpressionRest11439);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LOGICAL_NOT.add(LOGICAL_NOT438);
}
pushFollow(FOLLOW_unaryExpressionAll_in_unaryExpressionRest11441);
unaryExpressionAll439 = unaryExpressionAll();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_unaryExpressionAll.add(unaryExpressionAll439.getTree());
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 1039:57: -> ^( LOGICAL_NOT unaryExpressionAll )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1039:61: ^( LOGICAL_NOT unaryExpressionAll )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_LOGICAL_NOT.nextNode(), root_1);
adaptor.addChild(root_1, stream_unaryExpressionAll.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 3:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1040:9: LPAREN simpleType RPAREN unaryExpressionAll
{
LPAREN440 = (Token) match(input, LPAREN, FOLLOW_LPAREN_in_unaryExpressionRest11477);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LPAREN.add(LPAREN440);
}
pushFollow(FOLLOW_simpleType_in_unaryExpressionRest11479);
simpleType441 = simpleType();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_simpleType.add(simpleType441.getTree());
}
RPAREN442 = (Token) match(input, RPAREN, FOLLOW_RPAREN_in_unaryExpressionRest11481);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_RPAREN.add(RPAREN442);
}
pushFollow(FOLLOW_unaryExpressionAll_in_unaryExpressionRest11483);
unaryExpressionAll443 = unaryExpressionAll();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_unaryExpressionAll.add(unaryExpressionAll443.getTree());
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 1040:57: -> ^( CAST_EXPR[$LPAREN, \"CAST_EXPR\"] simpleType unaryExpressionAll )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1040:61: ^( CAST_EXPR[$LPAREN, \"CAST_EXPR\"] simpleType unaryExpressionAll )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(CAST_EXPR, LPAREN440, "CAST_EXPR"), root_1);
adaptor.addChild(root_1, stream_simpleType.nextTree());
adaptor.addChild(root_1, stream_unaryExpressionAll.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 4:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1041:9: LPAREN objectType RPAREN unaryExpressionRest
{
LPAREN444 = (Token) match(input, LPAREN, FOLLOW_LPAREN_in_unaryExpressionRest11509);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LPAREN.add(LPAREN444);
}
pushFollow(FOLLOW_objectType_in_unaryExpressionRest11511);
objectType445 = objectType();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_objectType.add(objectType445.getTree());
}
RPAREN446 = (Token) match(input, RPAREN, FOLLOW_RPAREN_in_unaryExpressionRest11513);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_RPAREN.add(RPAREN446);
}
pushFollow(FOLLOW_unaryExpressionRest_in_unaryExpressionRest11515);
unaryExpressionRest447 = unaryExpressionRest();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_unaryExpressionRest.add(unaryExpressionRest447.getTree());
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 1041:57: -> ^( CAST_EXPR[$LPAREN, \"CAST_EXPR\"] objectType unaryExpressionRest )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1041:61: ^( CAST_EXPR[$LPAREN, \"CAST_EXPR\"] objectType unaryExpressionRest )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(CAST_EXPR, LPAREN444, "CAST_EXPR"), root_1);
adaptor.addChild(root_1, stream_objectType.nextTree());
adaptor.addChild(root_1, stream_unaryExpressionRest.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 5:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1042:9: postfixedExpression
{
root_0 = (CommonTree) adaptor.nil();
pushFollow(FOLLOW_postfixedExpression_in_unaryExpressionRest11540);
postfixedExpression448 = postfixedExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, postfixedExpression448.getTree());
}
}
break;
}
retval.stop = input.LT(-1);
if (state.backtracking == 0) {
retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
} catch (RecognitionException re) {
reportError(re);
recover(input, re);
retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
} finally {
if (state.backtracking > 0) {
memoize(input, 103, unaryExpressionRest_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method enumTypeDeclaration.
// $ANTLR start "enumTypeDeclaration"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:489:1: enumTypeDeclaration[CommonTree modifiers] : ENUM IDENT ( implementsClause )? enumBody -> ^( ENUM IDENT ( implementsClause )? enumBody ) ;
public final JavaParser.enumTypeDeclaration_return enumTypeDeclaration(CommonTree modifiers) throws RecognitionException {
JavaParser.enumTypeDeclaration_return retval = new JavaParser.enumTypeDeclaration_return();
retval.start = input.LT(1);
int enumTypeDeclaration_StartIndex = input.index();
CommonTree root_0 = null;
Token ENUM47 = null;
Token IDENT48 = null;
JavaParser.implementsClause_return implementsClause49 = null;
JavaParser.enumBody_return enumBody50 = null;
CommonTree ENUM47_tree = null;
CommonTree IDENT48_tree = null;
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
RewriteRuleTokenStream stream_ENUM = new RewriteRuleTokenStream(adaptor, "token ENUM");
RewriteRuleSubtreeStream stream_implementsClause = new RewriteRuleSubtreeStream(adaptor, "rule implementsClause");
RewriteRuleSubtreeStream stream_enumBody = new RewriteRuleSubtreeStream(adaptor, "rule enumBody");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 15)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:490:5: ( ENUM IDENT ( implementsClause )? enumBody -> ^( ENUM IDENT ( implementsClause )? enumBody ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:490:9: ENUM IDENT ( implementsClause )? enumBody
{
ENUM47 = (Token) match(input, ENUM, FOLLOW_ENUM_in_enumTypeDeclaration5196);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_ENUM.add(ENUM47);
}
IDENT48 = (Token) match(input, IDENT, FOLLOW_IDENT_in_enumTypeDeclaration5198);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT48);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:490:20: ( implementsClause )?
int alt15 = 2;
int LA15_0 = input.LA(1);
if ((LA15_0 == IMPLEMENTS)) {
alt15 = 1;
}
switch(alt15) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: implementsClause
{
pushFollow(FOLLOW_implementsClause_in_enumTypeDeclaration5200);
implementsClause49 = implementsClause();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_implementsClause.add(implementsClause49.getTree());
}
}
break;
}
pushFollow(FOLLOW_enumBody_in_enumTypeDeclaration5203);
enumBody50 = enumBody();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_enumBody.add(enumBody50.getTree());
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 491:9: -> ^( ENUM IDENT ( implementsClause )? enumBody )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:491:13: ^( ENUM IDENT ( implementsClause )? enumBody )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_ENUM.nextNode(), root_1);
adaptor.addChild(root_1, modifiers);
adaptor.addChild(root_1, stream_IDENT.nextNode());
// /home/langera/dev/freud/trunk/src/grammar/Java.g:491:39: ( implementsClause )?
if (stream_implementsClause.hasNext()) {
adaptor.addChild(root_1, stream_implementsClause.nextTree());
}
stream_implementsClause.reset();
adaptor.addChild(root_1, stream_enumBody.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
retval.stop = input.LT(-1);
if (state.backtracking == 0) {
retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
} catch (RecognitionException re) {
reportError(re);
recover(input, re);
retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
} finally {
if (state.backtracking > 0) {
memoize(input, 15, enumTypeDeclaration_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method localVariableDeclaration.
// $ANTLR start "localVariableDeclaration"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:836:1: localVariableDeclaration : localModifierList type classFieldDeclaratorList -> ^( VAR_DECLARATION localModifierList type classFieldDeclaratorList ) ;
public final JavaParser.localVariableDeclaration_return localVariableDeclaration() throws RecognitionException {
JavaParser.localVariableDeclaration_return retval = new JavaParser.localVariableDeclaration_return();
retval.start = input.LT(1);
int localVariableDeclaration_StartIndex = input.index();
CommonTree root_0 = null;
JavaParser.localModifierList_return localModifierList272 = null;
JavaParser.type_return type273 = null;
JavaParser.classFieldDeclaratorList_return classFieldDeclaratorList274 = null;
RewriteRuleSubtreeStream stream_localModifierList = new RewriteRuleSubtreeStream(adaptor, "rule localModifierList");
RewriteRuleSubtreeStream stream_type = new RewriteRuleSubtreeStream(adaptor, "rule type");
RewriteRuleSubtreeStream stream_classFieldDeclaratorList = new RewriteRuleSubtreeStream(adaptor, "rule classFieldDeclaratorList");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 74)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:837:5: ( localModifierList type classFieldDeclaratorList -> ^( VAR_DECLARATION localModifierList type classFieldDeclaratorList ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:837:9: localModifierList type classFieldDeclaratorList
{
pushFollow(FOLLOW_localModifierList_in_localVariableDeclaration8498);
localModifierList272 = localModifierList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_localModifierList.add(localModifierList272.getTree());
}
pushFollow(FOLLOW_type_in_localVariableDeclaration8500);
type273 = type();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_type.add(type273.getTree());
}
pushFollow(FOLLOW_classFieldDeclaratorList_in_localVariableDeclaration8502);
classFieldDeclaratorList274 = classFieldDeclaratorList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_classFieldDeclaratorList.add(classFieldDeclaratorList274.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();
// 838:9: -> ^( VAR_DECLARATION localModifierList type classFieldDeclaratorList )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:838:13: ^( VAR_DECLARATION localModifierList type classFieldDeclaratorList )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(VAR_DECLARATION, "VAR_DECLARATION"), root_1);
adaptor.addChild(root_1, stream_localModifierList.nextTree());
adaptor.addChild(root_1, stream_type.nextTree());
adaptor.addChild(root_1, stream_classFieldDeclaratorList.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, 74, localVariableDeclaration_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method newExpression.
// $ANTLR start "newExpression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1128:1: newExpression : NEW ( primitiveType newArrayConstruction -> ^( STATIC_ARRAY_CREATOR[$NEW, \"STATIC_ARRAY_CREATOR\"] primitiveType newArrayConstruction ) | ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified ( newArrayConstruction -> ^( STATIC_ARRAY_CREATOR[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified newArrayConstruction ) | arguments ( classBody )? -> ^( CLASS_CONSTRUCTOR_CALL[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified arguments ( classBody )? ) ) ) ;
public final JavaParser.newExpression_return newExpression() throws RecognitionException {
JavaParser.newExpression_return retval = new JavaParser.newExpression_return();
retval.start = input.LT(1);
int newExpression_StartIndex = input.index();
CommonTree root_0 = null;
Token NEW509 = null;
JavaParser.primitiveType_return primitiveType510 = null;
JavaParser.newArrayConstruction_return newArrayConstruction511 = null;
JavaParser.genericTypeArgumentListSimplified_return genericTypeArgumentListSimplified512 = null;
JavaParser.qualifiedTypeIdentSimplified_return qualifiedTypeIdentSimplified513 = null;
JavaParser.newArrayConstruction_return newArrayConstruction514 = null;
JavaParser.arguments_return arguments515 = null;
JavaParser.classBody_return classBody516 = null;
CommonTree NEW509_tree = null;
RewriteRuleTokenStream stream_NEW = new RewriteRuleTokenStream(adaptor, "token NEW");
RewriteRuleSubtreeStream stream_newArrayConstruction = new RewriteRuleSubtreeStream(adaptor, "rule newArrayConstruction");
RewriteRuleSubtreeStream stream_arguments = new RewriteRuleSubtreeStream(adaptor, "rule arguments");
RewriteRuleSubtreeStream stream_qualifiedTypeIdentSimplified = new RewriteRuleSubtreeStream(adaptor, "rule qualifiedTypeIdentSimplified");
RewriteRuleSubtreeStream stream_primitiveType = new RewriteRuleSubtreeStream(adaptor, "rule primitiveType");
RewriteRuleSubtreeStream stream_classBody = new RewriteRuleSubtreeStream(adaptor, "rule classBody");
RewriteRuleSubtreeStream stream_genericTypeArgumentListSimplified = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeArgumentListSimplified");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 107)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1129:5: ( NEW ( primitiveType newArrayConstruction -> ^( STATIC_ARRAY_CREATOR[$NEW, \"STATIC_ARRAY_CREATOR\"] primitiveType newArrayConstruction ) | ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified ( newArrayConstruction -> ^( STATIC_ARRAY_CREATOR[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified newArrayConstruction ) | arguments ( classBody )? -> ^( CLASS_CONSTRUCTOR_CALL[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified arguments ( classBody )? ) ) ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1129:9: NEW ( primitiveType newArrayConstruction -> ^( STATIC_ARRAY_CREATOR[$NEW, \"STATIC_ARRAY_CREATOR\"] primitiveType newArrayConstruction ) | ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified ( newArrayConstruction -> ^( STATIC_ARRAY_CREATOR[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified newArrayConstruction ) | arguments ( classBody )? -> ^( CLASS_CONSTRUCTOR_CALL[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified arguments ( classBody )? ) ) )
{
NEW509 = (Token) match(input, NEW, FOLLOW_NEW_in_newExpression14040);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_NEW.add(NEW509);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1130:9: ( primitiveType newArrayConstruction -> ^( STATIC_ARRAY_CREATOR[$NEW, \"STATIC_ARRAY_CREATOR\"] primitiveType newArrayConstruction ) | ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified ( newArrayConstruction -> ^( STATIC_ARRAY_CREATOR[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified newArrayConstruction ) | arguments ( classBody )? -> ^( CLASS_CONSTRUCTOR_CALL[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified arguments ( classBody )? ) ) )
int alt148 = 2;
int LA148_0 = input.LA(1);
if ((LA148_0 == BOOLEAN || LA148_0 == BYTE || LA148_0 == CHAR || LA148_0 == DOUBLE || LA148_0 == FLOAT || (LA148_0 >= INT && LA148_0 <= LONG) || LA148_0 == SHORT)) {
alt148 = 1;
} else if ((LA148_0 == LESS_THAN || LA148_0 == IDENT)) {
alt148 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 148, 0, input);
throw nvae;
}
switch(alt148) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1130:13: primitiveType newArrayConstruction
{
pushFollow(FOLLOW_primitiveType_in_newExpression14054);
primitiveType510 = primitiveType();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_primitiveType.add(primitiveType510.getTree());
}
pushFollow(FOLLOW_newArrayConstruction_in_newExpression14056);
newArrayConstruction511 = newArrayConstruction();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_newArrayConstruction.add(newArrayConstruction511.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();
// 1131:13: -> ^( STATIC_ARRAY_CREATOR[$NEW, \"STATIC_ARRAY_CREATOR\"] primitiveType newArrayConstruction )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1131:17: ^( STATIC_ARRAY_CREATOR[$NEW, \"STATIC_ARRAY_CREATOR\"] primitiveType newArrayConstruction )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(STATIC_ARRAY_CREATOR, NEW509, "STATIC_ARRAY_CREATOR"), root_1);
adaptor.addChild(root_1, stream_primitiveType.nextTree());
adaptor.addChild(root_1, stream_newArrayConstruction.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1132:13: ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified ( newArrayConstruction -> ^( STATIC_ARRAY_CREATOR[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified newArrayConstruction ) | arguments ( classBody )? -> ^( CLASS_CONSTRUCTOR_CALL[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified arguments ( classBody )? ) )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1132:13: ( genericTypeArgumentListSimplified )?
int alt145 = 2;
int LA145_0 = input.LA(1);
if ((LA145_0 == LESS_THAN)) {
alt145 = 1;
}
switch(alt145) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: genericTypeArgumentListSimplified
{
pushFollow(FOLLOW_genericTypeArgumentListSimplified_in_newExpression14100);
genericTypeArgumentListSimplified512 = genericTypeArgumentListSimplified();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericTypeArgumentListSimplified.add(genericTypeArgumentListSimplified512.getTree());
}
}
break;
}
pushFollow(FOLLOW_qualifiedTypeIdentSimplified_in_newExpression14103);
qualifiedTypeIdentSimplified513 = qualifiedTypeIdentSimplified();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_qualifiedTypeIdentSimplified.add(qualifiedTypeIdentSimplified513.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1133:13: ( newArrayConstruction -> ^( STATIC_ARRAY_CREATOR[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified newArrayConstruction ) | arguments ( classBody )? -> ^( CLASS_CONSTRUCTOR_CALL[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified arguments ( classBody )? ) )
int alt147 = 2;
int LA147_0 = input.LA(1);
if ((LA147_0 == LBRACK)) {
alt147 = 1;
} else if ((LA147_0 == LPAREN)) {
alt147 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 147, 0, input);
throw nvae;
}
switch(alt147) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1133:17: newArrayConstruction
{
pushFollow(FOLLOW_newArrayConstruction_in_newExpression14121);
newArrayConstruction514 = newArrayConstruction();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_newArrayConstruction.add(newArrayConstruction514.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();
// 1134:17: -> ^( STATIC_ARRAY_CREATOR[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified newArrayConstruction )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1134:21: ^( STATIC_ARRAY_CREATOR[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified newArrayConstruction )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(STATIC_ARRAY_CREATOR, NEW509, "STATIC_ARRAY_CREATOR"), root_1);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1134:74: ( genericTypeArgumentListSimplified )?
if (stream_genericTypeArgumentListSimplified.hasNext()) {
adaptor.addChild(root_1, stream_genericTypeArgumentListSimplified.nextTree());
}
stream_genericTypeArgumentListSimplified.reset();
adaptor.addChild(root_1, stream_qualifiedTypeIdentSimplified.nextTree());
adaptor.addChild(root_1, stream_newArrayConstruction.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1135:17: arguments ( classBody )?
{
pushFollow(FOLLOW_arguments_in_newExpression14186);
arguments515 = arguments();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arguments.add(arguments515.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1135:27: ( classBody )?
int alt146 = 2;
int LA146_0 = input.LA(1);
if ((LA146_0 == LCURLY)) {
alt146 = 1;
}
switch(alt146) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: classBody
{
pushFollow(FOLLOW_classBody_in_newExpression14188);
classBody516 = classBody();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_classBody.add(classBody516.getTree());
}
}
break;
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 1136:17: -> ^( CLASS_CONSTRUCTOR_CALL[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified arguments ( classBody )? )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1136:21: ^( CLASS_CONSTRUCTOR_CALL[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? qualifiedTypeIdentSimplified arguments ( classBody )? )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(CLASS_CONSTRUCTOR_CALL, NEW509, "STATIC_ARRAY_CREATOR"), root_1);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1136:76: ( genericTypeArgumentListSimplified )?
if (stream_genericTypeArgumentListSimplified.hasNext()) {
adaptor.addChild(root_1, stream_genericTypeArgumentListSimplified.nextTree());
}
stream_genericTypeArgumentListSimplified.reset();
adaptor.addChild(root_1, stream_qualifiedTypeIdentSimplified.nextTree());
adaptor.addChild(root_1, stream_arguments.nextTree());
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1136:150: ( classBody )?
if (stream_classBody.hasNext()) {
adaptor.addChild(root_1, stream_classBody.nextTree());
}
stream_classBody.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
}
}
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, 107, newExpression_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method qualifiedIdentExpression.
// $ANTLR start "qualifiedIdentExpression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1104:1: qualifiedIdentExpression : ( qualifiedIdentifier -> qualifiedIdentifier ) ( ( arrayDeclarator -> ^( arrayDeclarator $qualifiedIdentExpression) )+ ( DOT CLASS -> ^( DOT $qualifiedIdentExpression CLASS ) ) | arguments -> ^( METHOD_CALL qualifiedIdentifier arguments ) | outerDot= DOT ( CLASS -> ^( DOT qualifiedIdentifier CLASS ) | genericTypeArgumentListSimplified (Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier genericTypeArgumentListSimplified arguments ) | SUPER innerDot= DOT IDENT arguments -> ^( METHOD_CALL ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT ) genericTypeArgumentListSimplified arguments ) | IDENT arguments -> ^( METHOD_CALL ^( DOT qualifiedIdentifier IDENT ) genericTypeArgumentListSimplified arguments ) ) | THIS -> ^( DOT qualifiedIdentifier THIS ) | Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier arguments ) | innerNewExpression -> ^( DOT qualifiedIdentifier innerNewExpression ) ) )? ;
public final JavaParser.qualifiedIdentExpression_return qualifiedIdentExpression() throws RecognitionException {
JavaParser.qualifiedIdentExpression_return retval = new JavaParser.qualifiedIdentExpression_return();
retval.start = input.LT(1);
int qualifiedIdentExpression_StartIndex = input.index();
CommonTree root_0 = null;
Token outerDot = null;
Token Super = null;
Token innerDot = null;
Token DOT495 = null;
Token CLASS496 = null;
Token CLASS498 = null;
Token SUPER501 = null;
Token IDENT502 = null;
Token IDENT504 = null;
Token THIS506 = null;
JavaParser.qualifiedIdentifier_return qualifiedIdentifier493 = null;
JavaParser.arrayDeclarator_return arrayDeclarator494 = null;
JavaParser.arguments_return arguments497 = null;
JavaParser.genericTypeArgumentListSimplified_return genericTypeArgumentListSimplified499 = null;
JavaParser.arguments_return arguments500 = null;
JavaParser.arguments_return arguments503 = null;
JavaParser.arguments_return arguments505 = null;
JavaParser.arguments_return arguments507 = null;
JavaParser.innerNewExpression_return innerNewExpression508 = null;
CommonTree outerDot_tree = null;
CommonTree Super_tree = null;
CommonTree innerDot_tree = null;
CommonTree DOT495_tree = null;
CommonTree CLASS496_tree = null;
CommonTree CLASS498_tree = null;
CommonTree SUPER501_tree = null;
CommonTree IDENT502_tree = null;
CommonTree IDENT504_tree = null;
CommonTree THIS506_tree = null;
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
RewriteRuleTokenStream stream_CLASS = new RewriteRuleTokenStream(adaptor, "token CLASS");
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_qualifiedIdentifier = new RewriteRuleSubtreeStream(adaptor, "rule qualifiedIdentifier");
RewriteRuleSubtreeStream stream_genericTypeArgumentListSimplified = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeArgumentListSimplified");
RewriteRuleSubtreeStream stream_innerNewExpression = new RewriteRuleSubtreeStream(adaptor, "rule innerNewExpression");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 106)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1106:5: ( ( qualifiedIdentifier -> qualifiedIdentifier ) ( ( arrayDeclarator -> ^( arrayDeclarator $qualifiedIdentExpression) )+ ( DOT CLASS -> ^( DOT $qualifiedIdentExpression CLASS ) ) | arguments -> ^( METHOD_CALL qualifiedIdentifier arguments ) | outerDot= DOT ( CLASS -> ^( DOT qualifiedIdentifier CLASS ) | genericTypeArgumentListSimplified (Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier genericTypeArgumentListSimplified arguments ) | SUPER innerDot= DOT IDENT arguments -> ^( METHOD_CALL ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT ) genericTypeArgumentListSimplified arguments ) | IDENT arguments -> ^( METHOD_CALL ^( DOT qualifiedIdentifier IDENT ) genericTypeArgumentListSimplified arguments ) ) | THIS -> ^( DOT qualifiedIdentifier THIS ) | Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier arguments ) | innerNewExpression -> ^( DOT qualifiedIdentifier innerNewExpression ) ) )? )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1106:9: ( qualifiedIdentifier -> qualifiedIdentifier ) ( ( arrayDeclarator -> ^( arrayDeclarator $qualifiedIdentExpression) )+ ( DOT CLASS -> ^( DOT $qualifiedIdentExpression CLASS ) ) | arguments -> ^( METHOD_CALL qualifiedIdentifier arguments ) | outerDot= DOT ( CLASS -> ^( DOT qualifiedIdentifier CLASS ) | genericTypeArgumentListSimplified (Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier genericTypeArgumentListSimplified arguments ) | SUPER innerDot= DOT IDENT arguments -> ^( METHOD_CALL ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT ) genericTypeArgumentListSimplified arguments ) | IDENT arguments -> ^( METHOD_CALL ^( DOT qualifiedIdentifier IDENT ) genericTypeArgumentListSimplified arguments ) ) | THIS -> ^( DOT qualifiedIdentifier THIS ) | Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier arguments ) | innerNewExpression -> ^( DOT qualifiedIdentifier innerNewExpression ) ) )?
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1106:9: ( qualifiedIdentifier -> qualifiedIdentifier )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1106:13: qualifiedIdentifier
{
pushFollow(FOLLOW_qualifiedIdentifier_in_qualifiedIdentExpression13286);
qualifiedIdentifier493 = qualifiedIdentifier();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_qualifiedIdentifier.add(qualifiedIdentifier493.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();
// 1106:61: -> qualifiedIdentifier
{
adaptor.addChild(root_0, stream_qualifiedIdentifier.nextTree());
}
retval.tree = root_0;
}
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1109:9: ( ( arrayDeclarator -> ^( arrayDeclarator $qualifiedIdentExpression) )+ ( DOT CLASS -> ^( DOT $qualifiedIdentExpression CLASS ) ) | arguments -> ^( METHOD_CALL qualifiedIdentifier arguments ) | outerDot= DOT ( CLASS -> ^( DOT qualifiedIdentifier CLASS ) | genericTypeArgumentListSimplified (Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier genericTypeArgumentListSimplified arguments ) | SUPER innerDot= DOT IDENT arguments -> ^( METHOD_CALL ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT ) genericTypeArgumentListSimplified arguments ) | IDENT arguments -> ^( METHOD_CALL ^( DOT qualifiedIdentifier IDENT ) genericTypeArgumentListSimplified arguments ) ) | THIS -> ^( DOT qualifiedIdentifier THIS ) | Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier arguments ) | innerNewExpression -> ^( DOT qualifiedIdentifier innerNewExpression ) ) )?
int alt144 = 4;
alt144 = dfa144.predict(input);
switch(alt144) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1109:13: ( arrayDeclarator -> ^( arrayDeclarator $qualifiedIdentExpression) )+ ( DOT CLASS -> ^( DOT $qualifiedIdentExpression CLASS ) )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1109:13: ( arrayDeclarator -> ^( arrayDeclarator $qualifiedIdentExpression) )+
int cnt141 = 0;
loop141: do {
int alt141 = 2;
int LA141_0 = input.LA(1);
if ((LA141_0 == LBRACK)) {
alt141 = 1;
}
switch(alt141) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1109:17: arrayDeclarator
{
pushFollow(FOLLOW_arrayDeclarator_in_qualifiedIdentExpression13356);
arrayDeclarator494 = arrayDeclarator();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arrayDeclarator.add(arrayDeclarator494.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();
// 1109:57: -> ^( arrayDeclarator $qualifiedIdentExpression)
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1109:61: ^( arrayDeclarator $qualifiedIdentExpression)
{
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:
if (cnt141 >= 1) {
break loop141;
}
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
EarlyExitException eee = new EarlyExitException(141, input);
throw eee;
}
cnt141++;
} while (true);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1111:13: ( DOT CLASS -> ^( DOT $qualifiedIdentExpression CLASS ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1111:17: DOT CLASS
{
DOT495 = (Token) match(input, DOT, FOLLOW_DOT_in_qualifiedIdentExpression13423);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_DOT.add(DOT495);
}
CLASS496 = (Token) match(input, CLASS, FOLLOW_CLASS_in_qualifiedIdentExpression13425);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_CLASS.add(CLASS496);
}
// 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();
// 1111:57: -> ^( DOT $qualifiedIdentExpression CLASS )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1111:61: ^( DOT $qualifiedIdentExpression 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 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1113:13: arguments
{
pushFollow(FOLLOW_arguments_in_qualifiedIdentExpression13495);
arguments497 = arguments();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arguments.add(arguments497.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();
// 1113:57: -> ^( METHOD_CALL qualifiedIdentifier arguments )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1113:61: ^( METHOD_CALL qualifiedIdentifier 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_qualifiedIdentifier.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:1114:13: outerDot= DOT ( CLASS -> ^( DOT qualifiedIdentifier CLASS ) | genericTypeArgumentListSimplified (Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier genericTypeArgumentListSimplified arguments ) | SUPER innerDot= DOT IDENT arguments -> ^( METHOD_CALL ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT ) genericTypeArgumentListSimplified arguments ) | IDENT arguments -> ^( METHOD_CALL ^( DOT qualifiedIdentifier IDENT ) genericTypeArgumentListSimplified arguments ) ) | THIS -> ^( DOT qualifiedIdentifier THIS ) | Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier arguments ) | innerNewExpression -> ^( DOT qualifiedIdentifier innerNewExpression ) )
{
outerDot = (Token) match(input, DOT, FOLLOW_DOT_in_qualifiedIdentExpression13556);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_DOT.add(outerDot);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1115:13: ( CLASS -> ^( DOT qualifiedIdentifier CLASS ) | genericTypeArgumentListSimplified (Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier genericTypeArgumentListSimplified arguments ) | SUPER innerDot= DOT IDENT arguments -> ^( METHOD_CALL ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT ) genericTypeArgumentListSimplified arguments ) | IDENT arguments -> ^( METHOD_CALL ^( DOT qualifiedIdentifier IDENT ) genericTypeArgumentListSimplified arguments ) ) | THIS -> ^( DOT qualifiedIdentifier THIS ) | Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier arguments ) | innerNewExpression -> ^( DOT qualifiedIdentifier innerNewExpression ) )
int alt143 = 5;
switch(input.LA(1)) {
case CLASS:
{
alt143 = 1;
}
break;
case LESS_THAN:
{
alt143 = 2;
}
break;
case THIS:
{
alt143 = 3;
}
break;
case SUPER:
{
alt143 = 4;
}
break;
case NEW:
{
alt143 = 5;
}
break;
default:
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 143, 0, input);
throw nvae;
}
switch(alt143) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1115:17: CLASS
{
CLASS498 = (Token) match(input, CLASS, FOLLOW_CLASS_in_qualifiedIdentExpression13574);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_CLASS.add(CLASS498);
}
// 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();
// 1115:57: -> ^( DOT qualifiedIdentifier CLASS )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1115:61: ^( DOT qualifiedIdentifier CLASS )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_DOT.nextNode(), root_1);
adaptor.addChild(root_1, stream_qualifiedIdentifier.nextTree());
adaptor.addChild(root_1, stream_CLASS.nextNode());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1116:17: genericTypeArgumentListSimplified (Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier genericTypeArgumentListSimplified arguments ) | SUPER innerDot= DOT IDENT arguments -> ^( METHOD_CALL ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT ) genericTypeArgumentListSimplified arguments ) | IDENT arguments -> ^( METHOD_CALL ^( DOT qualifiedIdentifier IDENT ) genericTypeArgumentListSimplified arguments ) )
{
pushFollow(FOLLOW_genericTypeArgumentListSimplified_in_qualifiedIdentExpression13637);
genericTypeArgumentListSimplified499 = genericTypeArgumentListSimplified();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericTypeArgumentListSimplified.add(genericTypeArgumentListSimplified499.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1117:17: (Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier genericTypeArgumentListSimplified arguments ) | SUPER innerDot= DOT IDENT arguments -> ^( METHOD_CALL ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT ) genericTypeArgumentListSimplified arguments ) | IDENT arguments -> ^( METHOD_CALL ^( DOT qualifiedIdentifier IDENT ) genericTypeArgumentListSimplified arguments ) )
int alt142 = 3;
int LA142_0 = input.LA(1);
if ((LA142_0 == SUPER)) {
int LA142_1 = input.LA(2);
if ((LA142_1 == DOT)) {
alt142 = 2;
} else if ((LA142_1 == LPAREN)) {
alt142 = 1;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 142, 1, input);
throw nvae;
}
} else if ((LA142_0 == IDENT)) {
alt142 = 3;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 142, 0, input);
throw nvae;
}
switch(alt142) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1117:21: Super= SUPER arguments
{
Super = (Token) match(input, SUPER, FOLLOW_SUPER_in_qualifiedIdentExpression13661);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SUPER.add(Super);
}
pushFollow(FOLLOW_arguments_in_qualifiedIdentExpression13663);
arguments500 = arguments();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arguments.add(arguments500.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();
// 1117:57: -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier genericTypeArgumentListSimplified arguments )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1117:61: ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier genericTypeArgumentListSimplified arguments )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(SUPER_CONSTRUCTOR_CALL, Super, "SUPER_CONSTRUCTOR_CALL"), root_1);
adaptor.addChild(root_1, stream_qualifiedIdentifier.nextTree());
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:1118:21: SUPER innerDot= DOT IDENT arguments
{
SUPER501 = (Token) match(input, SUPER, FOLLOW_SUPER_in_qualifiedIdentExpression13713);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SUPER.add(SUPER501);
}
innerDot = (Token) match(input, DOT, FOLLOW_DOT_in_qualifiedIdentExpression13717);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_DOT.add(innerDot);
}
IDENT502 = (Token) match(input, IDENT, FOLLOW_IDENT_in_qualifiedIdentExpression13719);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT502);
}
pushFollow(FOLLOW_arguments_in_qualifiedIdentExpression13721);
arguments503 = arguments();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arguments.add(arguments503.getTree());
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleTokenStream stream_outerDot = new RewriteRuleTokenStream(adaptor, "token outerDot", outerDot);
RewriteRuleTokenStream stream_innerDot = new RewriteRuleTokenStream(adaptor, "token innerDot", innerDot);
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 1118:57: -> ^( METHOD_CALL ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT ) genericTypeArgumentListSimplified arguments )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1118:61: ^( METHOD_CALL ^( $innerDot ^( $outerDot qualifiedIdentifier 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:1118:75: ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT )
{
CommonTree root_2 = (CommonTree) adaptor.nil();
root_2 = (CommonTree) adaptor.becomeRoot(stream_innerDot.nextNode(), root_2);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1118:87: ^( $outerDot qualifiedIdentifier SUPER )
{
CommonTree root_3 = (CommonTree) adaptor.nil();
root_3 = (CommonTree) adaptor.becomeRoot(stream_outerDot.nextNode(), root_3);
adaptor.addChild(root_3, stream_qualifiedIdentifier.nextTree());
adaptor.addChild(root_3, stream_SUPER.nextNode());
adaptor.addChild(root_2, root_3);
}
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;
case 3:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1119:21: IDENT arguments
{
IDENT504 = (Token) match(input, IDENT, FOLLOW_IDENT_in_qualifiedIdentExpression13771);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT504);
}
pushFollow(FOLLOW_arguments_in_qualifiedIdentExpression13773);
arguments505 = arguments();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arguments.add(arguments505.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();
// 1119:57: -> ^( METHOD_CALL ^( DOT qualifiedIdentifier IDENT ) genericTypeArgumentListSimplified arguments )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1119:61: ^( METHOD_CALL ^( DOT qualifiedIdentifier 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:1119:75: ^( DOT qualifiedIdentifier IDENT )
{
CommonTree root_2 = (CommonTree) adaptor.nil();
root_2 = (CommonTree) adaptor.becomeRoot(stream_DOT.nextNode(), root_2);
adaptor.addChild(root_2, stream_qualifiedIdentifier.nextTree());
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 3:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1121:17: THIS
{
THIS506 = (Token) match(input, THIS, FOLLOW_THIS_in_qualifiedIdentExpression13848);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_THIS.add(THIS506);
}
// 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();
// 1121:57: -> ^( DOT qualifiedIdentifier THIS )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1121:61: ^( DOT qualifiedIdentifier THIS )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_DOT.nextNode(), root_1);
adaptor.addChild(root_1, stream_qualifiedIdentifier.nextTree());
adaptor.addChild(root_1, stream_THIS.nextNode());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 4:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1122:17: Super= SUPER arguments
{
Super = (Token) match(input, SUPER, FOLLOW_SUPER_in_qualifiedIdentExpression13914);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SUPER.add(Super);
}
pushFollow(FOLLOW_arguments_in_qualifiedIdentExpression13916);
arguments507 = arguments();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arguments.add(arguments507.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();
// 1122:57: -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier arguments )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1122:61: ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier arguments )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(SUPER_CONSTRUCTOR_CALL, Super, "SUPER_CONSTRUCTOR_CALL"), root_1);
adaptor.addChild(root_1, stream_qualifiedIdentifier.nextTree());
adaptor.addChild(root_1, stream_arguments.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 5:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1123:17: innerNewExpression
{
pushFollow(FOLLOW_innerNewExpression_in_qualifiedIdentExpression13964);
innerNewExpression508 = innerNewExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_innerNewExpression.add(innerNewExpression508.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();
// 1123:57: -> ^( DOT qualifiedIdentifier innerNewExpression )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1123:61: ^( DOT qualifiedIdentifier innerNewExpression )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_DOT.nextNode(), root_1);
adaptor.addChild(root_1, stream_qualifiedIdentifier.nextTree());
adaptor.addChild(root_1, stream_innerNewExpression.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
}
}
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, 106, qualifiedIdentExpression_StartIndex);
}
}
return retval;
}
Aggregations