use of org.antlr.runtime.tree.RewriteEarlyExitException in project freud by LMAX-Exchange.
the class JavaParser method genericTypeParameterList.
// $ANTLR start "genericTypeParameterList"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:464:1: genericTypeParameterList : LESS_THAN genericTypeParameter ( COMMA genericTypeParameter )* genericTypeListClosing -> ^( GENERIC_TYPE_PARAM_LIST[$LESS_THAN, \"GENERIC_TYPE_PARAM_LIST\"] ( genericTypeParameter )+ ) ;
public final JavaParser.genericTypeParameterList_return genericTypeParameterList() throws RecognitionException {
JavaParser.genericTypeParameterList_return retval = new JavaParser.genericTypeParameterList_return();
retval.start = input.LT(1);
int genericTypeParameterList_StartIndex = input.index();
CommonTree root_0 = null;
Token LESS_THAN33 = null;
Token COMMA35 = null;
JavaParser.genericTypeParameter_return genericTypeParameter34 = null;
JavaParser.genericTypeParameter_return genericTypeParameter36 = null;
JavaParser.genericTypeListClosing_return genericTypeListClosing37 = null;
CommonTree LESS_THAN33_tree = null;
CommonTree COMMA35_tree = null;
RewriteRuleTokenStream stream_COMMA = new RewriteRuleTokenStream(adaptor, "token COMMA");
RewriteRuleTokenStream stream_LESS_THAN = new RewriteRuleTokenStream(adaptor, "token LESS_THAN");
RewriteRuleSubtreeStream stream_genericTypeParameter = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeParameter");
RewriteRuleSubtreeStream stream_genericTypeListClosing = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeListClosing");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 11)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:465:5: ( LESS_THAN genericTypeParameter ( COMMA genericTypeParameter )* genericTypeListClosing -> ^( GENERIC_TYPE_PARAM_LIST[$LESS_THAN, \"GENERIC_TYPE_PARAM_LIST\"] ( genericTypeParameter )+ ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:465:9: LESS_THAN genericTypeParameter ( COMMA genericTypeParameter )* genericTypeListClosing
{
LESS_THAN33 = (Token) match(input, LESS_THAN, FOLLOW_LESS_THAN_in_genericTypeParameterList4934);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LESS_THAN.add(LESS_THAN33);
}
pushFollow(FOLLOW_genericTypeParameter_in_genericTypeParameterList4936);
genericTypeParameter34 = genericTypeParameter();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericTypeParameter.add(genericTypeParameter34.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:465:40: ( COMMA genericTypeParameter )*
loop11: do {
int alt11 = 2;
int LA11_0 = input.LA(1);
if ((LA11_0 == COMMA)) {
alt11 = 1;
}
switch(alt11) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:465:41: COMMA genericTypeParameter
{
COMMA35 = (Token) match(input, COMMA, FOLLOW_COMMA_in_genericTypeParameterList4939);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_COMMA.add(COMMA35);
}
pushFollow(FOLLOW_genericTypeParameter_in_genericTypeParameterList4941);
genericTypeParameter36 = genericTypeParameter();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericTypeParameter.add(genericTypeParameter36.getTree());
}
}
break;
default:
break loop11;
}
} while (true);
pushFollow(FOLLOW_genericTypeListClosing_in_genericTypeParameterList4945);
genericTypeListClosing37 = genericTypeListClosing();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericTypeListClosing.add(genericTypeListClosing37.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();
// 466:9: -> ^( GENERIC_TYPE_PARAM_LIST[$LESS_THAN, \"GENERIC_TYPE_PARAM_LIST\"] ( genericTypeParameter )+ )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:466:13: ^( GENERIC_TYPE_PARAM_LIST[$LESS_THAN, \"GENERIC_TYPE_PARAM_LIST\"] ( genericTypeParameter )+ )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(GENERIC_TYPE_PARAM_LIST, LESS_THAN33, "GENERIC_TYPE_PARAM_LIST"), root_1);
if (!(stream_genericTypeParameter.hasNext())) {
throw new RewriteEarlyExitException();
}
while (stream_genericTypeParameter.hasNext()) {
adaptor.addChild(root_1, stream_genericTypeParameter.nextTree());
}
stream_genericTypeParameter.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, 11, genericTypeParameterList_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteEarlyExitException in project freud by LMAX-Exchange.
the class JavaParser method bound.
// $ANTLR start "bound"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:484:1: bound : EXTENDS type ( AND type )* -> ^( EXTENDS_BOUND_LIST[$EXTENDS, \"EXTENDS_BOUND_LIST\"] ( type )+ ) ;
public final JavaParser.bound_return bound() throws RecognitionException {
JavaParser.bound_return retval = new JavaParser.bound_return();
retval.start = input.LT(1);
int bound_StartIndex = input.index();
CommonTree root_0 = null;
Token EXTENDS43 = null;
Token AND45 = null;
JavaParser.type_return type44 = null;
JavaParser.type_return type46 = null;
CommonTree EXTENDS43_tree = null;
CommonTree AND45_tree = null;
RewriteRuleTokenStream stream_AND = new RewriteRuleTokenStream(adaptor, "token AND");
RewriteRuleTokenStream stream_EXTENDS = new RewriteRuleTokenStream(adaptor, "token EXTENDS");
RewriteRuleSubtreeStream stream_type = new RewriteRuleSubtreeStream(adaptor, "rule type");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 14)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:485:5: ( EXTENDS type ( AND type )* -> ^( EXTENDS_BOUND_LIST[$EXTENDS, \"EXTENDS_BOUND_LIST\"] ( type )+ ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:485:9: EXTENDS type ( AND type )*
{
EXTENDS43 = (Token) match(input, EXTENDS, FOLLOW_EXTENDS_in_bound5148);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_EXTENDS.add(EXTENDS43);
}
pushFollow(FOLLOW_type_in_bound5150);
type44 = type();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_type.add(type44.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:485:22: ( AND type )*
loop14: do {
int alt14 = 2;
int LA14_0 = input.LA(1);
if ((LA14_0 == AND)) {
alt14 = 1;
}
switch(alt14) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:485:23: AND type
{
AND45 = (Token) match(input, AND, FOLLOW_AND_in_bound5153);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_AND.add(AND45);
}
pushFollow(FOLLOW_type_in_bound5155);
type46 = type();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_type.add(type46.getTree());
}
}
break;
default:
break loop14;
}
} 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();
// 486:9: -> ^( EXTENDS_BOUND_LIST[$EXTENDS, \"EXTENDS_BOUND_LIST\"] ( type )+ )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:486:13: ^( EXTENDS_BOUND_LIST[$EXTENDS, \"EXTENDS_BOUND_LIST\"] ( type )+ )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(EXTENDS_BOUND_LIST, EXTENDS43, "EXTENDS_BOUND_LIST"), root_1);
if (!(stream_type.hasNext())) {
throw new RewriteEarlyExitException();
}
while (stream_type.hasNext()) {
adaptor.addChild(root_1, stream_type.nextTree());
}
stream_type.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, 14, bound_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteEarlyExitException in project freud by LMAX-Exchange.
the class JavaParser method arrayDeclaratorList.
// $ANTLR start "arrayDeclaratorList"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:603:1: arrayDeclaratorList : ( arrayDeclarator )+ -> ^( ARRAY_DECLARATOR_LIST ( arrayDeclarator )+ ) ;
public final JavaParser.arrayDeclaratorList_return arrayDeclaratorList() throws RecognitionException {
JavaParser.arrayDeclaratorList_return retval = new JavaParser.arrayDeclaratorList_return();
retval.start = input.LT(1);
int arrayDeclaratorList_StartIndex = input.index();
CommonTree root_0 = null;
JavaParser.arrayDeclarator_return arrayDeclarator142 = null;
RewriteRuleSubtreeStream stream_arrayDeclarator = new RewriteRuleSubtreeStream(adaptor, "rule arrayDeclarator");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 34)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:604:5: ( ( arrayDeclarator )+ -> ^( ARRAY_DECLARATOR_LIST ( arrayDeclarator )+ ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:604:9: ( arrayDeclarator )+
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:604:9: ( arrayDeclarator )+
int cnt50 = 0;
loop50: do {
int alt50 = 2;
int LA50_0 = input.LA(1);
if ((LA50_0 == LBRACK)) {
int LA50_2 = input.LA(2);
if ((synpred59_Java())) {
alt50 = 1;
}
}
switch(alt50) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: arrayDeclarator
{
pushFollow(FOLLOW_arrayDeclarator_in_arrayDeclaratorList6489);
arrayDeclarator142 = arrayDeclarator();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arrayDeclarator.add(arrayDeclarator142.getTree());
}
}
break;
default:
if (cnt50 >= 1) {
break loop50;
}
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
EarlyExitException eee = new EarlyExitException(50, input);
throw eee;
}
cnt50++;
} 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();
// 605:9: -> ^( ARRAY_DECLARATOR_LIST ( arrayDeclarator )+ )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:605:13: ^( ARRAY_DECLARATOR_LIST ( arrayDeclarator )+ )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ARRAY_DECLARATOR_LIST, "ARRAY_DECLARATOR_LIST"), root_1);
if (!(stream_arrayDeclarator.hasNext())) {
throw new RewriteEarlyExitException();
}
while (stream_arrayDeclarator.hasNext()) {
adaptor.addChild(root_1, stream_arrayDeclarator.nextTree());
}
stream_arrayDeclarator.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, 34, arrayDeclaratorList_StartIndex);
}
}
return retval;
}
Aggregations