Пример #1
0
    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);
    }
Пример #2
0
    private SimpleBooleanParser.andexpr_return andexpr()
    {
        EnterRule_andexpr();
        EnterRule("andexpr", 3);
        TraceIn("andexpr", 3);
        SimpleBooleanParser.andexpr_return retval = new SimpleBooleanParser.andexpr_return(this);
        retval.Start = (IToken)input.LT(1);

        object root_0 = default(object);

        IToken AND4 = default(IToken);

        SimpleBooleanParser.orexpr_return orexpr3 = default(SimpleBooleanParser.orexpr_return);
        SimpleBooleanParser.orexpr_return orexpr5 = default(SimpleBooleanParser.orexpr_return);

        object AND4_tree = default(object);

        try { DebugEnterRule(GrammarFileName, "andexpr");
              DebugLocation(20, 31);
              try
              {
                  // D:\\projects\\common\\Antlr\\simpleboolean-parser\\SimpleBoolean.g:20:9: ( orexpr ( AND orexpr )* )
                  DebugEnterAlt(1);
                  // D:\\projects\\common\\Antlr\\simpleboolean-parser\\SimpleBoolean.g:20:11: orexpr ( AND orexpr )*
                  {
                      root_0 = (object)adaptor.Nil();

                      DebugLocation(20, 11);
                      PushFollow(Follow._orexpr_in_andexpr152);
                      orexpr3 = orexpr();
                      PopFollow();

                      adaptor.AddChild(root_0, orexpr3.Tree);
                      DebugLocation(20, 18);
                      // D:\\projects\\common\\Antlr\\simpleboolean-parser\\SimpleBoolean.g:20:18: ( AND orexpr )*
                      try { DebugEnterSubRule(1);
                            while (true)
                            {
                                int alt1 = 2;
                                try { DebugEnterDecision(1, false);
                                      int LA1_0 = input.LA(1);

                                      if ((LA1_0 == AND))
                                      {
                                          alt1 = 1;
                                      }
                                } finally { DebugExitDecision(1); }
                                switch (alt1)
                                {
                                case 1:
                                    DebugEnterAlt(1);
                                    // D:\\projects\\common\\Antlr\\simpleboolean-parser\\SimpleBoolean.g:20:19: AND orexpr
                                    {
                                        DebugLocation(20, 22);
                                        AND4      = (IToken)Match(input, AND, Follow._AND_in_andexpr155);
                                        AND4_tree = (object)adaptor.Create(AND4);
                                        root_0    = (object)adaptor.BecomeRoot(AND4_tree, root_0);

                                        DebugLocation(20, 24);
                                        PushFollow(Follow._orexpr_in_andexpr158);
                                        orexpr5 = orexpr();
                                        PopFollow();

                                        adaptor.AddChild(root_0, orexpr5.Tree);
                                    }
                                    break;

                                default:
                                    goto loop1;
                                }
                            }

loop1:
                            ; } finally { DebugExitSubRule(1); }
                  }

                  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("andexpr", 3);
                  LeaveRule("andexpr", 3);
                  LeaveRule_andexpr();
              }
              DebugLocation(20, 31); } finally { DebugExitRule(GrammarFileName, "andexpr"); }
        return(retval);
    }