Created
July 29, 2012 12:43
-
-
Save lextm/3198483 to your computer and use it in GitHub Desktop.
ANTLR generated method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private sealed partial class statement_return : AstParserRuleReturnScope<CommonTree, IToken> | |
{ | |
public MibDocument result = new MibDocument(); | |
public statement_return(SmiParser grammar) {OnCreated(grammar);} | |
partial void OnCreated(SmiParser grammar); | |
} | |
partial void EnterRule_statement(); | |
partial void LeaveRule_statement(); | |
// $ANTLR start "statement" | |
// Mib\\Smi.g:523:1: statement returns [MibDocument result = new MibDocument()] : (mod= module_definition )* EOF ; | |
[GrammarRule("statement")] | |
private SmiParser.statement_return statement() | |
{ | |
EnterRule_statement(); | |
EnterRule("statement", 1); | |
TraceIn("statement", 1); | |
SmiParser.statement_return retval = new SmiParser.statement_return(this); | |
retval.Start = (IToken)input.LT(1); | |
CommonTree root_0 = default(CommonTree); | |
IToken EOF1 = default(IToken); | |
SmiParser.module_definition_return mod = default(SmiParser.module_definition_return); | |
CommonTree EOF1_tree = default(CommonTree); | |
try { DebugEnterRule(GrammarFileName, "statement"); | |
DebugLocation(523, 2); | |
try | |
{ | |
// Mib\\Smi.g:524:5: ( (mod= module_definition )* EOF ) | |
DebugEnterAlt(1); | |
// Mib\\Smi.g:524:7: (mod= module_definition )* EOF | |
{ | |
root_0 = (CommonTree)adaptor.Nil(); | |
DebugLocation(524, 7); | |
// Mib\\Smi.g:524:7: (mod= module_definition )* | |
try { DebugEnterSubRule(1); | |
while (true) | |
{ | |
int alt1=2; | |
try { DebugEnterDecision(1, false); | |
int LA1_1 = input.LA(1); | |
if ((LA1_1==NAME)) | |
{ | |
alt1 = 1; | |
} | |
} finally { DebugExitDecision(1); } | |
switch ( alt1 ) | |
{ | |
case 1: | |
DebugEnterAlt(1); | |
// Mib\\Smi.g:524:8: mod= module_definition | |
{ | |
DebugLocation(524, 11); | |
PushFollow(Follow._module_definition_in_statement1992); | |
mod=module_definition(); | |
PopFollow(); | |
if (state.failed) return retval; | |
if (state.backtracking == 0) adaptor.AddChild(root_0, mod.Tree); | |
DebugLocation(524, 30); | |
if (state.backtracking == 0) | |
{ | |
retval.result.Add(mod.result); | |
} | |
} | |
break; | |
default: | |
goto loop1; | |
} | |
} | |
loop1: | |
; | |
} finally { DebugExitSubRule(1); } | |
DebugLocation(524, 61); | |
EOF1=(IToken)Match(input,EOF,Follow._EOF_in_statement1998); if (state.failed) return retval; | |
if (state.backtracking == 0) { | |
EOF1_tree = (CommonTree)adaptor.Create(EOF1); | |
adaptor.AddChild(root_0, EOF1_tree); | |
} | |
} | |
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) | |
{ | |
throw; | |
} | |
finally | |
{ | |
TraceOut("statement", 1); | |
LeaveRule("statement", 1); | |
LeaveRule_statement(); | |
} | |
DebugLocation(525, 2); | |
} finally { DebugExitRule(GrammarFileName, "statement"); } | |
return retval; | |
} | |
// $ANTLR end "statement" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment