use of org.antlr.runtime.NoViableAltException in project freud by LMAX-Exchange.
the class JavaParser method relationalExpression.
// $ANTLR start "relationalExpression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:989:1: relationalExpression : shiftExpression ( ( LESS_OR_EQUAL | GREATER_OR_EQUAL | LESS_THAN | GREATER_THAN ) shiftExpression )* ;
public final JavaParser.relationalExpression_return relationalExpression() throws RecognitionException {
JavaParser.relationalExpression_return retval = new JavaParser.relationalExpression_return();
retval.start = input.LT(1);
int relationalExpression_StartIndex = input.index();
CommonTree root_0 = null;
Token LESS_OR_EQUAL408 = null;
Token GREATER_OR_EQUAL409 = null;
Token LESS_THAN410 = null;
Token GREATER_THAN411 = null;
JavaParser.shiftExpression_return shiftExpression407 = null;
JavaParser.shiftExpression_return shiftExpression412 = null;
CommonTree LESS_OR_EQUAL408_tree = null;
CommonTree GREATER_OR_EQUAL409_tree = null;
CommonTree LESS_THAN410_tree = null;
CommonTree GREATER_THAN411_tree = null;
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 98)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:990:5: ( shiftExpression ( ( LESS_OR_EQUAL | GREATER_OR_EQUAL | LESS_THAN | GREATER_THAN ) shiftExpression )* )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:990:9: shiftExpression ( ( LESS_OR_EQUAL | GREATER_OR_EQUAL | LESS_THAN | GREATER_THAN ) shiftExpression )*
{
root_0 = (CommonTree) adaptor.nil();
pushFollow(FOLLOW_shiftExpression_in_relationalExpression10811);
shiftExpression407 = shiftExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, shiftExpression407.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:991:9: ( ( LESS_OR_EQUAL | GREATER_OR_EQUAL | LESS_THAN | GREATER_THAN ) shiftExpression )*
loop120: do {
int alt120 = 2;
int LA120_0 = input.LA(1);
if (((LA120_0 >= GREATER_OR_EQUAL && LA120_0 <= GREATER_THAN) || (LA120_0 >= LESS_OR_EQUAL && LA120_0 <= LESS_THAN))) {
alt120 = 1;
}
switch(alt120) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:991:13: ( LESS_OR_EQUAL | GREATER_OR_EQUAL | LESS_THAN | GREATER_THAN ) shiftExpression
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:991:13: ( LESS_OR_EQUAL | GREATER_OR_EQUAL | LESS_THAN | GREATER_THAN )
int alt119 = 4;
switch(input.LA(1)) {
case LESS_OR_EQUAL:
{
alt119 = 1;
}
break;
case GREATER_OR_EQUAL:
{
alt119 = 2;
}
break;
case LESS_THAN:
{
alt119 = 3;
}
break;
case GREATER_THAN:
{
alt119 = 4;
}
break;
default:
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 119, 0, input);
throw nvae;
}
switch(alt119) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:991:17: LESS_OR_EQUAL
{
LESS_OR_EQUAL408 = (Token) match(input, LESS_OR_EQUAL, FOLLOW_LESS_OR_EQUAL_in_relationalExpression10829);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
LESS_OR_EQUAL408_tree = (CommonTree) adaptor.create(LESS_OR_EQUAL408);
root_0 = (CommonTree) adaptor.becomeRoot(LESS_OR_EQUAL408_tree, root_0);
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:992:17: GREATER_OR_EQUAL
{
GREATER_OR_EQUAL409 = (Token) match(input, GREATER_OR_EQUAL, FOLLOW_GREATER_OR_EQUAL_in_relationalExpression10848);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
GREATER_OR_EQUAL409_tree = (CommonTree) adaptor.create(GREATER_OR_EQUAL409);
root_0 = (CommonTree) adaptor.becomeRoot(GREATER_OR_EQUAL409_tree, root_0);
}
}
break;
case 3:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:993:17: LESS_THAN
{
LESS_THAN410 = (Token) match(input, LESS_THAN, FOLLOW_LESS_THAN_in_relationalExpression10867);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
LESS_THAN410_tree = (CommonTree) adaptor.create(LESS_THAN410);
root_0 = (CommonTree) adaptor.becomeRoot(LESS_THAN410_tree, root_0);
}
}
break;
case 4:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:994:17: GREATER_THAN
{
GREATER_THAN411 = (Token) match(input, GREATER_THAN, FOLLOW_GREATER_THAN_in_relationalExpression10886);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
GREATER_THAN411_tree = (CommonTree) adaptor.create(GREATER_THAN411);
root_0 = (CommonTree) adaptor.becomeRoot(GREATER_THAN411_tree, root_0);
}
}
break;
}
pushFollow(FOLLOW_shiftExpression_in_relationalExpression10915);
shiftExpression412 = shiftExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, shiftExpression412.getTree());
}
}
break;
default:
break loop120;
}
} while (true);
}
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, 98, relationalExpression_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.NoViableAltException in project freud by LMAX-Exchange.
the class JavaParser method newArrayConstruction.
// $ANTLR start "newArrayConstruction"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1146:1: newArrayConstruction : ( arrayDeclaratorList arrayInitializer | LBRACK expression RBRACK ( LBRACK expression RBRACK )* ( arrayDeclaratorList )? );
public final JavaParser.newArrayConstruction_return newArrayConstruction() throws RecognitionException {
JavaParser.newArrayConstruction_return retval = new JavaParser.newArrayConstruction_return();
retval.start = input.LT(1);
int newArrayConstruction_StartIndex = input.index();
CommonTree root_0 = null;
Token LBRACK524 = null;
Token RBRACK526 = null;
Token LBRACK527 = null;
Token RBRACK529 = null;
JavaParser.arrayDeclaratorList_return arrayDeclaratorList522 = null;
JavaParser.arrayInitializer_return arrayInitializer523 = null;
JavaParser.expression_return expression525 = null;
JavaParser.expression_return expression528 = null;
JavaParser.arrayDeclaratorList_return arrayDeclaratorList530 = null;
CommonTree LBRACK524_tree = null;
CommonTree RBRACK526_tree = null;
CommonTree LBRACK527_tree = null;
CommonTree RBRACK529_tree = null;
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 109)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1147:5: ( arrayDeclaratorList arrayInitializer | LBRACK expression RBRACK ( LBRACK expression RBRACK )* ( arrayDeclaratorList )? )
int alt153 = 2;
int LA153_0 = input.LA(1);
if ((LA153_0 == LBRACK)) {
int LA153_1 = input.LA(2);
if ((LA153_1 == RBRACK)) {
alt153 = 1;
} else if ((LA153_1 == DEC || LA153_1 == INC || LA153_1 == LESS_THAN || LA153_1 == LOGICAL_NOT || (LA153_1 >= LPAREN && LA153_1 <= MINUS) || LA153_1 == NOT || LA153_1 == PLUS || LA153_1 == BOOLEAN || LA153_1 == BYTE || LA153_1 == CHAR || LA153_1 == DOUBLE || LA153_1 == FALSE || LA153_1 == FLOAT || (LA153_1 >= INT && LA153_1 <= LONG) || (LA153_1 >= NEW && LA153_1 <= NULL) || LA153_1 == SHORT || LA153_1 == SUPER || LA153_1 == THIS || LA153_1 == TRUE || LA153_1 == VOID || (LA153_1 >= IDENT && LA153_1 <= STRING_LITERAL))) {
alt153 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 153, 1, input);
throw nvae;
}
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 153, 0, input);
throw nvae;
}
switch(alt153) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1147:9: arrayDeclaratorList arrayInitializer
{
root_0 = (CommonTree) adaptor.nil();
pushFollow(FOLLOW_arrayDeclaratorList_in_newArrayConstruction14338);
arrayDeclaratorList522 = arrayDeclaratorList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, arrayDeclaratorList522.getTree());
}
pushFollow(FOLLOW_arrayInitializer_in_newArrayConstruction14340);
arrayInitializer523 = arrayInitializer();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, arrayInitializer523.getTree());
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1148:9: LBRACK expression RBRACK ( LBRACK expression RBRACK )* ( arrayDeclaratorList )?
{
root_0 = (CommonTree) adaptor.nil();
LBRACK524 = (Token) match(input, LBRACK, FOLLOW_LBRACK_in_newArrayConstruction14350);
if (state.failed) {
return retval;
}
pushFollow(FOLLOW_expression_in_newArrayConstruction14353);
expression525 = expression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, expression525.getTree());
}
RBRACK526 = (Token) match(input, RBRACK, FOLLOW_RBRACK_in_newArrayConstruction14355);
if (state.failed) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1148:36: ( LBRACK expression RBRACK )*
loop151: do {
int alt151 = 2;
alt151 = dfa151.predict(input);
switch(alt151) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1148:37: LBRACK expression RBRACK
{
LBRACK527 = (Token) match(input, LBRACK, FOLLOW_LBRACK_in_newArrayConstruction14359);
if (state.failed) {
return retval;
}
pushFollow(FOLLOW_expression_in_newArrayConstruction14362);
expression528 = expression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, expression528.getTree());
}
RBRACK529 = (Token) match(input, RBRACK, FOLLOW_RBRACK_in_newArrayConstruction14364);
if (state.failed) {
return retval;
}
}
break;
default:
break loop151;
}
} while (true);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1148:66: ( arrayDeclaratorList )?
int alt152 = 2;
int LA152_0 = input.LA(1);
if ((LA152_0 == LBRACK)) {
int LA152_1 = input.LA(2);
if ((LA152_1 == RBRACK)) {
alt152 = 1;
}
}
switch(alt152) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: arrayDeclaratorList
{
pushFollow(FOLLOW_arrayDeclaratorList_in_newArrayConstruction14369);
arrayDeclaratorList530 = arrayDeclaratorList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, arrayDeclaratorList530.getTree());
}
}
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, 109, newArrayConstruction_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.NoViableAltException in project freud by LMAX-Exchange.
the class JavaParser method classScopeDeclarations.
// $ANTLR start "classScopeDeclarations"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:535:1: classScopeDeclarations : ( block -> ^( CLASS_INSTANCE_INITIALIZER block ) | STATIC block -> ^( CLASS_STATIC_INITIALIZER[$STATIC, \"CLASS_STATIC_INITIALIZER\"] block ) | modifierList ( ( genericTypeParameterList )? ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block | SEMI ) -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block )? ) | VOID IDENT formalParameterList ( throwsClause )? ( block | SEMI ) -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ( block )? ) | ident= IDENT formalParameterList ( throwsClause )? block -> ^( CONSTRUCTOR_DECL[$ident, \"CONSTRUCTOR_DECL\"] modifierList ( genericTypeParameterList )? formalParameterList ( throwsClause )? block ) ) | type classFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList ) ) | typeDeclaration | SEMI );
public final JavaParser.classScopeDeclarations_return classScopeDeclarations() throws RecognitionException {
JavaParser.classScopeDeclarations_return retval = new JavaParser.classScopeDeclarations_return();
retval.start = input.LT(1);
int classScopeDeclarations_StartIndex = input.index();
CommonTree root_0 = null;
Token ident = null;
Token STATIC81 = null;
Token IDENT86 = null;
Token SEMI91 = null;
Token VOID92 = null;
Token IDENT93 = null;
Token SEMI97 = null;
Token SEMI103 = null;
Token SEMI105 = null;
JavaParser.block_return block80 = null;
JavaParser.block_return block82 = null;
JavaParser.modifierList_return modifierList83 = null;
JavaParser.genericTypeParameterList_return genericTypeParameterList84 = null;
JavaParser.type_return type85 = null;
JavaParser.formalParameterList_return formalParameterList87 = null;
JavaParser.arrayDeclaratorList_return arrayDeclaratorList88 = null;
JavaParser.throwsClause_return throwsClause89 = null;
JavaParser.block_return block90 = null;
JavaParser.formalParameterList_return formalParameterList94 = null;
JavaParser.throwsClause_return throwsClause95 = null;
JavaParser.block_return block96 = null;
JavaParser.formalParameterList_return formalParameterList98 = null;
JavaParser.throwsClause_return throwsClause99 = null;
JavaParser.block_return block100 = null;
JavaParser.type_return type101 = null;
JavaParser.classFieldDeclaratorList_return classFieldDeclaratorList102 = null;
JavaParser.typeDeclaration_return typeDeclaration104 = null;
CommonTree ident_tree = null;
CommonTree STATIC81_tree = null;
CommonTree IDENT86_tree = null;
CommonTree SEMI91_tree = null;
CommonTree VOID92_tree = null;
CommonTree IDENT93_tree = null;
CommonTree SEMI97_tree = null;
CommonTree SEMI103_tree = null;
CommonTree SEMI105_tree = null;
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
RewriteRuleTokenStream stream_VOID = new RewriteRuleTokenStream(adaptor, "token VOID");
RewriteRuleTokenStream stream_SEMI = new RewriteRuleTokenStream(adaptor, "token SEMI");
RewriteRuleTokenStream stream_STATIC = new RewriteRuleTokenStream(adaptor, "token STATIC");
RewriteRuleSubtreeStream stream_arrayDeclaratorList = new RewriteRuleSubtreeStream(adaptor, "rule arrayDeclaratorList");
RewriteRuleSubtreeStream stream_throwsClause = new RewriteRuleSubtreeStream(adaptor, "rule throwsClause");
RewriteRuleSubtreeStream stream_modifierList = new RewriteRuleSubtreeStream(adaptor, "rule modifierList");
RewriteRuleSubtreeStream stream_genericTypeParameterList = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeParameterList");
RewriteRuleSubtreeStream stream_block = new RewriteRuleSubtreeStream(adaptor, "rule block");
RewriteRuleSubtreeStream stream_type = new RewriteRuleSubtreeStream(adaptor, "rule type");
RewriteRuleSubtreeStream stream_classFieldDeclaratorList = new RewriteRuleSubtreeStream(adaptor, "rule classFieldDeclaratorList");
RewriteRuleSubtreeStream stream_formalParameterList = new RewriteRuleSubtreeStream(adaptor, "rule formalParameterList");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 25)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:536:5: ( block -> ^( CLASS_INSTANCE_INITIALIZER block ) | STATIC block -> ^( CLASS_STATIC_INITIALIZER[$STATIC, \"CLASS_STATIC_INITIALIZER\"] block ) | modifierList ( ( genericTypeParameterList )? ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block | SEMI ) -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block )? ) | VOID IDENT formalParameterList ( throwsClause )? ( block | SEMI ) -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ( block )? ) | ident= IDENT formalParameterList ( throwsClause )? block -> ^( CONSTRUCTOR_DECL[$ident, \"CONSTRUCTOR_DECL\"] modifierList ( genericTypeParameterList )? formalParameterList ( throwsClause )? block ) ) | type classFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList ) ) | typeDeclaration | SEMI )
int alt37 = 5;
alt37 = dfa37.predict(input);
switch(alt37) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:536:9: block
{
pushFollow(FOLLOW_block_in_classScopeDeclarations5582);
block80 = block();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_block.add(block80.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();
// 536:25: -> ^( CLASS_INSTANCE_INITIALIZER block )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:536:29: ^( CLASS_INSTANCE_INITIALIZER block )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(CLASS_INSTANCE_INITIALIZER, "CLASS_INSTANCE_INITIALIZER"), root_1);
adaptor.addChild(root_1, stream_block.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:537:9: STATIC block
{
STATIC81 = (Token) match(input, STATIC, FOLLOW_STATIC_in_classScopeDeclarations5611);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_STATIC.add(STATIC81);
}
pushFollow(FOLLOW_block_in_classScopeDeclarations5613);
block82 = block();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_block.add(block82.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();
// 537:25: -> ^( CLASS_STATIC_INITIALIZER[$STATIC, \"CLASS_STATIC_INITIALIZER\"] block )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:537:29: ^( CLASS_STATIC_INITIALIZER[$STATIC, \"CLASS_STATIC_INITIALIZER\"] block )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(CLASS_STATIC_INITIALIZER, STATIC81, "CLASS_STATIC_INITIALIZER"), root_1);
adaptor.addChild(root_1, stream_block.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 3:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:538:9: modifierList ( ( genericTypeParameterList )? ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block | SEMI ) -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block )? ) | VOID IDENT formalParameterList ( throwsClause )? ( block | SEMI ) -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ( block )? ) | ident= IDENT formalParameterList ( throwsClause )? block -> ^( CONSTRUCTOR_DECL[$ident, \"CONSTRUCTOR_DECL\"] modifierList ( genericTypeParameterList )? formalParameterList ( throwsClause )? block ) ) | type classFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList ) )
{
pushFollow(FOLLOW_modifierList_in_classScopeDeclarations5636);
modifierList83 = modifierList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_modifierList.add(modifierList83.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:539:9: ( ( genericTypeParameterList )? ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block | SEMI ) -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block )? ) | VOID IDENT formalParameterList ( throwsClause )? ( block | SEMI ) -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ( block )? ) | ident= IDENT formalParameterList ( throwsClause )? block -> ^( CONSTRUCTOR_DECL[$ident, \"CONSTRUCTOR_DECL\"] modifierList ( genericTypeParameterList )? formalParameterList ( throwsClause )? block ) ) | type classFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList ) )
int alt36 = 2;
switch(input.LA(1)) {
case LESS_THAN:
case VOID:
{
alt36 = 1;
}
break;
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case FLOAT:
case INT:
case LONG:
case SHORT:
{
int LA36_2 = input.LA(2);
if ((synpred43_Java())) {
alt36 = 1;
} else if ((true)) {
alt36 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 36, 2, input);
throw nvae;
}
}
break;
case IDENT:
{
int LA36_3 = input.LA(2);
if ((synpred43_Java())) {
alt36 = 1;
} else if ((true)) {
alt36 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 36, 3, input);
throw nvae;
}
}
break;
default:
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 36, 0, input);
throw nvae;
}
switch(alt36) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:539:13: ( genericTypeParameterList )? ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block | SEMI ) -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block )? ) | VOID IDENT formalParameterList ( throwsClause )? ( block | SEMI ) -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ( block )? ) | ident= IDENT formalParameterList ( throwsClause )? block -> ^( CONSTRUCTOR_DECL[$ident, \"CONSTRUCTOR_DECL\"] modifierList ( genericTypeParameterList )? formalParameterList ( throwsClause )? block ) )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:539:13: ( genericTypeParameterList )?
int alt28 = 2;
int LA28_0 = input.LA(1);
if ((LA28_0 == LESS_THAN)) {
alt28 = 1;
}
switch(alt28) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: genericTypeParameterList
{
pushFollow(FOLLOW_genericTypeParameterList_in_classScopeDeclarations5650);
genericTypeParameterList84 = genericTypeParameterList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericTypeParameterList.add(genericTypeParameterList84.getTree());
}
}
break;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:540:13: ( type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block | SEMI ) -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block )? ) | VOID IDENT formalParameterList ( throwsClause )? ( block | SEMI ) -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ( block )? ) | ident= IDENT formalParameterList ( throwsClause )? block -> ^( CONSTRUCTOR_DECL[$ident, \"CONSTRUCTOR_DECL\"] modifierList ( genericTypeParameterList )? formalParameterList ( throwsClause )? block ) )
int alt35 = 3;
switch(input.LA(1)) {
case BOOLEAN:
case BYTE:
case CHAR:
case DOUBLE:
case FLOAT:
case INT:
case LONG:
case SHORT:
{
alt35 = 1;
}
break;
case IDENT:
{
int LA35_2 = input.LA(2);
if ((LA35_2 == LPAREN)) {
alt35 = 3;
} else if ((LA35_2 == DOT || LA35_2 == LBRACK || LA35_2 == LESS_THAN || LA35_2 == IDENT)) {
alt35 = 1;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 35, 2, input);
throw nvae;
}
}
break;
case VOID:
{
alt35 = 2;
}
break;
default:
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 35, 0, input);
throw nvae;
}
switch(alt35) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:540:17: type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block | SEMI )
{
pushFollow(FOLLOW_type_in_classScopeDeclarations5669);
type85 = type();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_type.add(type85.getTree());
}
IDENT86 = (Token) match(input, IDENT, FOLLOW_IDENT_in_classScopeDeclarations5671);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT86);
}
pushFollow(FOLLOW_formalParameterList_in_classScopeDeclarations5673);
formalParameterList87 = formalParameterList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_formalParameterList.add(formalParameterList87.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:540:48: ( arrayDeclaratorList )?
int alt29 = 2;
int LA29_0 = input.LA(1);
if ((LA29_0 == LBRACK)) {
alt29 = 1;
}
switch(alt29) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: arrayDeclaratorList
{
pushFollow(FOLLOW_arrayDeclaratorList_in_classScopeDeclarations5675);
arrayDeclaratorList88 = arrayDeclaratorList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arrayDeclaratorList.add(arrayDeclaratorList88.getTree());
}
}
break;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:540:69: ( throwsClause )?
int alt30 = 2;
int LA30_0 = input.LA(1);
if ((LA30_0 == THROWS)) {
alt30 = 1;
}
switch(alt30) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: throwsClause
{
pushFollow(FOLLOW_throwsClause_in_classScopeDeclarations5678);
throwsClause89 = throwsClause();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_throwsClause.add(throwsClause89.getTree());
}
}
break;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:540:83: ( block | SEMI )
int alt31 = 2;
int LA31_0 = input.LA(1);
if ((LA31_0 == LCURLY)) {
alt31 = 1;
} else if ((LA31_0 == SEMI)) {
alt31 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 31, 0, input);
throw nvae;
}
switch(alt31) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:540:84: block
{
pushFollow(FOLLOW_block_in_classScopeDeclarations5682);
block90 = block();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_block.add(block90.getTree());
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:540:92: SEMI
{
SEMI91 = (Token) match(input, SEMI, FOLLOW_SEMI_in_classScopeDeclarations5686);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SEMI.add(SEMI91);
}
}
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();
// 541:17: -> ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block )? )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:541:21: ^( FUNCTION_METHOD_DECL modifierList ( genericTypeParameterList )? type IDENT formalParameterList ( arrayDeclaratorList )? ( throwsClause )? ( block )? )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(FUNCTION_METHOD_DECL, "FUNCTION_METHOD_DECL"), root_1);
adaptor.addChild(root_1, stream_modifierList.nextTree());
// /home/langera/dev/freud/trunk/src/grammar/Java.g:541:57: ( genericTypeParameterList )?
if (stream_genericTypeParameterList.hasNext()) {
adaptor.addChild(root_1, stream_genericTypeParameterList.nextTree());
}
stream_genericTypeParameterList.reset();
adaptor.addChild(root_1, stream_type.nextTree());
adaptor.addChild(root_1, stream_IDENT.nextNode());
adaptor.addChild(root_1, stream_formalParameterList.nextTree());
// /home/langera/dev/freud/trunk/src/grammar/Java.g:541:114: ( arrayDeclaratorList )?
if (stream_arrayDeclaratorList.hasNext()) {
adaptor.addChild(root_1, stream_arrayDeclaratorList.nextTree());
}
stream_arrayDeclaratorList.reset();
// /home/langera/dev/freud/trunk/src/grammar/Java.g:541:135: ( throwsClause )?
if (stream_throwsClause.hasNext()) {
adaptor.addChild(root_1, stream_throwsClause.nextTree());
}
stream_throwsClause.reset();
// /home/langera/dev/freud/trunk/src/grammar/Java.g:541:149: ( block )?
if (stream_block.hasNext()) {
adaptor.addChild(root_1, stream_block.nextTree());
}
stream_block.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:542:17: VOID IDENT formalParameterList ( throwsClause )? ( block | SEMI )
{
VOID92 = (Token) match(input, VOID, FOLLOW_VOID_in_classScopeDeclarations5748);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_VOID.add(VOID92);
}
IDENT93 = (Token) match(input, IDENT, FOLLOW_IDENT_in_classScopeDeclarations5750);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT93);
}
pushFollow(FOLLOW_formalParameterList_in_classScopeDeclarations5752);
formalParameterList94 = formalParameterList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_formalParameterList.add(formalParameterList94.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:542:48: ( throwsClause )?
int alt32 = 2;
int LA32_0 = input.LA(1);
if ((LA32_0 == THROWS)) {
alt32 = 1;
}
switch(alt32) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: throwsClause
{
pushFollow(FOLLOW_throwsClause_in_classScopeDeclarations5754);
throwsClause95 = throwsClause();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_throwsClause.add(throwsClause95.getTree());
}
}
break;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:542:62: ( block | SEMI )
int alt33 = 2;
int LA33_0 = input.LA(1);
if ((LA33_0 == LCURLY)) {
alt33 = 1;
} else if ((LA33_0 == SEMI)) {
alt33 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 33, 0, input);
throw nvae;
}
switch(alt33) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:542:63: block
{
pushFollow(FOLLOW_block_in_classScopeDeclarations5758);
block96 = block();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_block.add(block96.getTree());
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:542:71: SEMI
{
SEMI97 = (Token) match(input, SEMI, FOLLOW_SEMI_in_classScopeDeclarations5762);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SEMI.add(SEMI97);
}
}
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();
// 543:17: -> ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ( block )? )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:543:21: ^( VOID_METHOD_DECL modifierList ( genericTypeParameterList )? IDENT formalParameterList ( throwsClause )? ( block )? )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(VOID_METHOD_DECL, "VOID_METHOD_DECL"), root_1);
adaptor.addChild(root_1, stream_modifierList.nextTree());
// /home/langera/dev/freud/trunk/src/grammar/Java.g:543:53: ( genericTypeParameterList )?
if (stream_genericTypeParameterList.hasNext()) {
adaptor.addChild(root_1, stream_genericTypeParameterList.nextTree());
}
stream_genericTypeParameterList.reset();
adaptor.addChild(root_1, stream_IDENT.nextNode());
adaptor.addChild(root_1, stream_formalParameterList.nextTree());
// /home/langera/dev/freud/trunk/src/grammar/Java.g:543:105: ( throwsClause )?
if (stream_throwsClause.hasNext()) {
adaptor.addChild(root_1, stream_throwsClause.nextTree());
}
stream_throwsClause.reset();
// /home/langera/dev/freud/trunk/src/grammar/Java.g:543:119: ( block )?
if (stream_block.hasNext()) {
adaptor.addChild(root_1, stream_block.nextTree());
}
stream_block.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 3:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:544:17: ident= IDENT formalParameterList ( throwsClause )? block
{
ident = (Token) match(input, IDENT, FOLLOW_IDENT_in_classScopeDeclarations5821);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(ident);
}
pushFollow(FOLLOW_formalParameterList_in_classScopeDeclarations5823);
formalParameterList98 = formalParameterList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_formalParameterList.add(formalParameterList98.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:544:49: ( throwsClause )?
int alt34 = 2;
int LA34_0 = input.LA(1);
if ((LA34_0 == THROWS)) {
alt34 = 1;
}
switch(alt34) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: throwsClause
{
pushFollow(FOLLOW_throwsClause_in_classScopeDeclarations5825);
throwsClause99 = throwsClause();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_throwsClause.add(throwsClause99.getTree());
}
}
break;
}
pushFollow(FOLLOW_block_in_classScopeDeclarations5828);
block100 = block();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_block.add(block100.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();
// 545:17: -> ^( CONSTRUCTOR_DECL[$ident, \"CONSTRUCTOR_DECL\"] modifierList ( genericTypeParameterList )? formalParameterList ( throwsClause )? block )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:545:21: ^( CONSTRUCTOR_DECL[$ident, \"CONSTRUCTOR_DECL\"] modifierList ( genericTypeParameterList )? formalParameterList ( throwsClause )? block )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(CONSTRUCTOR_DECL, ident, "CONSTRUCTOR_DECL"), root_1);
adaptor.addChild(root_1, stream_modifierList.nextTree());
// /home/langera/dev/freud/trunk/src/grammar/Java.g:545:81: ( genericTypeParameterList )?
if (stream_genericTypeParameterList.hasNext()) {
adaptor.addChild(root_1, stream_genericTypeParameterList.nextTree());
}
stream_genericTypeParameterList.reset();
adaptor.addChild(root_1, stream_formalParameterList.nextTree());
// /home/langera/dev/freud/trunk/src/grammar/Java.g:545:127: ( throwsClause )?
if (stream_throwsClause.hasNext()) {
adaptor.addChild(root_1, stream_throwsClause.nextTree());
}
stream_throwsClause.reset();
adaptor.addChild(root_1, stream_block.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:547:13: type classFieldDeclaratorList SEMI
{
pushFollow(FOLLOW_type_in_classScopeDeclarations5892);
type101 = type();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_type.add(type101.getTree());
}
pushFollow(FOLLOW_classFieldDeclaratorList_in_classScopeDeclarations5894);
classFieldDeclaratorList102 = classFieldDeclaratorList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_classFieldDeclaratorList.add(classFieldDeclaratorList102.getTree());
}
SEMI103 = (Token) match(input, SEMI, FOLLOW_SEMI_in_classScopeDeclarations5896);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SEMI.add(SEMI103);
}
// 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();
// 548:13: -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:548:17: ^( VAR_DECLARATION modifierList 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_modifierList.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;
}
}
break;
}
}
break;
case 4:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:550:9: typeDeclaration
{
root_0 = (CommonTree) adaptor.nil();
pushFollow(FOLLOW_typeDeclaration_in_classScopeDeclarations5941);
typeDeclaration104 = typeDeclaration();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, typeDeclaration104.getTree());
}
}
break;
case 5:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:551:9: SEMI
{
root_0 = (CommonTree) adaptor.nil();
SEMI105 = (Token) match(input, SEMI, FOLLOW_SEMI_in_classScopeDeclarations5951);
if (state.failed) {
return retval;
}
}
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, 25, classScopeDeclarations_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.NoViableAltException in project drools by kiegroup.
the class DSLMapParser method statement.
// $ANTLR start "statement"
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:111:1: statement : ( entry | EOL !);
public final DSLMapParser.statement_return statement() throws RecognitionException {
DSLMapParser.statement_return retval = new DSLMapParser.statement_return();
retval.start = input.LT(1);
Object root_0 = null;
Token EOL3 = null;
ParserRuleReturnScope entry2 = null;
Object EOL3_tree = null;
try {
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:112:5: ( entry | EOL !)
int alt2 = 2;
int LA2_0 = input.LA(1);
if ((LA2_0 == LEFT_SQUARE)) {
alt2 = 1;
} else if ((LA2_0 == EOL)) {
alt2 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 2, 0, input);
throw nvae;
}
switch(alt2) {
case 1:
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:112:7: entry
{
root_0 = (Object) adaptor.nil();
pushFollow(FOLLOW_entry_in_statement306);
entry2 = entry();
state._fsp--;
if (state.failed)
return retval;
if (state.backtracking == 0)
adaptor.addChild(root_0, entry2.getTree());
}
break;
case 2:
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:113:7: EOL !
{
root_0 = (Object) adaptor.nil();
EOL3 = (Token) match(input, EOL, FOLLOW_EOL_in_statement314);
if (state.failed)
return retval;
}
break;
}
retval.stop = input.LT(-1);
if (state.backtracking == 0) {
retval.tree = (Object) adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
} catch (RecognitionException re) {
reportError(re);
recover(input, re);
retval.tree = (Object) adaptor.errorNode(input, retval.start, input.LT(-1), re);
} finally {
// do for sure before leaving
}
return retval;
}
use of org.antlr.runtime.NoViableAltException in project drools by kiegroup.
the class DSLMapParser method value_sentence.
// $ANTLR start "value_sentence"
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:172:1: value_sentence : ( variable_reference |vc= value_chunk -> VT_LITERAL[$vc.start, text] );
public final DSLMapParser.value_sentence_return value_sentence() throws RecognitionException {
DSLMapParser.value_sentence_return retval = new DSLMapParser.value_sentence_return();
retval.start = input.LT(1);
Object root_0 = null;
ParserRuleReturnScope vc = null;
ParserRuleReturnScope variable_reference19 = null;
RewriteRuleSubtreeStream stream_value_chunk = new RewriteRuleSubtreeStream(adaptor, "rule value_chunk");
String text = "";
try {
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:176:5: ( variable_reference |vc= value_chunk -> VT_LITERAL[$vc.start, text] )
int alt12 = 2;
int LA12_0 = input.LA(1);
if ((LA12_0 == LEFT_CURLY)) {
alt12 = 1;
} else if (((LA12_0 >= COLON && LA12_0 <= DOT) || LA12_0 == EQUALS || (LA12_0 >= LEFT_SQUARE && LA12_0 <= LITERAL) || LA12_0 == RIGHT_SQUARE)) {
alt12 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 12, 0, input);
throw nvae;
}
switch(alt12) {
case 1:
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:176:7: variable_reference
{
root_0 = (Object) adaptor.nil();
pushFollow(FOLLOW_variable_reference_in_value_sentence703);
variable_reference19 = variable_reference();
state._fsp--;
if (state.failed)
return retval;
if (state.backtracking == 0)
adaptor.addChild(root_0, variable_reference19.getTree());
}
break;
case 2:
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:177:7: vc= value_chunk
{
pushFollow(FOLLOW_value_chunk_in_value_sentence713);
vc = value_chunk();
state._fsp--;
if (state.failed)
return retval;
if (state.backtracking == 0)
stream_value_chunk.add(vc.getTree());
if (state.backtracking == 0) {
text = (vc != null ? input.toString(vc.start, vc.stop) : null);
}
// wildcard labels:
if (state.backtracking == 0) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.getTree() : null);
root_0 = (Object) adaptor.nil();
// 178:5: -> VT_LITERAL[$vc.start, text]
{
adaptor.addChild(root_0, (Object) adaptor.create(VT_LITERAL, (vc != null ? (vc.start) : null), text));
}
retval.tree = root_0;
}
}
break;
}
retval.stop = input.LT(-1);
if (state.backtracking == 0) {
retval.tree = (Object) adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
} catch (RecognitionException re) {
reportError(re);
recover(input, re);
retval.tree = (Object) adaptor.errorNode(input, retval.start, input.LT(-1), re);
} finally {
// do for sure before leaving
}
return retval;
}
Aggregations