use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method modifierList.
// $ANTLR start "modifierList"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:618:1: modifierList : ( modifier )* -> ^( MODIFIER_LIST ( modifier )* ) ;
public final JavaParser.modifierList_return modifierList() throws RecognitionException {
JavaParser.modifierList_return retval = new JavaParser.modifierList_return();
retval.start = input.LT(1);
int modifierList_StartIndex = input.index();
CommonTree root_0 = null;
JavaParser.modifier_return modifier151 = null;
RewriteRuleSubtreeStream stream_modifier = new RewriteRuleSubtreeStream(adaptor, "rule modifier");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 37)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:619:5: ( ( modifier )* -> ^( MODIFIER_LIST ( modifier )* ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:619:9: ( modifier )*
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:619:9: ( modifier )*
loop54: do {
int alt54 = 2;
int LA54_0 = input.LA(1);
if ((LA54_0 == AT)) {
int LA54_2 = input.LA(2);
if ((LA54_2 == IDENT)) {
alt54 = 1;
}
} else if ((LA54_0 == ABSTRACT || LA54_0 == FINAL || LA54_0 == NATIVE || (LA54_0 >= PRIVATE && LA54_0 <= PUBLIC) || (LA54_0 >= STATIC && LA54_0 <= STRICTFP) || LA54_0 == SYNCHRONIZED || LA54_0 == TRANSIENT || LA54_0 == VOLATILE)) {
alt54 = 1;
}
switch(alt54) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: modifier
{
pushFollow(FOLLOW_modifier_in_modifierList6621);
modifier151 = modifier();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_modifier.add(modifier151.getTree());
}
}
break;
default:
break loop54;
}
} 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();
// 620:9: -> ^( MODIFIER_LIST ( modifier )* )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:620:13: ^( MODIFIER_LIST ( modifier )* )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(MODIFIER_LIST, "MODIFIER_LIST"), root_1);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:620:29: ( modifier )*
while (stream_modifier.hasNext()) {
adaptor.addChild(root_1, stream_modifier.nextTree());
}
stream_modifier.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, 37, modifierList_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method arrayDeclarator.
// $ANTLR start "arrayDeclarator"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:598:1: arrayDeclarator : LBRACK RBRACK -> ^( ARRAY_DECLARATOR ) ;
public final JavaParser.arrayDeclarator_return arrayDeclarator() throws RecognitionException {
JavaParser.arrayDeclarator_return retval = new JavaParser.arrayDeclarator_return();
retval.start = input.LT(1);
int arrayDeclarator_StartIndex = input.index();
CommonTree root_0 = null;
Token LBRACK140 = null;
Token RBRACK141 = null;
CommonTree LBRACK140_tree = null;
CommonTree RBRACK141_tree = null;
RewriteRuleTokenStream stream_RBRACK = new RewriteRuleTokenStream(adaptor, "token RBRACK");
RewriteRuleTokenStream stream_LBRACK = new RewriteRuleTokenStream(adaptor, "token LBRACK");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 33)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:599:5: ( LBRACK RBRACK -> ^( ARRAY_DECLARATOR ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:599:9: LBRACK RBRACK
{
LBRACK140 = (Token) match(input, LBRACK, FOLLOW_LBRACK_in_arrayDeclarator6453);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LBRACK.add(LBRACK140);
}
RBRACK141 = (Token) match(input, RBRACK, FOLLOW_RBRACK_in_arrayDeclarator6455);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_RBRACK.add(RBRACK141);
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 600:9: -> ^( ARRAY_DECLARATOR )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:600:13: ^( ARRAY_DECLARATOR )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ARRAY_DECLARATOR, "ARRAY_DECLARATOR"), root_1);
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
retval.stop = input.LT(-1);
if (state.backtracking == 0) {
retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
} catch (RecognitionException re) {
reportError(re);
recover(input, re);
retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
} finally {
if (state.backtracking > 0) {
memoize(input, 33, arrayDeclarator_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method catches.
// $ANTLR start "catches"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:871:1: catches : ( catchClause )+ -> ^( CATCH_CLAUSE_LIST ( catchClause )+ ) ;
public final JavaParser.catches_return catches() throws RecognitionException {
JavaParser.catches_return retval = new JavaParser.catches_return();
retval.start = input.LT(1);
int catches_StartIndex = input.index();
CommonTree root_0 = null;
JavaParser.catchClause_return catchClause338 = null;
RewriteRuleSubtreeStream stream_catchClause = new RewriteRuleSubtreeStream(adaptor, "rule catchClause");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 76)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:872:5: ( ( catchClause )+ -> ^( CATCH_CLAUSE_LIST ( catchClause )+ ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:872:9: ( catchClause )+
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:872:9: ( catchClause )+
int cnt99 = 0;
loop99: do {
int alt99 = 2;
int LA99_0 = input.LA(1);
if ((LA99_0 == CATCH)) {
alt99 = 1;
}
switch(alt99) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: catchClause
{
pushFollow(FOLLOW_catchClause_in_catches9734);
catchClause338 = catchClause();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_catchClause.add(catchClause338.getTree());
}
}
break;
default:
if (cnt99 >= 1) {
break loop99;
}
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
EarlyExitException eee = new EarlyExitException(99, input);
throw eee;
}
cnt99++;
} 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();
// 873:9: -> ^( CATCH_CLAUSE_LIST ( catchClause )+ )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:873:13: ^( CATCH_CLAUSE_LIST ( catchClause )+ )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(CATCH_CLAUSE_LIST, "CATCH_CLAUSE_LIST"), root_1);
if (!(stream_catchClause.hasNext())) {
throw new RewriteEarlyExitException();
}
while (stream_catchClause.hasNext()) {
adaptor.addChild(root_1, stream_catchClause.nextTree());
}
stream_catchClause.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, 76, catches_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method genericTypeArgumentList.
// $ANTLR start "genericTypeArgumentList"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:696:1: genericTypeArgumentList : LESS_THAN genericTypeArgument ( COMMA genericTypeArgument )* genericTypeListClosing -> ^( GENERIC_TYPE_ARG_LIST[$LESS_THAN, \"GENERIC_TYPE_ARG_LIST\"] ( genericTypeArgument )+ ) ;
public final JavaParser.genericTypeArgumentList_return genericTypeArgumentList() throws RecognitionException {
JavaParser.genericTypeArgumentList_return retval = new JavaParser.genericTypeArgumentList_return();
retval.start = input.LT(1);
int genericTypeArgumentList_StartIndex = input.index();
CommonTree root_0 = null;
Token LESS_THAN185 = null;
Token COMMA187 = null;
JavaParser.genericTypeArgument_return genericTypeArgument186 = null;
JavaParser.genericTypeArgument_return genericTypeArgument188 = null;
JavaParser.genericTypeListClosing_return genericTypeListClosing189 = null;
CommonTree LESS_THAN185_tree = null;
CommonTree COMMA187_tree = null;
RewriteRuleTokenStream stream_COMMA = new RewriteRuleTokenStream(adaptor, "token COMMA");
RewriteRuleTokenStream stream_LESS_THAN = new RewriteRuleTokenStream(adaptor, "token LESS_THAN");
RewriteRuleSubtreeStream stream_genericTypeArgument = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeArgument");
RewriteRuleSubtreeStream stream_genericTypeListClosing = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeListClosing");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 50)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:697:5: ( LESS_THAN genericTypeArgument ( COMMA genericTypeArgument )* genericTypeListClosing -> ^( GENERIC_TYPE_ARG_LIST[$LESS_THAN, \"GENERIC_TYPE_ARG_LIST\"] ( genericTypeArgument )+ ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:697:9: LESS_THAN genericTypeArgument ( COMMA genericTypeArgument )* genericTypeListClosing
{
LESS_THAN185 = (Token) match(input, LESS_THAN, FOLLOW_LESS_THAN_in_genericTypeArgumentList7224);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LESS_THAN.add(LESS_THAN185);
}
pushFollow(FOLLOW_genericTypeArgument_in_genericTypeArgumentList7226);
genericTypeArgument186 = genericTypeArgument();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericTypeArgument.add(genericTypeArgument186.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:697:39: ( COMMA genericTypeArgument )*
loop66: do {
int alt66 = 2;
int LA66_0 = input.LA(1);
if ((LA66_0 == COMMA)) {
int LA66_2 = input.LA(2);
if ((synpred91_Java())) {
alt66 = 1;
}
}
switch(alt66) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:697:40: COMMA genericTypeArgument
{
COMMA187 = (Token) match(input, COMMA, FOLLOW_COMMA_in_genericTypeArgumentList7229);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_COMMA.add(COMMA187);
}
pushFollow(FOLLOW_genericTypeArgument_in_genericTypeArgumentList7231);
genericTypeArgument188 = genericTypeArgument();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericTypeArgument.add(genericTypeArgument188.getTree());
}
}
break;
default:
break loop66;
}
} while (true);
pushFollow(FOLLOW_genericTypeListClosing_in_genericTypeArgumentList7235);
genericTypeListClosing189 = genericTypeListClosing();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericTypeListClosing.add(genericTypeListClosing189.getTree());
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 698:9: -> ^( GENERIC_TYPE_ARG_LIST[$LESS_THAN, \"GENERIC_TYPE_ARG_LIST\"] ( genericTypeArgument )+ )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:698:13: ^( GENERIC_TYPE_ARG_LIST[$LESS_THAN, \"GENERIC_TYPE_ARG_LIST\"] ( genericTypeArgument )+ )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(GENERIC_TYPE_ARG_LIST, LESS_THAN185, "GENERIC_TYPE_ARG_LIST"), root_1);
if (!(stream_genericTypeArgument.hasNext())) {
throw new RewriteEarlyExitException();
}
while (stream_genericTypeArgument.hasNext()) {
adaptor.addChild(root_1, stream_genericTypeArgument.nextTree());
}
stream_genericTypeArgument.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
retval.stop = input.LT(-1);
if (state.backtracking == 0) {
retval.tree = (CommonTree) adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
} catch (RecognitionException re) {
reportError(re);
recover(input, re);
retval.tree = (CommonTree) adaptor.errorNode(input, retval.start, input.LT(-1), re);
} finally {
if (state.backtracking > 0) {
memoize(input, 50, genericTypeArgumentList_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method annotationElementValueExpression.
// $ANTLR start "annotationElementValueExpression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:789:1: annotationElementValueExpression : conditionalExpression -> ^( EXPR conditionalExpression ) ;
public final JavaParser.annotationElementValueExpression_return annotationElementValueExpression() throws RecognitionException {
JavaParser.annotationElementValueExpression_return retval = new JavaParser.annotationElementValueExpression_return();
retval.start = input.LT(1);
int annotationElementValueExpression_StartIndex = input.index();
CommonTree root_0 = null;
JavaParser.conditionalExpression_return conditionalExpression239 = null;
RewriteRuleSubtreeStream stream_conditionalExpression = new RewriteRuleSubtreeStream(adaptor, "rule conditionalExpression");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 66)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:790:5: ( conditionalExpression -> ^( EXPR conditionalExpression ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:790:9: conditionalExpression
{
pushFollow(FOLLOW_conditionalExpression_in_annotationElementValueExpression8074);
conditionalExpression239 = conditionalExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_conditionalExpression.add(conditionalExpression239.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();
// 791:9: -> ^( EXPR conditionalExpression )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:791:13: ^( EXPR conditionalExpression )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(EXPR, "EXPR"), root_1);
adaptor.addChild(root_1, stream_conditionalExpression.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, 66, annotationElementValueExpression_StartIndex);
}
}
return retval;
}
Aggregations