本文整理汇总了C#中Antlr.Runtime.Tree.RewriteRuleSubtreeStream.NextTree方法的典型用法代码示例。如果您正苦于以下问题:C# RewriteRuleSubtreeStream.NextTree方法的具体用法?C# RewriteRuleSubtreeStream.NextTree怎么用?C# RewriteRuleSubtreeStream.NextTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Antlr.Runtime.Tree.RewriteRuleSubtreeStream
的用法示例。
在下文中一共展示了RewriteRuleSubtreeStream.NextTree方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: lvalue
//.........这里部分代码省略.........
goto loop623;
}
}
loop623:
;
} finally { DebugExitSubRule(623); }
DebugLocation(760, 55);
char_literal966=(IToken)Match(input,94,Follow._94_in_lvalue9204); if (state.failed) return retval;
if (state.backtracking == 0) stream_94.Add(char_literal966);
{
// AST REWRITE
// elements: lvalue_item
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// 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:59: -> ^( Match_Tuple ( lvalue_item )* )
{
DebugLocation(760, 62);
// SugarCpp.g:760:62: ^( Match_Tuple ( lvalue_item )* )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(760, 64);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Match_Tuple, "Match_Tuple"), root_1);
DebugLocation(760, 76);
// SugarCpp.g:760:76: ( lvalue_item )*
while ( stream_lvalue_item.HasNext )
{
DebugLocation(760, 76);
adaptor.AddChild(root_1, stream_lvalue_item.NextTree());
}
stream_lvalue_item.Reset();
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;
}
}
}
break;
case 2:
DebugEnterAlt(2);
// SugarCpp.g:761:4: lvalue_item
{
root_0 = (CommonTree)adaptor.Nil();
DebugLocation(761, 4);
PushFollow(Follow._lvalue_item_in_lvalue9218);
lvalue_item967=lvalue_item();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) adaptor.AddChild(root_0, lvalue_item967.Tree);
}
break;
}
retval.Stop = (IToken)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
{
TraceOut("lvalue", 101);
LeaveRule("lvalue", 101);
LeaveRule_lvalue();
}
DebugLocation(762, 1);
} finally { DebugExitRule(GrammarFileName, "lvalue"); }
return retval;
}
示例2: functionCall
//.........这里部分代码省略.........
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:
// 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();
// 256:53: -> ^( FUNCTION[$x] ( expression )* )
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:56: ^( FUNCTION[$x] ( expression )* )
{
var root_1 = (CommonTree)adaptor.GetNilNode();
root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( FUNCTION, x ), root_1 );
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:72: ( expression )*
while ( stream_expression.HasNext() )
adaptor.AddChild( root_1, stream_expression.NextTree() );
stream_expression.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 )
{
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;
}
示例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
//.........这里部分代码省略.........
string_literal12=(IToken)Match(input,77,Follow._77_in_or_expression595);
stream_77.Add(string_literal12);
}
break;
}
} finally { DebugExitSubRule(3); }
DebugLocation(94, 33);
PushFollow(Follow._and_expression_in_or_expression598);
and_expression13=and_expression();
PopFollow();
stream_and_expression.Add(and_expression13.Tree);
}
break;
default:
goto loop4;
}
}
loop4:
;
} finally { DebugExitSubRule(4); }
{
// AST REWRITE
// elements: and_expression
// 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();
// 94:51: -> ^( OR_OP ( and_expression )+ )
{
DebugLocation(94, 54);
// Queries\\PomonaQuery.g:94:54: ^( OR_OP ( and_expression )+ )
{
object root_1 = (object)adaptor.Nil();
DebugLocation(94, 56);
root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(OR_OP, "OR_OP"), root_1);
DebugLocation(94, 62);
if (!(stream_and_expression.HasNext))
{
throw new RewriteEarlyExitException();
}
while ( stream_and_expression.HasNext )
{
DebugLocation(94, 62);
adaptor.AddChild(root_1, stream_and_expression.NextTree());
}
stream_and_expression.Reset();
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;
}
}
retval.Stop = (IToken)input.LT(-1);
retval.Tree = (object)adaptor.RulePostProcessing(root_0);
adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
}
catch (RecognitionException re)
{
ReportError(re);
Recover(input,re);
retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);
}
finally
{
TraceOut("or_expression", 5);
LeaveRule("or_expression", 5);
LeaveRule_or_expression();
}
DebugLocation(95, 1);
} finally { DebugExitRule(GrammarFileName, "or_expression"); }
return retval;
}
示例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
//.........这里部分代码省略.........
{
// AST REWRITE
// elements: type_name, type_single
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// 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();
// 301:57: -> ^( Type_Func ^( Type_List type_single ) ( type_name )? )
{
DebugLocation(301, 60);
// SugarCpp.g:301:60: ^( Type_Func ^( Type_List type_single ) ( type_name )? )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(301, 62);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Type_Func, "Type_Func"), root_1);
DebugLocation(301, 72);
// SugarCpp.g:301:72: ^( Type_List type_single )
{
CommonTree root_2 = (CommonTree)adaptor.Nil();
DebugLocation(301, 74);
root_2 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Type_List, "Type_List"), root_2);
DebugLocation(301, 84);
adaptor.AddChild(root_2, stream_type_single.NextTree());
adaptor.AddChild(root_1, root_2);
}
DebugLocation(301, 97);
// SugarCpp.g:301:97: ( type_name )?
if (stream_type_name.HasNext)
{
DebugLocation(301, 97);
adaptor.AddChild(root_1, stream_type_name.NextTree());
}
stream_type_name.Reset();
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;
}
}
}
break;
case 2:
DebugEnterAlt(2);
// SugarCpp.g:302:9:
{
{
// AST REWRITE
// elements: type_single
示例9: type_single
//.........这里部分代码省略.........
;
} finally { DebugExitSubRule(129); }
DebugLocation(308, 20);
char_literal199=(IToken)Match(input,91,Follow._91_in_type_single1904); if (state.failed) return retval;
if (state.backtracking == 0) stream_91.Add(char_literal199);
{
// AST REWRITE
// elements: type_star
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// 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();
// 308:24: -> ^( Type_Ref type_star )
{
DebugLocation(308, 27);
// SugarCpp.g:308:27: ^( Type_Ref type_star )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(308, 29);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Type_Ref, "Type_Ref"), root_1);
DebugLocation(308, 38);
adaptor.AddChild(root_1, stream_type_star.NextTree());
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;
}
}
}
break;
case 2:
DebugEnterAlt(2);
// SugarCpp.g:309:7: ( WS )* '[' ( ( WS )* expr ( ( WS )* ',' ( WS )* expr )* ( WS )* ']' -> ^( Type_Array type_star ( expr )+ ) | ( ( WS )* ',' )* ( WS )* ']' -> ^( Type_Array type_star ( expr )+ ) )
{
DebugLocation(309, 7);
// SugarCpp.g:309:7: ( WS )*
try { DebugEnterSubRule(130);
while (true)
{
int alt130=2;
try { DebugEnterDecision(130, false);
int LA130_0 = input.LA(1);
if ((LA130_0==WS))
{
alt130 = 1;
}
} finally { DebugExitDecision(130); }
示例10: class_def
//.........这里部分代码省略.........
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// 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();
// 291:167: -> ^( Class ( 'public' )? ( attribute )? ident ( generic_parameter )? ( class_args )? ( ^( Ident_List ( ident )* ) )? ( global_block )? )
{
DebugLocation(291, 170);
// SugarCpp.g:291:170: ^( Class ( 'public' )? ( attribute )? ident ( generic_parameter )? ( class_args )? ( ^( Ident_List ( ident )* ) )? ( global_block )? )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(291, 172);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Class, "Class"), root_1);
DebugLocation(291, 178);
// SugarCpp.g:291:178: ( 'public' )?
if (stream_163.HasNext)
{
DebugLocation(291, 178);
adaptor.AddChild(root_1, stream_163.NextNode());
}
stream_163.Reset();
DebugLocation(291, 188);
// SugarCpp.g:291:188: ( attribute )?
if (stream_attribute.HasNext)
{
DebugLocation(291, 188);
adaptor.AddChild(root_1, stream_attribute.NextTree());
}
stream_attribute.Reset();
DebugLocation(291, 199);
adaptor.AddChild(root_1, stream_ident.NextTree());
DebugLocation(291, 205);
// SugarCpp.g:291:205: ( generic_parameter )?
if (stream_generic_parameter.HasNext)
{
DebugLocation(291, 205);
adaptor.AddChild(root_1, stream_generic_parameter.NextTree());
}
stream_generic_parameter.Reset();
DebugLocation(291, 224);
// SugarCpp.g:291:224: ( class_args )?
if (stream_class_args.HasNext)
{
DebugLocation(291, 224);
adaptor.AddChild(root_1, stream_class_args.NextTree());
}
stream_class_args.Reset();
DebugLocation(291, 236);
// SugarCpp.g:291:236: ( ^( Ident_List ( ident )* ) )?
if (stream_ident.HasNext)
{
DebugLocation(291, 237);
// SugarCpp.g:291:237: ^( Ident_List ( ident )* )
{
CommonTree root_2 = (CommonTree)adaptor.Nil();
DebugLocation(291, 239);
示例11: type_list
//.........这里部分代码省略.........
default:
goto loop114;
}
}
loop114:
;
} finally { DebugExitSubRule(114); }
DebugLocation(297, 28);
PushFollow(Follow._type_name_in_type_list1755);
type_name176=type_name();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_type_name.Add(type_name176.Tree);
}
break;
default:
goto loop115;
}
}
loop115:
;
} finally { DebugExitSubRule(115); }
{
// AST REWRITE
// elements: type_name
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// 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();
// 297:40: -> ^( Type_List ( type_name )* )
{
DebugLocation(297, 43);
// SugarCpp.g:297:43: ^( Type_List ( type_name )* )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(297, 45);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Type_List, "Type_List"), root_1);
DebugLocation(297, 55);
// SugarCpp.g:297:55: ( type_name )*
while ( stream_type_name.HasNext )
{
DebugLocation(297, 55);
adaptor.AddChild(root_1, stream_type_name.NextTree());
}
stream_type_name.Reset();
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;
}
}
}
retval.Stop = (IToken)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
{
TraceOut("type_list", 16);
LeaveRule("type_list", 16);
LeaveRule_type_list();
}
DebugLocation(298, 1);
} finally { DebugExitRule(GrammarFileName, "type_list"); }
return retval;
}
示例12: class_args
//.........这里部分代码省略.........
default:
goto loop79;
}
}
loop79:
;
} finally { DebugExitSubRule(79); }
DebugLocation(285, 28);
char_literal126=(IToken)Match(input,94,Follow._94_in_class_args1465); if (state.failed) return retval;
if (state.backtracking == 0) stream_94.Add(char_literal126);
{
// AST REWRITE
// elements: func_args
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// 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();
// 285:32: -> func_args
{
DebugLocation(285, 35);
adaptor.AddChild(root_0, stream_func_args.NextTree());
}
retval.Tree = root_0;
}
}
}
break;
case 2:
DebugEnterAlt(2);
// SugarCpp.g:286:7: ( WS )* ')'
{
DebugLocation(286, 7);
// SugarCpp.g:286:7: ( WS )*
try { DebugEnterSubRule(80);
while (true)
{
int alt80=2;
try { DebugEnterDecision(80, false);
int LA80_0 = input.LA(1);
if ((LA80_0==WS))
{
alt80 = 1;
}
} finally { DebugExitDecision(80); }
switch ( alt80 )
{
case 1:
示例13: namespace_def
//.........这里部分代码省略.........
} finally { DebugExitSubRule(76); }
DebugLocation(281, 67);
PushFollow(Follow._global_block_in_namespace_def1424);
global_block120=global_block();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_global_block.Add(global_block120.Tree);
DebugLocation(281, 80);
DEDENT121=(IToken)Match(input,DEDENT,Follow._DEDENT_in_namespace_def1426); if (state.failed) return retval;
if (state.backtracking == 0) stream_DEDENT.Add(DEDENT121);
}
break;
}
} finally { DebugExitSubRule(77); }
{
// AST REWRITE
// elements: ident, attribute, global_block
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// 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();
// 281:89: -> ^( Namespace ( attribute )? ident ( global_block )? )
{
DebugLocation(281, 92);
// SugarCpp.g:281:92: ^( Namespace ( attribute )? ident ( global_block )? )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(281, 94);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Namespace, "Namespace"), root_1);
DebugLocation(281, 104);
// SugarCpp.g:281:104: ( attribute )?
if (stream_attribute.HasNext)
{
DebugLocation(281, 104);
adaptor.AddChild(root_1, stream_attribute.NextTree());
}
stream_attribute.Reset();
DebugLocation(281, 115);
adaptor.AddChild(root_1, stream_ident.NextTree());
DebugLocation(281, 121);
// SugarCpp.g:281:121: ( global_block )?
if (stream_global_block.HasNext)
{
DebugLocation(281, 121);
adaptor.AddChild(root_1, stream_global_block.NextTree());
}
stream_global_block.Reset();
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;
}
}
}
retval.Stop = (IToken)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
{
TraceOut("namespace_def", 13);
LeaveRule("namespace_def", 13);
LeaveRule_namespace_def();
}
DebugLocation(282, 1);
} finally { DebugExitRule(GrammarFileName, "namespace_def"); }
return retval;
}
示例14: enum_def
//.........这里部分代码省略.........
} finally { DebugExitSubRule(70); }
}
break;
}
} finally { DebugExitSubRule(71); }
{
// AST REWRITE
// elements: ident, ident, attribute
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// 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();
// 277:74: -> ^( Enum ( attribute )? ident ^( Ident_List ( ident )* ) )
{
DebugLocation(277, 77);
// SugarCpp.g:277:77: ^( Enum ( attribute )? ident ^( Ident_List ( ident )* ) )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(277, 79);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Enum, "Enum"), root_1);
DebugLocation(277, 84);
// SugarCpp.g:277:84: ( attribute )?
if (stream_attribute.HasNext)
{
DebugLocation(277, 84);
adaptor.AddChild(root_1, stream_attribute.NextTree());
}
stream_attribute.Reset();
DebugLocation(277, 95);
adaptor.AddChild(root_1, stream_ident.NextTree());
DebugLocation(277, 101);
// SugarCpp.g:277:101: ^( Ident_List ( ident )* )
{
CommonTree root_2 = (CommonTree)adaptor.Nil();
DebugLocation(277, 103);
root_2 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Ident_List, "Ident_List"), root_2);
DebugLocation(277, 114);
// SugarCpp.g:277:114: ( ident )*
while ( stream_ident.HasNext )
{
DebugLocation(277, 114);
adaptor.AddChild(root_2, stream_ident.NextTree());
}
stream_ident.Reset();
adaptor.AddChild(root_1, root_2);
}
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;
}
}
}
retval.Stop = (IToken)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
{
TraceOut("enum_def", 12);
LeaveRule("enum_def", 12);
LeaveRule_enum_def();
}
DebugLocation(278, 1);
} finally { DebugExitRule(GrammarFileName, "enum_def"); }
return retval;
}
示例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);
}
}
//.........这里部分代码省略.........