use of org.antlr.runtime.tree.CommonTree in project freud by LMAX-Exchange.
the class JavaParser method annotationScopeDeclarations.
// $ANTLR start "annotationScopeDeclarations"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:809:1: annotationScopeDeclarations : ( modifierList type ( IDENT LPAREN RPAREN ( annotationDefaultValue )? SEMI -> ^( ANNOTATION_METHOD_DECL modifierList type IDENT ( annotationDefaultValue )? ) | classFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList ) ) | typeDeclaration );
public final JavaParser.annotationScopeDeclarations_return annotationScopeDeclarations() throws RecognitionException {
JavaParser.annotationScopeDeclarations_return retval = new JavaParser.annotationScopeDeclarations_return();
retval.start = input.LT(1);
int annotationScopeDeclarations_StartIndex = input.index();
CommonTree root_0 = null;
Token IDENT255 = null;
Token LPAREN256 = null;
Token RPAREN257 = null;
Token SEMI259 = null;
Token SEMI261 = null;
JavaParser.modifierList_return modifierList253 = null;
JavaParser.type_return type254 = null;
JavaParser.annotationDefaultValue_return annotationDefaultValue258 = null;
JavaParser.classFieldDeclaratorList_return classFieldDeclaratorList260 = null;
JavaParser.typeDeclaration_return typeDeclaration262 = null;
CommonTree IDENT255_tree = null;
CommonTree LPAREN256_tree = null;
CommonTree RPAREN257_tree = null;
CommonTree SEMI259_tree = null;
CommonTree SEMI261_tree = null;
RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor, "token IDENT");
RewriteRuleTokenStream stream_RPAREN = new RewriteRuleTokenStream(adaptor, "token RPAREN");
RewriteRuleTokenStream stream_SEMI = new RewriteRuleTokenStream(adaptor, "token SEMI");
RewriteRuleTokenStream stream_LPAREN = new RewriteRuleTokenStream(adaptor, "token LPAREN");
RewriteRuleSubtreeStream stream_modifierList = new RewriteRuleSubtreeStream(adaptor, "rule modifierList");
RewriteRuleSubtreeStream stream_annotationDefaultValue = new RewriteRuleSubtreeStream(adaptor, "rule annotationDefaultValue");
RewriteRuleSubtreeStream stream_type = new RewriteRuleSubtreeStream(adaptor, "rule type");
RewriteRuleSubtreeStream stream_classFieldDeclaratorList = new RewriteRuleSubtreeStream(adaptor, "rule classFieldDeclaratorList");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 70)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:810:5: ( modifierList type ( IDENT LPAREN RPAREN ( annotationDefaultValue )? SEMI -> ^( ANNOTATION_METHOD_DECL modifierList type IDENT ( annotationDefaultValue )? ) | classFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList ) ) | typeDeclaration )
int alt87 = 2;
alt87 = dfa87.predict(input);
switch(alt87) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:810:9: modifierList type ( IDENT LPAREN RPAREN ( annotationDefaultValue )? SEMI -> ^( ANNOTATION_METHOD_DECL modifierList type IDENT ( annotationDefaultValue )? ) | classFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList ) )
{
pushFollow(FOLLOW_modifierList_in_annotationScopeDeclarations8256);
modifierList253 = modifierList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_modifierList.add(modifierList253.getTree());
}
pushFollow(FOLLOW_type_in_annotationScopeDeclarations8258);
type254 = type();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_type.add(type254.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:811:9: ( IDENT LPAREN RPAREN ( annotationDefaultValue )? SEMI -> ^( ANNOTATION_METHOD_DECL modifierList type IDENT ( annotationDefaultValue )? ) | classFieldDeclaratorList SEMI -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList ) )
int alt86 = 2;
int LA86_0 = input.LA(1);
if ((LA86_0 == IDENT)) {
int LA86_1 = input.LA(2);
if ((LA86_1 == LPAREN)) {
alt86 = 1;
} else if ((LA86_1 == ASSIGN || LA86_1 == COMMA || LA86_1 == LBRACK || LA86_1 == SEMI)) {
alt86 = 2;
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 86, 1, input);
throw nvae;
}
} else {
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 86, 0, input);
throw nvae;
}
switch(alt86) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:811:13: IDENT LPAREN RPAREN ( annotationDefaultValue )? SEMI
{
IDENT255 = (Token) match(input, IDENT, FOLLOW_IDENT_in_annotationScopeDeclarations8272);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_IDENT.add(IDENT255);
}
LPAREN256 = (Token) match(input, LPAREN, FOLLOW_LPAREN_in_annotationScopeDeclarations8274);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LPAREN.add(LPAREN256);
}
RPAREN257 = (Token) match(input, RPAREN, FOLLOW_RPAREN_in_annotationScopeDeclarations8276);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_RPAREN.add(RPAREN257);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:811:33: ( annotationDefaultValue )?
int alt85 = 2;
int LA85_0 = input.LA(1);
if ((LA85_0 == DEFAULT)) {
alt85 = 1;
}
switch(alt85) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: annotationDefaultValue
{
pushFollow(FOLLOW_annotationDefaultValue_in_annotationScopeDeclarations8278);
annotationDefaultValue258 = annotationDefaultValue();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_annotationDefaultValue.add(annotationDefaultValue258.getTree());
}
}
break;
}
SEMI259 = (Token) match(input, SEMI, FOLLOW_SEMI_in_annotationScopeDeclarations8281);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SEMI.add(SEMI259);
}
// 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();
// 812:13: -> ^( ANNOTATION_METHOD_DECL modifierList type IDENT ( annotationDefaultValue )? )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:812:17: ^( ANNOTATION_METHOD_DECL modifierList type IDENT ( annotationDefaultValue )? )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ANNOTATION_METHOD_DECL, "ANNOTATION_METHOD_DECL"), root_1);
adaptor.addChild(root_1, stream_modifierList.nextTree());
adaptor.addChild(root_1, stream_type.nextTree());
adaptor.addChild(root_1, stream_IDENT.nextNode());
// /home/langera/dev/freud/trunk/src/grammar/Java.g:812:66: ( annotationDefaultValue )?
if (stream_annotationDefaultValue.hasNext()) {
adaptor.addChild(root_1, stream_annotationDefaultValue.nextTree());
}
stream_annotationDefaultValue.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:813:13: classFieldDeclaratorList SEMI
{
pushFollow(FOLLOW_classFieldDeclaratorList_in_annotationScopeDeclarations8323);
classFieldDeclaratorList260 = classFieldDeclaratorList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_classFieldDeclaratorList.add(classFieldDeclaratorList260.getTree());
}
SEMI261 = (Token) match(input, SEMI, FOLLOW_SEMI_in_annotationScopeDeclarations8325);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_SEMI.add(SEMI261);
}
// 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();
// 814:13: -> ^( VAR_DECLARATION modifierList type classFieldDeclaratorList )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:814:17: ^( VAR_DECLARATION modifierList type classFieldDeclaratorList )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(VAR_DECLARATION, "VAR_DECLARATION"), root_1);
adaptor.addChild(root_1, stream_modifierList.nextTree());
adaptor.addChild(root_1, stream_type.nextTree());
adaptor.addChild(root_1, stream_classFieldDeclaratorList.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
}
break;
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:816:9: typeDeclaration
{
root_0 = (CommonTree) adaptor.nil();
pushFollow(FOLLOW_typeDeclaration_in_annotationScopeDeclarations8370);
typeDeclaration262 = typeDeclaration();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, typeDeclaration262.getTree());
}
}
break;
}
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, 70, annotationScopeDeclarations_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.CommonTree in project freud by LMAX-Exchange.
the class JavaParser method typeDeclaration.
// $ANTLR start "typeDeclaration"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:435:1: typeDeclaration : modifierList ( classTypeDeclaration[$modifierList.tree] | interfaceTypeDeclaration[$modifierList.tree] | enumTypeDeclaration[$modifierList.tree] | annotationTypeDeclaration[$modifierList.tree] ) ;
public final JavaParser.typeDeclaration_return typeDeclaration() throws RecognitionException {
JavaParser.typeDeclaration_return retval = new JavaParser.typeDeclaration_return();
retval.start = input.LT(1);
int typeDeclaration_StartIndex = input.index();
CommonTree root_0 = null;
JavaParser.modifierList_return modifierList16 = null;
JavaParser.classTypeDeclaration_return classTypeDeclaration17 = null;
JavaParser.interfaceTypeDeclaration_return interfaceTypeDeclaration18 = null;
JavaParser.enumTypeDeclaration_return enumTypeDeclaration19 = null;
JavaParser.annotationTypeDeclaration_return annotationTypeDeclaration20 = null;
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 6)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:436:5: ( modifierList ( classTypeDeclaration[$modifierList.tree] | interfaceTypeDeclaration[$modifierList.tree] | enumTypeDeclaration[$modifierList.tree] | annotationTypeDeclaration[$modifierList.tree] ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:436:9: modifierList ( classTypeDeclaration[$modifierList.tree] | interfaceTypeDeclaration[$modifierList.tree] | enumTypeDeclaration[$modifierList.tree] | annotationTypeDeclaration[$modifierList.tree] )
{
root_0 = (CommonTree) adaptor.nil();
pushFollow(FOLLOW_modifierList_in_typeDeclaration4664);
modifierList16 = modifierList();
state._fsp--;
if (state.failed) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:437:9: ( classTypeDeclaration[$modifierList.tree] | interfaceTypeDeclaration[$modifierList.tree] | enumTypeDeclaration[$modifierList.tree] | annotationTypeDeclaration[$modifierList.tree] )
int alt7 = 4;
switch(input.LA(1)) {
case CLASS:
{
alt7 = 1;
}
break;
case INTERFACE:
{
alt7 = 2;
}
break;
case ENUM:
{
alt7 = 3;
}
break;
case AT:
{
alt7 = 4;
}
break;
default:
if (state.backtracking > 0) {
state.failed = true;
return retval;
}
NoViableAltException nvae = new NoViableAltException("", 7, 0, input);
throw nvae;
}
switch(alt7) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:437:13: classTypeDeclaration[$modifierList.tree]
{
pushFollow(FOLLOW_classTypeDeclaration_in_typeDeclaration4679);
classTypeDeclaration17 = classTypeDeclaration((modifierList16 != null ? ((CommonTree) modifierList16.tree) : null));
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, classTypeDeclaration17.getTree());
}
}
break;
case 2:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:438:13: interfaceTypeDeclaration[$modifierList.tree]
{
pushFollow(FOLLOW_interfaceTypeDeclaration_in_typeDeclaration4694);
interfaceTypeDeclaration18 = interfaceTypeDeclaration((modifierList16 != null ? ((CommonTree) modifierList16.tree) : null));
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, interfaceTypeDeclaration18.getTree());
}
}
break;
case 3:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:439:13: enumTypeDeclaration[$modifierList.tree]
{
pushFollow(FOLLOW_enumTypeDeclaration_in_typeDeclaration4709);
enumTypeDeclaration19 = enumTypeDeclaration((modifierList16 != null ? ((CommonTree) modifierList16.tree) : null));
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, enumTypeDeclaration19.getTree());
}
}
break;
case 4:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:440:13: annotationTypeDeclaration[$modifierList.tree]
{
pushFollow(FOLLOW_annotationTypeDeclaration_in_typeDeclaration4724);
annotationTypeDeclaration20 = annotationTypeDeclaration((modifierList16 != null ? ((CommonTree) modifierList16.tree) : null));
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
adaptor.addChild(root_0, annotationTypeDeclaration20.getTree());
}
}
break;
}
}
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, 6, typeDeclaration_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.CommonTree in project freud by LMAX-Exchange.
the class JavaParser method annotationList.
// $ANTLR start "annotationList"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:758:1: annotationList : ( annotation )* -> ^( ANNOTATION_LIST ( annotation )* ) ;
public final JavaParser.annotationList_return annotationList() throws RecognitionException {
JavaParser.annotationList_return retval = new JavaParser.annotationList_return();
retval.start = input.LT(1);
int annotationList_StartIndex = input.index();
CommonTree root_0 = null;
JavaParser.annotation_return annotation222 = null;
RewriteRuleSubtreeStream stream_annotation = new RewriteRuleSubtreeStream(adaptor, "rule annotation");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 60)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:759:5: ( ( annotation )* -> ^( ANNOTATION_LIST ( annotation )* ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:759:9: ( annotation )*
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:759:9: ( annotation )*
loop76: do {
int alt76 = 2;
int LA76_0 = input.LA(1);
if ((LA76_0 == AT)) {
int LA76_2 = input.LA(2);
if ((LA76_2 == IDENT)) {
int LA76_3 = input.LA(3);
if ((synpred103_Java())) {
alt76 = 1;
}
}
}
switch(alt76) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: annotation
{
pushFollow(FOLLOW_annotation_in_annotationList7834);
annotation222 = annotation();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_annotation.add(annotation222.getTree());
}
}
break;
default:
break loop76;
}
} 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();
// 760:9: -> ^( ANNOTATION_LIST ( annotation )* )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:760:13: ^( ANNOTATION_LIST ( annotation )* )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(ANNOTATION_LIST, "ANNOTATION_LIST"), root_1);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:760:31: ( annotation )*
while (stream_annotation.hasNext()) {
adaptor.addChild(root_1, stream_annotation.nextTree());
}
stream_annotation.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, 60, annotationList_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.CommonTree in project freud by LMAX-Exchange.
the class JavaParser method classBody.
// $ANTLR start "classBody"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:525:1: classBody : LCURLY ( classScopeDeclarations )* RCURLY -> ^( CLASS_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( classScopeDeclarations )* ) ;
public final JavaParser.classBody_return classBody() throws RecognitionException {
JavaParser.classBody_return retval = new JavaParser.classBody_return();
retval.start = input.LT(1);
int classBody_StartIndex = input.index();
CommonTree root_0 = null;
Token LCURLY74 = null;
Token RCURLY76 = null;
JavaParser.classScopeDeclarations_return classScopeDeclarations75 = null;
CommonTree LCURLY74_tree = null;
CommonTree RCURLY76_tree = null;
RewriteRuleTokenStream stream_LCURLY = new RewriteRuleTokenStream(adaptor, "token LCURLY");
RewriteRuleTokenStream stream_RCURLY = new RewriteRuleTokenStream(adaptor, "token RCURLY");
RewriteRuleSubtreeStream stream_classScopeDeclarations = new RewriteRuleSubtreeStream(adaptor, "rule classScopeDeclarations");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 23)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:526:5: ( LCURLY ( classScopeDeclarations )* RCURLY -> ^( CLASS_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( classScopeDeclarations )* ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:526:9: LCURLY ( classScopeDeclarations )* RCURLY
{
LCURLY74 = (Token) match(input, LCURLY, FOLLOW_LCURLY_in_classBody5496);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_LCURLY.add(LCURLY74);
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:526:16: ( classScopeDeclarations )*
loop26: do {
int alt26 = 2;
int LA26_0 = input.LA(1);
if ((LA26_0 == AT || LA26_0 == LCURLY || LA26_0 == LESS_THAN || LA26_0 == SEMI || LA26_0 == ABSTRACT || LA26_0 == BOOLEAN || LA26_0 == BYTE || (LA26_0 >= CHAR && LA26_0 <= CLASS) || LA26_0 == DOUBLE || LA26_0 == ENUM || LA26_0 == FINAL || LA26_0 == FLOAT || LA26_0 == INTERFACE || (LA26_0 >= INT && LA26_0 <= NATIVE) || (LA26_0 >= PRIVATE && LA26_0 <= PUBLIC) || (LA26_0 >= SHORT && LA26_0 <= STRICTFP) || LA26_0 == SYNCHRONIZED || LA26_0 == TRANSIENT || (LA26_0 >= VOID && LA26_0 <= VOLATILE) || LA26_0 == IDENT)) {
alt26 = 1;
}
switch(alt26) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: classScopeDeclarations
{
pushFollow(FOLLOW_classScopeDeclarations_in_classBody5498);
classScopeDeclarations75 = classScopeDeclarations();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_classScopeDeclarations.add(classScopeDeclarations75.getTree());
}
}
break;
default:
break loop26;
}
} while (true);
RCURLY76 = (Token) match(input, RCURLY, FOLLOW_RCURLY_in_classBody5501);
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_RCURLY.add(RCURLY76);
}
// 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();
// 527:9: -> ^( CLASS_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( classScopeDeclarations )* )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:527:13: ^( CLASS_TOP_LEVEL_SCOPE[$LCURLY, \"CLASS_TOP_LEVEL_SCOPE\"] ( classScopeDeclarations )* )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(CLASS_TOP_LEVEL_SCOPE, LCURLY74, "CLASS_TOP_LEVEL_SCOPE"), root_1);
// /home/langera/dev/freud/trunk/src/grammar/Java.g:527:71: ( 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, 23, classBody_StartIndex);
}
}
return retval;
}
use of org.antlr.runtime.tree.CommonTree in project freud by LMAX-Exchange.
the class JavaParser method objectTypeSimplified.
// $ANTLR start "objectTypeSimplified"
// /home/langera/dev/freud/trunk/src/grammar/Java.g:662:1: objectTypeSimplified : qualifiedTypeIdentSimplified ( arrayDeclaratorList )? -> ^( TYPE qualifiedTypeIdentSimplified ( arrayDeclaratorList )? ) ;
public final JavaParser.objectTypeSimplified_return objectTypeSimplified() throws RecognitionException {
JavaParser.objectTypeSimplified_return retval = new JavaParser.objectTypeSimplified_return();
retval.start = input.LT(1);
int objectTypeSimplified_StartIndex = input.index();
CommonTree root_0 = null;
JavaParser.qualifiedTypeIdentSimplified_return qualifiedTypeIdentSimplified172 = null;
JavaParser.arrayDeclaratorList_return arrayDeclaratorList173 = null;
RewriteRuleSubtreeStream stream_arrayDeclaratorList = new RewriteRuleSubtreeStream(adaptor, "rule arrayDeclaratorList");
RewriteRuleSubtreeStream stream_qualifiedTypeIdentSimplified = new RewriteRuleSubtreeStream(adaptor, "rule qualifiedTypeIdentSimplified");
try {
if (state.backtracking > 0 && alreadyParsedRule(input, 44)) {
return retval;
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:663:5: ( qualifiedTypeIdentSimplified ( arrayDeclaratorList )? -> ^( TYPE qualifiedTypeIdentSimplified ( arrayDeclaratorList )? ) )
// /home/langera/dev/freud/trunk/src/grammar/Java.g:663:9: qualifiedTypeIdentSimplified ( arrayDeclaratorList )?
{
pushFollow(FOLLOW_qualifiedTypeIdentSimplified_in_objectTypeSimplified6959);
qualifiedTypeIdentSimplified172 = qualifiedTypeIdentSimplified();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_qualifiedTypeIdentSimplified.add(qualifiedTypeIdentSimplified172.getTree());
}
// /home/langera/dev/freud/trunk/src/grammar/Java.g:663:38: ( arrayDeclaratorList )?
int alt61 = 2;
int LA61_0 = input.LA(1);
if ((LA61_0 == LBRACK)) {
alt61 = 1;
}
switch(alt61) {
case 1:
// /home/langera/dev/freud/trunk/src/grammar/Java.g:0:0: arrayDeclaratorList
{
pushFollow(FOLLOW_arrayDeclaratorList_in_objectTypeSimplified6961);
arrayDeclaratorList173 = arrayDeclaratorList();
state._fsp--;
if (state.failed) {
return retval;
}
if (state.backtracking == 0) {
stream_arrayDeclaratorList.add(arrayDeclaratorList173.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();
// 664:9: -> ^( TYPE qualifiedTypeIdentSimplified ( arrayDeclaratorList )? )
{
// /home/langera/dev/freud/trunk/src/grammar/Java.g:664:13: ^( TYPE qualifiedTypeIdentSimplified ( arrayDeclaratorList )? )
{
CommonTree root_1 = (CommonTree) adaptor.nil();
root_1 = (CommonTree) adaptor.becomeRoot((CommonTree) adaptor.create(TYPE, "TYPE"), root_1);
adaptor.addChild(root_1, stream_qualifiedTypeIdentSimplified.nextTree());
// /home/langera/dev/freud/trunk/src/grammar/Java.g:664:49: ( 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, 44, objectTypeSimplified_StartIndex);
}
}
return retval;
}
Aggregations