use of org.antlr.runtime.tree.CommonTree in project freud by LMAX-Exchange.
the class JavaParser method qualifiedIdentList.
// $ANTLR start "qualifiedIdentList"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:721:1: qualifiedIdentList : qualifiedIdentifier ( COMMA qualifiedIdentifier )* ;
public final JavaParser.qualifiedIdentList_return qualifiedIdentList() throws RecognitionException {
JavaParser.qualifiedIdentList_return retval = new JavaParser.qualifiedIdentList_return();
retval.start = input.LT(1);
int qualifiedIdentList_StartIndex = input.index();
CommonTree root_0 = null;
Token COMMA203 = null;
JavaParser.qualifiedIdentifier_return qualifiedIdentifier202 = null;
JavaParser.qualifiedIdentifier_return qualifiedIdentifier204 = null;
CommonTree COMMA203_tree = null;
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 55)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:722:5: ( qualifiedIdentifier ( COMMA qualifiedIdentifier )* )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:722:9: qualifiedIdentifier ( COMMA qualifiedIdentifier )*
{
root_0 = (CommonTree) adaptor.nil();
pushFollow(FOLLOW_qualifiedIdentifier_in_qualifiedIdentList7429);
qualifiedIdentifier202 = qualifiedIdentifier();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, qualifiedIdentifier202.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:722:29: ( COMMA qualifiedIdentifier )*
loop71: do {
int alt71 = 2;
int LA71_0 = input.LA(1);
if ((LA71_0 == COMMA)) {
alt71 = 1;
}
switch(alt71) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:722:30: COMMA qualifiedIdentifier
{
COMMA203 = (Token) match(input, COMMA, FOLLOW_COMMA_in_qualifiedIdentList7432);
if (state.failed) {
return retval;
}
pushFollow(FOLLOW_qualifiedIdentifier_in_qualifiedIdentList7435);
qualifiedIdentifier204 = qualifiedIdentifier();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, qualifiedIdentifier204.getTree());
}
}
break;
default:
break loop71;
}
} 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, 55, qualifiedIdentList_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.CommonTree in project freud by LMAX-Exchange.
the class JavaParser method logicalOrExpression.
// $ANTLR start "logicalOrExpression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:956:1: logicalOrExpression : logicalAndExpression ( LOGICAL_OR logicalAndExpression )* ;
public final JavaParser.logicalOrExpression_return logicalOrExpression() throws RecognitionException {
JavaParser.logicalOrExpression_return retval = new JavaParser.logicalOrExpression_return();
retval.start = input.LT(1);
int logicalOrExpression_StartIndex = input.index();
CommonTree root_0 = null;
Token LOGICAL_OR386 = null;
JavaParser.logicalAndExpression_return logicalAndExpression385 = null;
JavaParser.logicalAndExpression_return logicalAndExpression387 = null;
CommonTree LOGICAL_OR386_tree = null;
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 91)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:957:5: ( logicalAndExpression ( LOGICAL_OR logicalAndExpression )* )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:957:9: logicalAndExpression ( LOGICAL_OR logicalAndExpression )*
{
root_0 = (CommonTree) adaptor.nil();
pushFollow(FOLLOW_logicalAndExpression_in_logicalOrExpression10553);
logicalAndExpression385 = logicalAndExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, logicalAndExpression385.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:957:30: ( LOGICAL_OR logicalAndExpression )*
loop111: do {
int alt111 = 2;
int LA111_0 = input.LA(1);
if ((LA111_0 == LOGICAL_OR)) {
alt111 = 1;
}
switch(alt111) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:957:31: LOGICAL_OR logicalAndExpression
{
LOGICAL_OR386 = (Token) match(input, LOGICAL_OR, FOLLOW_LOGICAL_OR_in_logicalOrExpression10556);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
LOGICAL_OR386_tree = (CommonTree) adaptor.create(LOGICAL_OR386);
root_0 = (CommonTree) adaptor.becomeRoot(LOGICAL_OR386_tree, root_0);
}
pushFollow(FOLLOW_logicalAndExpression_in_logicalOrExpression10559);
logicalAndExpression387 = logicalAndExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, logicalAndExpression387.getTree());
}
}
break;
default:
break loop111;
}
} 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, 91, logicalOrExpression_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.CommonTree in project freud by LMAX-Exchange.
the class CssParser method nest.
// $ANTLR start "nest"
// /home/langera/dev/freud/src/grammar/Css.g:52:1: nest : IDENT ( IDENT )* ( pseudo )* -> ^( NEST IDENT ( IDENT )* ( pseudo )* ) ;
public final CssParser.nest_return nest() throws RecognitionException {
CssParser.nest_return retval = new CssParser.nest_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token IDENT13 = null;
Token IDENT14 = null;
CssParser.pseudo_return pseudo15 = null;
CommonTree IDENT13_tree = null;
CommonTree IDENT14_tree = null;
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
RewriteRuleSubtreeStream stream_pseudo = new RewriteRuleSubtreeStream(adaptor, "rule pseudo");
try {
// /home/langera/dev/freud/src/grammar/Css.g:53:2: ( IDENT ( IDENT )* ( pseudo )* -> ^( NEST IDENT ( IDENT )* ( pseudo )* ) )
// /home/langera/dev/freud/src/grammar/Css.g:53:4: IDENT ( IDENT )* ( pseudo )*
{
IDENT13 = (Token) match(input, IDENT, FOLLOW_IDENT_in_nest222);
stream_IDENT.add(IDENT13);
// /home/langera/dev/freud/src/grammar/Css.g:53:10: ( IDENT )*
loop6: do {
int alt6 = 2;
int LA6_0 = input.LA(1);
if ((LA6_0 == IDENT)) {
alt6 = 1;
}
switch(alt6) {
case 1:
// /home/langera/dev/freud/src/grammar/Css.g:53:10: IDENT
{
IDENT14 = (Token) match(input, IDENT, FOLLOW_IDENT_in_nest224);
stream_IDENT.add(IDENT14);
}
break;
default:
break loop6;
}
} while (true);
// /home/langera/dev/freud/src/grammar/Css.g:53:17: ( pseudo )*
loop7: do {
int alt7 = 2;
int LA7_0 = input.LA(1);
if (((LA7_0 >= 38 && LA7_0 <= 39))) {
alt7 = 1;
}
switch(alt7) {
case 1:
// /home/langera/dev/freud/src/grammar/Css.g:53:17: pseudo
{
pushFollow(FOLLOW_pseudo_in_nest227);
pseudo15 = pseudo();
state._fsp--;
stream_pseudo.add(pseudo15.getTree());
}
break;
default:
break loop7;
}
} while (true);
// AST REWRITE
// elements: pseudo, IDENT, IDENT
// 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();
// 53:25: -> ^( NEST IDENT ( IDENT )* ( pseudo )* )
{
// /home/langera/dev/freud/src/grammar/Css.g:53:28: ^( NEST IDENT ( IDENT )* ( pseudo )* )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(NEST, "NEST"), root_1);
adaptor.addChild(root_1, stream_IDENT.nextNode());
// /home/langera/dev/freud/src/grammar/Css.g:53:42: ( IDENT )*
while (stream_IDENT.hasNext()) {
adaptor.addChild(root_1, stream_IDENT.nextNode());
}
stream_IDENT.reset();
// /home/langera/dev/freud/src/grammar/Css.g:53:49: ( pseudo )*
while (stream_pseudo.hasNext()) {
adaptor.addChild(root_1, stream_pseudo.nextTree());
}
stream_pseudo.reset();
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.CommonTree in project freud by LMAX-Exchange.
the class CssParser method attrib.
// $ANTLR start "attrib"
// /home/langera/dev/freud/src/grammar/Css.g:93:1: attrib : '[' IDENT ( attribRelate IDENT )? ']' -> ^( ATTRIB IDENT ( attribRelate ( IDENT )* )? ) ;
public final CssParser.attrib_return attrib() throws RecognitionException {
CssParser.attrib_return retval = new CssParser.attrib_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token char_literal46 = null;
Token IDENT47 = null;
Token IDENT49 = null;
Token char_literal50 = null;
CssParser.attribRelate_return attribRelate48 = null;
CommonTree char_literal46_tree = null;
CommonTree IDENT47_tree = null;
CommonTree IDENT49_tree = null;
CommonTree char_literal50_tree = null;
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
RewriteRuleTokenStream stream_41 = new RewriteRuleTokenStream(adaptor, "token 41");
RewriteRuleTokenStream stream_40 = new RewriteRuleTokenStream(adaptor, "token 40");
RewriteRuleSubtreeStream stream_attribRelate = new RewriteRuleSubtreeStream(adaptor, "rule attribRelate");
try {
// /home/langera/dev/freud/src/grammar/Css.g:94:2: ( '[' IDENT ( attribRelate IDENT )? ']' -> ^( ATTRIB IDENT ( attribRelate ( IDENT )* )? ) )
// /home/langera/dev/freud/src/grammar/Css.g:94:4: '[' IDENT ( attribRelate IDENT )? ']'
{
char_literal46 = (Token) match(input, 40, FOLLOW_40_in_attrib540);
stream_40.add(char_literal46);
IDENT47 = (Token) match(input, IDENT, FOLLOW_IDENT_in_attrib542);
stream_IDENT.add(IDENT47);
// /home/langera/dev/freud/src/grammar/Css.g:94:14: ( attribRelate IDENT )?
int alt21 = 2;
int LA21_0 = input.LA(1);
if (((LA21_0 >= 42 && LA21_0 <= 44))) {
alt21 = 1;
}
switch(alt21) {
case 1:
// /home/langera/dev/freud/src/grammar/Css.g:94:15: attribRelate IDENT
{
pushFollow(FOLLOW_attribRelate_in_attrib545);
attribRelate48 = attribRelate();
state._fsp--;
stream_attribRelate.add(attribRelate48.getTree());
IDENT49 = (Token) match(input, IDENT, FOLLOW_IDENT_in_attrib547);
stream_IDENT.add(IDENT49);
}
break;
}
char_literal50 = (Token) match(input, 41, FOLLOW_41_in_attrib551);
stream_41.add(char_literal50);
// AST REWRITE
// elements: attribRelate, IDENT, IDENT
// 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();
// 94:40: -> ^( ATTRIB IDENT ( attribRelate ( IDENT )* )? )
{
// /home/langera/dev/freud/src/grammar/Css.g:94:43: ^( ATTRIB IDENT ( attribRelate ( IDENT )* )? )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ATTRIB, "ATTRIB"), root_1);
adaptor.addChild(root_1, stream_IDENT.nextNode());
// /home/langera/dev/freud/src/grammar/Css.g:94:59: ( attribRelate ( IDENT )* )?
if (stream_attribRelate.hasNext() || stream_IDENT.hasNext()) {
adaptor.addChild(root_1, stream_attribRelate.nextTree());
// /home/langera/dev/freud/src/grammar/Css.g:94:73: ( IDENT )*
while (stream_IDENT.hasNext()) {
adaptor.addChild(root_1, stream_IDENT.nextNode());
}
stream_IDENT.reset();
}
stream_attribRelate.reset();
stream_IDENT.reset();
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.CommonTree in project freud by LMAX-Exchange.
the class CssParser method pseudo.
// $ANTLR start "pseudo"
// /home/langera/dev/freud/src/grammar/Css.g:88:1: pseudo : ( ( ':' | '::' ) IDENT -> ^( PSEUDO IDENT ) | ( ':' | '::' ) function -> ^( PSEUDO function ) );
public final CssParser.pseudo_return pseudo() throws RecognitionException {
CssParser.pseudo_return retval = new CssParser.pseudo_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token char_literal40 = null;
Token string_literal41 = null;
Token IDENT42 = null;
Token char_literal43 = null;
Token string_literal44 = null;
CssParser.function_return function45 = null;
CommonTree char_literal40_tree = null;
CommonTree string_literal41_tree = null;
CommonTree IDENT42_tree = null;
CommonTree char_literal43_tree = null;
CommonTree string_literal44_tree = null;
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
RewriteRuleTokenStream stream_39 = new RewriteRuleTokenStream(adaptor, "token 39");
RewriteRuleTokenStream stream_38 = new RewriteRuleTokenStream(adaptor, "token 38");
RewriteRuleSubtreeStream stream_function = new RewriteRuleSubtreeStream(adaptor, "rule function");
try {
// /home/langera/dev/freud/src/grammar/Css.g:89:2: ( ( ':' | '::' ) IDENT -> ^( PSEUDO IDENT ) | ( ':' | '::' ) function -> ^( PSEUDO function ) )
int alt20 = 2;
alt20 = dfa20.predict(input);
switch(alt20) {
case 1:
// /home/langera/dev/freud/src/grammar/Css.g:89:4: ( ':' | '::' ) IDENT
{
// /home/langera/dev/freud/src/grammar/Css.g:89:4: ( ':' | '::' )
int alt18 = 2;
int LA18_0 = input.LA(1);
if ((LA18_0 == 38)) {
alt18 = 1;
} else if ((LA18_0 == 39)) {
alt18 = 2;
} else {
NoViableAltException nvae = new NoViableAltException("", 18, 0, input);
throw nvae;
}
switch(alt18) {
case 1:
// /home/langera/dev/freud/src/grammar/Css.g:89:5: ':'
{
char_literal40 = (Token) match(input, 38, FOLLOW_38_in_pseudo493);
stream_38.add(char_literal40);
}
break;
case 2:
// /home/langera/dev/freud/src/grammar/Css.g:89:9: '::'
{
string_literal41 = (Token) match(input, 39, FOLLOW_39_in_pseudo495);
stream_39.add(string_literal41);
}
break;
}
IDENT42 = (Token) match(input, IDENT, FOLLOW_IDENT_in_pseudo498);
stream_IDENT.add(IDENT42);
// AST REWRITE
// elements: IDENT
// 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();
// 89:21: -> ^( PSEUDO IDENT )
{
// /home/langera/dev/freud/src/grammar/Css.g:89:24: ^( PSEUDO IDENT )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(PSEUDO, "PSEUDO"), root_1);
adaptor.addChild(root_1, stream_IDENT.nextNode());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
case 2:
// /home/langera/dev/freud/src/grammar/Css.g:90:4: ( ':' | '::' ) function
{
// /home/langera/dev/freud/src/grammar/Css.g:90:4: ( ':' | '::' )
int alt19 = 2;
int LA19_0 = input.LA(1);
if ((LA19_0 == 38)) {
alt19 = 1;
} else if ((LA19_0 == 39)) {
alt19 = 2;
} else {
NoViableAltException nvae = new NoViableAltException("", 19, 0, input);
throw nvae;
}
switch(alt19) {
case 1:
// /home/langera/dev/freud/src/grammar/Css.g:90:5: ':'
{
char_literal43 = (Token) match(input, 38, FOLLOW_38_in_pseudo514);
stream_38.add(char_literal43);
}
break;
case 2:
// /home/langera/dev/freud/src/grammar/Css.g:90:9: '::'
{
string_literal44 = (Token) match(input, 39, FOLLOW_39_in_pseudo516);
stream_39.add(string_literal44);
}
break;
}
pushFollow(FOLLOW_function_in_pseudo519);
function45 = function();
state._fsp--;
stream_function.add(function45.getTree());
// AST REWRITE
// elements: function
// 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();
// 90:24: -> ^( PSEUDO function )
{
// /home/langera/dev/freud/src/grammar/Css.g:90:27: ^( PSEUDO function )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(PSEUDO, "PSEUDO"), root_1);
adaptor.addChild(root_1, stream_function.nextTree());
adaptor.addChild(root_0, root_1);
}
}
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;
}
Aggregations