本文整理汇总了C#中RewriteRuleSubtreeStream.Reset方法的典型用法代码示例。如果您正苦于以下问题:C# RewriteRuleSubtreeStream.Reset方法的具体用法?C# RewriteRuleSubtreeStream.Reset怎么用?C# RewriteRuleSubtreeStream.Reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RewriteRuleSubtreeStream
的用法示例。
在下文中一共展示了RewriteRuleSubtreeStream.Reset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: annotation
//.........这里部分代码省略.........
if ((LA57_1==LPAREN))
{
alt57 = 1;
}
} finally { DebugExitDecision(57); }
switch (alt57)
{
case 1:
DebugEnterAlt(1);
// AS3.g:630:3: annotationParamList
{
DebugLocation(630, 3);
PushFollow(Follow._annotationParamList_in_annotation3428);
annotationParamList265=annotationParamList();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_annotationParamList.Add(annotationParamList265.Tree);
}
break;
}
} finally { DebugExitSubRule(57); }
DebugLocation(631, 3);
RBRACK266=(IToken)Match(input,RBRACK,Follow._RBRACK_in_annotation3433); if (state.failed) return retval;
if (state.backtracking == 0) stream_RBRACK.Add(RBRACK266);
{
// AST REWRITE
// elements: ident, annotationParamList
// 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();
// 632:3: -> ^( ANNOTATION ident ( annotationParamList )? )
{
DebugLocation(632, 6);
// AS3.g:632:6: ^( ANNOTATION ident ( annotationParamList )? )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(632, 8);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(ANNOTATION, "ANNOTATION"), root_1);
DebugLocation(632, 19);
adaptor.AddChild(root_1, stream_ident.NextTree());
DebugLocation(632, 25);
// AS3.g:632:25: ( annotationParamList )?
if (stream_annotationParamList.HasNext)
{
DebugLocation(632, 25);
adaptor.AddChild(root_1, stream_annotationParamList.NextTree());
}
stream_annotationParamList.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("annotation", 80);
LeaveRule("annotation", 80);
LeaveRule_annotation();
}
DebugLocation(633, 1);
} finally { DebugExitRule(GrammarFileName, "annotation"); }
return retval;
}
示例2: switchStatementList
//.........这里部分代码省略.........
}
} finally { DebugExitDecision(42); }
switch ( alt42 )
{
case 1:
DebugEnterAlt(1);
// AS3.g:488:4: statement
{
DebugLocation(488, 4);
PushFollow(Follow._statement_in_switchStatementList2649);
statement184=statement();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_statement.Add(statement184.Tree);
}
break;
default:
goto loop42;
}
}
loop42:
;
} finally { DebugExitSubRule(42); }
{
// AST REWRITE
// elements: 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();
// 488:15: -> ^( SWITCH_STATEMENT_LIST ( statement )* )
{
DebugLocation(488, 18);
// AS3.g:488:18: ^( SWITCH_STATEMENT_LIST ( statement )* )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(488, 20);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(SWITCH_STATEMENT_LIST, "SWITCH_STATEMENT_LIST"), root_1);
DebugLocation(488, 42);
// AS3.g:488:42: ( statement )*
while ( stream_statement.HasNext )
{
DebugLocation(488, 42);
adaptor.AddChild(root_1, stream_statement.NextTree());
}
stream_statement.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("switchStatementList", 57);
LeaveRule("switchStatementList", 57);
LeaveRule_switchStatementList();
}
DebugLocation(489, 1);
} finally { DebugExitRule(GrammarFileName, "switchStatementList"); }
return retval;
}
示例3: forIter
private AstParserRuleReturnScope<CommonTree, IToken> forIter()
{
EnterRule_forIter();
EnterRule("forIter", 66);
TraceIn("forIter", 66);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
AstParserRuleReturnScope<CommonTree, IToken> expressionList214 = default(AstParserRuleReturnScope<CommonTree, IToken>);
RewriteRuleSubtreeStream stream_expressionList=new RewriteRuleSubtreeStream(adaptor,"rule expressionList");
try { DebugEnterRule(GrammarFileName, "forIter");
DebugLocation(543, 1);
try
{
// AS3.g:544:2: ( ( expressionList )? -> ^( FOR_ITERATOR ( expressionList )? ) )
DebugEnterAlt(1);
// AS3.g:544:4: ( expressionList )?
{
DebugLocation(544, 4);
// AS3.g:544:4: ( expressionList )?
int alt48=2;
try { DebugEnterSubRule(48);
try { DebugEnterDecision(48, false);
int LA48_1 = input.LA(1);
if ((LA48_1==AS||LA48_1==BNOT||(LA48_1>=DEC && LA48_1<=DECIMAL_LITERAL)||(LA48_1>=DYNAMIC && LA48_1<=E4X_ATTRI)||(LA48_1>=FALSE && LA48_1<=FLOAT_LITERAL)||LA48_1==FUNCTION||LA48_1==GET||(LA48_1>=HEX_LITERAL && LA48_1<=IDENT)||LA48_1==INC||(LA48_1>=INTERNAL && LA48_1<=IS)||(LA48_1>=LBRACK && LA48_1<=LCURLY)||LA48_1==LNOT||LA48_1==LPAREN||LA48_1==MINUS||LA48_1==NAMESPACE||LA48_1==NEW||LA48_1==NULL||LA48_1==OCTAL_LITERAL||LA48_1==PLUS||LA48_1==PRIVATE||(LA48_1>=PROTECTED && LA48_1<=PUBLIC)||LA48_1==REGEX_LITERAL||LA48_1==SET||(LA48_1>=STRING_LITERAL_DOUBLE && LA48_1<=SUPER)||LA48_1==TRUE||LA48_1==USE||LA48_1==XML||LA48_1==XML_LITERAL||LA48_1==243||(LA48_1>=255 && LA48_1<=257)))
{
alt48 = 1;
}
} finally { DebugExitDecision(48); }
switch (alt48)
{
case 1:
DebugEnterAlt(1);
// AS3.g:544:4: expressionList
{
DebugLocation(544, 4);
PushFollow(Follow._expressionList_in_forIter2939);
expressionList214=expressionList();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_expressionList.Add(expressionList214.Tree);
}
break;
}
} finally { DebugExitSubRule(48); }
{
// AST REWRITE
// elements: expressionList
// 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();
// 545:3: -> ^( FOR_ITERATOR ( expressionList )? )
{
DebugLocation(545, 6);
// AS3.g:545:6: ^( FOR_ITERATOR ( expressionList )? )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(545, 8);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(FOR_ITERATOR, "FOR_ITERATOR"), root_1);
DebugLocation(545, 21);
// AS3.g:545:21: ( expressionList )?
if (stream_expressionList.HasNext)
{
DebugLocation(545, 21);
adaptor.AddChild(root_1, stream_expressionList.NextTree());
}
stream_expressionList.Reset();
adaptor.AddChild(root_0, root_1);
}
}
retval.Tree = root_0;
}
}
}
retval.Stop = (IToken)input.LT(-1);
if (state.backtracking == 0) {
//.........这里部分代码省略.........
示例4: ifStatement
//.........这里部分代码省略.........
{
alt35 = 1;
}
}
} finally { DebugExitDecision(35); }
switch (alt35)
{
case 1:
DebugEnterAlt(1);
// AS3.g:419:4: ( ELSE )=> elseClause
{
DebugLocation(419, 12);
PushFollow(Follow._elseClause_in_ifStatement2230);
elseClause151=elseClause();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_elseClause.Add(elseClause151.Tree);
}
break;
}
} finally { DebugExitSubRule(35); }
{
// AST REWRITE
// elements: IF, condition, statement, elseClause
// 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();
// 420:9: -> ^( IF_STMT IF condition statement ( elseClause )? )
{
DebugLocation(420, 12);
// AS3.g:420:12: ^( IF_STMT IF condition statement ( elseClause )? )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(420, 14);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(IF_STMT, "IF_STMT"), root_1);
DebugLocation(420, 22);
adaptor.AddChild(root_1, stream_IF.NextNode());
DebugLocation(420, 25);
adaptor.AddChild(root_1, stream_condition.NextTree());
DebugLocation(420, 35);
adaptor.AddChild(root_1, stream_statement.NextTree());
DebugLocation(420, 45);
// AS3.g:420:45: ( elseClause )?
if (stream_elseClause.HasNext)
{
DebugLocation(420, 45);
adaptor.AddChild(root_1, stream_elseClause.NextTree());
}
stream_elseClause.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("ifStatement", 44);
LeaveRule("ifStatement", 44);
LeaveRule_ifStatement();
}
DebugLocation(421, 1);
} finally { DebugExitRule(GrammarFileName, "ifStatement"); }
return retval;
}
示例5: returnStatement
//.........这里部分代码省略.........
} 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());
}
stream_expression.Reset();
DebugLocation(452, 50);
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("returnStatement", 50);
LeaveRule("returnStatement", 50);
LeaveRule_returnStatement();
}
DebugLocation(453, 1);
} finally { DebugExitRule(GrammarFileName, "returnStatement"); }
return retval;
}
示例6: parameterDeclarationList
//.........这里部分代码省略.........
if (state.backtracking == 0) stream_parameterDeclaration.Add(parameterDeclaration110.Tree);
}
break;
default:
goto loop25;
}
}
loop25:
;
} finally { DebugExitSubRule(25); }
}
break;
}
} finally { DebugExitSubRule(26); }
DebugLocation(334, 3);
RPAREN111=(IToken)Match(input,RPAREN,Follow._RPAREN_in_parameterDeclarationList1835); if (state.failed) return retval;
if (state.backtracking == 0) stream_RPAREN.Add(RPAREN111);
{
// AST REWRITE
// elements: LPAREN, parameterDeclaration, RPAREN
// 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();
// 335:3: -> ^( PARAMS LPAREN ( parameterDeclaration )* RPAREN )
{
DebugLocation(335, 6);
// AS3.g:335:6: ^( PARAMS LPAREN ( parameterDeclaration )* RPAREN )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(335, 8);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(PARAMS, "PARAMS"), root_1);
DebugLocation(335, 15);
adaptor.AddChild(root_1, stream_LPAREN.NextNode());
DebugLocation(335, 22);
// AS3.g:335:22: ( parameterDeclaration )*
while ( stream_parameterDeclaration.HasNext )
{
DebugLocation(335, 22);
adaptor.AddChild(root_1, stream_parameterDeclaration.NextTree());
}
stream_parameterDeclaration.Reset();
DebugLocation(335, 44);
adaptor.AddChild(root_1, stream_RPAREN.NextNode());
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("parameterDeclarationList", 33);
LeaveRule("parameterDeclarationList", 33);
LeaveRule_parameterDeclarationList();
}
DebugLocation(336, 1);
} finally { DebugExitRule(GrammarFileName, "parameterDeclarationList"); }
return retval;
}
示例7: parameterRestDeclaration
//.........这里部分代码省略.........
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:
// 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();
// 355:3: -> ^( PARAM REST ( ident )? ( typeExpression )? )
{
DebugLocation(355, 6);
// AS3.g:355:6: ^( PARAM REST ( ident )? ( typeExpression )? )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(355, 8);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(PARAM, "PARAM"), root_1);
DebugLocation(355, 14);
adaptor.AddChild(root_1, stream_REST.NextNode());
DebugLocation(355, 19);
// AS3.g:355:19: ( ident )?
if (stream_ident.HasNext)
{
DebugLocation(355, 19);
adaptor.AddChild(root_1, stream_ident.NextTree());
}
stream_ident.Reset();
DebugLocation(355, 26);
// AS3.g:355:26: ( typeExpression )?
if (stream_typeExpression.HasNext)
{
DebugLocation(355, 26);
adaptor.AddChild(root_1, stream_typeExpression.NextTree());
}
stream_typeExpression.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("parameterRestDeclaration", 37);
LeaveRule("parameterRestDeclaration", 37);
LeaveRule_parameterRestDeclaration();
}
DebugLocation(356, 1);
} finally { DebugExitRule(GrammarFileName, "parameterRestDeclaration"); }
return retval;
}
示例8: classDefinition
//.........这里部分代码省略.........
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_typeBlock.Add(typeBlock35.Tree);
{
// AST REWRITE
// elements: modifiers, CLASS, ident, classExtendsClause, implementsClause, typeBlock
// 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();
// 182:3: -> ^( CLASS_DEF modifiers CLASS ^( CLASS_NAME ident ) ( classExtendsClause )? ( implementsClause )? typeBlock )
{
DebugLocation(182, 6);
// AS3.g:182:6: ^( CLASS_DEF modifiers CLASS ^( CLASS_NAME ident ) ( classExtendsClause )? ( implementsClause )? typeBlock )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(182, 8);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(CLASS_DEF, "CLASS_DEF"), root_1);
DebugLocation(182, 18);
adaptor.AddChild(root_1, stream_modifiers.NextTree());
DebugLocation(182, 28);
adaptor.AddChild(root_1, stream_CLASS.NextNode());
DebugLocation(182, 34);
// AS3.g:182:34: ^( CLASS_NAME ident )
{
CommonTree root_2 = (CommonTree)adaptor.Nil();
DebugLocation(182, 36);
root_2 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(CLASS_NAME, "CLASS_NAME"), root_2);
DebugLocation(182, 47);
adaptor.AddChild(root_2, stream_ident.NextTree());
adaptor.AddChild(root_1, root_2);
}
DebugLocation(182, 54);
// AS3.g:182:54: ( classExtendsClause )?
if (stream_classExtendsClause.HasNext)
{
DebugLocation(182, 54);
adaptor.AddChild(root_1, stream_classExtendsClause.NextTree());
}
stream_classExtendsClause.Reset();
DebugLocation(182, 74);
// AS3.g:182:74: ( implementsClause )?
if (stream_implementsClause.HasNext)
{
DebugLocation(182, 74);
adaptor.AddChild(root_1, stream_implementsClause.NextTree());
}
stream_implementsClause.Reset();
DebugLocation(182, 92);
adaptor.AddChild(root_1, stream_typeBlock.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("classDefinition", 10);
LeaveRule("classDefinition", 10);
LeaveRule_classDefinition();
}
DebugLocation(183, 1);
} finally { DebugExitRule(GrammarFileName, "classDefinition"); }
return retval;
}
示例9: as2ClassDefinition
//.........这里部分代码省略.........
if (state.failed) return retval;
if (state.backtracking == 0) stream_implementsClause.Add(implementsClause40.Tree);
}
break;
}
} finally { DebugExitSubRule(11); }
DebugLocation(190, 3);
PushFollow(Follow._typeBlock_in_as2ClassDefinition950);
typeBlock41=typeBlock();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_typeBlock.Add(typeBlock41.Tree);
{
// AST REWRITE
// elements: modifiers, identifier, classExtendsClause, implementsClause, typeBlock
// 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();
// 191:3: -> ^( CLASS_DEF modifiers identifier ( classExtendsClause )? ( implementsClause )? typeBlock )
{
DebugLocation(191, 6);
// AS3.g:191:6: ^( CLASS_DEF modifiers identifier ( classExtendsClause )? ( implementsClause )? typeBlock )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(191, 8);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(CLASS_DEF, "CLASS_DEF"), root_1);
DebugLocation(191, 18);
adaptor.AddChild(root_1, stream_modifiers.NextTree());
DebugLocation(191, 28);
adaptor.AddChild(root_1, stream_identifier.NextTree());
DebugLocation(191, 39);
// AS3.g:191:39: ( classExtendsClause )?
if (stream_classExtendsClause.HasNext)
{
DebugLocation(191, 39);
adaptor.AddChild(root_1, stream_classExtendsClause.NextTree());
}
stream_classExtendsClause.Reset();
DebugLocation(191, 59);
// AS3.g:191:59: ( implementsClause )?
if (stream_implementsClause.HasNext)
{
DebugLocation(191, 59);
adaptor.AddChild(root_1, stream_implementsClause.NextTree());
}
stream_implementsClause.Reset();
DebugLocation(191, 77);
adaptor.AddChild(root_1, stream_typeBlock.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("as2ClassDefinition", 11);
LeaveRule("as2ClassDefinition", 11);
LeaveRule_as2ClassDefinition();
}
DebugLocation(192, 1);
} finally { DebugExitRule(GrammarFileName, "as2ClassDefinition"); }
return retval;
}
示例10: objectLiteral
private AstParserRuleReturnScope<CommonTree, IToken> objectLiteral()
{
EnterRule_objectLiteral();
EnterRule("objectLiteral", 90);
TraceIn("objectLiteral", 90);
AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
retval.Start = (IToken)input.LT(1);
CommonTree root_0 = default(CommonTree);
IToken LCURLY301 = default(IToken);
IToken RCURLY303 = default(IToken);
AstParserRuleReturnScope<CommonTree, IToken> fieldList302 = default(AstParserRuleReturnScope<CommonTree, IToken>);
CommonTree LCURLY301_tree = default(CommonTree);
CommonTree RCURLY303_tree = default(CommonTree);
RewriteRuleITokenStream stream_LCURLY=new RewriteRuleITokenStream(adaptor,"token LCURLY");
RewriteRuleITokenStream stream_RCURLY=new RewriteRuleITokenStream(adaptor,"token RCURLY");
RewriteRuleSubtreeStream stream_fieldList=new RewriteRuleSubtreeStream(adaptor,"rule fieldList");
try { DebugEnterRule(GrammarFileName, "objectLiteral");
DebugLocation(707, 1);
try
{
// AS3.g:708:2: ( LCURLY ( fieldList )? RCURLY -> ^( OBJECT_LITERAL ( fieldList )? ) )
DebugEnterAlt(1);
// AS3.g:708:4: LCURLY ( fieldList )? RCURLY
{
DebugLocation(708, 4);
LCURLY301=(IToken)Match(input,LCURLY,Follow._LCURLY_in_objectLiteral3771); if (state.failed) return retval;
if (state.backtracking == 0) stream_LCURLY.Add(LCURLY301);
DebugLocation(708, 11);
// AS3.g:708:11: ( fieldList )?
int alt68=2;
try { DebugEnterSubRule(68);
try { DebugEnterDecision(68, false);
int LA68_1 = input.LA(1);
if ((LA68_1==AS||LA68_1==DECIMAL_LITERAL||LA68_1==DYNAMIC||LA68_1==FLOAT_LITERAL||LA68_1==GET||(LA68_1>=HEX_LITERAL && LA68_1<=IDENT)||LA68_1==IS||LA68_1==NAMESPACE||LA68_1==OCTAL_LITERAL||LA68_1==SET||LA68_1==SUPER||LA68_1==USE||LA68_1==XML))
{
alt68 = 1;
}
} finally { DebugExitDecision(68); }
switch (alt68)
{
case 1:
DebugEnterAlt(1);
// AS3.g:708:11: fieldList
{
DebugLocation(708, 11);
PushFollow(Follow._fieldList_in_objectLiteral3773);
fieldList302=fieldList();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_fieldList.Add(fieldList302.Tree);
}
break;
}
} finally { DebugExitSubRule(68); }
DebugLocation(708, 22);
RCURLY303=(IToken)Match(input,RCURLY,Follow._RCURLY_in_objectLiteral3776); if (state.failed) return retval;
if (state.backtracking == 0) stream_RCURLY.Add(RCURLY303);
{
// AST REWRITE
// elements: fieldList
// 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();
// 709:3: -> ^( OBJECT_LITERAL ( fieldList )? )
{
DebugLocation(709, 6);
// AS3.g:709:6: ^( OBJECT_LITERAL ( fieldList )? )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(709, 8);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(OBJECT_LITERAL, "OBJECT_LITERAL"), root_1);
DebugLocation(709, 23);
// AS3.g:709:23: ( fieldList )?
if (stream_fieldList.HasNext)
{
DebugLocation(709, 23);
adaptor.AddChild(root_1, stream_fieldList.NextTree());
}
stream_fieldList.Reset();
//.........这里部分代码省略.........
示例11: expressionList
//.........这里部分代码省略.........
DebugEnterAlt(1);
// AS3.g:734:26: COMMA assignmentExpression
{
DebugLocation(734, 26);
COMMA314=(IToken)Match(input,COMMA,Follow._COMMA_in_expressionList3898); if (state.failed) return retval;
if (state.backtracking == 0) stream_COMMA.Add(COMMA314);
DebugLocation(734, 32);
PushFollow(Follow._assignmentExpression_in_expressionList3900);
assignmentExpression315=assignmentExpression();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_assignmentExpression.Add(assignmentExpression315.Tree);
}
break;
default:
goto loop72;
}
}
loop72:
;
} finally { DebugExitSubRule(72); }
{
// AST REWRITE
// elements: assignmentExpression
// 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();
// 735:9: -> ^( EXPR_LIST ( assignmentExpression )+ )
{
DebugLocation(735, 12);
// AS3.g:735:12: ^( EXPR_LIST ( assignmentExpression )+ )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(735, 14);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(EXPR_LIST, "EXPR_LIST"), root_1);
DebugLocation(735, 24);
if (!(stream_assignmentExpression.HasNext))
{
throw new RewriteEarlyExitException();
}
while ( stream_assignmentExpression.HasNext )
{
DebugLocation(735, 24);
adaptor.AddChild(root_1, stream_assignmentExpression.NextTree());
}
stream_assignmentExpression.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("expressionList", 95);
LeaveRule("expressionList", 95);
LeaveRule_expressionList();
}
DebugLocation(736, 1);
} finally { DebugExitRule(GrammarFileName, "expressionList"); }
return retval;
}
示例12: arrayLiteral
//.........这里部分代码省略.........
alt65 = 1;
}
} finally { DebugExitDecision(65); }
switch (alt65)
{
case 1:
DebugEnterAlt(1);
// AS3.g:689:11: elementList
{
DebugLocation(689, 11);
PushFollow(Follow._elementList_in_arrayLiteral3683);
elementList293=elementList();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_elementList.Add(elementList293.Tree);
}
break;
}
} finally { DebugExitSubRule(65); }
DebugLocation(689, 24);
RBRACK294=(IToken)Match(input,RBRACK,Follow._RBRACK_in_arrayLiteral3686); if (state.failed) return retval;
if (state.backtracking == 0) stream_RBRACK.Add(RBRACK294);
{
// AST REWRITE
// elements: LBRACK, elementList, RBRACK
// 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();
// 690:3: -> ^( ARRAY_LITERAL LBRACK ( elementList )? RBRACK )
{
DebugLocation(690, 6);
// AS3.g:690:6: ^( ARRAY_LITERAL LBRACK ( elementList )? RBRACK )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(690, 8);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(ARRAY_LITERAL, "ARRAY_LITERAL"), root_1);
DebugLocation(690, 22);
adaptor.AddChild(root_1, stream_LBRACK.NextNode());
DebugLocation(690, 29);
// AS3.g:690:29: ( elementList )?
if (stream_elementList.HasNext)
{
DebugLocation(690, 29);
adaptor.AddChild(root_1, stream_elementList.NextTree());
}
stream_elementList.Reset();
DebugLocation(690, 42);
adaptor.AddChild(root_1, stream_RBRACK.NextNode());
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("arrayLiteral", 86);
LeaveRule("arrayLiteral", 86);
LeaveRule_arrayLiteral();
}
DebugLocation(691, 1);
} finally { DebugExitRule(GrammarFileName, "arrayLiteral"); }
return retval;
}
示例13: modifiers
//.........这里部分代码省略.........
DebugEnterAlt(1);
// AS3.g:665:16: modifier
{
DebugLocation(665, 16);
PushFollow(Follow._modifier_in_modifiers3560);
modifier278=modifier();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_modifier.Add(modifier278.Tree);
}
break;
default:
goto loop61;
}
}
loop61:
;
} finally { DebugExitSubRule(61); }
}
break;
}
} finally { DebugExitSubRule(62); }
{
// AST REWRITE
// elements: modifier
// 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();
// 666:2: -> ^( MODIFIER_LIST ( modifier )* )
{
DebugLocation(666, 5);
// AS3.g:666:5: ^( MODIFIER_LIST ( modifier )* )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(666, 7);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(MODIFIER_LIST, "MODIFIER_LIST"), root_1);
DebugLocation(666, 21);
// AS3.g:666:21: ( modifier )*
while ( stream_modifier.HasNext )
{
DebugLocation(666, 21);
adaptor.AddChild(root_1, stream_modifier.NextTree());
}
stream_modifier.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("modifiers", 83);
LeaveRule("modifiers", 83);
LeaveRule_modifiers();
}
DebugLocation(667, 1);
} finally { DebugExitRule(GrammarFileName, "modifiers"); }
return retval;
}
示例14: annotationParamList
//.........这里部分代码省略.........
PushFollow(Follow._annotationParam_in_annotationParamList3473);
annotationParam270=annotationParam();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_annotationParam.Add(annotationParam270.Tree);
}
break;
default:
goto loop58;
}
}
loop58:
;
} finally { DebugExitSubRule(58); }
}
break;
}
} finally { DebugExitSubRule(59); }
DebugLocation(641, 3);
RPAREN271=(IToken)Match(input,RPAREN,Follow._RPAREN_in_annotationParamList3484); if (state.failed) return retval;
if (state.backtracking == 0) stream_RPAREN.Add(RPAREN271);
{
// AST REWRITE
// elements: annotationParam
// 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();
// 642:3: -> ^( ANNOTATION_PARAMS ( annotationParam )* )
{
DebugLocation(642, 6);
// AS3.g:642:6: ^( ANNOTATION_PARAMS ( annotationParam )* )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(642, 8);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(ANNOTATION_PARAMS, "ANNOTATION_PARAMS"), root_1);
DebugLocation(642, 26);
// AS3.g:642:26: ( annotationParam )*
while ( stream_annotationParam.HasNext )
{
DebugLocation(642, 26);
adaptor.AddChild(root_1, stream_annotationParam.NextTree());
}
stream_annotationParam.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("annotationParamList", 81);
LeaveRule("annotationParamList", 81);
LeaveRule_annotationParamList();
}
DebugLocation(643, 1);
} finally { DebugExitRule(GrammarFileName, "annotationParamList"); }
return retval;
}
示例15: variableDefinition
//.........这里部分代码省略.........
}
break;
default:
goto loop21;
}
}
loop21:
;
} finally { DebugExitSubRule(21); }
DebugLocation(299, 4);
PushFollow(Follow._semi_in_variableDefinition1642);
s=semi();
PopFollow();
if (state.failed) return retval;
if (state.backtracking == 0) stream_semi.Add(s.Tree);
{
// AST REWRITE
// elements: modifiers, decl, variableDeclarator
// token labels:
// rule labels: decl, retval
// token list labels:
// rule list labels:
// wildcard labels:
if (state.backtracking == 0) {
retval.Tree = root_0;
RewriteRuleSubtreeStream stream_decl=new RewriteRuleSubtreeStream(adaptor,"rule decl",decl!=null?decl.Tree:null);
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);
root_0 = (CommonTree)adaptor.Nil();
// 300:3: -> ^( VARIABLE_DEF modifiers $decl ( variableDeclarator )+ )
{
DebugLocation(300, 6);
// AS3.g:300:6: ^( VARIABLE_DEF modifiers $decl ( variableDeclarator )+ )
{
CommonTree root_1 = (CommonTree)adaptor.Nil();
DebugLocation(300, 8);
root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(VARIABLE_DEF, "VARIABLE_DEF"), root_1);
DebugLocation(300, 21);
adaptor.AddChild(root_1, stream_modifiers.NextTree());
DebugLocation(300, 32);
adaptor.AddChild(root_1, stream_decl.NextTree());
DebugLocation(300, 37);
if (!(stream_variableDeclarator.HasNext))
{
throw new RewriteEarlyExitException();
}
while ( stream_variableDeclarator.HasNext )
{
DebugLocation(300, 37);
adaptor.AddChild(root_1, stream_variableDeclarator.NextTree());
}
stream_variableDeclarator.Reset();
DebugLocation(300, 57);
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("variableDefinition", 27);
LeaveRule("variableDefinition", 27);
LeaveRule_variableDefinition();
}
DebugLocation(301, 1);
} finally { DebugExitRule(GrammarFileName, "variableDefinition"); }
return retval;
}