本文整理汇总了C#中RewriteRuleSubtreeStream.Add方法的典型用法代码示例。如果您正苦于以下问题:C# RewriteRuleSubtreeStream.Add方法的具体用法?C# RewriteRuleSubtreeStream.Add怎么用?C# RewriteRuleSubtreeStream.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RewriteRuleSubtreeStream
的用法示例。
在下文中一共展示了RewriteRuleSubtreeStream.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: variableDefinition
private AstParserRuleReturnScope<CommonTree, IToken> variableDefinition()
{
EnterRule_variableDefinition();
EnterRule("variableDefinition", 27);
TraceIn("variableDefinition", 27);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken COMMA94 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> decl = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> s = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> modifiers92 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> variableDeclarator93 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> variableDeclarator95 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree COMMA94_tree = default(CommonTree);
RewriteRuleITokenStream stream_COMMA=new RewriteRuleITokenStream(adaptor,"token COMMA");
RewriteRuleSubtreeStream stream_modifiers=new RewriteRuleSubtreeStream(adaptor,"rule modifiers");
RewriteRuleSubtreeStream stream_varOrConst=new RewriteRuleSubtreeStream(adaptor,"rule varOrConst");
RewriteRuleSubtreeStream stream_variableDeclarator=new RewriteRuleSubtreeStream(adaptor,"rule variableDeclarator");
RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
try { DebugEnterRule(GrammarFileName, "variableDefinition");
DebugLocation(295, 1);
try
{
// AS3.g:296:2: ( modifiers decl= varOrConst variableDeclarator ( COMMA variableDeclarator )* s= semi -> ^( VARIABLE_DEF modifiers $decl ( variableDeclarator )+ ) )
DebugEnterAlt(1);
// AS3.g:296:4: modifiers decl= varOrConst variableDeclarator ( COMMA variableDeclarator )* s= semi
{
DebugLocation(296, 4);
PushFollow(Follow._modifiers_in_variableDefinition1619);
modifiers92=modifiers();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_modifiers.Add(modifiers92.Tree);
DebugLocation(297, 7);
PushFollow(Follow._varOrConst_in_variableDefinition1625);
decl=varOrConst();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_varOrConst.Add(decl.Tree);
DebugLocation(297, 19);
PushFollow(Follow._variableDeclarator_in_variableDefinition1627);
variableDeclarator93=variableDeclarator();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_variableDeclarator.Add(variableDeclarator93.Tree);
DebugLocation(298, 3);
// AS3.g:298:3: ( COMMA variableDeclarator )*
try { DebugEnterSubRule(21);
while (true)
{
int alt21=2;
try { DebugEnterDecision(21, false);
int LA21_1 = input.LA(1);
if ((LA21_1==COMMA))
{
alt21 = 1;
}
} finally { DebugExitDecision(21); }
switch ( alt21 )
{
case 1:
DebugEnterAlt(1);
// AS3.g:298:4: COMMA variableDeclarator
{
DebugLocation(298, 4);
COMMA94=(IToken)Match(input,COMMA,Follow._COMMA_in_variableDefinition1632); if (state.failed) return retval;
if (state.backtracking == 0) stream_COMMA.Add(COMMA94);
DebugLocation(298, 10);
PushFollow(Follow._variableDeclarator_in_variableDefinition1634);
variableDeclarator95=variableDeclarator();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_variableDeclarator.Add(variableDeclarator95.Tree);
}
break;
default:
goto loop21;
}
}
loop21:
;
} finally { DebugExitSubRule(21); }
DebugLocation(299, 4);
PushFollow(Follow._semi_in_variableDefinition1642);
s=semi();
PopFollow();
if (state.failed) return retval;
//.........这里部分代码省略.........
示例2: whileStatement
private AstParserRuleReturnScope<CommonTree, IToken> whileStatement()
{
EnterRule_whileStatement();
EnterRule("whileStatement", 67);
TraceIn("whileStatement", 67);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken WHILE215 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> condition216 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> statement217 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree WHILE215_tree = default(CommonTree);
RewriteRuleITokenStream stream_WHILE=new RewriteRuleITokenStream(adaptor,"token WHILE");
RewriteRuleSubtreeStream stream_condition=new RewriteRuleSubtreeStream(adaptor,"rule condition");
RewriteRuleSubtreeStream stream_statement=new RewriteRuleSubtreeStream(adaptor,"rule statement");
try { DebugEnterRule(GrammarFileName, "whileStatement");
DebugLocation(548, 1);
try
{
// AS3.g:549:2: ( WHILE condition statement -> ^( WHILE_LOOP condition statement ) )
DebugEnterAlt(1);
// AS3.g:549:4: WHILE condition statement
{
DebugLocation(549, 4);
WHILE215=(IToken)Match(input,WHILE,Follow._WHILE_in_whileStatement2962); if (state.failed) return retval;
if (state.backtracking == 0) stream_WHILE.Add(WHILE215);
DebugLocation(549, 10);
PushFollow(Follow._condition_in_whileStatement2964);
condition216=condition();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_condition.Add(condition216.Tree);
DebugLocation(549, 20);
PushFollow(Follow._statement_in_whileStatement2966);
statement217=statement();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_statement.Add(statement217.Tree);
{
// AST REWRITE
// elements: condition, statement
// 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();
// 550:3: -> ^( WHILE_LOOP condition statement )
{
DebugLocation(550, 6);
// AS3.g:550:6: ^( WHILE_LOOP condition statement )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(550, 8);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(WHILE_LOOP, "WHILE_LOOP"), root_1);
DebugLocation(550, 19);
adaptor.AddChild(root_1, stream_condition.NextTree());
DebugLocation(550, 29);
adaptor.AddChild(root_1, stream_statement.NextTree());
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("whileStatement", 67);
LeaveRule("whileStatement", 67);
//.........这里部分代码省略.........
示例3: defaultXMLNamespaceStatement
private AstParserRuleReturnScope<CommonTree, IToken> defaultXMLNamespaceStatement()
{
EnterRule_defaultXMLNamespaceStatement();
EnterRule("defaultXMLNamespaceStatement", 70);
TraceIn("defaultXMLNamespaceStatement", 70);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken DEFAULT226 = default(IToken);
IToken XML227 = default(IToken);
IToken NAMESPACE228 = default(IToken);
IToken ASSIGN229 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> expression230 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> semi231 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree DEFAULT226_tree = default(CommonTree);
CommonTree XML227_tree = default(CommonTree);
CommonTree NAMESPACE228_tree = default(CommonTree);
CommonTree ASSIGN229_tree = default(CommonTree);
RewriteRuleITokenStream stream_DEFAULT=new RewriteRuleITokenStream(adaptor,"token DEFAULT");
RewriteRuleITokenStream stream_XML=new RewriteRuleITokenStream(adaptor,"token XML");
RewriteRuleITokenStream stream_NAMESPACE=new RewriteRuleITokenStream(adaptor,"token NAMESPACE");
RewriteRuleITokenStream stream_ASSIGN=new RewriteRuleITokenStream(adaptor,"token ASSIGN");
RewriteRuleSubtreeStream stream_expression=new RewriteRuleSubtreeStream(adaptor,"rule expression");
RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
try { DebugEnterRule(GrammarFileName, "defaultXMLNamespaceStatement");
DebugLocation(562, 1);
try
{
// AS3.g:563:2: ( DEFAULT XML NAMESPACE ASSIGN expression semi -> ^( DEFAULT_XML_NAMESPACE expression ) )
DebugEnterAlt(1);
// AS3.g:563:4: DEFAULT XML NAMESPACE ASSIGN expression semi
{
DebugLocation(563, 4);
DEFAULT226=(IToken)Match(input,DEFAULT,Follow._DEFAULT_in_defaultXMLNamespaceStatement3040); if (state.failed) return retval;
if (state.backtracking == 0) stream_DEFAULT.Add(DEFAULT226);
DebugLocation(563, 12);
XML227=(IToken)Match(input,XML,Follow._XML_in_defaultXMLNamespaceStatement3042); if (state.failed) return retval;
if (state.backtracking == 0) stream_XML.Add(XML227);
DebugLocation(563, 16);
NAMESPACE228=(IToken)Match(input,NAMESPACE,Follow._NAMESPACE_in_defaultXMLNamespaceStatement3044); if (state.failed) return retval;
if (state.backtracking == 0) stream_NAMESPACE.Add(NAMESPACE228);
DebugLocation(563, 26);
ASSIGN229=(IToken)Match(input,ASSIGN,Follow._ASSIGN_in_defaultXMLNamespaceStatement3046); if (state.failed) return retval;
if (state.backtracking == 0) stream_ASSIGN.Add(ASSIGN229);
DebugLocation(563, 33);
PushFollow(Follow._expression_in_defaultXMLNamespaceStatement3048);
expression230=expression();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_expression.Add(expression230.Tree);
DebugLocation(563, 44);
PushFollow(Follow._semi_in_defaultXMLNamespaceStatement3050);
semi231=semi();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_semi.Add(semi231.Tree);
{
// AST REWRITE
// elements: expression
// 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();
// 564:3: -> ^( DEFAULT_XML_NAMESPACE expression )
{
DebugLocation(564, 6);
// AS3.g:564:6: ^( DEFAULT_XML_NAMESPACE expression )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(564, 8);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(DEFAULT_XML_NAMESPACE, "DEFAULT_XML_NAMESPACE"), root_1);
DebugLocation(564, 30);
adaptor.AddChild(root_1, stream_expression.NextTree());
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;
}
}
}
//.........这里部分代码省略.........
示例4: forEachStatement
private AstParserRuleReturnScope<CommonTree, IToken> forEachStatement()
{
EnterRule_forEachStatement();
EnterRule("forEachStatement", 58);
TraceIn("forEachStatement", 58);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken f = default(IToken);
IToken EACH185 = default(IToken);
IToken LPAREN186 = default(IToken);
IToken RPAREN188 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> forInClause187 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> statement189 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree f_tree = default(CommonTree);
CommonTree EACH185_tree = default(CommonTree);
CommonTree LPAREN186_tree = default(CommonTree);
CommonTree RPAREN188_tree = default(CommonTree);
RewriteRuleITokenStream stream_FOR=new RewriteRuleITokenStream(adaptor,"token FOR");
RewriteRuleITokenStream stream_EACH=new RewriteRuleITokenStream(adaptor,"token EACH");
RewriteRuleITokenStream stream_LPAREN=new RewriteRuleITokenStream(adaptor,"token LPAREN");
RewriteRuleITokenStream stream_RPAREN=new RewriteRuleITokenStream(adaptor,"token RPAREN");
RewriteRuleSubtreeStream stream_forInClause=new RewriteRuleSubtreeStream(adaptor,"rule forInClause");
RewriteRuleSubtreeStream stream_statement=new RewriteRuleSubtreeStream(adaptor,"rule statement");
try { DebugEnterRule(GrammarFileName, "forEachStatement");
DebugLocation(491, 1);
try
{
// AS3.g:492:2: (f= FOR EACH LPAREN forInClause RPAREN statement -> ^( FOR_EACH_LOOP $f forInClause statement ) )
DebugEnterAlt(1);
// AS3.g:492:4: f= FOR EACH LPAREN forInClause RPAREN statement
{
DebugLocation(492, 5);
f=(IToken)Match(input,FOR,Follow._FOR_in_forEachStatement2672); if (state.failed) return retval;
if (state.backtracking == 0) stream_FOR.Add(f);
DebugLocation(492, 10);
EACH185=(IToken)Match(input,EACH,Follow._EACH_in_forEachStatement2674); if (state.failed) return retval;
if (state.backtracking == 0) stream_EACH.Add(EACH185);
DebugLocation(493, 3);
LPAREN186=(IToken)Match(input,LPAREN,Follow._LPAREN_in_forEachStatement2678); if (state.failed) return retval;
if (state.backtracking == 0) stream_LPAREN.Add(LPAREN186);
DebugLocation(494, 3);
PushFollow(Follow._forInClause_in_forEachStatement2682);
forInClause187=forInClause();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_forInClause.Add(forInClause187.Tree);
DebugLocation(495, 3);
RPAREN188=(IToken)Match(input,RPAREN,Follow._RPAREN_in_forEachStatement2686); if (state.failed) return retval;
if (state.backtracking == 0) stream_RPAREN.Add(RPAREN188);
DebugLocation(496, 3);
PushFollow(Follow._statement_in_forEachStatement2690);
statement189=statement();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_statement.Add(statement189.Tree);
{
// AST REWRITE
// elements: f, forInClause, statement
// token labels: f
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
if (state.backtracking == 0) {
retval.Tree = root_0;
RewriteRuleITokenStream stream_f=new RewriteRuleITokenStream(adaptor,"token f",f);
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);
root_0 = (CommonTree)adaptor.Nil();
// 497:3: -> ^( FOR_EACH_LOOP $f forInClause statement )
{
DebugLocation(497, 6);
// AS3.g:497:6: ^( FOR_EACH_LOOP $f forInClause statement )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(497, 8);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(FOR_EACH_LOOP, "FOR_EACH_LOOP"), root_1);
DebugLocation(497, 23);
adaptor.AddChild(root_1, stream_f.NextNode());
DebugLocation(497, 25);
adaptor.AddChild(root_1, stream_forInClause.NextTree());
DebugLocation(497, 37);
adaptor.AddChild(root_1, stream_statement.NextTree());
adaptor.AddChild(root_0, root_1);
}
}
//.........这里部分代码省略.........
示例5: packageDecl
private AstParserRuleReturnScope<CommonTree, IToken> packageDecl()
{
EnterRule_packageDecl();
EnterRule("packageDecl", 5);
TraceIn("packageDecl", 5);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken PACKAGE11 = default(IToken);
IToken LCURLY13 = default(IToken);
IToken RCURLY15 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> identifierStar12 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> packageBlockEntry14 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree PACKAGE11_tree = default(CommonTree);
CommonTree LCURLY13_tree = default(CommonTree);
CommonTree RCURLY15_tree = default(CommonTree);
RewriteRuleITokenStream stream_PACKAGE=new RewriteRuleITokenStream(adaptor,"token PACKAGE");
RewriteRuleITokenStream stream_LCURLY=new RewriteRuleITokenStream(adaptor,"token LCURLY");
RewriteRuleITokenStream stream_RCURLY=new RewriteRuleITokenStream(adaptor,"token RCURLY");
RewriteRuleSubtreeStream stream_identifierStar=new RewriteRuleSubtreeStream(adaptor,"rule identifierStar");
RewriteRuleSubtreeStream stream_packageBlockEntry=new RewriteRuleSubtreeStream(adaptor,"rule packageBlockEntry");
try { DebugEnterRule(GrammarFileName, "packageDecl");
DebugLocation(139, 1);
try
{
// AS3.g:140:2: ( PACKAGE ( identifierStar )? LCURLY ( packageBlockEntry )* RCURLY -> ^( PACKAGE_DECL PACKAGE ( identifierStar )? LCURLY ( packageBlockEntry )* RCURLY ) )
DebugEnterAlt(1);
// AS3.g:140:4: PACKAGE ( identifierStar )? LCURLY ( packageBlockEntry )* RCURLY
{
DebugLocation(140, 4);
PACKAGE11=(IToken)Match(input,PACKAGE,Follow._PACKAGE_in_packageDecl590); if (state.failed) return retval;
if (state.backtracking == 0) stream_PACKAGE.Add(PACKAGE11);
DebugLocation(140, 12);
// AS3.g:140:12: ( identifierStar )?
int alt5=2;
try { DebugEnterSubRule(5);
try { DebugEnterDecision(5, false);
int LA5_1 = input.LA(1);
if ((LA5_1==AS||LA5_1==DYNAMIC||LA5_1==GET||LA5_1==IDENT||LA5_1==IS||LA5_1==NAMESPACE||LA5_1==SET||LA5_1==SUPER||LA5_1==USE||LA5_1==XML))
{
alt5 = 1;
}
} finally { DebugExitDecision(5); }
switch (alt5)
{
case 1:
DebugEnterAlt(1);
// AS3.g:140:12: identifierStar
{
DebugLocation(140, 12);
PushFollow(Follow._identifierStar_in_packageDecl592);
identifierStar12=identifierStar();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_identifierStar.Add(identifierStar12.Tree);
}
break;
}
} finally { DebugExitSubRule(5); }
DebugLocation(141, 3);
LCURLY13=(IToken)Match(input,LCURLY,Follow._LCURLY_in_packageDecl597); if (state.failed) return retval;
if (state.backtracking == 0) stream_LCURLY.Add(LCURLY13);
DebugLocation(142, 9);
// AS3.g:142:9: ( packageBlockEntry )*
try { DebugEnterSubRule(6);
while (true)
{
int alt6=2;
try { DebugEnterDecision(6, false);
int LA6_1 = input.LA(1);
if ((LA6_1==AS||LA6_1==BNOT||LA6_1==BREAK||LA6_1==CLASS||LA6_1==CONST||LA6_1==CONTINUE||(LA6_1>=DEC && LA6_1<=DECIMAL_LITERAL)||LA6_1==DEFAULT||LA6_1==DO||(LA6_1>=DYNAMIC && LA6_1<=E4X_ATTRI)||(LA6_1>=FALSE && LA6_1<=FOR)||LA6_1==FUNCTION||LA6_1==GET||(LA6_1>=HEX_LITERAL && LA6_1<=IDENT)||LA6_1==IF||LA6_1==IMPORT||LA6_1==INC||LA6_1==INTERFACE||(LA6_1>=INTERNAL && LA6_1<=IS)||(LA6_1>=LBRACK && LA6_1<=LCURLY)||LA6_1==LNOT||LA6_1==LPAREN||LA6_1==MINUS||LA6_1==NAMESPACE||LA6_1==NEW||LA6_1==NULL||LA6_1==OCTAL_LITERAL||LA6_1==PLUS||LA6_1==PRIVATE||(LA6_1>=PROTECTED && LA6_1<=PUBLIC)||LA6_1==REGEX_LITERAL||LA6_1==RETURN||(LA6_1>=SEMI && LA6_1<=SET)||LA6_1==STATIC||(LA6_1>=STRING_LITERAL_DOUBLE && LA6_1<=SWITCH)||LA6_1==TRUE||(LA6_1>=USE && LA6_1<=VAR)||LA6_1==WHILE||LA6_1==WITH||LA6_1==XML||LA6_1==XML_LITERAL||(LA6_1>=243 && LA6_1<=246)||LA6_1==248||LA6_1==250||(LA6_1>=252 && LA6_1<=257)))
{
alt6 = 1;
}
} finally { DebugExitDecision(6); }
switch ( alt6 )
{
case 1:
DebugEnterAlt(1);
// AS3.g:142:9: packageBlockEntry
{
DebugLocation(142, 9);
PushFollow(Follow._packageBlockEntry_in_packageDecl608);
packageBlockEntry14=packageBlockEntry();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_packageBlockEntry.Add(packageBlockEntry14.Tree);
//.........这里部分代码省略.........
示例6: breakStatement
private AstParserRuleReturnScope<CommonTree, IToken> breakStatement()
{
EnterRule_breakStatement();
EnterRule("breakStatement", 52);
TraceIn("breakStatement", 52);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken BREAK171 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> s = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree BREAK171_tree = default(CommonTree);
RewriteRuleITokenStream stream_BREAK=new RewriteRuleITokenStream(adaptor,"token BREAK");
RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
try { DebugEnterRule(GrammarFileName, "breakStatement");
DebugLocation(460, 1);
try
{
// AS3.g:461:2: ( BREAK s= semi -> ^( BREAK_STATEMENT BREAK ) )
DebugEnterAlt(1);
// AS3.g:461:4: BREAK s= semi
{
DebugLocation(461, 4);
BREAK171=(IToken)Match(input,BREAK,Follow._BREAK_in_breakStatement2495); if (state.failed) return retval;
if (state.backtracking == 0) stream_BREAK.Add(BREAK171);
DebugLocation(461, 11);
PushFollow(Follow._semi_in_breakStatement2499);
s=semi();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_semi.Add(s.Tree);
{
// AST REWRITE
// elements: BREAK
// 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();
// 462:9: -> ^( BREAK_STATEMENT BREAK )
{
DebugLocation(462, 12);
// AS3.g:462:12: ^( BREAK_STATEMENT BREAK )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(462, 14);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(BREAK_STATEMENT, "BREAK_STATEMENT"), root_1);
DebugLocation(462, 30);
adaptor.AddChild(root_1, stream_BREAK.NextNode());
DebugLocation(462, 36);
adaptor.AddChild(root_1, maybeSemi(s));
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("breakStatement", 52);
LeaveRule("breakStatement", 52);
LeaveRule_breakStatement();
}
DebugLocation(463, 1);
} finally { DebugExitRule(GrammarFileName, "breakStatement"); }
return retval;
}
示例7: switchBlock
private AstParserRuleReturnScope<CommonTree, IToken> switchBlock()
{
EnterRule_switchBlock();
EnterRule("switchBlock", 54);
TraceIn("switchBlock", 54);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken LCURLY175 = default(IToken);
IToken RCURLY178 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> caseStatement176 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> defaultStatement177 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree LCURLY175_tree = default(CommonTree);
CommonTree RCURLY178_tree = default(CommonTree);
RewriteRuleITokenStream stream_LCURLY=new RewriteRuleITokenStream(adaptor,"token LCURLY");
RewriteRuleITokenStream stream_RCURLY=new RewriteRuleITokenStream(adaptor,"token RCURLY");
RewriteRuleSubtreeStream stream_caseStatement=new RewriteRuleSubtreeStream(adaptor,"rule caseStatement");
RewriteRuleSubtreeStream stream_defaultStatement=new RewriteRuleSubtreeStream(adaptor,"rule defaultStatement");
try { DebugEnterRule(GrammarFileName, "switchBlock");
DebugLocation(471, 1);
try
{
// AS3.g:472:2: ( LCURLY ( caseStatement )* ( defaultStatement )? RCURLY -> ^( BLOCK ( caseStatement )* ( defaultStatement )? ) )
DebugEnterAlt(1);
// AS3.g:472:4: LCURLY ( caseStatement )* ( defaultStatement )? RCURLY
{
DebugLocation(472, 4);
LCURLY175=(IToken)Match(input,LCURLY,Follow._LCURLY_in_switchBlock2565); if (state.failed) return retval;
if (state.backtracking == 0) stream_LCURLY.Add(LCURLY175);
DebugLocation(473, 3);
// AS3.g:473:3: ( caseStatement )*
try { DebugEnterSubRule(40);
while (true)
{
int alt40=2;
try { DebugEnterDecision(40, false);
int LA40_1 = input.LA(1);
if ((LA40_1==CASE))
{
alt40 = 1;
}
} finally { DebugExitDecision(40); }
switch ( alt40 )
{
case 1:
DebugEnterAlt(1);
// AS3.g:473:4: caseStatement
{
DebugLocation(473, 4);
PushFollow(Follow._caseStatement_in_switchBlock2570);
caseStatement176=caseStatement();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_caseStatement.Add(caseStatement176.Tree);
}
break;
default:
goto loop40;
}
}
loop40:
;
} finally { DebugExitSubRule(40); }
DebugLocation(474, 3);
// AS3.g:474:3: ( defaultStatement )?
int alt41=2;
try { DebugEnterSubRule(41);
try { DebugEnterDecision(41, false);
int LA41_1 = input.LA(1);
if ((LA41_1==DEFAULT))
{
alt41 = 1;
}
} finally { DebugExitDecision(41); }
switch (alt41)
{
case 1:
DebugEnterAlt(1);
// AS3.g:474:4: defaultStatement
{
DebugLocation(474, 4);
PushFollow(Follow._defaultStatement_in_switchBlock2577);
defaultStatement177=defaultStatement();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_defaultStatement.Add(defaultStatement177.Tree);
//.........这里部分代码省略.........
示例8: parameterRestDeclaration
private AstParserRuleReturnScope<CommonTree, IToken> parameterRestDeclaration()
{
EnterRule_parameterRestDeclaration();
EnterRule("parameterRestDeclaration", 37);
TraceIn("parameterRestDeclaration", 37);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken REST120 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> ident121 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> typeExpression122 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree REST120_tree = default(CommonTree);
RewriteRuleITokenStream stream_REST=new RewriteRuleITokenStream(adaptor,"token REST");
RewriteRuleSubtreeStream stream_ident=new RewriteRuleSubtreeStream(adaptor,"rule ident");
RewriteRuleSubtreeStream stream_typeExpression=new RewriteRuleSubtreeStream(adaptor,"rule typeExpression");
try { DebugEnterRule(GrammarFileName, "parameterRestDeclaration");
DebugLocation(353, 1);
try
{
// AS3.g:354:2: ( REST ( ident )? ( typeExpression )? -> ^( PARAM REST ( ident )? ( typeExpression )? ) )
DebugEnterAlt(1);
// AS3.g:354:4: REST ( ident )? ( typeExpression )?
{
DebugLocation(354, 4);
REST120=(IToken)Match(input,REST,Follow._REST_in_parameterRestDeclaration1932); if (state.failed) return retval;
if (state.backtracking == 0) stream_REST.Add(REST120);
DebugLocation(354, 9);
// AS3.g:354:9: ( ident )?
int alt31=2;
try { DebugEnterSubRule(31);
try { DebugEnterDecision(31, false);
int LA31_1 = input.LA(1);
if ((LA31_1==AS||LA31_1==DYNAMIC||LA31_1==GET||LA31_1==IDENT||LA31_1==IS||LA31_1==NAMESPACE||LA31_1==SET||LA31_1==SUPER||LA31_1==USE||LA31_1==XML))
{
alt31 = 1;
}
} finally { DebugExitDecision(31); }
switch (alt31)
{
case 1:
DebugEnterAlt(1);
// AS3.g:354:9: ident
{
DebugLocation(354, 9);
PushFollow(Follow._ident_in_parameterRestDeclaration1934);
ident121=ident();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_ident.Add(ident121.Tree);
}
break;
}
} finally { DebugExitSubRule(31); }
DebugLocation(354, 16);
// AS3.g:354:16: ( typeExpression )?
int alt32=2;
try { DebugEnterSubRule(32);
try { DebugEnterDecision(32, false);
int LA32_1 = input.LA(1);
if ((LA32_1==COLON))
{
alt32 = 1;
}
} finally { DebugExitDecision(32); }
switch (alt32)
{
case 1:
DebugEnterAlt(1);
// AS3.g:354:16: typeExpression
{
DebugLocation(354, 16);
PushFollow(Follow._typeExpression_in_parameterRestDeclaration1937);
typeExpression122=typeExpression();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_typeExpression.Add(typeExpression122.Tree);
}
break;
}
} finally { DebugExitSubRule(32); }
{
// AST REWRITE
// elements: REST, ident, typeExpression
// token labels:
// rule labels: retval
// token list labels:
//.........这里部分代码省略.........
示例9: block
private AstParserRuleReturnScope<CommonTree, IToken> block()
{
EnterRule_block();
EnterRule("block", 38);
TraceIn("block", 38);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken LCURLY123 = default(IToken);
IToken RCURLY125 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> blockEntry124 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree LCURLY123_tree = default(CommonTree);
CommonTree RCURLY125_tree = default(CommonTree);
RewriteRuleITokenStream stream_LCURLY=new RewriteRuleITokenStream(adaptor,"token LCURLY");
RewriteRuleITokenStream stream_RCURLY=new RewriteRuleITokenStream(adaptor,"token RCURLY");
RewriteRuleSubtreeStream stream_blockEntry=new RewriteRuleSubtreeStream(adaptor,"rule blockEntry");
try { DebugEnterRule(GrammarFileName, "block");
DebugLocation(357, 1);
try
{
// AS3.g:358:2: ( LCURLY ( blockEntry )* RCURLY -> ^( BLOCK LCURLY ( blockEntry )* RCURLY ) )
DebugEnterAlt(1);
// AS3.g:358:4: LCURLY ( blockEntry )* RCURLY
{
DebugLocation(358, 4);
LCURLY123=(IToken)Match(input,LCURLY,Follow._LCURLY_in_block1964); if (state.failed) return retval;
if (state.backtracking == 0) stream_LCURLY.Add(LCURLY123);
DebugLocation(358, 11);
// AS3.g:358:11: ( blockEntry )*
try { DebugEnterSubRule(33);
while (true)
{
int alt33=2;
try { DebugEnterDecision(33, false);
int LA33_1 = input.LA(1);
if ((LA33_1==AS||LA33_1==BNOT||LA33_1==BREAK||LA33_1==CONST||LA33_1==CONTINUE||(LA33_1>=DEC && LA33_1<=DECIMAL_LITERAL)||LA33_1==DEFAULT||LA33_1==DO||(LA33_1>=DYNAMIC && LA33_1<=E4X_ATTRI)||(LA33_1>=FALSE && LA33_1<=FOR)||LA33_1==FUNCTION||LA33_1==GET||(LA33_1>=HEX_LITERAL && LA33_1<=IDENT)||LA33_1==IF||LA33_1==INC||(LA33_1>=INTERNAL && LA33_1<=IS)||(LA33_1>=LBRACK && LA33_1<=LCURLY)||LA33_1==LNOT||LA33_1==LPAREN||LA33_1==MINUS||LA33_1==NAMESPACE||LA33_1==NEW||LA33_1==NULL||LA33_1==OCTAL_LITERAL||LA33_1==PLUS||LA33_1==PRIVATE||(LA33_1>=PROTECTED && LA33_1<=PUBLIC)||LA33_1==REGEX_LITERAL||LA33_1==RETURN||(LA33_1>=SEMI && LA33_1<=SET)||(LA33_1>=STRING_LITERAL_DOUBLE && LA33_1<=SWITCH)||LA33_1==TRUE||(LA33_1>=USE && LA33_1<=VAR)||LA33_1==WHILE||LA33_1==WITH||LA33_1==XML||LA33_1==XML_LITERAL||LA33_1==243||(LA33_1>=253 && LA33_1<=257)))
{
alt33 = 1;
}
} finally { DebugExitDecision(33); }
switch ( alt33 )
{
case 1:
DebugEnterAlt(1);
// AS3.g:358:11: blockEntry
{
DebugLocation(358, 11);
PushFollow(Follow._blockEntry_in_block1966);
blockEntry124=blockEntry();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_blockEntry.Add(blockEntry124.Tree);
}
break;
default:
goto loop33;
}
}
loop33:
;
} finally { DebugExitSubRule(33); }
DebugLocation(358, 23);
RCURLY125=(IToken)Match(input,RCURLY,Follow._RCURLY_in_block1969); if (state.failed) return retval;
if (state.backtracking == 0) stream_RCURLY.Add(RCURLY125);
{
// AST REWRITE
// elements: LCURLY, blockEntry, RCURLY
// 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();
// 359:3: -> ^( BLOCK LCURLY ( blockEntry )* RCURLY )
{
DebugLocation(359, 6);
// AS3.g:359:6: ^( BLOCK LCURLY ( blockEntry )* RCURLY )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(359, 8);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(BLOCK, "BLOCK"), root_1);
//.........这里部分代码省略.........
示例10: parameterDeclarationList
private AstParserRuleReturnScope<CommonTree, IToken> parameterDeclarationList()
{
EnterRule_parameterDeclarationList();
EnterRule("parameterDeclarationList", 33);
TraceIn("parameterDeclarationList", 33);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken LPAREN107 = default(IToken);
IToken COMMA109 = default(IToken);
IToken RPAREN111 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> parameterDeclaration108 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> parameterDeclaration110 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree LPAREN107_tree = default(CommonTree);
CommonTree COMMA109_tree = default(CommonTree);
CommonTree RPAREN111_tree = default(CommonTree);
RewriteRuleITokenStream stream_LPAREN=new RewriteRuleITokenStream(adaptor,"token LPAREN");
RewriteRuleITokenStream stream_COMMA=new RewriteRuleITokenStream(adaptor,"token COMMA");
RewriteRuleITokenStream stream_RPAREN=new RewriteRuleITokenStream(adaptor,"token RPAREN");
RewriteRuleSubtreeStream stream_parameterDeclaration=new RewriteRuleSubtreeStream(adaptor,"rule parameterDeclaration");
try { DebugEnterRule(GrammarFileName, "parameterDeclarationList");
DebugLocation(329, 1);
try
{
// AS3.g:330:2: ( LPAREN ( parameterDeclaration ( COMMA parameterDeclaration )* )? RPAREN -> ^( PARAMS LPAREN ( parameterDeclaration )* RPAREN ) )
DebugEnterAlt(1);
// AS3.g:330:4: LPAREN ( parameterDeclaration ( COMMA parameterDeclaration )* )? RPAREN
{
DebugLocation(330, 4);
LPAREN107=(IToken)Match(input,LPAREN,Follow._LPAREN_in_parameterDeclarationList1810); if (state.failed) return retval;
if (state.backtracking == 0) stream_LPAREN.Add(LPAREN107);
DebugLocation(331, 3);
// AS3.g:331:3: ( parameterDeclaration ( COMMA parameterDeclaration )* )?
int alt26=2;
try { DebugEnterSubRule(26);
try { DebugEnterDecision(26, false);
int LA26_1 = input.LA(1);
if ((LA26_1==AS||LA26_1==CONST||LA26_1==DYNAMIC||LA26_1==GET||LA26_1==IDENT||LA26_1==IS||LA26_1==NAMESPACE||LA26_1==REST||LA26_1==SET||LA26_1==SUPER||LA26_1==USE||LA26_1==XML))
{
alt26 = 1;
}
} finally { DebugExitDecision(26); }
switch (alt26)
{
case 1:
DebugEnterAlt(1);
// AS3.g:331:5: parameterDeclaration ( COMMA parameterDeclaration )*
{
DebugLocation(331, 5);
PushFollow(Follow._parameterDeclaration_in_parameterDeclarationList1816);
parameterDeclaration108=parameterDeclaration();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_parameterDeclaration.Add(parameterDeclaration108.Tree);
DebugLocation(332, 4);
// AS3.g:332:4: ( COMMA parameterDeclaration )*
try { DebugEnterSubRule(25);
while (true)
{
int alt25=2;
try { DebugEnterDecision(25, false);
int LA25_1 = input.LA(1);
if ((LA25_1==COMMA))
{
alt25 = 1;
}
} finally { DebugExitDecision(25); }
switch ( alt25 )
{
case 1:
DebugEnterAlt(1);
// AS3.g:332:5: COMMA parameterDeclaration
{
DebugLocation(332, 5);
COMMA109=(IToken)Match(input,COMMA,Follow._COMMA_in_parameterDeclarationList1822); if (state.failed) return retval;
if (state.backtracking == 0) stream_COMMA.Add(COMMA109);
DebugLocation(332, 11);
PushFollow(Follow._parameterDeclaration_in_parameterDeclarationList1824);
parameterDeclaration110=parameterDeclaration();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_parameterDeclaration.Add(parameterDeclaration110.Tree);
}
break;
default:
goto loop25;
}
}
//.........这里部分代码省略.........
示例11: basicParameterDeclaration
private AstParserRuleReturnScope<CommonTree, IToken> basicParameterDeclaration()
{
EnterRule_basicParameterDeclaration();
EnterRule("basicParameterDeclaration", 35);
TraceIn("basicParameterDeclaration", 35);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken CONST114 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> ident115 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> typeExpression116 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> parameterDefault117 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree CONST114_tree = default(CommonTree);
RewriteRuleITokenStream stream_CONST=new RewriteRuleITokenStream(adaptor,"token CONST");
RewriteRuleSubtreeStream stream_ident=new RewriteRuleSubtreeStream(adaptor,"rule ident");
RewriteRuleSubtreeStream stream_typeExpression=new RewriteRuleSubtreeStream(adaptor,"rule typeExpression");
RewriteRuleSubtreeStream stream_parameterDefault=new RewriteRuleSubtreeStream(adaptor,"rule parameterDefault");
try { DebugEnterRule(GrammarFileName, "basicParameterDeclaration");
DebugLocation(343, 1);
try
{
// AS3.g:344:2: ( ( CONST )? ident ( typeExpression )? ( parameterDefault )? -> ^( PARAM ( CONST )? ident ( typeExpression )? ( parameterDefault )? ) )
DebugEnterAlt(1);
// AS3.g:344:4: ( CONST )? ident ( typeExpression )? ( parameterDefault )?
{
DebugLocation(344, 4);
// AS3.g:344:4: ( CONST )?
int alt28=2;
try { DebugEnterSubRule(28);
try { DebugEnterDecision(28, false);
int LA28_1 = input.LA(1);
if ((LA28_1==CONST))
{
alt28 = 1;
}
} finally { DebugExitDecision(28); }
switch (alt28)
{
case 1:
DebugEnterAlt(1);
// AS3.g:344:4: CONST
{
DebugLocation(344, 4);
CONST114=(IToken)Match(input,CONST,Follow._CONST_in_basicParameterDeclaration1877); if (state.failed) return retval;
if (state.backtracking == 0) stream_CONST.Add(CONST114);
}
break;
}
} finally { DebugExitSubRule(28); }
DebugLocation(344, 11);
PushFollow(Follow._ident_in_basicParameterDeclaration1880);
ident115=ident();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_ident.Add(ident115.Tree);
DebugLocation(344, 17);
// AS3.g:344:17: ( typeExpression )?
int alt29=2;
try { DebugEnterSubRule(29);
try { DebugEnterDecision(29, false);
int LA29_1 = input.LA(1);
if ((LA29_1==COLON))
{
alt29 = 1;
}
} finally { DebugExitDecision(29); }
switch (alt29)
{
case 1:
DebugEnterAlt(1);
// AS3.g:344:17: typeExpression
{
DebugLocation(344, 17);
PushFollow(Follow._typeExpression_in_basicParameterDeclaration1882);
typeExpression116=typeExpression();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_typeExpression.Add(typeExpression116.Tree);
}
break;
}
} finally { DebugExitSubRule(29); }
DebugLocation(344, 33);
// AS3.g:344:33: ( parameterDefault )?
int alt30=2;
try { DebugEnterSubRule(30);
try { DebugEnterDecision(30, false);
int LA30_1 = input.LA(1);
//.........这里部分代码省略.........
示例12: variableDeclarator
private AstParserRuleReturnScope<CommonTree, IToken> variableDeclarator()
{
EnterRule_variableDeclarator();
EnterRule("variableDeclarator", 32);
TraceIn("variableDeclarator", 32);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
AstParserRuleReturnScope<CommonTree, IToken> ident104 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> typeExpression105 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> variableInitializer106 = default(AstParserRuleReturnScope<CommonTree, IToken>);
RewriteRuleSubtreeStream stream_ident=new RewriteRuleSubtreeStream(adaptor,"rule ident");
RewriteRuleSubtreeStream stream_typeExpression=new RewriteRuleSubtreeStream(adaptor,"rule typeExpression");
RewriteRuleSubtreeStream stream_variableInitializer=new RewriteRuleSubtreeStream(adaptor,"rule variableInitializer");
try { DebugEnterRule(GrammarFileName, "variableDeclarator");
DebugLocation(321, 1);
try
{
// AS3.g:322:2: ( ident ( typeExpression )? ( variableInitializer )? -> ^( VAR_DECLARATION ident ( typeExpression )? ( variableInitializer )? ) )
DebugEnterAlt(1);
// AS3.g:322:4: ident ( typeExpression )? ( variableInitializer )?
{
DebugLocation(322, 4);
PushFollow(Follow._ident_in_variableDeclarator1768);
ident104=ident();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_ident.Add(ident104.Tree);
DebugLocation(322, 10);
// AS3.g:322:10: ( typeExpression )?
int alt23=2;
try { DebugEnterSubRule(23);
try { DebugEnterDecision(23, false);
int LA23_1 = input.LA(1);
if ((LA23_1==COLON))
{
alt23 = 1;
}
} finally { DebugExitDecision(23); }
switch (alt23)
{
case 1:
DebugEnterAlt(1);
// AS3.g:322:10: typeExpression
{
DebugLocation(322, 10);
PushFollow(Follow._typeExpression_in_variableDeclarator1770);
typeExpression105=typeExpression();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_typeExpression.Add(typeExpression105.Tree);
}
break;
}
} finally { DebugExitSubRule(23); }
DebugLocation(322, 26);
// AS3.g:322:26: ( variableInitializer )?
int alt24=2;
try { DebugEnterSubRule(24);
try { DebugEnterDecision(24, false);
int LA24_1 = input.LA(1);
if ((LA24_1==ASSIGN))
{
alt24 = 1;
}
} finally { DebugExitDecision(24); }
switch (alt24)
{
case 1:
DebugEnterAlt(1);
// AS3.g:322:26: variableInitializer
{
DebugLocation(322, 26);
PushFollow(Follow._variableInitializer_in_variableDeclarator1773);
variableInitializer106=variableInitializer();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_variableInitializer.Add(variableInitializer106.Tree);
}
break;
}
} finally { DebugExitSubRule(24); }
{
// AST REWRITE
// elements: ident, typeExpression, variableInitializer
// token labels:
// rule labels: retval
//.........这里部分代码省略.........
示例13: variableInitializer
private AstParserRuleReturnScope<CommonTree, IToken> variableInitializer()
{
EnterRule_variableInitializer();
EnterRule("variableInitializer", 31);
TraceIn("variableInitializer", 31);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken ASSIGN102 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> expression103 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree ASSIGN102_tree = default(CommonTree);
RewriteRuleITokenStream stream_ASSIGN=new RewriteRuleITokenStream(adaptor,"token ASSIGN");
RewriteRuleSubtreeStream stream_expression=new RewriteRuleSubtreeStream(adaptor,"rule expression");
try { DebugEnterRule(GrammarFileName, "variableInitializer");
DebugLocation(316, 1);
try
{
// AS3.g:317:2: ( ASSIGN expression -> ^( VAR_INITIALIZER ASSIGN expression ) )
DebugEnterAlt(1);
// AS3.g:317:4: ASSIGN expression
{
DebugLocation(317, 4);
ASSIGN102=(IToken)Match(input,ASSIGN,Follow._ASSIGN_in_variableInitializer1737); if (state.failed) return retval;
if (state.backtracking == 0) stream_ASSIGN.Add(ASSIGN102);
DebugLocation(317, 11);
PushFollow(Follow._expression_in_variableInitializer1739);
expression103=expression();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_expression.Add(expression103.Tree);
{
// AST REWRITE
// elements: ASSIGN, expression
// 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();
// 318:9: -> ^( VAR_INITIALIZER ASSIGN expression )
{
DebugLocation(318, 12);
// AS3.g:318:12: ^( VAR_INITIALIZER ASSIGN expression )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(318, 14);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(VAR_INITIALIZER, "VAR_INITIALIZER"), root_1);
DebugLocation(318, 30);
adaptor.AddChild(root_1, stream_ASSIGN.NextNode());
DebugLocation(318, 37);
adaptor.AddChild(root_1, stream_expression.NextTree());
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("variableInitializer", 31);
LeaveRule("variableInitializer", 31);
LeaveRule_variableInitializer();
}
DebugLocation(319, 1);
} finally { DebugExitRule(GrammarFileName, "variableInitializer"); }
return retval;
}
示例14: declaration
private AstParserRuleReturnScope<CommonTree, IToken> declaration()
{
EnterRule_declaration();
EnterRule("declaration", 28);
TraceIn("declaration", 28);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
AstParserRuleReturnScope<CommonTree, IToken> varOrConst96 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> variableDeclarator97 = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> declarationTail98 = default(AstParserRuleReturnScope<CommonTree, IToken>);
RewriteRuleSubtreeStream stream_varOrConst=new RewriteRuleSubtreeStream(adaptor,"rule varOrConst");
RewriteRuleSubtreeStream stream_variableDeclarator=new RewriteRuleSubtreeStream(adaptor,"rule variableDeclarator");
RewriteRuleSubtreeStream stream_declarationTail=new RewriteRuleSubtreeStream(adaptor,"rule declarationTail");
try { DebugEnterRule(GrammarFileName, "declaration");
DebugLocation(303, 1);
try
{
// AS3.g:304:2: ( varOrConst variableDeclarator declarationTail -> ^( DECLARATION varOrConst variableDeclarator declarationTail ) )
DebugEnterAlt(1);
// AS3.g:304:4: varOrConst variableDeclarator declarationTail
{
DebugLocation(304, 4);
PushFollow(Follow._varOrConst_in_declaration1671);
varOrConst96=varOrConst();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_varOrConst.Add(varOrConst96.Tree);
DebugLocation(304, 15);
PushFollow(Follow._variableDeclarator_in_declaration1673);
variableDeclarator97=variableDeclarator();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_variableDeclarator.Add(variableDeclarator97.Tree);
DebugLocation(304, 34);
PushFollow(Follow._declarationTail_in_declaration1675);
declarationTail98=declarationTail();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_declarationTail.Add(declarationTail98.Tree);
{
// AST REWRITE
// elements: varOrConst, variableDeclarator, declarationTail
// 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();
// 305:9: -> ^( DECLARATION varOrConst variableDeclarator declarationTail )
{
DebugLocation(305, 12);
// AS3.g:305:12: ^( DECLARATION varOrConst variableDeclarator declarationTail )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(305, 14);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(DECLARATION, "DECLARATION"), root_1);
DebugLocation(305, 26);
adaptor.AddChild(root_1, stream_varOrConst.NextTree());
DebugLocation(305, 37);
adaptor.AddChild(root_1, stream_variableDeclarator.NextTree());
DebugLocation(305, 56);
adaptor.AddChild(root_1, stream_declarationTail.NextTree());
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
//.........这里部分代码省略.........
示例15: returnStatement
private AstParserRuleReturnScope<CommonTree, IToken> returnStatement()
{
EnterRule_returnStatement();
EnterRule("returnStatement", 50);
TraceIn("returnStatement", 50);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken RETURN168 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> s = default(AstParserRuleReturnScope<CommonTree, IToken>);
AstParserRuleReturnScope<CommonTree, IToken> expression169 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree RETURN168_tree = default(CommonTree);
RewriteRuleITokenStream stream_RETURN=new RewriteRuleITokenStream(adaptor,"token RETURN");
RewriteRuleSubtreeStream stream_expression=new RewriteRuleSubtreeStream(adaptor,"rule expression");
RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
try { DebugEnterRule(GrammarFileName, "returnStatement");
DebugLocation(450, 1);
try
{
// AS3.g:451:2: ( RETURN ( expression )? s= semi -> ^( RETURN_STATEMENT RETURN ( expression )? ) )
DebugEnterAlt(1);
// AS3.g:451:4: RETURN ( expression )? s= semi
{
DebugLocation(451, 4);
RETURN168=(IToken)Match(input,RETURN,Follow._RETURN_in_returnStatement2421); if (state.failed) return retval;
if (state.backtracking == 0) stream_RETURN.Add(RETURN168);
DebugLocation(451, 11);
// AS3.g:451:11: ( expression )?
int alt39=2;
try { DebugEnterSubRule(39);
try { DebugEnterDecision(39, false);
int LA39_1 = input.LA(1);
if ((LA39_1==AS||LA39_1==BNOT||(LA39_1>=DEC && LA39_1<=DECIMAL_LITERAL)||(LA39_1>=DYNAMIC && LA39_1<=E4X_ATTRI)||(LA39_1>=FALSE && LA39_1<=FLOAT_LITERAL)||LA39_1==FUNCTION||LA39_1==GET||(LA39_1>=HEX_LITERAL && LA39_1<=IDENT)||LA39_1==INC||(LA39_1>=INTERNAL && LA39_1<=IS)||(LA39_1>=LBRACK && LA39_1<=LCURLY)||LA39_1==LNOT||LA39_1==LPAREN||LA39_1==MINUS||LA39_1==NAMESPACE||LA39_1==NEW||LA39_1==NULL||LA39_1==OCTAL_LITERAL||LA39_1==PLUS||LA39_1==PRIVATE||(LA39_1>=PROTECTED && LA39_1<=PUBLIC)||LA39_1==REGEX_LITERAL||LA39_1==SET||(LA39_1>=STRING_LITERAL_DOUBLE && LA39_1<=SUPER)||LA39_1==TRUE||LA39_1==USE||LA39_1==XML||LA39_1==XML_LITERAL||LA39_1==243||(LA39_1>=255 && LA39_1<=257)))
{
alt39 = 1;
}
} finally { DebugExitDecision(39); }
switch (alt39)
{
case 1:
DebugEnterAlt(1);
// AS3.g:451:11: expression
{
DebugLocation(451, 11);
PushFollow(Follow._expression_in_returnStatement2423);
expression169=expression();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_expression.Add(expression169.Tree);
}
break;
}
} finally { DebugExitSubRule(39); }
DebugLocation(451, 24);
PushFollow(Follow._semi_in_returnStatement2428);
s=semi();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_semi.Add(s.Tree);
{
// AST REWRITE
// elements: RETURN, expression
// 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();
// 452:9: -> ^( RETURN_STATEMENT RETURN ( expression )? )
{
DebugLocation(452, 12);
// AS3.g:452:12: ^( RETURN_STATEMENT RETURN ( expression )? )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(452, 14);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(RETURN_STATEMENT, "RETURN_STATEMENT"), root_1);
DebugLocation(452, 31);
adaptor.AddChild(root_1, stream_RETURN.NextNode());
DebugLocation(452, 38);
// AS3.g:452:38: ( expression )?
if (stream_expression.HasNext)
{
DebugLocation(452, 38);
adaptor.AddChild(root_1, stream_expression.NextTree());
//.........这里部分代码省略.........