use of org.antlr.runtime.tree.RewriteRuleTokenStream in project freud by LMAX-Exchange.
the class JavaParser method qualifiedTypeIdentSimplified.
// $ANTLR start "qualifiedTypeIdentSimplified"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:672:1: qualifiedTypeIdentSimplified : typeIdentSimplified ( DOT typeIdentSimplified )* -> ^( QUALIFIED_TYPE_IDENT ( typeIdentSimplified )+ ) ;
public final JavaParser.qualifiedTypeIdentSimplified_return qualifiedTypeIdentSimplified() throws RecognitionException {
JavaParser.qualifiedTypeIdentSimplified_return retval = new JavaParser.qualifiedTypeIdentSimplified_return();
retval.start = input.LT(1);
int qualifiedTypeIdentSimplified_StartIndex = input.index();
CommonTree root_0 = null;
Token DOT178 = null;
JavaParser.typeIdentSimplified_return typeIdentSimplified177 = null;
JavaParser.typeIdentSimplified_return typeIdentSimplified179 = null;
CommonTree DOT178_tree = null;
RewriteRuleTokenStream stream_DOT = new RewriteRuleTokenStream(adaptor, "token DOT");
RewriteRuleSubtreeStream stream_typeIdentSimplified = new RewriteRuleSubtreeStream(adaptor, "rule typeIdentSimplified");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 46)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:673:5: ( typeIdentSimplified ( DOT typeIdentSimplified )* -> ^( QUALIFIED_TYPE_IDENT ( typeIdentSimplified )+ ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:673:9: typeIdentSimplified ( DOT typeIdentSimplified )*
{
pushFollow(FOLLOW_typeIdentSimplified_in_qualifiedTypeIdentSimplified7045);
typeIdentSimplified177 = typeIdentSimplified();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_typeIdentSimplified.add(typeIdentSimplified177.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:673:29: ( DOT typeIdentSimplified )*
loop63: do {
int alt63 = 2;
int LA63_0 = input.LA(1);
if ((LA63_0 == DOT)) {
alt63 = 1;
}
switch(alt63) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:673:30: DOT typeIdentSimplified
{
DOT178 = (Token) match(input, DOT, FOLLOW_DOT_in_qualifiedTypeIdentSimplified7048);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_DOT.add(DOT178);
}
pushFollow(FOLLOW_typeIdentSimplified_in_qualifiedTypeIdentSimplified7050);
typeIdentSimplified179 = typeIdentSimplified();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_typeIdentSimplified.add(typeIdentSimplified179.getTree());
}
}
break;
default:
break loop63;
}
} 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();
// 674:9: -> ^( QUALIFIED_TYPE_IDENT ( typeIdentSimplified )+ )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:674:13: ^( QUALIFIED_TYPE_IDENT ( typeIdentSimplified )+ )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(QUALIFIED_TYPE_IDENT, "QUALIFIED_TYPE_IDENT"), root_1);
if (!(stream_typeIdentSimplified.hasNext())) {
throw new RewriteEarlyExitException();
}
while (stream_typeIdentSimplified.hasNext()) {
adaptor.addChild(root_1, stream_typeIdentSimplified.nextTree());
}
stream_typeIdentSimplified.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, 46, qualifiedTypeIdentSimplified_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleTokenStream in project freud by LMAX-Exchange.
the class JavaParser method genericTypeArgumentListSimplified.
// $ANTLR start "genericTypeArgumentListSimplified"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:711:1: genericTypeArgumentListSimplified : LESS_THAN genericTypeArgumentSimplified ( COMMA genericTypeArgumentSimplified )* genericTypeListClosing -> ^( GENERIC_TYPE_ARG_LIST[$LESS_THAN, \"GENERIC_TYPE_ARG_LIST\"] ( genericTypeArgumentSimplified )+ ) ;
public final JavaParser.genericTypeArgumentListSimplified_return genericTypeArgumentListSimplified() throws RecognitionException {
JavaParser.genericTypeArgumentListSimplified_return retval = new JavaParser.genericTypeArgumentListSimplified_return();
retval.start = input.LT(1);
int genericTypeArgumentListSimplified_StartIndex = input.index();
CommonTree root_0 = null;
Token LESS_THAN195 = null;
Token COMMA197 = null;
JavaParser.genericTypeArgumentSimplified_return genericTypeArgumentSimplified196 = null;
JavaParser.genericTypeArgumentSimplified_return genericTypeArgumentSimplified198 = null;
JavaParser.genericTypeListClosing_return genericTypeListClosing199 = null;
CommonTree LESS_THAN195_tree = null;
CommonTree COMMA197_tree = null;
RewriteRuleTokenStream stream_COMMA = new RewriteRuleTokenStream(adaptor, "token COMMA");
RewriteRuleTokenStream stream_LESS_THAN = new RewriteRuleTokenStream(adaptor, "token LESS_THAN");
RewriteRuleSubtreeStream stream_genericTypeArgumentSimplified = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeArgumentSimplified");
RewriteRuleSubtreeStream stream_genericTypeListClosing = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeListClosing");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 53)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:712:5: ( LESS_THAN genericTypeArgumentSimplified ( COMMA genericTypeArgumentSimplified )* genericTypeListClosing -> ^( GENERIC_TYPE_ARG_LIST[$LESS_THAN, \"GENERIC_TYPE_ARG_LIST\"] ( genericTypeArgumentSimplified )+ ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:712:9: LESS_THAN genericTypeArgumentSimplified ( COMMA genericTypeArgumentSimplified )* genericTypeListClosing
{
LESS_THAN195 = (Token) match(input, LESS_THAN, FOLLOW_LESS_THAN_in_genericTypeArgumentListSimplified7351);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LESS_THAN.add(LESS_THAN195);
}
pushFollow(FOLLOW_genericTypeArgumentSimplified_in_genericTypeArgumentListSimplified7353);
genericTypeArgumentSimplified196 = genericTypeArgumentSimplified();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericTypeArgumentSimplified.add(genericTypeArgumentSimplified196.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:712:49: ( COMMA genericTypeArgumentSimplified )*
loop69: do {
int alt69 = 2;
int LA69_0 = input.LA(1);
if ((LA69_0 == COMMA)) {
alt69 = 1;
}
switch(alt69) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:712:50: COMMA genericTypeArgumentSimplified
{
COMMA197 = (Token) match(input, COMMA, FOLLOW_COMMA_in_genericTypeArgumentListSimplified7356);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_COMMA.add(COMMA197);
}
pushFollow(FOLLOW_genericTypeArgumentSimplified_in_genericTypeArgumentListSimplified7358);
genericTypeArgumentSimplified198 = genericTypeArgumentSimplified();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericTypeArgumentSimplified.add(genericTypeArgumentSimplified198.getTree());
}
}
break;
default:
break loop69;
}
} while (true);
pushFollow(FOLLOW_genericTypeListClosing_in_genericTypeArgumentListSimplified7362);
genericTypeListClosing199 = genericTypeListClosing();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericTypeListClosing.add(genericTypeListClosing199.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();
// 713:9: -> ^( GENERIC_TYPE_ARG_LIST[$LESS_THAN, \"GENERIC_TYPE_ARG_LIST\"] ( genericTypeArgumentSimplified )+ )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:713:13: ^( GENERIC_TYPE_ARG_LIST[$LESS_THAN, \"GENERIC_TYPE_ARG_LIST\"] ( genericTypeArgumentSimplified )+ )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(GENERIC_TYPE_ARG_LIST, LESS_THAN195, "GENERIC_TYPE_ARG_LIST"), root_1);
if (!(stream_genericTypeArgumentSimplified.hasNext())) {
throw new RewriteEarlyExitException();
}
while (stream_genericTypeArgumentSimplified.hasNext()) {
adaptor.addChild(root_1, stream_genericTypeArgumentSimplified.nextTree());
}
stream_genericTypeArgumentSimplified.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, 53, genericTypeArgumentListSimplified_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleTokenStream in project freud by LMAX-Exchange.
the class JavaParser method arguments.
// $ANTLR start "arguments"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1151:1: arguments : LPAREN ( expressionList )? RPAREN -> ^( ARGUMENT_LIST[$LPAREN, \"ARGUMENT_LIST\"] ( expressionList )? ) ;
public final JavaParser.arguments_return arguments() throws RecognitionException {
JavaParser.arguments_return retval = new JavaParser.arguments_return();
retval.start = input.LT(1);
int arguments_StartIndex = input.index();
CommonTree root_0 = null;
Token LPAREN531 = null;
Token RPAREN533 = null;
JavaParser.expressionList_return expressionList532 = null;
CommonTree LPAREN531_tree = null;
CommonTree RPAREN533_tree = null;
RewriteRuleTokenStream stream_RPAREN = new RewriteRuleTokenStream(adaptor, "token RPAREN");
RewriteRuleTokenStream stream_LPAREN = new RewriteRuleTokenStream(adaptor, "token LPAREN");
RewriteRuleSubtreeStream stream_expressionList = new RewriteRuleSubtreeStream(adaptor, "rule expressionList");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 110)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1152:5: ( LPAREN ( expressionList )? RPAREN -> ^( ARGUMENT_LIST[$LPAREN, \"ARGUMENT_LIST\"] ( expressionList )? ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1152:9: LPAREN ( expressionList )? RPAREN
{
LPAREN531 = (Token) match(input, LPAREN, FOLLOW_LPAREN_in_arguments14389);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LPAREN.add(LPAREN531);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1152:16: ( expressionList )?
int alt154 = 2;
int LA154_0 = input.LA(1);
if ((LA154_0 == DEC || LA154_0 == INC || LA154_0 == LESS_THAN || LA154_0 == LOGICAL_NOT || (LA154_0 >= LPAREN && LA154_0 <= MINUS) || LA154_0 == NOT || LA154_0 == PLUS || LA154_0 == BOOLEAN || LA154_0 == BYTE || LA154_0 == CHAR || LA154_0 == DOUBLE || LA154_0 == FALSE || LA154_0 == FLOAT || (LA154_0 >= INT && LA154_0 <= LONG) || (LA154_0 >= NEW && LA154_0 <= NULL) || LA154_0 == SHORT || LA154_0 == SUPER || LA154_0 == THIS || LA154_0 == TRUE || LA154_0 == VOID || (LA154_0 >= IDENT && LA154_0 <= STRING_LITERAL))) {
alt154 = 1;
}
switch(alt154) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: expressionList
{
pushFollow(FOLLOW_expressionList_in_arguments14391);
expressionList532 = expressionList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_expressionList.add(expressionList532.getTree());
}
}
break;
}
RPAREN533 = (Token) match(input, RPAREN, FOLLOW_RPAREN_in_arguments14394);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_RPAREN.add(RPAREN533);
}
// 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();
// 1153:9: -> ^( ARGUMENT_LIST[$LPAREN, \"ARGUMENT_LIST\"] ( expressionList )? )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1153:13: ^( ARGUMENT_LIST[$LPAREN, \"ARGUMENT_LIST\"] ( expressionList )? )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ARGUMENT_LIST, LPAREN531, "ARGUMENT_LIST"), root_1);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1153:55: ( expressionList )?
if (stream_expressionList.hasNext()) {
adaptor.addChild(root_1, stream_expressionList.nextTree());
}
stream_expressionList.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, 110, arguments_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleTokenStream in project drools by kiegroup.
the class DSLMapParser method any_key.
// $ANTLR start "any_key"
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:266:1: any_key :{...}?value= LITERAL -> VT_ANY[$value] ;
public final DSLMapParser.any_key_return any_key() throws RecognitionException {
DSLMapParser.any_key_return retval = new DSLMapParser.any_key_return();
retval.start = input.LT(1);
Object root_0 = null;
Token value = null;
Object value_tree = null;
RewriteRuleTokenStream stream_LITERAL = new RewriteRuleTokenStream(adaptor, "token LITERAL");
try {
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:267:5: ({...}?value= LITERAL -> VT_ANY[$value] )
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:267:7: {...}?value= LITERAL
{
if (!((validateIdentifierKey("*")))) {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
throw new FailedPredicateException(input, "any_key", "validateIdentifierKey(\"*\")");
}
value = (Token) match(input, LITERAL, FOLLOW_LITERAL_in_any_key1695);
if (state.failed)
return retval;
if (state.backtracking == 0)
stream_LITERAL.add(value);
// 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();
// 268:5: -> VT_ANY[$value]
{
adaptor.addChild(root_0, (Object) adaptor.create(VT_ANY, value));
}
retval.tree = root_0;
}
}
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.tree.RewriteRuleTokenStream in project drools by kiegroup.
the class DSLMapParser method meta_section.
// $ANTLR start "meta_section"
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:144:1: meta_section : LEFT_SQUARE ( LITERAL )? RIGHT_SQUARE -> ^( VT_META[$LEFT_SQUARE, \"META SECTION\"] ( LITERAL )? ) ;
public final DSLMapParser.meta_section_return meta_section() throws RecognitionException {
DSLMapParser.meta_section_return retval = new DSLMapParser.meta_section_return();
retval.start = input.LT(1);
Object root_0 = null;
Token LEFT_SQUARE13 = null;
Token LITERAL14 = null;
Token RIGHT_SQUARE15 = null;
Object LEFT_SQUARE13_tree = null;
Object LITERAL14_tree = null;
Object RIGHT_SQUARE15_tree = null;
RewriteRuleTokenStream stream_RIGHT_SQUARE = new RewriteRuleTokenStream(adaptor, "token RIGHT_SQUARE");
RewriteRuleTokenStream stream_LITERAL = new RewriteRuleTokenStream(adaptor, "token LITERAL");
RewriteRuleTokenStream stream_LEFT_SQUARE = new RewriteRuleTokenStream(adaptor, "token LEFT_SQUARE");
try {
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:145:5: ( LEFT_SQUARE ( LITERAL )? RIGHT_SQUARE -> ^( VT_META[$LEFT_SQUARE, \"META SECTION\"] ( LITERAL )? ) )
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:145:7: LEFT_SQUARE ( LITERAL )? RIGHT_SQUARE
{
LEFT_SQUARE13 = (Token) match(input, LEFT_SQUARE, FOLLOW_LEFT_SQUARE_in_meta_section530);
if (state.failed)
return retval;
if (state.backtracking == 0)
stream_LEFT_SQUARE.add(LEFT_SQUARE13);
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:145:19: ( LITERAL )?
int alt7 = 2;
int LA7_0 = input.LA(1);
if ((LA7_0 == LITERAL)) {
alt7 = 1;
}
switch(alt7) {
case 1:
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:145:19: LITERAL
{
LITERAL14 = (Token) match(input, LITERAL, FOLLOW_LITERAL_in_meta_section532);
if (state.failed)
return retval;
if (state.backtracking == 0)
stream_LITERAL.add(LITERAL14);
}
break;
}
RIGHT_SQUARE15 = (Token) match(input, RIGHT_SQUARE, FOLLOW_RIGHT_SQUARE_in_meta_section535);
if (state.failed)
return retval;
if (state.backtracking == 0)
stream_RIGHT_SQUARE.add(RIGHT_SQUARE15);
// 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();
// 146:5: -> ^( VT_META[$LEFT_SQUARE, \"META SECTION\"] ( LITERAL )? )
{
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:146:8: ^( VT_META[$LEFT_SQUARE, \"META SECTION\"] ( LITERAL )? )
{
Object root_1 = (Object) adaptor.nil();
root_1 = (Object) adaptor.becomeRoot((Object) adaptor.create(VT_META, LEFT_SQUARE13, "META SECTION"), root_1);
// src/main/resources/org/drools/compiler/lang/dsl/DSLMap.g:146:48: ( LITERAL )?
if (stream_LITERAL.hasNext()) {
adaptor.addChild(root_1, stream_LITERAL.nextNode());
}
stream_LITERAL.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
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