예제 #1
0
        private LiteralExpressionParser.method_return method()
        {
            Enter_method();
            EnterRule("method", 5);
            TraceIn("method", 5);
            LiteralExpressionParser.method_return retval = new LiteralExpressionParser.method_return();
            retval.Start = (IToken)input.LT(1);

            object root_0 = null;

            IToken IDENTIFIER15 = null;

            LiteralExpressionParser.keyword_return keyword14 = default(LiteralExpressionParser.keyword_return);

            object IDENTIFIER15_tree = null;

            try { DebugEnterRule(GrammarFileName, "method");
                  DebugLocation(25, 29);
                  try
                  {
                      // D:\\Dev\\Codeplex\\sheepaop\\SheepAop\\Saql\\Ast\\LiteralExpression.g:25:8: ( keyword | IDENTIFIER )
                      int alt4 = 2;
                      try { DebugEnterDecision(4, decisionCanBacktrack[4]);
                            int LA4_0 = input.LA(1);

                            if ((LA4_0 == ACCESSOR))
                            {
                                alt4 = 1;
                            }
                            else if ((LA4_0 == IDENTIFIER))
                            {
                                alt4 = 2;
                            }
                            else
                            {
                                NoViableAltException nvae = new NoViableAltException("", 4, 0, input);

                                DebugRecognitionException(nvae);
                                throw nvae;
                            } } finally { DebugExitDecision(4); }
                      switch (alt4)
                      {
                      case 1:
                          DebugEnterAlt(1);
                          // D:\\Dev\\Codeplex\\sheepaop\\SheepAop\\Saql\\Ast\\LiteralExpression.g:25:10: keyword
                          {
                              root_0 = (object)adaptor.Nil();

                              DebugLocation(25, 10);
                              PushFollow(Follow._keyword_in_method133);
                              keyword14 = keyword();
                              PopFollow();

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

                      case 2:
                          DebugEnterAlt(2);
                          // D:\\Dev\\Codeplex\\sheepaop\\SheepAop\\Saql\\Ast\\LiteralExpression.g:25:20: IDENTIFIER
                          {
                              root_0 = (object)adaptor.Nil();

                              DebugLocation(25, 20);
                              IDENTIFIER15      = (IToken)Match(input, IDENTIFIER, Follow._IDENTIFIER_in_method137);
                              IDENTIFIER15_tree = (object)adaptor.Create(IDENTIFIER15);
                              adaptor.AddChild(root_0, IDENTIFIER15_tree);
                          }
                          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("method", 5);
                      LeaveRule("method", 5);
                      Leave_method();
                  }
                  DebugLocation(25, 29); } finally { DebugExitRule(GrammarFileName, "method"); }
            return(retval);
        }
예제 #2
0
        public LiteralExpressionParser.methodExp_return methodExp()
        {
            Enter_methodExp();
            EnterRule("methodExp", 1);
            TraceIn("methodExp", 1);
            LiteralExpressionParser.methodExp_return retval = new LiteralExpressionParser.methodExp_return();
            retval.Start = (IToken)input.LT(1);

            object root_0 = null;

            IToken ACCESSOR1     = null;
            IToken char_literal3 = null;
            IToken char_literal5 = null;
            IToken char_literal7 = null;

            LiteralExpressionParser.type_return   type2   = default(LiteralExpressionParser.type_return);
            LiteralExpressionParser.method_return method4 = default(LiteralExpressionParser.method_return);
            LiteralExpressionParser.args_return   args6   = default(LiteralExpressionParser.args_return);

            object ACCESSOR1_tree     = null;
            object char_literal3_tree = null;
            object char_literal5_tree = null;
            object char_literal7_tree = null;

            try { DebugEnterRule(GrammarFileName, "methodExp");
                  DebugLocation(12, 52);
                  try
                  {
                      // D:\\Dev\\Codeplex\\sheepaop\\SheepAop\\Saql\\Ast\\LiteralExpression.g:13:11: ( ( ACCESSOR )? type '.' method '(' args ')' )
                      DebugEnterAlt(1);
                      // D:\\Dev\\Codeplex\\sheepaop\\SheepAop\\Saql\\Ast\\LiteralExpression.g:13:13: ( ACCESSOR )? type '.' method '(' args ')'
                      {
                          root_0 = (object)adaptor.Nil();

                          DebugLocation(13, 13);
                          // D:\\Dev\\Codeplex\\sheepaop\\SheepAop\\Saql\\Ast\\LiteralExpression.g:13:13: ( ACCESSOR )?
                          int alt1 = 2;
                          try { DebugEnterSubRule(1);
                                try { DebugEnterDecision(1, decisionCanBacktrack[1]);
                                      int LA1_0 = input.LA(1);

                                      if ((LA1_0 == ACCESSOR))
                                      {
                                          int LA1_1 = input.LA(2);

                                          if (((LA1_1 >= ACCESSOR && LA1_1 <= IDENTIFIER) || LA1_1 == 12))
                                          {
                                              alt1 = 1;
                                          }
                                      }
                                } finally { DebugExitDecision(1); }
                                switch (alt1)
                                {
                                case 1:
                                    DebugEnterAlt(1);
                                    // D:\\Dev\\Codeplex\\sheepaop\\SheepAop\\Saql\\Ast\\LiteralExpression.g:13:14: ACCESSOR
                                    {
                                        DebugLocation(13, 14);
                                        ACCESSOR1      = (IToken)Match(input, ACCESSOR, Follow._ACCESSOR_in_methodExp55);
                                        ACCESSOR1_tree = (object)adaptor.Create(ACCESSOR1);
                                        adaptor.AddChild(root_0, ACCESSOR1_tree);
                                    }
                                    break;
                                }
                          } finally { DebugExitSubRule(1); }

                          DebugLocation(13, 25);
                          PushFollow(Follow._type_in_methodExp59);
                          type2 = type();
                          PopFollow();

                          adaptor.AddChild(root_0, type2.Tree);
                          DebugLocation(13, 30);
                          char_literal3      = (IToken)Match(input, 8, Follow._8_in_methodExp61);
                          char_literal3_tree = (object)adaptor.Create(char_literal3);
                          adaptor.AddChild(root_0, char_literal3_tree);

                          DebugLocation(13, 34);
                          PushFollow(Follow._method_in_methodExp63);
                          method4 = method();
                          PopFollow();

                          adaptor.AddChild(root_0, method4.Tree);
                          DebugLocation(13, 41);
                          char_literal5      = (IToken)Match(input, 9, Follow._9_in_methodExp65);
                          char_literal5_tree = (object)adaptor.Create(char_literal5);
                          adaptor.AddChild(root_0, char_literal5_tree);

                          DebugLocation(13, 45);
                          PushFollow(Follow._args_in_methodExp67);
                          args6 = args();
                          PopFollow();

                          adaptor.AddChild(root_0, args6.Tree);
                          DebugLocation(13, 50);
                          char_literal7      = (IToken)Match(input, 10, Follow._10_in_methodExp69);
                          char_literal7_tree = (object)adaptor.Create(char_literal7);
                          adaptor.AddChild(root_0, char_literal7_tree);
                      }

                      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("methodExp", 1);
                      LeaveRule("methodExp", 1);
                      Leave_methodExp();
                  }
                  DebugLocation(13, 52); } finally { DebugExitRule(GrammarFileName, "methodExp"); }
            return(retval);
        }