use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method interfaceBody.
// $ANTLR start "interfaceBody"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:530:1: interfaceBody : LCURLY ( interfaceScopeDeclarations )* RCURLY -> ^( INTERFACE_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( interfaceScopeDeclarations )* ) ;
public final JavaParser.interfaceBody_return interfaceBody() throws RecognitionException {
JavaParser.interfaceBody_return retval = new JavaParser.interfaceBody_return();
retval.start = input.LT(1);
int interfaceBody_StartIndex = input.index();
CommonTree root_0 = null;
Token LCURLY77 = null;
Token RCURLY79 = null;
JavaParser.interfaceScopeDeclarations_return interfaceScopeDeclarations78 = null;
CommonTree LCURLY77_tree = null;
CommonTree RCURLY79_tree = null;
RewriteRuleTokenStream stream_LCURLY = new RewriteRuleTokenStream(adaptor, "token LCURLY");
RewriteRuleTokenStream stream_RCURLY = new RewriteRuleTokenStream(adaptor, "token RCURLY");
RewriteRuleSubtreeStream stream_interfaceScopeDeclarations = new RewriteRuleSubtreeStream(adaptor, "rule interfaceScopeDeclarations");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 24)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:531:5: ( LCURLY ( interfaceScopeDeclarations )* RCURLY -> ^( INTERFACE_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( interfaceScopeDeclarations )* ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:531:9: LCURLY ( interfaceScopeDeclarations )* RCURLY
{
LCURLY77 = (Token) match(input, LCURLY, FOLLOW_LCURLY_in_interfaceBody5539);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LCURLY.add(LCURLY77);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:531:16: ( interfaceScopeDeclarations )*
loop27: do {
int alt27 = 2;
int LA27_0 = input.LA(1);
if ((LA27_0 == AT || LA27_0 == LESS_THAN || LA27_0 == SEMI || LA27_0 == ABSTRACT || LA27_0 == BOOLEAN || LA27_0 == BYTE || (LA27_0 >= CHAR && LA27_0 <= CLASS) || LA27_0 == DOUBLE || LA27_0 == ENUM || LA27_0 == FINAL || LA27_0 == FLOAT || LA27_0 == INTERFACE || (LA27_0 >= INT && LA27_0 <= NATIVE) || (LA27_0 >= PRIVATE && LA27_0 <= PUBLIC) || (LA27_0 >= SHORT && LA27_0 <= STRICTFP) || LA27_0 == SYNCHRONIZED || LA27_0 == TRANSIENT || (LA27_0 >= VOID && LA27_0 <= VOLATILE) || LA27_0 == IDENT)) {
alt27 = 1;
}
switch(alt27) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: interfaceScopeDeclarations
{
pushFollow(FOLLOW_interfaceScopeDeclarations_in_interfaceBody5541);
interfaceScopeDeclarations78 = interfaceScopeDeclarations();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_interfaceScopeDeclarations.add(interfaceScopeDeclarations78.getTree());
}
}
break;
default:
break loop27;
}
} while (true);
RCURLY79 = (Token) match(input, RCURLY, FOLLOW_RCURLY_in_interfaceBody5544);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_RCURLY.add(RCURLY79);
}
// 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();
// 532:9: -> ^( INTERFACE_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( interfaceScopeDeclarations )* )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:532:13: ^( INTERFACE_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( interfaceScopeDeclarations )* )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(INTERFACE_TOP_LEVEL_SCOPE, LCURLY77, "CLASS_TOP_LEVEL_SCOPE"), root_1);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:532:75: ( interfaceScopeDeclarations )*
while (stream_interfaceScopeDeclarations.hasNext()) {
adaptor.addChild(root_1, stream_interfaceScopeDeclarations.nextTree());
}
stream_interfaceScopeDeclarations.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, 24, interfaceBody_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method parenthesizedExpression.
// $ANTLR start "parenthesizedExpression"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:920:1: parenthesizedExpression : LPAREN expression RPAREN -> ^( PARENTESIZED_EXPR[$LPAREN, \"PARENTESIZED_EXPR\"] expression ) ;
public final JavaParser.parenthesizedExpression_return parenthesizedExpression() throws RecognitionException {
JavaParser.parenthesizedExpression_return retval = new JavaParser.parenthesizedExpression_return();
retval.start = input.LT(1);
int parenthesizedExpression_StartIndex = input.index();
CommonTree root_0 = null;
Token LPAREN359 = null;
Token RPAREN361 = null;
JavaParser.expression_return expression360 = null;
CommonTree LPAREN359_tree = null;
CommonTree RPAREN361_tree = null;
RewriteRuleTokenStream stream_RPAREN = new RewriteRuleTokenStream(adaptor, "token RPAREN");
RewriteRuleTokenStream stream_LPAREN = new RewriteRuleTokenStream(adaptor, "token LPAREN");
RewriteRuleSubtreeStream stream_expression = new RewriteRuleSubtreeStream(adaptor, "rule expression");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 86)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:921:5: ( LPAREN expression RPAREN -> ^( PARENTESIZED_EXPR[$LPAREN, \"PARENTESIZED_EXPR\"] expression ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:921:9: LPAREN expression RPAREN
{
LPAREN359 = (Token) match(input, LPAREN, FOLLOW_LPAREN_in_parenthesizedExpression10148);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LPAREN.add(LPAREN359);
}
pushFollow(FOLLOW_expression_in_parenthesizedExpression10150);
expression360 = expression();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_expression.add(expression360.getTree());
}
RPAREN361 = (Token) match(input, RPAREN, FOLLOW_RPAREN_in_parenthesizedExpression10152);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_RPAREN.add(RPAREN361);
}
// 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();
// 922:9: -> ^( PARENTESIZED_EXPR[$LPAREN, \"PARENTESIZED_EXPR\"] expression )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:922:13: ^( PARENTESIZED_EXPR[$LPAREN, \"PARENTESIZED_EXPR\"] expression )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(PARENTESIZED_EXPR, LPAREN359, "PARENTESIZED_EXPR"), root_1);
adaptor.addChild(root_1, stream_expression.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, 86, parenthesizedExpression_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method annotationTypeDeclaration.
// $ANTLR start "annotationTypeDeclaration"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:799:1: annotationTypeDeclaration[CommonTree modifiers] : AT INTERFACE IDENT annotationBody -> ^( AT IDENT annotationBody ) ;
public final JavaParser.annotationTypeDeclaration_return annotationTypeDeclaration(CommonTree modifiers) throws RecognitionException {
JavaParser.annotationTypeDeclaration_return retval = new JavaParser.annotationTypeDeclaration_return();
retval.start = input.LT(1);
int annotationTypeDeclaration_StartIndex = input.index();
CommonTree root_0 = null;
Token AT246 = null;
Token INTERFACE247 = null;
Token IDENT248 = null;
JavaParser.annotationBody_return annotationBody249 = null;
CommonTree AT246_tree = null;
CommonTree INTERFACE247_tree = null;
CommonTree IDENT248_tree = null;
RewriteRuleTokenStream stream_AT = new RewriteRuleTokenStream(adaptor, "token AT");
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
RewriteRuleTokenStream stream_INTERFACE = new RewriteRuleTokenStream(adaptor, "token INTERFACE");
RewriteRuleSubtreeStream stream_annotationBody = new RewriteRuleSubtreeStream(adaptor, "rule annotationBody");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 68)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:800:5: ( AT INTERFACE IDENT annotationBody -> ^( AT IDENT annotationBody ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:800:9: AT INTERFACE IDENT annotationBody
{
AT246 = (Token) match(input, AT, FOLLOW_AT_in_annotationTypeDeclaration8168);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_AT.add(AT246);
}
INTERFACE247 = (Token) match(input, INTERFACE, FOLLOW_INTERFACE_in_annotationTypeDeclaration8170);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_INTERFACE.add(INTERFACE247);
}
IDENT248 = (Token) match(input, IDENT, FOLLOW_IDENT_in_annotationTypeDeclaration8172);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT248);
}
pushFollow(FOLLOW_annotationBody_in_annotationTypeDeclaration8174);
annotationBody249 = annotationBody();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_annotationBody.add(annotationBody249.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();
// 801:9: -> ^( AT IDENT annotationBody )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:801:12: ^( AT IDENT annotationBody )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot(stream_AT.nextNode(), root_1);
adaptor.addChild(root_1, modifiers);
adaptor.addChild(root_1, stream_IDENT.nextNode());
adaptor.addChild(root_1, stream_annotationBody.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, 68, annotationTypeDeclaration_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method javaSource.
// $ANTLR start "javaSource"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:410:1: javaSource : compilationUnit -> ^( JAVA_SOURCE compilationUnit ) ;
public final JavaParser.javaSource_return javaSource() throws RecognitionException {
JavaParser.javaSource_return retval = new JavaParser.javaSource_return();
retval.start = input.LT(1);
int javaSource_StartIndex = input.index();
CommonTree root_0 = null;
JavaParser.compilationUnit_return compilationUnit1 = null;
RewriteRuleSubtreeStream stream_compilationUnit = new RewriteRuleSubtreeStream(adaptor, "rule compilationUnit");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 1)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:411:5: ( compilationUnit -> ^( JAVA_SOURCE compilationUnit ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:411:9: compilationUnit
{
pushFollow(FOLLOW_compilationUnit_in_javaSource4490);
compilationUnit1 = compilationUnit();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_compilationUnit.add(compilationUnit1.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();
// 412:9: -> ^( JAVA_SOURCE compilationUnit )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:412:13: ^( JAVA_SOURCE compilationUnit )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(JAVA_SOURCE, "JAVA_SOURCE"), root_1);
adaptor.addChild(root_1, stream_compilationUnit.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, 1, javaSource_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.RewriteRuleSubtreeStream in project freud by LMAX-Exchange.
the class JavaParser method objectType.
// $ANTLR start "objectType"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:657:1: objectType : qualifiedTypeIdent ( arrayDeclaratorList )? -> ^( TYPE qualifiedTypeIdent ( arrayDeclaratorList )? ) ;
public final JavaParser.objectType_return objectType() throws RecognitionException {
JavaParser.objectType_return retval = new JavaParser.objectType_return();
retval.start = input.LT(1);
int objectType_StartIndex = input.index();
CommonTree root_0 = null;
JavaParser.qualifiedTypeIdent_return qualifiedTypeIdent170 = null;
JavaParser.arrayDeclaratorList_return arrayDeclaratorList171 = null;
RewriteRuleSubtreeStream stream_arrayDeclaratorList = new RewriteRuleSubtreeStream(adaptor, "rule arrayDeclaratorList");
RewriteRuleSubtreeStream stream_qualifiedTypeIdent = new RewriteRuleSubtreeStream(adaptor, "rule qualifiedTypeIdent");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 43)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:658:5: ( qualifiedTypeIdent ( arrayDeclaratorList )? -> ^( TYPE qualifiedTypeIdent ( arrayDeclaratorList )? ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:658:9: qualifiedTypeIdent ( arrayDeclaratorList )?
{
pushFollow(FOLLOW_qualifiedTypeIdent_in_objectType6917);
qualifiedTypeIdent170 = qualifiedTypeIdent();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_qualifiedTypeIdent.add(qualifiedTypeIdent170.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:658:28: ( arrayDeclaratorList )?
int alt60 = 2;
int LA60_0 = input.LA(1);
if ((LA60_0 == LBRACK)) {
int LA60_1 = input.LA(2);
if ((synpred78_Java())) {
alt60 = 1;
}
}
switch(alt60) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: arrayDeclaratorList
{
pushFollow(FOLLOW_arrayDeclaratorList_in_objectType6919);
arrayDeclaratorList171 = arrayDeclaratorList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arrayDeclaratorList.add(arrayDeclaratorList171.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();
// 659:9: -> ^( TYPE qualifiedTypeIdent ( arrayDeclaratorList )? )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:659:13: ^( TYPE qualifiedTypeIdent ( arrayDeclaratorList )? )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(TYPE, "TYPE"), root_1);
adaptor.addChild(root_1, stream_qualifiedTypeIdent.nextTree());
// /home/langera/dev/freud/trunk/src/grammar/Java.g:659:39: ( arrayDeclaratorList )?
if (stream_arrayDeclaratorList.hasNext()) {
adaptor.addChild(root_1, stream_arrayDeclaratorList.nextTree());
}
stream_arrayDeclaratorList.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, 43, objectType_StartIndex);
}
}
return retval;
}
Aggregations