Skip to content

Instantly share code, notes, and snippets.

@lextm
Created July 29, 2012 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lextm/3198483 to your computer and use it in GitHub Desktop.
Save lextm/3198483 to your computer and use it in GitHub Desktop.
ANTLR generated method
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