use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method enumClassScopeDeclarations.
// $ANTLR start "enumClassScopeDeclarations"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:503:1: enumClassScopeDeclarations : SEMI ( classScopeDeclarations )* -> ^( CLASS_TOP_LEVEL_SCOPE[$SEMI, \"CLASS_TOP_LEVEL_SCOPE\"] ( classScopeDeclarations )* ) ;
public final JavaParser.enumClassScopeDeclarations_return enumClassScopeDeclarations() throws RecognitionException {
JavaParser.enumClassScopeDeclarations_return retval = new JavaParser.enumClassScopeDeclarations_return();
retval.start = input.LT(1);
int enumClassScopeDeclarations_StartIndex = input.index();
CommonTree root_0 = null;
Token SEMI57 = null;
JavaParser.classScopeDeclarations_return classScopeDeclarations58 = null;
CommonTree SEMI57_tree = null;
RewriteRuleTokenStream stream_SEMI = new RewriteRuleTokenStream(adaptor, "token SEMI");
RewriteRuleSubtreeStream stream_classScopeDeclarations = new RewriteRuleSubtreeStream(adaptor, "rule classScopeDeclarations");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 18)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:504:5: ( SEMI ( classScopeDeclarations )* -> ^( CLASS_TOP_LEVEL_SCOPE[$SEMI, \"CLASS_TOP_LEVEL_SCOPE\"] ( classScopeDeclarations )* ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:504:9: SEMI ( classScopeDeclarations )*
{
SEMI57 = (Token) match(input, SEMI, FOLLOW_SEMI_in_enumClassScopeDeclarations5316);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SEMI.add(SEMI57);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:504:14: ( classScopeDeclarations )*
loop19: do {
int alt19 = 2;
int LA19_0 = input.LA(1);
if ((LA19_0 == AT || LA19_0 == LCURLY || LA19_0 == LESS_THAN || LA19_0 == SEMI || LA19_0 == ABSTRACT || LA19_0 == BOOLEAN || LA19_0 == BYTE || (LA19_0 >= CHAR && LA19_0 <= CLASS) || LA19_0 == DOUBLE || LA19_0 == ENUM || LA19_0 == FINAL || LA19_0 == FLOAT || LA19_0 == INTERFACE || (LA19_0 >= INT && LA19_0 <= NATIVE) || (LA19_0 >= PRIVATE && LA19_0 <= PUBLIC) || (LA19_0 >= SHORT && LA19_0 <= STRICTFP) || LA19_0 == SYNCHRONIZED || LA19_0 == TRANSIENT || (LA19_0 >= VOID && LA19_0 <= VOLATILE) || LA19_0 == IDENT)) {
alt19 = 1;
}
switch(alt19) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: classScopeDeclarations
{
pushFollow(FOLLOW_classScopeDeclarations_in_enumClassScopeDeclarations5318);
classScopeDeclarations58 = classScopeDeclarations();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_classScopeDeclarations.add(classScopeDeclarations58.getTree());
}
}
break;
default:
break loop19;
}
} 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();
// 505:9: -> ^( CLASS_TOP_LEVEL_SCOPE[$SEMI, \"CLASS_TOP_LEVEL_SCOPE\"] ( classScopeDeclarations )* )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:505:13: ^( CLASS_TOP_LEVEL_SCOPE[$SEMI, \"CLASS_TOP_LEVEL_SCOPE\"] ( classScopeDeclarations )* )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(CLASS_TOP_LEVEL_SCOPE, SEMI57, "CLASS_TOP_LEVEL_SCOPE"), root_1);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:505:69: ( classScopeDeclarations )*
while (stream_classScopeDeclarations.hasNext()) {
adaptor.addChild(root_1, stream_classScopeDeclarations.nextTree());
}
stream_classScopeDeclarations.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, 18, enumClassScopeDeclarations_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method expression.
// $ANTLR start "expression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:929:1: expression : assignmentExpression -> ^( EXPR assignmentExpression ) ;
public final JavaParser.expression_return expression() throws RecognitionException {
JavaParser.expression_return retval = new JavaParser.expression_return();
retval.start = input.LT(1);
int expression_StartIndex = input.index();
CommonTree root_0 = null;
JavaParser.assignmentExpression_return assignmentExpression365 = null;
RewriteRuleSubtreeStream stream_assignmentExpression = new RewriteRuleSubtreeStream(adaptor, "rule assignmentExpression");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 88)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:930:5: ( assignmentExpression -> ^( EXPR assignmentExpression ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:930:9: assignmentExpression
{
pushFollow(FOLLOW_assignmentExpression_in_expression10216);
assignmentExpression365 = assignmentExpression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_assignmentExpression.add(assignmentExpression365.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();
// 931:9: -> ^( EXPR assignmentExpression )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:931:13: ^( EXPR assignmentExpression )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(EXPR, "EXPR"), root_1);
adaptor.addChild(root_1, stream_assignmentExpression.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, 88, expression_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method qualifiedTypeIdent.
// $ANTLR start "qualifiedTypeIdent"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:667:1: qualifiedTypeIdent : typeIdent ( DOT typeIdent )* -> ^( QUALIFIED_TYPE_IDENT ( typeIdent )+ ) ;
public final JavaParser.qualifiedTypeIdent_return qualifiedTypeIdent() throws RecognitionException {
JavaParser.qualifiedTypeIdent_return retval = new JavaParser.qualifiedTypeIdent_return();
retval.start = input.LT(1);
int qualifiedTypeIdent_StartIndex = input.index();
CommonTree root_0 = null;
Token DOT175 = null;
JavaParser.typeIdent_return typeIdent174 = null;
JavaParser.typeIdent_return typeIdent176 = null;
CommonTree DOT175_tree = null;
RewriteRuleTokenStream stream_DOT = new RewriteRuleTokenStream(adaptor, "token DOT");
RewriteRuleSubtreeStream stream_typeIdent = new RewriteRuleSubtreeStream(adaptor, "rule typeIdent");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 45)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:668:5: ( typeIdent ( DOT typeIdent )* -> ^( QUALIFIED_TYPE_IDENT ( typeIdent )+ ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:668:9: typeIdent ( DOT typeIdent )*
{
pushFollow(FOLLOW_typeIdent_in_qualifiedTypeIdent7001);
typeIdent174 = typeIdent();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_typeIdent.add(typeIdent174.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:668:19: ( DOT typeIdent )*
loop62: do {
int alt62 = 2;
int LA62_0 = input.LA(1);
if ((LA62_0 == DOT)) {
int LA62_2 = input.LA(2);
if ((synpred80_Java())) {
alt62 = 1;
}
}
switch(alt62) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:668:20: DOT typeIdent
{
DOT175 = (Token) match(input, DOT, FOLLOW_DOT_in_qualifiedTypeIdent7004);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_DOT.add(DOT175);
}
pushFollow(FOLLOW_typeIdent_in_qualifiedTypeIdent7006);
typeIdent176 = typeIdent();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_typeIdent.add(typeIdent176.getTree());
}
}
break;
default:
break loop62;
}
} 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();
// 669:9: -> ^( QUALIFIED_TYPE_IDENT ( typeIdent )+ )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:669:13: ^( QUALIFIED_TYPE_IDENT ( typeIdent )+ )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(QUALIFIED_TYPE_IDENT, "QUALIFIED_TYPE_IDENT"), root_1);
if (!(stream_typeIdent.hasNext())) {
throw new RewriteEarlyExitException();
}
while (stream_typeIdent.hasNext()) {
adaptor.addChild(root_1, stream_typeIdent.nextTree());
}
stream_typeIdent.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, 45, qualifiedTypeIdent_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method forUpdater.
// $ANTLR start "forUpdater"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:913:1: forUpdater : ( expressionList )? -> ^( FOR_UPDATE ( expressionList )? ) ;
public final JavaParser.forUpdater_return forUpdater() throws RecognitionException {
JavaParser.forUpdater_return retval = new JavaParser.forUpdater_return();
retval.start = input.LT(1);
int forUpdater_StartIndex = input.index();
CommonTree root_0 = null;
JavaParser.expressionList_return expressionList358 = null;
RewriteRuleSubtreeStream stream_expressionList = new RewriteRuleSubtreeStream(adaptor, "rule expressionList");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 85)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:914:5: ( ( expressionList )? -> ^( FOR_UPDATE ( expressionList )? ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:914:9: ( expressionList )?
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:914:9: ( expressionList )?
int alt106 = 2;
int LA106_0 = input.LA(1);
if ((LA106_0 == DEC || LA106_0 == INC || LA106_0 == LESS_THAN || LA106_0 == LOGICAL_NOT || (LA106_0 >= LPAREN && LA106_0 <= MINUS) || LA106_0 == NOT || LA106_0 == PLUS || LA106_0 == BOOLEAN || LA106_0 == BYTE || LA106_0 == CHAR || LA106_0 == DOUBLE || LA106_0 == FALSE || LA106_0 == FLOAT || (LA106_0 >= INT && LA106_0 <= LONG) || (LA106_0 >= NEW && LA106_0 <= NULL) || LA106_0 == SHORT || LA106_0 == SUPER || LA106_0 == THIS || LA106_0 == TRUE || LA106_0 == VOID || (LA106_0 >= IDENT && LA106_0 <= STRING_LITERAL))) {
alt106 = 1;
}
switch(alt106) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: expressionList
{
pushFollow(FOLLOW_expressionList_in_forUpdater10108);
expressionList358 = expressionList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_expressionList.add(expressionList358.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();
// 915:9: -> ^( FOR_UPDATE ( expressionList )? )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:915:13: ^( FOR_UPDATE ( expressionList )? )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(FOR_UPDATE, "FOR_UPDATE"), root_1);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:915:26: ( 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, 85, forUpdater_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method classExtendsClause.
// $ANTLR start "classExtendsClause"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:449:1: classExtendsClause : EXTENDS type -> ^( EXTENDS_CLAUSE[$EXTENDS, \"EXTENDS_CLAUSE\"] type ) ;
public final JavaParser.classExtendsClause_return classExtendsClause() throws RecognitionException {
JavaParser.classExtendsClause_return retval = new JavaParser.classExtendsClause_return();
retval.start = input.LT(1);
int classExtendsClause_StartIndex = input.index();
CommonTree root_0 = null;
Token EXTENDS27 = null;
JavaParser.type_return type28 = null;
CommonTree EXTENDS27_tree = null;
RewriteRuleTokenStream stream_EXTENDS = new RewriteRuleTokenStream(adaptor, "token EXTENDS");
RewriteRuleSubtreeStream stream_type = new RewriteRuleSubtreeStream(adaptor, "rule type");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 8)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:450:5: ( EXTENDS type -> ^( EXTENDS_CLAUSE[$EXTENDS, \"EXTENDS_CLAUSE\"] type ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:450:9: EXTENDS type
{
EXTENDS27 = (Token) match(input, EXTENDS, FOLLOW_EXTENDS_in_classExtendsClause4817);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_EXTENDS.add(EXTENDS27);
}
pushFollow(FOLLOW_type_in_classExtendsClause4819);
type28 = type();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_type.add(type28.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();
// 451:9: -> ^( EXTENDS_CLAUSE[$EXTENDS, \"EXTENDS_CLAUSE\"] type )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:451:13: ^( EXTENDS_CLAUSE[$EXTENDS, \"EXTENDS_CLAUSE\"] type )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(EXTENDS_CLAUSE, EXTENDS27, "EXTENDS_CLAUSE"), root_1);
adaptor.addChild(root_1, stream_type.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, 8, classExtendsClause_StartIndex);
}
}
return retval;
}
Aggregations