use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class CssParser method selectop.
// $ANTLR start "selectop"
// /home/langera/dev/freud/src/grammar/Css.g:72:1: selectop : ( '>' -> CHILD | '+' -> ADJACENT_SIBLING );
public final CssParser.selectop_return selectop() throws RecognitionException {
CssParser.selectop_return retval = new CssParser.selectop_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token char_literal29 = null;
Token char_literal30 = null;
CommonTree char_literal29_tree = null;
CommonTree char_literal30_tree = null;
RewriteRuleTokenStream stream_32 = new RewriteRuleTokenStream(adaptor, "token 32");
RewriteRuleTokenStream stream_33 = new RewriteRuleTokenStream(adaptor, "token 33");
try {
// /home/langera/dev/freud/src/grammar/Css.g:73:2: ( '>' -> CHILD | '+' -> ADJACENT_SIBLING )
int alt14 = 2;
int LA14_0 = input.LA(1);
if ((LA14_0 == 32)) {
alt14 = 1;
} else if ((LA14_0 == 33)) {
alt14 = 2;
} else {
NoViableAltException nvae = new NoViableAltException("", 14, 0, input);
throw nvae;
}
switch(alt14) {
case 1:
// /home/langera/dev/freud/src/grammar/Css.g:73:4: '>'
{
char_literal29 = (Token) match(input, 32, FOLLOW_32_in_selectop363);
stream_32.add(char_literal29);
// AST REWRITE
// elements:
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 73:8: -> CHILD
{
adaptor.addChild(root_0, (CommonTree) adaptor.create(CHILD, "CHILD"));
}
retval.tree = root_0;
}
break;
case 2:
// /home/langera/dev/freud/src/grammar/Css.g:74:11: '+'
{
char_literal30 = (Token) match(input, 33, FOLLOW_33_in_selectop379);
stream_33.add(char_literal30);
// AST REWRITE
// elements:
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 74:16: -> ADJACENT_SIBLING
{
adaptor.addChild(root_0, (CommonTree) adaptor.create(ADJACENT_SIBLING, "ADJACENT_SIBLING"));
}
retval.tree = root_0;
}
break;
}
retval.stop = input.LT(-1);
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 {
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class CssParser method declaration.
// $ANTLR start "declaration"
// /home/langera/dev/freud/src/grammar/Css.g:103:1: declaration : IDENT ':' args -> ^( PROPERTY IDENT args ) ;
public final CssParser.declaration_return declaration() throws RecognitionException {
CssParser.declaration_return retval = new CssParser.declaration_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token IDENT54 = null;
Token char_literal55 = null;
CssParser.args_return args56 = null;
CommonTree IDENT54_tree = null;
CommonTree char_literal55_tree = null;
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
RewriteRuleTokenStream stream_38 = new RewriteRuleTokenStream(adaptor, "token 38");
RewriteRuleSubtreeStream stream_args = new RewriteRuleSubtreeStream(adaptor, "rule args");
try {
// /home/langera/dev/freud/src/grammar/Css.g:104:2: ( IDENT ':' args -> ^( PROPERTY IDENT args ) )
// /home/langera/dev/freud/src/grammar/Css.g:104:4: IDENT ':' args
{
IDENT54 = (Token) match(input, IDENT, FOLLOW_IDENT_in_declaration618);
stream_IDENT.add(IDENT54);
char_literal55 = (Token) match(input, 38, FOLLOW_38_in_declaration620);
stream_38.add(char_literal55);
pushFollow(FOLLOW_args_in_declaration622);
args56 = args();
state._fsp--;
stream_args.add(args56.getTree());
// AST REWRITE
// elements: IDENT, args
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 104:19: -> ^( PROPERTY IDENT args )
{
// /home/langera/dev/freud/src/grammar/Css.g:104:22: ^( PROPERTY IDENT args )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(PROPERTY, "PROPERTY"), root_1);
adaptor.addChild(root_1, stream_IDENT.nextNode());
adaptor.addChild(root_1, stream_args.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
retval.stop = input.LT(-1);
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 {
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class CssParser method attribRelate.
// $ANTLR start "attribRelate"
// /home/langera/dev/freud/src/grammar/Css.g:97:1: attribRelate : ( '=' -> ATTRIBEQUAL | '~=' -> HASVALUE | '|=' -> BEGINSWITH );
public final CssParser.attribRelate_return attribRelate() throws RecognitionException {
CssParser.attribRelate_return retval = new CssParser.attribRelate_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token char_literal51 = null;
Token string_literal52 = null;
Token string_literal53 = null;
CommonTree char_literal51_tree = null;
CommonTree string_literal52_tree = null;
CommonTree string_literal53_tree = null;
RewriteRuleTokenStream stream_43 = new RewriteRuleTokenStream(adaptor, "token 43");
RewriteRuleTokenStream stream_44 = new RewriteRuleTokenStream(adaptor, "token 44");
RewriteRuleTokenStream stream_42 = new RewriteRuleTokenStream(adaptor, "token 42");
try {
// /home/langera/dev/freud/src/grammar/Css.g:98:2: ( '=' -> ATTRIBEQUAL | '~=' -> HASVALUE | '|=' -> BEGINSWITH )
int alt22 = 3;
switch(input.LA(1)) {
case 42:
{
alt22 = 1;
}
break;
case 43:
{
alt22 = 2;
}
break;
case 44:
{
alt22 = 3;
}
break;
default:
NoViableAltException nvae = new NoViableAltException("", 22, 0, input);
throw nvae;
}
switch(alt22) {
case 1:
// /home/langera/dev/freud/src/grammar/Css.g:98:4: '='
{
char_literal51 = (Token) match(input, 42, FOLLOW_42_in_attribRelate581);
stream_42.add(char_literal51);
// AST REWRITE
// elements:
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 98:9: -> ATTRIBEQUAL
{
adaptor.addChild(root_0, (CommonTree) adaptor.create(ATTRIBEQUAL, "ATTRIBEQUAL"));
}
retval.tree = root_0;
}
break;
case 2:
// /home/langera/dev/freud/src/grammar/Css.g:99:4: '~='
{
string_literal52 = (Token) match(input, 43, FOLLOW_43_in_attribRelate591);
stream_43.add(string_literal52);
// AST REWRITE
// elements:
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 99:9: -> HASVALUE
{
adaptor.addChild(root_0, (CommonTree) adaptor.create(HASVALUE, "HASVALUE"));
}
retval.tree = root_0;
}
break;
case 3:
// /home/langera/dev/freud/src/grammar/Css.g:100:4: '|='
{
string_literal53 = (Token) match(input, 44, FOLLOW_44_in_attribRelate600);
stream_44.add(string_literal53);
// AST REWRITE
// elements:
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null ? retval.tree : null);
root_0 = (CommonTree) adaptor.nil();
// 100:9: -> BEGINSWITH
{
adaptor.addChild(root_0, (CommonTree) adaptor.create(BEGINSWITH, "BEGINSWITH"));
}
retval.tree = root_0;
}
break;
}
retval.stop = input.LT(-1);
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 {
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method implementsClause.
// $ANTLR start "implementsClause"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:459:1: implementsClause : IMPLEMENTS typeList -> ^( IMPLEMENTS_CLAUSE[$IMPLEMENTS, \"IMPLEMENTS_CLAUSE\"] typeList ) ;
public final JavaParser.implementsClause_return implementsClause() throws RecognitionException {
JavaParser.implementsClause_return retval = new JavaParser.implementsClause_return();
retval.start = input.LT(1);
int implementsClause_StartIndex = input.index();
CommonTree root_0 = null;
Token IMPLEMENTS31 = null;
JavaParser.typeList_return typeList32 = null;
CommonTree IMPLEMENTS31_tree = null;
RewriteRuleTokenStream stream_IMPLEMENTS = new RewriteRuleTokenStream(adaptor, "token IMPLEMENTS");
RewriteRuleSubtreeStream stream_typeList = new RewriteRuleSubtreeStream(adaptor, "rule typeList");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 10)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:460:5: ( IMPLEMENTS typeList -> ^( IMPLEMENTS_CLAUSE[$IMPLEMENTS, \"IMPLEMENTS_CLAUSE\"] typeList ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:460:9: IMPLEMENTS typeList
{
IMPLEMENTS31 = (Token) match(input, IMPLEMENTS, FOLLOW_IMPLEMENTS_in_implementsClause4895);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IMPLEMENTS.add(IMPLEMENTS31);
}
pushFollow(FOLLOW_typeList_in_implementsClause4897);
typeList32 = typeList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_typeList.add(typeList32.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();
// 461:9: -> ^( IMPLEMENTS_CLAUSE[$IMPLEMENTS, \"IMPLEMENTS_CLAUSE\"] typeList )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:461:13: ^( IMPLEMENTS_CLAUSE[$IMPLEMENTS, \"IMPLEMENTS_CLAUSE\"] typeList )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(IMPLEMENTS_CLAUSE, IMPLEMENTS31, "IMPLEMENTS_CLAUSE"), root_1);
adaptor.addChild(root_1, stream_typeList.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, 10, implementsClause_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method innerNewExpression.
// $ANTLR start "innerNewExpression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1141:1: innerNewExpression : NEW ( genericTypeArgumentListSimplified )? IDENT arguments ( classBody )? -> ^( CLASS_CONSTRUCTOR_CALL[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? IDENT arguments ( classBody )? ) ;
public final JavaParser.innerNewExpression_return innerNewExpression() throws RecognitionException {
JavaParser.innerNewExpression_return retval = new JavaParser.innerNewExpression_return();
retval.start = input.LT(1);
int innerNewExpression_StartIndex = input.index();
CommonTree root_0 = null;
Token NEW517 = null;
Token IDENT519 = null;
JavaParser.genericTypeArgumentListSimplified_return genericTypeArgumentListSimplified518 = null;
JavaParser.arguments_return arguments520 = null;
JavaParser.classBody_return classBody521 = null;
CommonTree NEW517_tree = null;
CommonTree IDENT519_tree = null;
RewriteRuleTokenStream stream_NEW = new RewriteRuleTokenStream(adaptor, "token NEW");
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
RewriteRuleSubtreeStream stream_arguments = new RewriteRuleSubtreeStream(adaptor, "rule arguments");
RewriteRuleSubtreeStream stream_classBody = new RewriteRuleSubtreeStream(adaptor, "rule classBody");
RewriteRuleSubtreeStream stream_genericTypeArgumentListSimplified = new RewriteRuleSubtreeStream(adaptor, "rule genericTypeArgumentListSimplified");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 108)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1142:5: ( NEW ( genericTypeArgumentListSimplified )? IDENT arguments ( classBody )? -> ^( CLASS_CONSTRUCTOR_CALL[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? IDENT arguments ( classBody )? ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1142:9: NEW ( genericTypeArgumentListSimplified )? IDENT arguments ( classBody )?
{
NEW517 = (Token) match(input, NEW, FOLLOW_NEW_in_innerNewExpression14283);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_NEW.add(NEW517);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1142:13: ( genericTypeArgumentListSimplified )?
int alt149 = 2;
int LA149_0 = input.LA(1);
if ((LA149_0 == LESS_THAN)) {
alt149 = 1;
}
switch(alt149) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: genericTypeArgumentListSimplified
{
pushFollow(FOLLOW_genericTypeArgumentListSimplified_in_innerNewExpression14285);
genericTypeArgumentListSimplified518 = genericTypeArgumentListSimplified();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_genericTypeArgumentListSimplified.add(genericTypeArgumentListSimplified518.getTree());
}
}
break;
}
IDENT519 = (Token) match(input, IDENT, FOLLOW_IDENT_in_innerNewExpression14288);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT519);
}
pushFollow(FOLLOW_arguments_in_innerNewExpression14290);
arguments520 = arguments();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arguments.add(arguments520.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1142:64: ( classBody )?
int alt150 = 2;
int LA150_0 = input.LA(1);
if ((LA150_0 == LCURLY)) {
alt150 = 1;
}
switch(alt150) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: classBody
{
pushFollow(FOLLOW_classBody_in_innerNewExpression14292);
classBody521 = classBody();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_classBody.add(classBody521.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();
// 1143:9: -> ^( CLASS_CONSTRUCTOR_CALL[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? IDENT arguments ( classBody )? )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1143:13: ^( CLASS_CONSTRUCTOR_CALL[$NEW, \"STATIC_ARRAY_CREATOR\"] ( genericTypeArgumentListSimplified )? IDENT arguments ( classBody )? )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(CLASS_CONSTRUCTOR_CALL, NEW517, "STATIC_ARRAY_CREATOR"), root_1);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1143:68: ( genericTypeArgumentListSimplified )?
if (stream_genericTypeArgumentListSimplified.hasNext()) {
adaptor.addChild(root_1, stream_genericTypeArgumentListSimplified.nextTree());
}
stream_genericTypeArgumentListSimplified.reset();
adaptor.addChild(root_1, stream_IDENT.nextNode());
adaptor.addChild(root_1, stream_arguments.nextTree());
// /home/langera/dev/freud/trunk/src/grammar/Java.g:1143:119: ( 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;
}
}
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, 108, innerNewExpression_StartIndex);
}
}
return retval;
}
Aggregations