本文整理汇总了C#中Antlr.Runtime.Tree.RewriteRuleSubtreeStream.Add方法的典型用法代码示例。如果您正苦于以下问题:C# RewriteRuleSubtreeStream.Add方法的具体用法?C# RewriteRuleSubtreeStream.Add怎么用?C# RewriteRuleSubtreeStream.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Antlr.Runtime.Tree.RewriteRuleSubtreeStream
的用法示例。
在下文中一共展示了RewriteRuleSubtreeStream.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: lvalue
private AstParserRuleReturnScope<CommonTree, IToken> lvalue()
{
EnterRule_lvalue();
EnterRule("lvalue", 101);
TraceIn("lvalue", 101);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken char_literal958 = default(IToken);
IToken WS959 = default(IToken);
IToken WS961 = default(IToken);
IToken char_literal962 = default(IToken);
IToken WS963 = default(IToken);
IToken WS965 = default(IToken);
IToken char_literal966 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> lvalue_item960 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> lvalue_item964 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> lvalue_item967 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree char_literal958_tree = default(CommonTree);
CommonTree WS959_tree = default(CommonTree);
CommonTree WS961_tree = default(CommonTree);
CommonTree char_literal962_tree = default(CommonTree);
CommonTree WS963_tree = default(CommonTree);
CommonTree WS965_tree = default(CommonTree);
CommonTree char_literal966_tree = default(CommonTree);
RewriteRuleITokenStream stream_94=new RewriteRuleITokenStream(adaptor,"token 94");
RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS");
RewriteRuleITokenStream stream_93=new RewriteRuleITokenStream(adaptor,"token 93");
RewriteRuleITokenStream stream_100=new RewriteRuleITokenStream(adaptor,"token 100");
RewriteRuleSubtreeStream stream_lvalue_item=new RewriteRuleSubtreeStream(adaptor,"rule lvalue_item");
try { DebugEnterRule(GrammarFileName, "lvalue");
DebugLocation(759, 1);
try
{
// SugarCpp.g:760:2: ( '(' ( WS )* lvalue_item ( ( WS )* ',' ( WS )* lvalue_item )+ ( WS )* ')' -> ^( Match_Tuple ( lvalue_item )* ) | lvalue_item )
int alt624=2;
try { DebugEnterDecision(624, false);
int LA624_0 = input.LA(1);
if ((LA624_0==93))
{
alt624 = 1;
}
else if ((LA624_0==IDENT||LA624_0==86||LA624_0==91||LA624_0==95||(LA624_0>=97 && LA624_0<=98)||(LA624_0>=101 && LA624_0<=102)||LA624_0==131||LA624_0==161||LA624_0==186))
{
alt624 = 2;
}
else
{
if (state.backtracking>0) {state.failed=true; return retval;}
NoViableAltException nvae = new NoViableAltException("", 624, 0, input);
DebugRecognitionException(nvae);
throw nvae;
}
} finally { DebugExitDecision(624); }
switch (alt624)
{
case 1:
DebugEnterAlt(1);
// SugarCpp.g:760:4: '(' ( WS )* lvalue_item ( ( WS )* ',' ( WS )* lvalue_item )+ ( WS )* ')'
{
DebugLocation(760, 4);
char_literal958=(IToken)Match(input,93,Follow._93_in_lvalue9181); if (state.failed) return retval;
if (state.backtracking == 0) stream_93.Add(char_literal958);
DebugLocation(760, 8);
// SugarCpp.g:760:8: ( WS )*
try { DebugEnterSubRule(619);
while (true)
{
int alt619=2;
try { DebugEnterDecision(619, false);
int LA619_0 = input.LA(1);
if ((LA619_0==WS))
{
alt619 = 1;
}
} finally { DebugExitDecision(619); }
switch ( alt619 )
{
case 1:
DebugEnterAlt(1);
// SugarCpp.g:760:8: WS
{
DebugLocation(760, 8);
WS959=(IToken)Match(input,WS,Follow._WS_in_lvalue9183); if (state.failed) return retval;
if (state.backtracking == 0) stream_WS.Add(WS959);
}
break;
default:
goto loop619;
//.........这里部分代码省略.........
示例2: functionCall
// $ANTLR start "functionCall"
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:255:1: functionCall : x= ID '(' ( expression ( ',' expression )* )? ')' -> ^( FUNCTION[$x] ( expression )* ) ;
public functionCall_return functionCall() // throws RecognitionException [1]
{
var retval = new functionCall_return();
retval.Start = input.LT( 1 );
CommonTree root_0 = null;
IToken x = null;
IToken char_literal87 = null;
IToken char_literal89 = null;
IToken char_literal91 = null;
expression_return expression88 = default( expression_return );
expression_return expression90 = default( expression_return );
CommonTree x_tree = null;
CommonTree char_literal87_tree = null;
CommonTree char_literal89_tree = null;
CommonTree char_literal91_tree = null;
var stream_69 = new RewriteRuleTokenStream( adaptor, "token 69" );
var stream_94 = new RewriteRuleTokenStream( adaptor, "token 94" );
var stream_ID = new RewriteRuleTokenStream( adaptor, "token ID" );
var stream_70 = new RewriteRuleTokenStream( adaptor, "token 70" );
var stream_expression = new RewriteRuleSubtreeStream( adaptor, "rule expression" );
try
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:2: (x= ID '(' ( expression ( ',' expression )* )? ')' -> ^( FUNCTION[$x] ( expression )* ) )
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:4: x= ID '(' ( expression ( ',' expression )* )? ')'
{
x = (IToken)Match( input, ID, FOLLOW_ID_in_functionCall1352 );
stream_ID.Add( x );
char_literal87 = (IToken)Match( input, 69, FOLLOW_69_in_functionCall1354 );
stream_69.Add( char_literal87 );
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:13: ( expression ( ',' expression )* )?
int alt33 = 2;
int LA33_0 = input.LA( 1 );
if ( ( ( LA33_0 >= ID && LA33_0 <= FLOAT ) || LA33_0 == 69 || ( LA33_0 >= 71 && LA33_0 <= 72 ) || LA33_0 == 87 || LA33_0 == 91 || ( LA33_0 >= 95 && LA33_0 <= 96 ) ) )
alt33 = 1;
switch ( alt33 )
{
case 1:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:15: expression ( ',' expression )*
{
PushFollow( FOLLOW_expression_in_functionCall1358 );
expression88 = expression();
state.followingStackPointer--;
stream_expression.Add( expression88.Tree );
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:26: ( ',' expression )*
do
{
int alt32 = 2;
int LA32_0 = input.LA( 1 );
if ( ( LA32_0 == 94 ) )
alt32 = 1;
switch ( alt32 )
{
case 1:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:28: ',' expression
{
char_literal89 = (IToken)Match( input, 94, FOLLOW_94_in_functionCall1362 );
stream_94.Add( char_literal89 );
PushFollow( FOLLOW_expression_in_functionCall1364 );
expression90 = expression();
state.followingStackPointer--;
stream_expression.Add( expression90.Tree );
}
break;
default:
goto loop32;
}
} while ( true );
loop32:
; // Stops C# compiler whining that label 'loop32' has no statements
}
break;
}
char_literal91 = (IToken)Match( input, 70, FOLLOW_70_in_functionCall1372 );
stream_70.Add( char_literal91 );
// AST REWRITE
// elements: expression
// token labels:
// rule labels: retval
// token list labels:
//.........这里部分代码省略.........
示例3: classStatementBlock
// $ANTLR start "classStatementBlock"
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:85:1: classStatementBlock : '{' ( classLevelStatement )* '}' -> ^( STATEMENT_BLOCK ( classLevelStatement )* ) ;
public classStatementBlock_return classStatementBlock() // throws RecognitionException [1]
{
var retval = new classStatementBlock_return();
retval.Start = input.LT( 1 );
CommonTree root_0 = null;
IToken char_literal12 = null;
IToken char_literal14 = null;
classLevelStatement_return classLevelStatement13 = default( classLevelStatement_return );
CommonTree char_literal12_tree = null;
CommonTree char_literal14_tree = null;
var stream_60 = new RewriteRuleTokenStream( adaptor, "token 60" );
var stream_61 = new RewriteRuleTokenStream( adaptor, "token 61" );
var stream_classLevelStatement = new RewriteRuleSubtreeStream( adaptor, "rule classLevelStatement" );
try
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:2: ( '{' ( classLevelStatement )* '}' -> ^( STATEMENT_BLOCK ( classLevelStatement )* ) )
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:4: '{' ( classLevelStatement )* '}'
{
char_literal12 = (IToken)Match( input, 60, FOLLOW_60_in_classStatementBlock328 );
stream_60.Add( char_literal12 );
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:8: ( classLevelStatement )*
do
{
int alt4 = 2;
int LA4_0 = input.LA( 1 );
if ( ( LA4_0 == 62 || LA4_0 == 67 ) )
alt4 = 1;
switch ( alt4 )
{
case 1:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:8: classLevelStatement
{
PushFollow( FOLLOW_classLevelStatement_in_classStatementBlock330 );
classLevelStatement13 = classLevelStatement();
state.followingStackPointer--;
stream_classLevelStatement.Add( classLevelStatement13.Tree );
}
break;
default:
goto loop4;
}
} while ( true );
loop4:
; // Stops C# compiler whining that label 'loop4' has no statements
char_literal14 = (IToken)Match( input, 61, FOLLOW_61_in_classStatementBlock333 );
stream_61.Add( char_literal14 );
// AST REWRITE
// elements: classLevelStatement
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.Tree = root_0;
var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );
root_0 = (CommonTree)adaptor.GetNilNode();
// 86:33: -> ^( STATEMENT_BLOCK ( classLevelStatement )* )
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:36: ^( STATEMENT_BLOCK ( classLevelStatement )* )
{
var root_1 = (CommonTree)adaptor.GetNilNode();
root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( STATEMENT_BLOCK, "STATEMENT_BLOCK" ), root_1 );
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:55: ( classLevelStatement )*
while ( stream_classLevelStatement.HasNext() )
adaptor.AddChild( root_1, stream_classLevelStatement.NextTree() );
stream_classLevelStatement.Reset();
adaptor.AddChild( root_0, root_1 );
}
}
retval.Tree = root_0;
retval.Tree = root_0;
}
retval.Stop = input.LT( -1 );
retval.Tree = adaptor.RulePostProcessing( root_0 );
adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
}
catch ( RecognitionException re )
{
//.........这里部分代码省略.........
示例4: relationshipJoinDeclaration
// $ANTLR start "relationshipJoinDeclaration"
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:116:1: relationshipJoinDeclaration : name 'where' expression -> ^( JOIN ^( TARGET name ) ^( CRITERIA expression ) ) ;
public relationshipJoinDeclaration_return relationshipJoinDeclaration() // throws RecognitionException [1]
{
var retval = new relationshipJoinDeclaration_return();
retval.Start = input.LT( 1 );
CommonTree root_0 = null;
IToken string_literal31 = null;
name_return name30 = default( name_return );
expression_return expression32 = default( expression_return );
CommonTree string_literal31_tree = null;
var stream_59 = new RewriteRuleTokenStream( adaptor, "token 59" );
var stream_expression = new RewriteRuleSubtreeStream( adaptor, "rule expression" );
var stream_name = new RewriteRuleSubtreeStream( adaptor, "rule name" );
try
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:117:2: ( name 'where' expression -> ^( JOIN ^( TARGET name ) ^( CRITERIA expression ) ) )
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:117:4: name 'where' expression
{
PushFollow( FOLLOW_name_in_relationshipJoinDeclaration514 );
name30 = name();
state.followingStackPointer--;
stream_name.Add( name30.Tree );
string_literal31 = (IToken)Match( input, 59, FOLLOW_59_in_relationshipJoinDeclaration516 );
stream_59.Add( string_literal31 );
PushFollow( FOLLOW_expression_in_relationshipJoinDeclaration518 );
expression32 = expression();
state.followingStackPointer--;
stream_expression.Add( expression32.Tree );
// AST REWRITE
// elements: name, expression
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.Tree = root_0;
var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );
root_0 = (CommonTree)adaptor.GetNilNode();
// 117:28: -> ^( JOIN ^( TARGET name ) ^( CRITERIA expression ) )
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:117:31: ^( JOIN ^( TARGET name ) ^( CRITERIA expression ) )
{
var root_1 = (CommonTree)adaptor.GetNilNode();
root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( JOIN, "JOIN" ), root_1 );
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:117:39: ^( TARGET name )
{
var root_2 = (CommonTree)adaptor.GetNilNode();
root_2 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( TARGET, "TARGET" ), root_2 );
adaptor.AddChild( root_2, stream_name.NextTree() );
adaptor.AddChild( root_1, root_2 );
}
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:117:56: ^( CRITERIA expression )
{
var root_2 = (CommonTree)adaptor.GetNilNode();
root_2 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( CRITERIA, "CRITERIA" ), root_2 );
adaptor.AddChild( root_2, stream_expression.NextTree() );
adaptor.AddChild( root_1, root_2 );
}
adaptor.AddChild( root_0, root_1 );
}
}
retval.Tree = root_0;
retval.Tree = root_0;
}
retval.Stop = input.LT( -1 );
retval.Tree = adaptor.RulePostProcessing( root_0 );
adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
}
catch ( RecognitionException re )
{
ReportError( re );
Recover( input, re );
// Conversion of the second argument necessary, but harmless
retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
}
finally {}
return retval;
}
示例5: classDeclaration
// $ANTLR start "classDeclaration"
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:79:1: classDeclaration : 'class' name ( baseClassDeclaration )? classStatementBlock -> ^( CLASS name ( baseClassDeclaration )? classStatementBlock ) ;
public classDeclaration_return classDeclaration() // throws RecognitionException [1]
{
var retval = new classDeclaration_return();
retval.Start = input.LT( 1 );
CommonTree root_0 = null;
IToken string_literal4 = null;
name_return name5 = default( name_return );
baseClassDeclaration_return baseClassDeclaration6 = default( baseClassDeclaration_return );
classStatementBlock_return classStatementBlock7 = default( classStatementBlock_return );
CommonTree string_literal4_tree = null;
var stream_57 = new RewriteRuleTokenStream( adaptor, "token 57" );
var stream_classStatementBlock = new RewriteRuleSubtreeStream( adaptor, "rule classStatementBlock" );
var stream_name = new RewriteRuleSubtreeStream( adaptor, "rule name" );
var stream_baseClassDeclaration = new RewriteRuleSubtreeStream( adaptor, "rule baseClassDeclaration" );
try
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:2: ( 'class' name ( baseClassDeclaration )? classStatementBlock -> ^( CLASS name ( baseClassDeclaration )? classStatementBlock ) )
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:4: 'class' name ( baseClassDeclaration )? classStatementBlock
{
string_literal4 = (IToken)Match( input, 57, FOLLOW_57_in_classDeclaration262 );
stream_57.Add( string_literal4 );
PushFollow( FOLLOW_name_in_classDeclaration264 );
name5 = name();
state.followingStackPointer--;
stream_name.Add( name5.Tree );
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:17: ( baseClassDeclaration )?
int alt3 = 2;
int LA3_0 = input.LA( 1 );
if ( ( LA3_0 == 58 ) )
alt3 = 1;
switch ( alt3 )
{
case 1:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:17: baseClassDeclaration
{
PushFollow( FOLLOW_baseClassDeclaration_in_classDeclaration266 );
baseClassDeclaration6 = baseClassDeclaration();
state.followingStackPointer--;
stream_baseClassDeclaration.Add( baseClassDeclaration6.Tree );
}
break;
}
PushFollow( FOLLOW_classStatementBlock_in_classDeclaration269 );
classStatementBlock7 = classStatementBlock();
state.followingStackPointer--;
stream_classStatementBlock.Add( classStatementBlock7.Tree );
// AST REWRITE
// elements: name, classStatementBlock, baseClassDeclaration
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.Tree = root_0;
var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );
root_0 = (CommonTree)adaptor.GetNilNode();
// 80:59: -> ^( CLASS name ( baseClassDeclaration )? classStatementBlock )
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:62: ^( CLASS name ( baseClassDeclaration )? classStatementBlock )
{
var root_1 = (CommonTree)adaptor.GetNilNode();
root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( CLASS, "CLASS" ), root_1 );
adaptor.AddChild( root_1, stream_name.NextTree() );
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:76: ( baseClassDeclaration )?
if ( stream_baseClassDeclaration.HasNext() )
adaptor.AddChild( root_1, stream_baseClassDeclaration.NextTree() );
stream_baseClassDeclaration.Reset();
adaptor.AddChild( root_1, stream_classStatementBlock.NextTree() );
adaptor.AddChild( root_0, root_1 );
}
}
retval.Tree = root_0;
retval.Tree = root_0;
}
retval.Stop = input.LT( -1 );
retval.Tree = adaptor.RulePostProcessing( root_0 );
adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
}
//.........这里部分代码省略.........
示例6: or_expression
private AstParserRuleReturnScope<object, IToken> or_expression()
{
EnterRule_or_expression();
EnterRule("or_expression", 5);
TraceIn("or_expression", 5);
AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
retval.Start = (IToken)input.LT(1);
object root_0 = default(object);
IToken string_literal11 = default(IToken);
IToken string_literal12 = default(IToken);
AstParserRuleReturnScope<object, IToken> and_expression10 = default(AstParserRuleReturnScope<object, IToken>);
AstParserRuleReturnScope<object, IToken> and_expression13 = default(AstParserRuleReturnScope<object, IToken>);
object string_literal11_tree = default(object);
object string_literal12_tree = default(object);
RewriteRuleITokenStream stream_75=new RewriteRuleITokenStream(adaptor,"token 75");
RewriteRuleITokenStream stream_77=new RewriteRuleITokenStream(adaptor,"token 77");
RewriteRuleSubtreeStream stream_and_expression=new RewriteRuleSubtreeStream(adaptor,"rule and_expression");
try { DebugEnterRule(GrammarFileName, "or_expression");
DebugLocation(93, 1);
try
{
// Queries\\PomonaQuery.g:94:2: ( and_expression ( ( 'or' | '||' ) and_expression )* -> ^( OR_OP ( and_expression )+ ) )
DebugEnterAlt(1);
// Queries\\PomonaQuery.g:94:4: and_expression ( ( 'or' | '||' ) and_expression )*
{
DebugLocation(94, 4);
PushFollow(Follow._and_expression_in_or_expression588);
and_expression10=and_expression();
PopFollow();
stream_and_expression.Add(and_expression10.Tree);
DebugLocation(94, 19);
// Queries\\PomonaQuery.g:94:19: ( ( 'or' | '||' ) and_expression )*
try { DebugEnterSubRule(4);
while (true)
{
int alt4=2;
try { DebugEnterDecision(4, false);
int LA4_1 = input.LA(1);
if ((LA4_1==75||LA4_1==77))
{
alt4 = 1;
}
} finally { DebugExitDecision(4); }
switch ( alt4 )
{
case 1:
DebugEnterAlt(1);
// Queries\\PomonaQuery.g:94:21: ( 'or' | '||' ) and_expression
{
DebugLocation(94, 21);
// Queries\\PomonaQuery.g:94:21: ( 'or' | '||' )
int alt3=2;
try { DebugEnterSubRule(3);
try { DebugEnterDecision(3, false);
int LA3_1 = input.LA(1);
if ((LA3_1==75))
{
alt3 = 1;
}
else if ((LA3_1==77))
{
alt3 = 2;
}
else
{
NoViableAltException nvae = new NoViableAltException("", 3, 0, input, 1);
DebugRecognitionException(nvae);
throw nvae;
}
} finally { DebugExitDecision(3); }
switch (alt3)
{
case 1:
DebugEnterAlt(1);
// Queries\\PomonaQuery.g:94:22: 'or'
{
DebugLocation(94, 22);
string_literal11=(IToken)Match(input,75,Follow._75_in_or_expression593);
stream_75.Add(string_literal11);
}
break;
case 2:
DebugEnterAlt(2);
// Queries\\PomonaQuery.g:94:27: '||'
{
DebugLocation(94, 27);
string_literal12=(IToken)Match(input,77,Follow._77_in_or_expression595);
stream_77.Add(string_literal12);
//.........这里部分代码省略.........
示例7: propertyModifiers
// $ANTLR start "propertyModifiers"
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:100:1: propertyModifiers : ( exclusivePropertyModifier -> ^( MODIFIERS exclusivePropertyModifier ) | ( propertyModifier )+ -> ^( MODIFIERS ( propertyModifier )+ ) );
public propertyModifiers_return propertyModifiers() // throws RecognitionException [1]
{
var retval = new propertyModifiers_return();
retval.Start = input.LT( 1 );
CommonTree root_0 = null;
exclusivePropertyModifier_return exclusivePropertyModifier21 = default( exclusivePropertyModifier_return );
propertyModifier_return propertyModifier22 = default( propertyModifier_return );
var stream_propertyModifier = new RewriteRuleSubtreeStream( adaptor, "rule propertyModifier" );
var stream_exclusivePropertyModifier = new RewriteRuleSubtreeStream( adaptor, "rule exclusivePropertyModifier" );
try
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:101:2: ( exclusivePropertyModifier -> ^( MODIFIERS exclusivePropertyModifier ) | ( propertyModifier )+ -> ^( MODIFIERS ( propertyModifier )+ ) )
int alt8 = 2;
int LA8_0 = input.LA( 1 );
if ( ( LA8_0 == 64 ) )
alt8 = 1;
else if ( ( ( LA8_0 >= 65 && LA8_0 <= 66 ) ) )
alt8 = 2;
else
{
var nvae_d8s0 =
new NoViableAltException( "", 8, 0, input );
throw nvae_d8s0;
}
switch ( alt8 )
{
case 1:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:101:4: exclusivePropertyModifier
{
PushFollow( FOLLOW_exclusivePropertyModifier_in_propertyModifiers419 );
exclusivePropertyModifier21 = exclusivePropertyModifier();
state.followingStackPointer--;
stream_exclusivePropertyModifier.Add( exclusivePropertyModifier21.Tree );
// AST REWRITE
// elements: exclusivePropertyModifier
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.Tree = root_0;
var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );
root_0 = (CommonTree)adaptor.GetNilNode();
// 101:30: -> ^( MODIFIERS exclusivePropertyModifier )
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:101:33: ^( MODIFIERS exclusivePropertyModifier )
{
var root_1 = (CommonTree)adaptor.GetNilNode();
root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( MODIFIERS, "MODIFIERS" ), root_1 );
adaptor.AddChild( root_1, stream_exclusivePropertyModifier.NextTree() );
adaptor.AddChild( root_0, root_1 );
}
}
retval.Tree = root_0;
retval.Tree = root_0;
}
break;
case 2:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:102:4: ( propertyModifier )+
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:102:4: ( propertyModifier )+
int cnt7 = 0;
do
{
int alt7 = 2;
int LA7_0 = input.LA( 1 );
if ( ( ( LA7_0 >= 65 && LA7_0 <= 66 ) ) )
alt7 = 1;
switch ( alt7 )
{
case 1:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:102:4: propertyModifier
{
PushFollow( FOLLOW_propertyModifier_in_propertyModifiers434 );
propertyModifier22 = propertyModifier();
state.followingStackPointer--;
stream_propertyModifier.Add( propertyModifier22.Tree );
}
break;
//.........这里部分代码省略.........
示例8: type_name
private AstParserRuleReturnScope<CommonTree, IToken> type_name()
{
EnterRule_type_name();
EnterRule("type_name", 17);
TraceIn("type_name", 17);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken WS178 = default(IToken);
IToken string_literal179 = default(IToken);
IToken WS180 = default(IToken);
IToken char_literal182 = default(IToken);
IToken WS183 = default(IToken);
IToken char_literal184 = default(IToken);
IToken char_literal185 = default(IToken);
IToken WS186 = default(IToken);
IToken WS188 = default(IToken);
IToken char_literal189 = default(IToken);
IToken WS190 = default(IToken);
IToken string_literal191 = default(IToken);
IToken WS192 = default(IToken);
IToken char_literal194 = default(IToken);
IToken WS195 = default(IToken);
IToken char_literal196 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> type_single177 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> type_name181 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> type_list187 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> type_name193 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree WS178_tree = default(CommonTree);
CommonTree string_literal179_tree = default(CommonTree);
CommonTree WS180_tree = default(CommonTree);
CommonTree char_literal182_tree = default(CommonTree);
CommonTree WS183_tree = default(CommonTree);
CommonTree char_literal184_tree = default(CommonTree);
CommonTree char_literal185_tree = default(CommonTree);
CommonTree WS186_tree = default(CommonTree);
CommonTree WS188_tree = default(CommonTree);
CommonTree char_literal189_tree = default(CommonTree);
CommonTree WS190_tree = default(CommonTree);
CommonTree string_literal191_tree = default(CommonTree);
CommonTree WS192_tree = default(CommonTree);
CommonTree char_literal194_tree = default(CommonTree);
CommonTree WS195_tree = default(CommonTree);
CommonTree char_literal196_tree = default(CommonTree);
RewriteRuleITokenStream stream_94=new RewriteRuleITokenStream(adaptor,"token 94");
RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS");
RewriteRuleITokenStream stream_93=new RewriteRuleITokenStream(adaptor,"token 93");
RewriteRuleITokenStream stream_105=new RewriteRuleITokenStream(adaptor,"token 105");
RewriteRuleSubtreeStream stream_type_name=new RewriteRuleSubtreeStream(adaptor,"rule type_name");
RewriteRuleSubtreeStream stream_type_list=new RewriteRuleSubtreeStream(adaptor,"rule type_list");
RewriteRuleSubtreeStream stream_type_single=new RewriteRuleSubtreeStream(adaptor,"rule type_single");
try { DebugEnterRule(GrammarFileName, "type_name");
DebugLocation(300, 1);
try
{
// SugarCpp.g:301:2: ( type_single ( ( WS )* '->' ( WS )* ( type_name | '(' ( WS )* ')' ) -> ^( Type_Func ^( Type_List type_single ) ( type_name )? ) | -> type_single ) | '(' ( ( WS )* type_list )? ( WS )* ')' ( WS )* '->' ( WS )* ( type_name | '(' ( WS )* ')' ) -> ^( Type_Func ( type_list )? ( type_name )? ) )
int alt128=2;
try { DebugEnterDecision(128, false);
int LA128_0 = input.LA(1);
if ((LA128_0==IDENT||LA128_0==142||LA128_0==156||(LA128_0>=166 && LA128_0<=167)||LA128_0==170))
{
alt128 = 1;
}
else if ((LA128_0==93))
{
alt128 = 2;
}
else
{
if (state.backtracking>0) {state.failed=true; return retval;}
NoViableAltException nvae = new NoViableAltException("", 128, 0, input);
DebugRecognitionException(nvae);
throw nvae;
}
} finally { DebugExitDecision(128); }
switch (alt128)
{
case 1:
DebugEnterAlt(1);
// SugarCpp.g:301:4: type_single ( ( WS )* '->' ( WS )* ( type_name | '(' ( WS )* ')' ) -> ^( Type_Func ^( Type_List type_single ) ( type_name )? ) | -> type_single )
{
DebugLocation(301, 4);
PushFollow(Follow._type_single_in_type_name1777);
type_single177=type_single();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_type_single.Add(type_single177.Tree);
DebugLocation(301, 16);
// SugarCpp.g:301:16: ( ( WS )* '->' ( WS )* ( type_name | '(' ( WS )* ')' ) -> ^( Type_Func ^( Type_List type_single ) ( type_name )? ) | -> type_single )
int alt120=2;
try { DebugEnterSubRule(120);
try { DebugEnterDecision(120, false);
try
{
alt120 = dfa120.Predict(input);
}
//.........这里部分代码省略.........
示例9: type_single
private AstParserRuleReturnScope<CommonTree, IToken> type_single()
{
EnterRule_type_single();
EnterRule("type_single", 18);
TraceIn("type_single", 18);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken WS198 = default(IToken);
IToken char_literal199 = default(IToken);
IToken WS200 = default(IToken);
IToken char_literal201 = default(IToken);
IToken WS202 = default(IToken);
IToken WS204 = default(IToken);
IToken char_literal205 = default(IToken);
IToken WS206 = default(IToken);
IToken WS208 = default(IToken);
IToken char_literal209 = default(IToken);
IToken WS210 = default(IToken);
IToken char_literal211 = default(IToken);
IToken WS212 = default(IToken);
IToken char_literal213 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> type_star197 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> expr203 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> expr207 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree WS198_tree = default(CommonTree);
CommonTree char_literal199_tree = default(CommonTree);
CommonTree WS200_tree = default(CommonTree);
CommonTree char_literal201_tree = default(CommonTree);
CommonTree WS202_tree = default(CommonTree);
CommonTree WS204_tree = default(CommonTree);
CommonTree char_literal205_tree = default(CommonTree);
CommonTree WS206_tree = default(CommonTree);
CommonTree WS208_tree = default(CommonTree);
CommonTree char_literal209_tree = default(CommonTree);
CommonTree WS210_tree = default(CommonTree);
CommonTree char_literal211_tree = default(CommonTree);
CommonTree WS212_tree = default(CommonTree);
CommonTree char_literal213_tree = default(CommonTree);
RewriteRuleITokenStream stream_132=new RewriteRuleITokenStream(adaptor,"token 132");
RewriteRuleITokenStream stream_133=new RewriteRuleITokenStream(adaptor,"token 133");
RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS");
RewriteRuleITokenStream stream_91=new RewriteRuleITokenStream(adaptor,"token 91");
RewriteRuleITokenStream stream_100=new RewriteRuleITokenStream(adaptor,"token 100");
RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
RewriteRuleSubtreeStream stream_type_star=new RewriteRuleSubtreeStream(adaptor,"rule type_star");
try { DebugEnterRule(GrammarFileName, "type_single");
DebugLocation(307, 1);
try
{
// SugarCpp.g:308:2: ( type_star ( ( WS )* '&' -> ^( Type_Ref type_star ) | ( WS )* '[' ( ( WS )* expr ( ( WS )* ',' ( WS )* expr )* ( WS )* ']' -> ^( Type_Array type_star ( expr )+ ) | ( ( WS )* ',' )* ( WS )* ']' -> ^( Type_Array type_star ( expr )+ ) ) | -> type_star ) )
DebugEnterAlt(1);
// SugarCpp.g:308:4: type_star ( ( WS )* '&' -> ^( Type_Ref type_star ) | ( WS )* '[' ( ( WS )* expr ( ( WS )* ',' ( WS )* expr )* ( WS )* ']' -> ^( Type_Array type_star ( expr )+ ) | ( ( WS )* ',' )* ( WS )* ']' -> ^( Type_Array type_star ( expr )+ ) ) | -> type_star )
{
DebugLocation(308, 4);
PushFollow(Follow._type_star_in_type_single1897);
type_star197=type_star();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_type_star.Add(type_star197.Tree);
DebugLocation(308, 14);
// SugarCpp.g:308:14: ( ( WS )* '&' -> ^( Type_Ref type_star ) | ( WS )* '[' ( ( WS )* expr ( ( WS )* ',' ( WS )* expr )* ( WS )* ']' -> ^( Type_Array type_star ( expr )+ ) | ( ( WS )* ',' )* ( WS )* ']' -> ^( Type_Array type_star ( expr )+ ) ) | -> type_star )
int alt140=3;
try { DebugEnterSubRule(140);
try { DebugEnterDecision(140, false);
try
{
alt140 = dfa140.Predict(input);
}
catch (NoViableAltException nvae)
{
DebugRecognitionException(nvae);
throw;
}
} finally { DebugExitDecision(140); }
switch (alt140)
{
case 1:
DebugEnterAlt(1);
// SugarCpp.g:308:16: ( WS )* '&'
{
DebugLocation(308, 16);
// SugarCpp.g:308:16: ( WS )*
try { DebugEnterSubRule(129);
while (true)
{
int alt129=2;
try { DebugEnterDecision(129, false);
int LA129_0 = input.LA(1);
if ((LA129_0==WS))
{
alt129 = 1;
}
} finally { DebugExitDecision(129); }
//.........这里部分代码省略.........
示例10: class_def
//.........这里部分代码省略.........
RewriteRuleSubtreeStream stream_global_block=new RewriteRuleSubtreeStream(adaptor,"rule global_block");
RewriteRuleSubtreeStream stream_generic_parameter=new RewriteRuleSubtreeStream(adaptor,"rule generic_parameter");
try { DebugEnterRule(GrammarFileName, "class_def");
DebugLocation(290, 1);
try
{
// SugarCpp.g:291:2: ( ( attribute )? ( 'public' ( WS )* )? ( 'class' ( WS )* ident ( generic_parameter )? ( ( WS )* ':' ( WS )* ident ( ( WS )* ',' ( WS )* ident )* )? ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT )? -> ^( Class ( 'public' )? ( attribute )? ident ( generic_parameter )? ( class_args )? ( ^( Ident_List ( ident )* ) )? ( global_block )? ) | 'case' ( WS )* 'class' ( WS )* ident ( generic_parameter )? ( ( WS )* class_args )? ( ( WS )* ':' ( WS )* ident ( ( WS )* ',' ( WS )* ident )* )? ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT )? -> ^( Class 'case' ( 'public' )? ( attribute )? ident ( generic_parameter )? ( class_args )? ( ^( Ident_List ( ident )* ) )? ( global_block )? ) ) )
DebugEnterAlt(1);
// SugarCpp.g:291:5: ( attribute )? ( 'public' ( WS )* )? ( 'class' ( WS )* ident ( generic_parameter )? ( ( WS )* ':' ( WS )* ident ( ( WS )* ',' ( WS )* ident )* )? ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT )? -> ^( Class ( 'public' )? ( attribute )? ident ( generic_parameter )? ( class_args )? ( ^( Ident_List ( ident )* ) )? ( global_block )? ) | 'case' ( WS )* 'class' ( WS )* ident ( generic_parameter )? ( ( WS )* class_args )? ( ( WS )* ':' ( WS )* ident ( ( WS )* ',' ( WS )* ident )* )? ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT )? -> ^( Class 'case' ( 'public' )? ( attribute )? ident ( generic_parameter )? ( class_args )? ( ^( Ident_List ( ident )* ) )? ( global_block )? ) )
{
DebugLocation(291, 5);
// SugarCpp.g:291:5: ( attribute )?
int alt82=2;
try { DebugEnterSubRule(82);
try { DebugEnterDecision(82, false);
int LA82_0 = input.LA(1);
if ((LA82_0==132))
{
alt82 = 1;
}
} finally { DebugExitDecision(82); }
switch (alt82)
{
case 1:
DebugEnterAlt(1);
// SugarCpp.g:291:5: attribute
{
DebugLocation(291, 5);
PushFollow(Follow._attribute_in_class_def1504);
attribute129=attribute();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_attribute.Add(attribute129.Tree);
}
break;
}
} finally { DebugExitSubRule(82); }
DebugLocation(291, 16);
// SugarCpp.g:291:16: ( 'public' ( WS )* )?
int alt84=2;
try { DebugEnterSubRule(84);
try { DebugEnterDecision(84, false);
int LA84_0 = input.LA(1);
if ((LA84_0==163))
{
alt84 = 1;
}
} finally { DebugExitDecision(84); }
switch (alt84)
{
case 1:
DebugEnterAlt(1);
// SugarCpp.g:291:17: 'public' ( WS )*
{
DebugLocation(291, 17);
string_literal130=(IToken)Match(input,163,Follow._163_in_class_def1508); if (state.failed) return retval;
if (state.backtracking == 0) stream_163.Add(string_literal130);
DebugLocation(291, 26);
// SugarCpp.g:291:26: ( WS )*
try { DebugEnterSubRule(83);
示例11: type_list
private AstParserRuleReturnScope<CommonTree, IToken> type_list()
{
EnterRule_type_list();
EnterRule("type_list", 16);
TraceIn("type_list", 16);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken WS173 = default(IToken);
IToken char_literal174 = default(IToken);
IToken WS175 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> type_name172 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> type_name176 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree WS173_tree = default(CommonTree);
CommonTree char_literal174_tree = default(CommonTree);
CommonTree WS175_tree = default(CommonTree);
RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS");
RewriteRuleITokenStream stream_100=new RewriteRuleITokenStream(adaptor,"token 100");
RewriteRuleSubtreeStream stream_type_name=new RewriteRuleSubtreeStream(adaptor,"rule type_name");
try { DebugEnterRule(GrammarFileName, "type_list");
DebugLocation(296, 1);
try
{
// SugarCpp.g:297:2: ( type_name ( ( WS )* ',' ( WS )* type_name )* -> ^( Type_List ( type_name )* ) )
DebugEnterAlt(1);
// SugarCpp.g:297:4: type_name ( ( WS )* ',' ( WS )* type_name )*
{
DebugLocation(297, 4);
PushFollow(Follow._type_name_in_type_list1743);
type_name172=type_name();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_type_name.Add(type_name172.Tree);
DebugLocation(297, 14);
// SugarCpp.g:297:14: ( ( WS )* ',' ( WS )* type_name )*
try { DebugEnterSubRule(115);
while (true)
{
int alt115=2;
try { DebugEnterDecision(115, false);
try
{
alt115 = dfa115.Predict(input);
}
catch (NoViableAltException nvae)
{
DebugRecognitionException(nvae);
throw;
}
} finally { DebugExitDecision(115); }
switch ( alt115 )
{
case 1:
DebugEnterAlt(1);
// SugarCpp.g:297:15: ( WS )* ',' ( WS )* type_name
{
DebugLocation(297, 15);
// SugarCpp.g:297:15: ( WS )*
try { DebugEnterSubRule(113);
while (true)
{
int alt113=2;
try { DebugEnterDecision(113, false);
int LA113_0 = input.LA(1);
if ((LA113_0==WS))
{
alt113 = 1;
}
} finally { DebugExitDecision(113); }
switch ( alt113 )
{
case 1:
DebugEnterAlt(1);
// SugarCpp.g:297:15: WS
{
DebugLocation(297, 15);
WS173=(IToken)Match(input,WS,Follow._WS_in_type_list1746); if (state.failed) return retval;
if (state.backtracking == 0) stream_WS.Add(WS173);
}
break;
default:
goto loop113;
}
}
loop113:
;
} finally { DebugExitSubRule(113); }
DebugLocation(297, 19);
//.........这里部分代码省略.........
示例12: class_args
private AstParserRuleReturnScope<CommonTree, IToken> class_args()
{
EnterRule_class_args();
EnterRule("class_args", 14);
TraceIn("class_args", 14);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken char_literal122 = default(IToken);
IToken WS123 = default(IToken);
IToken WS125 = default(IToken);
IToken char_literal126 = default(IToken);
IToken WS127 = default(IToken);
IToken char_literal128 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> func_args124 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree char_literal122_tree = default(CommonTree);
CommonTree WS123_tree = default(CommonTree);
CommonTree WS125_tree = default(CommonTree);
CommonTree char_literal126_tree = default(CommonTree);
CommonTree WS127_tree = default(CommonTree);
CommonTree char_literal128_tree = default(CommonTree);
RewriteRuleITokenStream stream_94=new RewriteRuleITokenStream(adaptor,"token 94");
RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS");
RewriteRuleITokenStream stream_93=new RewriteRuleITokenStream(adaptor,"token 93");
RewriteRuleSubtreeStream stream_func_args=new RewriteRuleSubtreeStream(adaptor,"rule func_args");
try { DebugEnterRule(GrammarFileName, "class_args");
DebugLocation(284, 1);
try
{
// SugarCpp.g:285:2: ( '(' ( ( WS )* func_args ( WS )* ')' -> func_args | ( WS )* ')' -> ^( Func_Args ) ) )
DebugEnterAlt(1);
// SugarCpp.g:285:4: '(' ( ( WS )* func_args ( WS )* ')' -> func_args | ( WS )* ')' -> ^( Func_Args ) )
{
DebugLocation(285, 4);
char_literal122=(IToken)Match(input,93,Follow._93_in_class_args1453); if (state.failed) return retval;
if (state.backtracking == 0) stream_93.Add(char_literal122);
DebugLocation(285, 8);
// SugarCpp.g:285:8: ( ( WS )* func_args ( WS )* ')' -> func_args | ( WS )* ')' -> ^( Func_Args ) )
int alt81=2;
try { DebugEnterSubRule(81);
try { DebugEnterDecision(81, false);
try
{
alt81 = dfa81.Predict(input);
}
catch (NoViableAltException nvae)
{
DebugRecognitionException(nvae);
throw;
}
} finally { DebugExitDecision(81); }
switch (alt81)
{
case 1:
DebugEnterAlt(1);
// SugarCpp.g:285:10: ( WS )* func_args ( WS )* ')'
{
DebugLocation(285, 10);
// SugarCpp.g:285:10: ( WS )*
try { DebugEnterSubRule(78);
while (true)
{
int alt78=2;
try { DebugEnterDecision(78, false);
int LA78_0 = input.LA(1);
if ((LA78_0==WS))
{
alt78 = 1;
}
} finally { DebugExitDecision(78); }
switch ( alt78 )
{
case 1:
DebugEnterAlt(1);
// SugarCpp.g:285:10: WS
{
DebugLocation(285, 10);
WS123=(IToken)Match(input,WS,Follow._WS_in_class_args1457); if (state.failed) return retval;
if (state.backtracking == 0) stream_WS.Add(WS123);
}
break;
default:
goto loop78;
}
}
loop78:
;
} finally { DebugExitSubRule(78); }
//.........这里部分代码省略.........
示例13: namespace_def
private AstParserRuleReturnScope<CommonTree, IToken> namespace_def()
{
EnterRule_namespace_def();
EnterRule("namespace_def", 13);
TraceIn("namespace_def", 13);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken string_literal113 = default(IToken);
IToken WS114 = default(IToken);
IToken WS116 = default(IToken);
IToken NEWLINE117 = default(IToken);
IToken INDENT118 = default(IToken);
IToken NEWLINE119 = default(IToken);
IToken DEDENT121 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> attribute112 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> ident115 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> global_block120 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree string_literal113_tree = default(CommonTree);
CommonTree WS114_tree = default(CommonTree);
CommonTree WS116_tree = default(CommonTree);
CommonTree NEWLINE117_tree = default(CommonTree);
CommonTree INDENT118_tree = default(CommonTree);
CommonTree NEWLINE119_tree = default(CommonTree);
CommonTree DEDENT121_tree = default(CommonTree);
RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS");
RewriteRuleITokenStream stream_DEDENT=new RewriteRuleITokenStream(adaptor,"token DEDENT");
RewriteRuleITokenStream stream_NEWLINE=new RewriteRuleITokenStream(adaptor,"token NEWLINE");
RewriteRuleITokenStream stream_159=new RewriteRuleITokenStream(adaptor,"token 159");
RewriteRuleITokenStream stream_INDENT=new RewriteRuleITokenStream(adaptor,"token INDENT");
RewriteRuleSubtreeStream stream_ident=new RewriteRuleSubtreeStream(adaptor,"rule ident");
RewriteRuleSubtreeStream stream_attribute=new RewriteRuleSubtreeStream(adaptor,"rule attribute");
RewriteRuleSubtreeStream stream_global_block=new RewriteRuleSubtreeStream(adaptor,"rule global_block");
try { DebugEnterRule(GrammarFileName, "namespace_def");
DebugLocation(280, 1);
try
{
// SugarCpp.g:281:2: ( ( attribute )? 'namespace' ( WS )* ident ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT )? -> ^( Namespace ( attribute )? ident ( global_block )? ) )
DebugEnterAlt(1);
// SugarCpp.g:281:4: ( attribute )? 'namespace' ( WS )* ident ( ( WS )* ( NEWLINE )+ INDENT ( NEWLINE )* global_block DEDENT )?
{
DebugLocation(281, 4);
// SugarCpp.g:281:4: ( attribute )?
int alt72=2;
try { DebugEnterSubRule(72);
try { DebugEnterDecision(72, false);
int LA72_0 = input.LA(1);
if ((LA72_0==132))
{
alt72 = 1;
}
} finally { DebugExitDecision(72); }
switch (alt72)
{
case 1:
DebugEnterAlt(1);
// SugarCpp.g:281:4: attribute
{
DebugLocation(281, 4);
PushFollow(Follow._attribute_in_namespace_def1402);
attribute112=attribute();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_attribute.Add(attribute112.Tree);
}
break;
}
} finally { DebugExitSubRule(72); }
DebugLocation(281, 15);
string_literal113=(IToken)Match(input,159,Follow._159_in_namespace_def1405); if (state.failed) return retval;
if (state.backtracking == 0) stream_159.Add(string_literal113);
DebugLocation(281, 27);
// SugarCpp.g:281:27: ( WS )*
try { DebugEnterSubRule(73);
while (true)
{
int alt73=2;
try { DebugEnterDecision(73, false);
int LA73_0 = input.LA(1);
if ((LA73_0==WS))
{
alt73 = 1;
}
} finally { DebugExitDecision(73); }
switch ( alt73 )
{
case 1:
DebugEnterAlt(1);
// SugarCpp.g:281:27: WS
//.........这里部分代码省略.........
示例14: enum_def
private AstParserRuleReturnScope<CommonTree, IToken> enum_def()
{
EnterRule_enum_def();
EnterRule("enum_def", 12);
TraceIn("enum_def", 12);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken string_literal101 = default(IToken);
IToken WS102 = default(IToken);
IToken WS104 = default(IToken);
IToken char_literal105 = default(IToken);
IToken WS106 = default(IToken);
IToken WS108 = default(IToken);
IToken char_literal109 = default(IToken);
IToken WS110 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> attribute100 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> ident103 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> ident107 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> ident111 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree string_literal101_tree = default(CommonTree);
CommonTree WS102_tree = default(CommonTree);
CommonTree WS104_tree = default(CommonTree);
CommonTree char_literal105_tree = default(CommonTree);
CommonTree WS106_tree = default(CommonTree);
CommonTree WS108_tree = default(CommonTree);
CommonTree char_literal109_tree = default(CommonTree);
CommonTree WS110_tree = default(CommonTree);
RewriteRuleITokenStream stream_182=new RewriteRuleITokenStream(adaptor,"token 182");
RewriteRuleITokenStream stream_146=new RewriteRuleITokenStream(adaptor,"token 146");
RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS");
RewriteRuleITokenStream stream_121=new RewriteRuleITokenStream(adaptor,"token 121");
RewriteRuleSubtreeStream stream_ident=new RewriteRuleSubtreeStream(adaptor,"rule ident");
RewriteRuleSubtreeStream stream_attribute=new RewriteRuleSubtreeStream(adaptor,"rule attribute");
try { DebugEnterRule(GrammarFileName, "enum_def");
DebugLocation(276, 1);
try
{
// SugarCpp.g:277:2: ( ( attribute )? 'enum' ( WS )* ident ( WS )* '=' ( ( WS )* ident ( ( WS )* '|' ( WS )* ident )* )? -> ^( Enum ( attribute )? ident ^( Ident_List ( ident )* ) ) )
DebugEnterAlt(1);
// SugarCpp.g:277:4: ( attribute )? 'enum' ( WS )* ident ( WS )* '=' ( ( WS )* ident ( ( WS )* '|' ( WS )* ident )* )?
{
DebugLocation(277, 4);
// SugarCpp.g:277:4: ( attribute )?
int alt64=2;
try { DebugEnterSubRule(64);
try { DebugEnterDecision(64, false);
int LA64_0 = input.LA(1);
if ((LA64_0==132))
{
alt64 = 1;
}
} finally { DebugExitDecision(64); }
switch (alt64)
{
case 1:
DebugEnterAlt(1);
// SugarCpp.g:277:4: attribute
{
DebugLocation(277, 4);
PushFollow(Follow._attribute_in_enum_def1339);
attribute100=attribute();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_attribute.Add(attribute100.Tree);
}
break;
}
} finally { DebugExitSubRule(64); }
DebugLocation(277, 15);
string_literal101=(IToken)Match(input,146,Follow._146_in_enum_def1342); if (state.failed) return retval;
if (state.backtracking == 0) stream_146.Add(string_literal101);
DebugLocation(277, 22);
// SugarCpp.g:277:22: ( WS )*
try { DebugEnterSubRule(65);
while (true)
{
int alt65=2;
try { DebugEnterDecision(65, false);
int LA65_0 = input.LA(1);
if ((LA65_0==WS))
{
alt65 = 1;
}
} finally { DebugExitDecision(65); }
switch ( alt65 )
{
case 1:
DebugEnterAlt(1);
//.........这里部分代码省略.........
示例15: orderby_expr
private AstParserRuleReturnScope<object, IToken> orderby_expr()
{
EnterRule_orderby_expr();
EnterRule("orderby_expr", 20);
TraceIn("orderby_expr", 20);
AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
retval.Start = (IToken)input.LT(1);
object root_0 = default(object);
AstParserRuleReturnScope<object, IToken> exp84 = default(AstParserRuleReturnScope<object, IToken>);
AstParserRuleReturnScope<object, IToken> sortorder_operator85 = default(AstParserRuleReturnScope<object, IToken>);
RewriteRuleSubtreeStream stream_exp=new RewriteRuleSubtreeStream(adaptor,"rule exp");
RewriteRuleSubtreeStream stream_sortorder_operator=new RewriteRuleSubtreeStream(adaptor,"rule sortorder_operator");
try { DebugEnterRule(GrammarFileName, "orderby_expr");
DebugLocation(184, 1);
try
{
// Queries\\PomonaQuery.g:185:2: ( exp ( sortorder_operator )? -> ^( ORDERBY_ASC exp ( sortorder_operator )? ) )
DebugEnterAlt(1);
// Queries\\PomonaQuery.g:185:4: exp ( sortorder_operator )?
{
DebugLocation(185, 4);
PushFollow(Follow._exp_in_orderby_expr1167);
exp84=exp();
PopFollow();
stream_exp.Add(exp84.Tree);
DebugLocation(185, 8);
// Queries\\PomonaQuery.g:185:8: ( sortorder_operator )?
int alt27=2;
try { DebugEnterSubRule(27);
try { DebugEnterDecision(27, false);
int LA27_1 = input.LA(1);
if (((LA27_1>=62 && LA27_1<=63)))
{
alt27 = 1;
}
} finally { DebugExitDecision(27); }
switch (alt27)
{
case 1:
DebugEnterAlt(1);
// Queries\\PomonaQuery.g:185:9: sortorder_operator
{
DebugLocation(185, 9);
PushFollow(Follow._sortorder_operator_in_orderby_expr1170);
sortorder_operator85=sortorder_operator();
PopFollow();
stream_sortorder_operator.Add(sortorder_operator85.Tree);
}
break;
}
} finally { DebugExitSubRule(27); }
{
// AST REWRITE
// elements: exp, sortorder_operator
// 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 = (object)adaptor.Nil();
// 185:30: -> ^( ORDERBY_ASC exp ( sortorder_operator )? )
{
DebugLocation(185, 33);
// Queries\\PomonaQuery.g:185:33: ^( ORDERBY_ASC exp ( sortorder_operator )? )
{
object root_1 = (object)adaptor.Nil();
DebugLocation(185, 35);
root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(ORDERBY_ASC, "ORDERBY_ASC"), root_1);
DebugLocation(185, 47);
adaptor.AddChild(root_1, stream_exp.NextTree());
DebugLocation(185, 51);
// Queries\\PomonaQuery.g:185:51: ( sortorder_operator )?
if (stream_sortorder_operator.HasNext)
{
DebugLocation(185, 51);
adaptor.AddChild(root_1, stream_sortorder_operator.NextTree());
}
stream_sortorder_operator.Reset();
adaptor.AddChild(root_0, root_1);
}
}
//.........这里部分代码省略.........