本文整理汇总了C#中Antlr.Runtime.Tree.RewriteRuleSubtreeStream类的典型用法代码示例。如果您正苦于以下问题:C# RewriteRuleSubtreeStream类的具体用法?C# RewriteRuleSubtreeStream怎么用?C# RewriteRuleSubtreeStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RewriteRuleSubtreeStream类属于Antlr.Runtime.Tree命名空间,在下文中一共展示了RewriteRuleSubtreeStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckRewriteRuleSubtreeStreamConstructors
public void CheckRewriteRuleSubtreeStreamConstructors() {
RewriteRuleSubtreeStream subtreeTest1 =
new RewriteRuleSubtreeStream(CreateTreeAdaptor(),
"RewriteRuleSubtreeStream test1");
RewriteRuleSubtreeStream subtreeTest2 =
new RewriteRuleSubtreeStream(CreateTreeAdaptor(),
"RewriteRuleSubtreeStream test2", CreateToken(1,
"test token without any real context"));
RewriteRuleSubtreeStream subtreeTest3 =
new RewriteRuleSubtreeStream(CreateTreeAdaptor(),
"RewriteRuleSubtreeStream test3", CreateTokenList(4));
}
示例2: additive_operator
//.........这里部分代码省略.........
DebugLocation(130, 8);
string_literal34=(IToken)Match(input,59,Follow._59_in_additive_operator787);
stream_59.Add(string_literal34);
}
break;
case 2:
DebugEnterAlt(2);
// Queries\\PomonaQuery.g:130:14: '+'
{
DebugLocation(130, 14);
char_literal35=(IToken)Match(input,46,Follow._46_in_additive_operator789);
stream_46.Add(char_literal35);
}
break;
}
} finally { DebugExitSubRule(14); }
{
// AST REWRITE
// elements:
// 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();
// 130:19: -> ADD_OP
{
DebugLocation(130, 22);
adaptor.AddChild(root_0, (object)adaptor.Create(ADD_OP, "ADD_OP"));
}
retval.Tree = root_0;
}
}
break;
case 2:
DebugEnterAlt(2);
// Queries\\PomonaQuery.g:131:7: ( 'sub' | '-' )
{
DebugLocation(131, 7);
// Queries\\PomonaQuery.g:131:7: ( 'sub' | '-' )
int alt15=2;
try { DebugEnterSubRule(15);
try { DebugEnterDecision(15, false);
int LA15_1 = input.LA(1);
if ((LA15_1==76))
{
alt15 = 1;
}
else if ((LA15_1==48))
{
alt15 = 2;
示例3: name
// $ANTLR start "name"
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:92:1: name : x= ID -> NAME[$x] ;
public name_return name() // throws RecognitionException [1]
{
var retval = new name_return();
retval.Start = input.LT( 1 );
CommonTree root_0 = null;
IToken x = null;
CommonTree x_tree = null;
var stream_ID = new RewriteRuleTokenStream( adaptor, "token ID" );
try
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:93:2: (x= ID -> NAME[$x] )
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:93:4: x= ID
{
x = (IToken)Match( input, ID, FOLLOW_ID_in_name371 );
stream_ID.Add( x );
// AST REWRITE
// elements:
// 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();
// 93:9: -> NAME[$x]
{
adaptor.AddChild( root_0, adaptor.Create( NAME, x ) );
}
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;
}
示例4: baseClassDeclaration
// $ANTLR start "baseClassDeclaration"
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:82:1: baseClassDeclaration : ':' name 'where' expression -> ^( BASE_CLASS name ^( DISCRIMINATOR expression ) ) ;
public baseClassDeclaration_return baseClassDeclaration() // throws RecognitionException [1]
{
var retval = new baseClassDeclaration_return();
retval.Start = input.LT( 1 );
CommonTree root_0 = null;
IToken char_literal8 = null;
IToken string_literal10 = null;
name_return name9 = default( name_return );
expression_return expression11 = default( expression_return );
CommonTree char_literal8_tree = null;
CommonTree string_literal10_tree = null;
var stream_59 = new RewriteRuleTokenStream( adaptor, "token 59" );
var stream_58 = new RewriteRuleTokenStream( adaptor, "token 58" );
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:83:2: ( ':' name 'where' expression -> ^( BASE_CLASS name ^( DISCRIMINATOR expression ) ) )
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:83:4: ':' name 'where' expression
{
char_literal8 = (IToken)Match( input, 58, FOLLOW_58_in_baseClassDeclaration294 );
stream_58.Add( char_literal8 );
PushFollow( FOLLOW_name_in_baseClassDeclaration296 );
name9 = name();
state.followingStackPointer--;
stream_name.Add( name9.Tree );
string_literal10 = (IToken)Match( input, 59, FOLLOW_59_in_baseClassDeclaration298 );
stream_59.Add( string_literal10 );
PushFollow( FOLLOW_expression_in_baseClassDeclaration300 );
expression11 = expression();
state.followingStackPointer--;
stream_expression.Add( expression11.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();
// 83:32: -> ^( BASE_CLASS name ^( DISCRIMINATOR expression ) )
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:83:35: ^( BASE_CLASS name ^( DISCRIMINATOR expression ) )
{
var root_1 = (CommonTree)adaptor.GetNilNode();
root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( BASE_CLASS, "BASE_CLASS" ), root_1 );
adaptor.AddChild( root_1, stream_name.NextTree() );
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:83:54: ^( DISCRIMINATOR expression )
{
var root_2 = (CommonTree)adaptor.GetNilNode();
root_2 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( DISCRIMINATOR, "DISCRIMINATOR" ), 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: identifier
// $ANTLR start "identifier"
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:262:1: identifier : ID -> ^( IDENTIFIER ID ) ;
public identifier_return identifier() // throws RecognitionException [1]
{
var retval = new identifier_return();
retval.Start = input.LT( 1 );
CommonTree root_0 = null;
IToken ID92 = null;
CommonTree ID92_tree = null;
var stream_ID = new RewriteRuleTokenStream( adaptor, "token ID" );
try
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:263:2: ( ID -> ^( IDENTIFIER ID ) )
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:263:4: ID
{
ID92 = (IToken)Match( input, ID, FOLLOW_ID_in_identifier1399 );
stream_ID.Add( ID92 );
// AST REWRITE
// elements: ID
// 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();
// 263:7: -> ^( IDENTIFIER ID )
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:263:10: ^( IDENTIFIER ID )
{
var root_1 = (CommonTree)adaptor.GetNilNode();
root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( IDENTIFIER, "IDENTIFIER" ), root_1 );
adaptor.AddChild( root_1, stream_ID.NextNode() );
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;
}
示例6: criteria
// $ANTLR start "criteria"
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:248:1: criteria : '[' expression ']' -> ^( CRITERIA expression ) ;
public criteria_return criteria() // throws RecognitionException [1]
{
var retval = new criteria_return();
retval.Start = input.LT( 1 );
CommonTree root_0 = null;
IToken char_literal84 = null;
IToken char_literal86 = null;
expression_return expression85 = default( expression_return );
CommonTree char_literal84_tree = null;
CommonTree char_literal86_tree = null;
var stream_93 = new RewriteRuleTokenStream( adaptor, "token 93" );
var stream_92 = new RewriteRuleTokenStream( adaptor, "token 92" );
var stream_expression = new RewriteRuleSubtreeStream( adaptor, "rule expression" );
try
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:249:2: ( '[' expression ']' -> ^( CRITERIA expression ) )
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:249:4: '[' expression ']'
{
char_literal84 = (IToken)Match( input, 92, FOLLOW_92_in_criteria1320 );
stream_92.Add( char_literal84 );
PushFollow( FOLLOW_expression_in_criteria1322 );
expression85 = expression();
state.followingStackPointer--;
stream_expression.Add( expression85.Tree );
char_literal86 = (IToken)Match( input, 93, FOLLOW_93_in_criteria1324 );
stream_93.Add( char_literal86 );
// 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();
// 249:23: -> ^( CRITERIA expression )
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:249:26: ^( CRITERIA expression )
{
var root_1 = (CommonTree)adaptor.GetNilNode();
root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( CRITERIA, "CRITERIA" ), root_1 );
adaptor.AddChild( root_1, stream_expression.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 );
}
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;
}
示例7: assignmentOp
// $ANTLR start "assignmentOp"
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:224:1: assignmentOp : x= '=' -> OP_ASSIGN[$x] ;
public assignmentOp_return assignmentOp() // throws RecognitionException [1]
{
var retval = new assignmentOp_return();
retval.Start = input.LT( 1 );
CommonTree root_0 = null;
IToken x = null;
CommonTree x_tree = null;
var stream_68 = new RewriteRuleTokenStream( adaptor, "token 68" );
try
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:225:2: (x= '=' -> OP_ASSIGN[$x] )
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:225:4: x= '='
{
x = (IToken)Match( input, 68, FOLLOW_68_in_assignmentOp1201 );
stream_68.Add( x );
// AST REWRITE
// elements:
// 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();
// 225:10: -> OP_ASSIGN[$x]
{
adaptor.AddChild( root_0, adaptor.Create( OP_ASSIGN, x ) );
}
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;
}
示例8: equalsOp
// $ANTLR start "equalsOp"
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:189:1: equalsOp : (x= '==' -> OP_EQ[$x] | x= '=' -> OP_EQ[$x] );
public equalsOp_return equalsOp() // throws RecognitionException [1]
{
var retval = new equalsOp_return();
retval.Start = input.LT( 1 );
CommonTree root_0 = null;
IToken x = null;
CommonTree x_tree = null;
var stream_79 = new RewriteRuleTokenStream( adaptor, "token 79" );
var stream_68 = new RewriteRuleTokenStream( adaptor, "token 68" );
try
{
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:190:2: (x= '==' -> OP_EQ[$x] | x= '=' -> OP_EQ[$x] )
int alt26 = 2;
int LA26_0 = input.LA( 1 );
if ( ( LA26_0 == 79 ) )
alt26 = 1;
else if ( ( LA26_0 == 68 ) )
alt26 = 2;
else
{
var nvae_d26s0 =
new NoViableAltException( "", 26, 0, input );
throw nvae_d26s0;
}
switch ( alt26 )
{
case 1:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:190:4: x= '=='
{
x = (IToken)Match( input, 79, FOLLOW_79_in_equalsOp988 );
stream_79.Add( x );
// AST REWRITE
// elements:
// 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();
// 190:11: -> OP_EQ[$x]
{
adaptor.AddChild( root_0, adaptor.Create( OP_EQ, x ) );
}
retval.Tree = root_0;
retval.Tree = root_0;
}
break;
case 2:
// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:191:4: x= '='
{
x = (IToken)Match( input, 68, FOLLOW_68_in_equalsOp1001 );
stream_68.Add( x );
// AST REWRITE
// elements:
// 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();
// 191:11: -> OP_EQ[$x]
{
adaptor.AddChild( root_0, adaptor.Create( OP_EQ, x ) );
}
retval.Tree = root_0;
retval.Tree = root_0;
}
break;
}
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 );
//.........这里部分代码省略.........
示例9: lambda_expression
private AstParserRuleReturnScope<object, IToken> lambda_expression()
{
EnterRule_lambda_expression();
EnterRule("lambda_expression", 4);
TraceIn("lambda_expression", 4);
AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
retval.Start = (IToken)input.LT(1);
object root_0 = default(object);
IToken char_literal8 = default(IToken);
AstParserRuleReturnScope<object, IToken> or_expression7 = default(AstParserRuleReturnScope<object, IToken>);
AstParserRuleReturnScope<object, IToken> or_expression9 = default(AstParserRuleReturnScope<object, IToken>);
object char_literal8_tree = default(object);
RewriteRuleITokenStream stream_51=new RewriteRuleITokenStream(adaptor,"token 51");
RewriteRuleSubtreeStream stream_or_expression=new RewriteRuleSubtreeStream(adaptor,"rule or_expression");
try { DebugEnterRule(GrammarFileName, "lambda_expression");
DebugLocation(89, 1);
try
{
// Queries\\PomonaQuery.g:90:2: ( or_expression ( ':' or_expression )? -> ^( LAMBDA_OP ( or_expression )+ ) )
DebugEnterAlt(1);
// Queries\\PomonaQuery.g:90:4: or_expression ( ':' or_expression )?
{
DebugLocation(90, 4);
PushFollow(Follow._or_expression_in_lambda_expression559);
or_expression7=or_expression();
PopFollow();
stream_or_expression.Add(or_expression7.Tree);
DebugLocation(90, 18);
// Queries\\PomonaQuery.g:90:18: ( ':' or_expression )?
int alt2=2;
try { DebugEnterSubRule(2);
try { DebugEnterDecision(2, false);
int LA2_1 = input.LA(1);
if ((LA2_1==51))
{
alt2 = 1;
}
} finally { DebugExitDecision(2); }
switch (alt2)
{
case 1:
DebugEnterAlt(1);
// Queries\\PomonaQuery.g:90:20: ':' or_expression
{
DebugLocation(90, 20);
char_literal8=(IToken)Match(input,51,Follow._51_in_lambda_expression563);
stream_51.Add(char_literal8);
DebugLocation(90, 24);
PushFollow(Follow._or_expression_in_lambda_expression565);
or_expression9=or_expression();
PopFollow();
stream_or_expression.Add(or_expression9.Tree);
}
break;
}
} finally { DebugExitSubRule(2); }
{
// AST REWRITE
// elements: or_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();
// 90:41: -> ^( LAMBDA_OP ( or_expression )+ )
{
DebugLocation(90, 44);
// Queries\\PomonaQuery.g:90:44: ^( LAMBDA_OP ( or_expression )+ )
{
object root_1 = (object)adaptor.Nil();
DebugLocation(90, 46);
root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(LAMBDA_OP, "LAMBDA_OP"), root_1);
DebugLocation(90, 56);
if (!(stream_or_expression.HasNext))
{
throw new RewriteEarlyExitException();
}
while ( stream_or_expression.HasNext )
{
DebugLocation(90, 56);
adaptor.AddChild(root_1, stream_or_expression.NextTree());
}
//.........这里部分代码省略.........
示例10: 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);
}
}
//.........这里部分代码省略.........
示例11: as_expression
private AstParserRuleReturnScope<object, IToken> as_expression()
{
EnterRule_as_expression();
EnterRule("as_expression", 3);
TraceIn("as_expression", 3);
AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
retval.Start = (IToken)input.LT(1);
object root_0 = default(object);
IToken string_literal5 = default(IToken);
AstParserRuleReturnScope<object, IToken> lambda_expression4 = default(AstParserRuleReturnScope<object, IToken>);
AstParserRuleReturnScope<object, IToken> lambda_expression6 = default(AstParserRuleReturnScope<object, IToken>);
object string_literal5_tree = default(object);
RewriteRuleITokenStream stream_61=new RewriteRuleITokenStream(adaptor,"token 61");
RewriteRuleSubtreeStream stream_lambda_expression=new RewriteRuleSubtreeStream(adaptor,"rule lambda_expression");
try { DebugEnterRule(GrammarFileName, "as_expression");
DebugLocation(85, 1);
try
{
// Queries\\PomonaQuery.g:86:2: ( lambda_expression ( 'as' lambda_expression )? -> ^( AS_OP ( lambda_expression )+ ) )
DebugEnterAlt(1);
// Queries\\PomonaQuery.g:86:4: lambda_expression ( 'as' lambda_expression )?
{
DebugLocation(86, 4);
PushFollow(Follow._lambda_expression_in_as_expression530);
lambda_expression4=lambda_expression();
PopFollow();
stream_lambda_expression.Add(lambda_expression4.Tree);
DebugLocation(86, 22);
// Queries\\PomonaQuery.g:86:22: ( 'as' lambda_expression )?
int alt1=2;
try { DebugEnterSubRule(1);
try { DebugEnterDecision(1, false);
int LA1_1 = input.LA(1);
if ((LA1_1==61))
{
alt1 = 1;
}
} finally { DebugExitDecision(1); }
switch (alt1)
{
case 1:
DebugEnterAlt(1);
// Queries\\PomonaQuery.g:86:24: 'as' lambda_expression
{
DebugLocation(86, 24);
string_literal5=(IToken)Match(input,61,Follow._61_in_as_expression534);
stream_61.Add(string_literal5);
DebugLocation(86, 29);
PushFollow(Follow._lambda_expression_in_as_expression536);
lambda_expression6=lambda_expression();
PopFollow();
stream_lambda_expression.Add(lambda_expression6.Tree);
}
break;
}
} finally { DebugExitSubRule(1); }
{
// AST REWRITE
// elements: lambda_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();
// 86:50: -> ^( AS_OP ( lambda_expression )+ )
{
DebugLocation(86, 53);
// Queries\\PomonaQuery.g:86:53: ^( AS_OP ( lambda_expression )+ )
{
object root_1 = (object)adaptor.Nil();
DebugLocation(86, 55);
root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(AS_OP, "AS_OP"), root_1);
DebugLocation(86, 61);
if (!(stream_lambda_expression.HasNext))
{
throw new RewriteEarlyExitException();
}
while ( stream_lambda_expression.HasNext )
{
DebugLocation(86, 61);
adaptor.AddChild(root_1, stream_lambda_expression.NextTree());
}
//.........这里部分代码省略.........
示例12: postfix_expr
private AstParserRuleReturnScope<object, IToken> postfix_expr()
{
EnterRule_postfix_expr();
EnterRule("postfix_expr", 18);
TraceIn("postfix_expr", 18);
AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
retval.Start = (IToken)input.LT(1);
object root_0 = default(object);
IToken ID59 = default(IToken);
IToken char_literal60 = default(IToken);
IToken char_literal62 = default(IToken);
IToken ID63 = default(IToken);
IToken char_literal64 = default(IToken);
IToken char_literal65 = default(IToken);
IToken ID66 = default(IToken);
IToken char_literal67 = default(IToken);
IToken char_literal69 = default(IToken);
IToken ID70 = default(IToken);
IToken char_literal71 = default(IToken);
IToken char_literal72 = default(IToken);
IToken ID73 = default(IToken);
IToken STRING74 = default(IToken);
IToken INT75 = default(IToken);
IToken char_literal76 = default(IToken);
IToken char_literal78 = default(IToken);
IToken char_literal79 = default(IToken);
IToken char_literal81 = default(IToken);
IToken PREFIXED_STRING82 = default(IToken);
AstParserRuleReturnScope<object, IToken> arglist_expr61 = default(AstParserRuleReturnScope<object, IToken>);
AstParserRuleReturnScope<object, IToken> arglist_expr68 = default(AstParserRuleReturnScope<object, IToken>);
AstParserRuleReturnScope<object, IToken> orderby_expr77 = default(AstParserRuleReturnScope<object, IToken>);
AstParserRuleReturnScope<object, IToken> arglist_expr80 = default(AstParserRuleReturnScope<object, IToken>);
object ID59_tree = default(object);
object char_literal60_tree = default(object);
object char_literal62_tree = default(object);
object ID63_tree = default(object);
object char_literal64_tree = default(object);
object char_literal65_tree = default(object);
object ID66_tree = default(object);
object char_literal67_tree = default(object);
object char_literal69_tree = default(object);
object ID70_tree = default(object);
object char_literal71_tree = default(object);
object char_literal72_tree = default(object);
object ID73_tree = default(object);
object STRING74_tree = default(object);
object INT75_tree = default(object);
object char_literal76_tree = default(object);
object char_literal78_tree = default(object);
object char_literal79_tree = default(object);
object char_literal81_tree = default(object);
object PREFIXED_STRING82_tree = default(object);
RewriteRuleITokenStream stream_ID=new RewriteRuleITokenStream(adaptor,"token ID");
RewriteRuleITokenStream stream_43=new RewriteRuleITokenStream(adaptor,"token 43");
RewriteRuleITokenStream stream_44=new RewriteRuleITokenStream(adaptor,"token 44");
RewriteRuleITokenStream stream_57=new RewriteRuleITokenStream(adaptor,"token 57");
RewriteRuleITokenStream stream_58=new RewriteRuleITokenStream(adaptor,"token 58");
RewriteRuleSubtreeStream stream_arglist_expr=new RewriteRuleSubtreeStream(adaptor,"rule arglist_expr");
try { DebugEnterRule(GrammarFileName, "postfix_expr");
DebugLocation(166, 1);
try
{
// Queries\\PomonaQuery.g:167:2: ( ID ( '(' arglist_expr ')' ) -> ^( METHOD_CALL ID arglist_expr ) | ID ( '(' ')' ) -> ^( METHOD_CALL ID ) | ID ( '[' arglist_expr ']' ) -> ^( INDEXER_ACCESS ID arglist_expr ) | ID ( '[' ']' ) -> ^( INDEXER_ACCESS ID ) | ID | STRING | INT | '(' ! orderby_expr ')' !| '[' arglist_expr ']' -> ^( ARRAY_LITERAL arglist_expr ) | PREFIXED_STRING )
int alt26=10;
try { DebugEnterDecision(26, false);
switch (input.LA(1))
{
case ID:
{
switch (input.LA(2))
{
case 43:
{
int LA26_3 = input.LA(3);
if ((LA26_3==44))
{
alt26 = 2;
}
else if ((LA26_3==ID||LA26_3==INT||LA26_3==PREFIXED_STRING||LA26_3==STRING||LA26_3==39||LA26_3==43||LA26_3==57||LA26_3==74))
{
alt26 = 1;
}
else
{
NoViableAltException nvae = new NoViableAltException("", 26, 7, input, 3);
DebugRecognitionException(nvae);
throw nvae;
}
}
break;
case 57:
{
int LA26_3 = input.LA(3);
if ((LA26_3==58))
{
//.........这里部分代码省略.........
示例13: dot_operator
private AstParserRuleReturnScope<object, IToken> dot_operator()
{
EnterRule_dot_operator();
EnterRule("dot_operator", 15);
TraceIn("dot_operator", 15);
AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
retval.Start = (IToken)input.LT(1);
object root_0 = default(object);
IToken char_literal52 = default(IToken);
object char_literal52_tree = default(object);
RewriteRuleITokenStream stream_49=new RewriteRuleITokenStream(adaptor,"token 49");
try { DebugEnterRule(GrammarFileName, "dot_operator");
DebugLocation(152, 1);
try
{
// Queries\\PomonaQuery.g:153:2: ( '.' -> DOT_OP )
DebugEnterAlt(1);
// Queries\\PomonaQuery.g:153:4: '.'
{
DebugLocation(153, 4);
char_literal52=(IToken)Match(input,49,Follow._49_in_dot_operator948);
stream_49.Add(char_literal52);
{
// AST REWRITE
// elements:
// 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();
// 153:8: -> DOT_OP
{
DebugLocation(153, 11);
adaptor.AddChild(root_0, (object)adaptor.Create(DOT_OP, "DOT_OP"));
}
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("dot_operator", 15);
LeaveRule("dot_operator", 15);
LeaveRule_dot_operator();
}
DebugLocation(154, 1);
} finally { DebugExitRule(GrammarFileName, "dot_operator"); }
return retval;
}
示例14: unary_operator
private AstParserRuleReturnScope<object, IToken> unary_operator()
{
EnterRule_unary_operator();
EnterRule("unary_operator", 14);
TraceIn("unary_operator", 14);
AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
retval.Start = (IToken)input.LT(1);
object root_0 = default(object);
IToken string_literal50 = default(IToken);
IToken char_literal51 = default(IToken);
object string_literal50_tree = default(object);
object char_literal51_tree = default(object);
RewriteRuleITokenStream stream_74=new RewriteRuleITokenStream(adaptor,"token 74");
RewriteRuleITokenStream stream_39=new RewriteRuleITokenStream(adaptor,"token 39");
try { DebugEnterRule(GrammarFileName, "unary_operator");
DebugLocation(148, 1);
try
{
// Queries\\PomonaQuery.g:149:2: ( ( 'not' | '!' ) -> NOT_OP )
DebugEnterAlt(1);
// Queries\\PomonaQuery.g:149:4: ( 'not' | '!' )
{
DebugLocation(149, 4);
// Queries\\PomonaQuery.g:149:4: ( 'not' | '!' )
int alt23=2;
try { DebugEnterSubRule(23);
try { DebugEnterDecision(23, false);
int LA23_1 = input.LA(1);
if ((LA23_1==74))
{
alt23 = 1;
}
else if ((LA23_1==39))
{
alt23 = 2;
}
else
{
NoViableAltException nvae = new NoViableAltException("", 23, 0, input, 1);
DebugRecognitionException(nvae);
throw nvae;
}
} finally { DebugExitDecision(23); }
switch (alt23)
{
case 1:
DebugEnterAlt(1);
// Queries\\PomonaQuery.g:149:5: 'not'
{
DebugLocation(149, 5);
string_literal50=(IToken)Match(input,74,Follow._74_in_unary_operator930);
stream_74.Add(string_literal50);
}
break;
case 2:
DebugEnterAlt(2);
// Queries\\PomonaQuery.g:149:11: '!'
{
DebugLocation(149, 11);
char_literal51=(IToken)Match(input,39,Follow._39_in_unary_operator932);
stream_39.Add(char_literal51);
}
break;
}
} finally { DebugExitSubRule(23); }
{
// AST REWRITE
// elements:
// 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();
// 149:16: -> NOT_OP
{
DebugLocation(149, 19);
adaptor.AddChild(root_0, (object)adaptor.Create(NOT_OP, "NOT_OP"));
}
retval.Tree = root_0;
}
}
//.........这里部分代码省略.........
示例15: multiplicative_operator
//.........这里部分代码省略.........
DebugLocation(139, 10);
string_literal41=(IToken)Match(input,72,Follow._72_in_multiplicative_operator852);
stream_72.Add(string_literal41);
}
break;
case 2:
DebugEnterAlt(2);
// Queries\\PomonaQuery.g:139:16: '*'
{
DebugLocation(139, 16);
char_literal42=(IToken)Match(input,45,Follow._45_in_multiplicative_operator854);
stream_45.Add(char_literal42);
}
break;
}
} finally { DebugExitSubRule(18); }
{
// AST REWRITE
// elements:
// 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();
// 139:21: -> MUL_OP
{
DebugLocation(139, 24);
adaptor.AddChild(root_0, (object)adaptor.Create(MUL_OP, "MUL_OP"));
}
retval.Tree = root_0;
}
}
break;
case 2:
DebugEnterAlt(2);
// Queries\\PomonaQuery.g:140:9: ( 'div' | '/' )
{
DebugLocation(140, 9);
// Queries\\PomonaQuery.g:140:9: ( 'div' | '/' )
int alt19=2;
try { DebugEnterSubRule(19);
try { DebugEnterDecision(19, false);
int LA19_1 = input.LA(1);
if ((LA19_1==64))
{
alt19 = 1;
}
else if ((LA19_1==50))
{
alt19 = 2;