private SimpleBooleanParser.atom_return atom() { EnterRule_atom(); EnterRule("atom", 5); TraceIn("atom", 5); SimpleBooleanParser.atom_return retval = new SimpleBooleanParser.atom_return(this); retval.Start = (IToken)input.LT(1); object root_0 = default(object); IToken WORD9 = default(IToken); IToken LPAREN10 = default(IToken); IToken RPAREN12 = default(IToken); SimpleBooleanParser.expr_return expr11 = default(SimpleBooleanParser.expr_return); object WORD9_tree = default(object); object LPAREN10_tree = default(object); object RPAREN12_tree = default(object); try { DebugEnterRule(GrammarFileName, "atom"); DebugLocation(22, 34); try { // D:\\projects\\common\\Antlr\\simpleboolean-parser\\SimpleBoolean.g:22:6: ( WORD | LPAREN expr RPAREN ) int alt3 = 2; try { DebugEnterDecision(3, false); int LA3_0 = input.LA(1); if ((LA3_0 == WORD)) { alt3 = 1; } else if ((LA3_0 == LPAREN)) { alt3 = 2; } else { NoViableAltException nvae = new NoViableAltException("", 3, 0, input); DebugRecognitionException(nvae); throw nvae; } } finally { DebugExitDecision(3); } switch (alt3) { case 1: DebugEnterAlt(1); // D:\\projects\\common\\Antlr\\simpleboolean-parser\\SimpleBoolean.g:22:8: WORD { root_0 = (object)adaptor.Nil(); DebugLocation(22, 8); WORD9 = (IToken)Match(input, WORD, Follow._WORD_in_atom182); WORD9_tree = (object)adaptor.Create(WORD9); adaptor.AddChild(root_0, WORD9_tree); } break; case 2: DebugEnterAlt(2); // D:\\projects\\common\\Antlr\\simpleboolean-parser\\SimpleBoolean.g:22:15: LPAREN expr RPAREN { root_0 = (object)adaptor.Nil(); DebugLocation(22, 21); LPAREN10 = (IToken)Match(input, LPAREN, Follow._LPAREN_in_atom186); DebugLocation(22, 23); PushFollow(Follow._expr_in_atom189); expr11 = expr(); PopFollow(); adaptor.AddChild(root_0, expr11.Tree); DebugLocation(22, 34); RPAREN12 = (IToken)Match(input, RPAREN, Follow._RPAREN_in_atom191); } break; } retval.Stop = (IToken)input.LT(-1); retval.Tree = (object)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } catch (RecognitionException re) { ReportError(re); Recover(input, re); retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("atom", 5); LeaveRule("atom", 5); LeaveRule_atom(); } DebugLocation(22, 34); } finally { DebugExitRule(GrammarFileName, "atom"); } return(retval); }
private SimpleBooleanParser.orexpr_return orexpr() { EnterRule_orexpr(); EnterRule("orexpr", 4); TraceIn("orexpr", 4); SimpleBooleanParser.orexpr_return retval = new SimpleBooleanParser.orexpr_return(this); retval.Start = (IToken)input.LT(1); object root_0 = default(object); IToken OR7 = default(IToken); SimpleBooleanParser.atom_return atom6 = default(SimpleBooleanParser.atom_return); SimpleBooleanParser.atom_return atom8 = default(SimpleBooleanParser.atom_return); object OR7_tree = default(object); try { DebugEnterRule(GrammarFileName, "orexpr"); DebugLocation(21, 25); try { // D:\\projects\\common\\Antlr\\simpleboolean-parser\\SimpleBoolean.g:21:8: ( atom ( OR atom )* ) DebugEnterAlt(1); // D:\\projects\\common\\Antlr\\simpleboolean-parser\\SimpleBoolean.g:21:10: atom ( OR atom )* { root_0 = (object)adaptor.Nil(); DebugLocation(21, 10); PushFollow(Follow._atom_in_orexpr167); atom6 = atom(); PopFollow(); adaptor.AddChild(root_0, atom6.Tree); DebugLocation(21, 15); // D:\\projects\\common\\Antlr\\simpleboolean-parser\\SimpleBoolean.g:21:15: ( OR atom )* try { DebugEnterSubRule(2); while (true) { int alt2 = 2; try { DebugEnterDecision(2, false); int LA2_0 = input.LA(1); if ((LA2_0 == OR)) { alt2 = 1; } } finally { DebugExitDecision(2); } switch (alt2) { case 1: DebugEnterAlt(1); // D:\\projects\\common\\Antlr\\simpleboolean-parser\\SimpleBoolean.g:21:16: OR atom { DebugLocation(21, 18); OR7 = (IToken)Match(input, OR, Follow._OR_in_orexpr170); OR7_tree = (object)adaptor.Create(OR7); root_0 = (object)adaptor.BecomeRoot(OR7_tree, root_0); DebugLocation(21, 20); PushFollow(Follow._atom_in_orexpr173); atom8 = atom(); PopFollow(); adaptor.AddChild(root_0, atom8.Tree); } break; default: goto loop2; } } loop2: ; } finally { DebugExitSubRule(2); } } retval.Stop = (IToken)input.LT(-1); retval.Tree = (object)adaptor.RulePostProcessing(root_0); adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop); } catch (RecognitionException re) { ReportError(re); Recover(input, re); retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re); } finally { TraceOut("orexpr", 4); LeaveRule("orexpr", 4); LeaveRule_orexpr(); } DebugLocation(21, 25); } finally { DebugExitRule(GrammarFileName, "orexpr"); } return(retval); }