Пример #1
0
        private PointcutParser.atom_return atom()
        {
            Enter_atom();
            EnterRule("atom", 6);
            TraceIn("atom", 6);
            PointcutParser.atom_return retval = new PointcutParser.atom_return();
            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken char_literal15 = null;
            IToken Identifier16   = null;
            IToken Value17        = null;
            IToken char_literal18 = null;
            IToken char_literal20 = null;

            PointcutParser.compound_return compound19 = default(PointcutParser.compound_return);

            object char_literal15_tree                = default(object);
            object Identifier16_tree                  = default(object);
            object Value17_tree                       = default(object);
            object char_literal18_tree                = default(object);
            object char_literal20_tree                = default(object);
            RewriteRuleITokenStream stream_16         = new RewriteRuleITokenStream(adaptor, "token 16");
            RewriteRuleITokenStream stream_Identifier = new RewriteRuleITokenStream(adaptor, "token Identifier");

            try { DebugEnterRule(GrammarFileName, "atom");
                  DebugLocation(33, 22);
                  try
                  {
                      // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:33:6: ( '@' Identifier -> ^( POINTCUTREF Identifier ) | Value | '(' compound ')' )
                      int alt8 = 3;
                      try { DebugEnterDecision(8, decisionCanBacktrack[8]);
                            switch (input.LA(1))
                            {
                            case 16:
                            {
                                alt8 = 1;
                            }
                            break;

                            case Value:
                            {
                                alt8 = 2;
                            }
                            break;

                            case 17:
                            {
                                alt8 = 3;
                            }
                            break;

                            default:
                            {
                                NoViableAltException nvae = new NoViableAltException("", 8, 0, input);

                                DebugRecognitionException(nvae);
                                throw nvae;
                            }
                            }
                      } finally { DebugExitDecision(8); }
                      switch (alt8)
                      {
                      case 1:
                          DebugEnterAlt(1);
                          // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:33:8: '@' Identifier
                          {
                              DebugLocation(33, 8);
                              char_literal15 = (IToken)Match(input, 16, Follow._16_in_atom190);
                              stream_16.Add(char_literal15);

                              DebugLocation(33, 12);
                              Identifier16 = (IToken)Match(input, Identifier, Follow._Identifier_in_atom192);
                              stream_Identifier.Add(Identifier16);



                              {
                                  // AST REWRITE
                                  // elements: Identifier
                                  // token labels:
                                  // rule labels: retval
                                  // token list labels:
                                  // rule list labels:
                                  // wildcard labels:
                                  retval.Tree = root_0;
                                  RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null?retval.Tree:null);

                                  root_0 = (object)adaptor.Nil();
                                  // 33:23: -> ^( POINTCUTREF Identifier )
                                  {
                                      DebugLocation(33, 26);
                                      // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:33:26: ^( POINTCUTREF Identifier )
                                      {
                                          object root_1 = (object)adaptor.Nil();
                                          DebugLocation(33, 28);
                                          root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(POINTCUTREF, "POINTCUTREF"), root_1);

                                          DebugLocation(33, 40);
                                          adaptor.AddChild(root_1, stream_Identifier.NextNode());

                                          adaptor.AddChild(root_0, root_1);
                                      }
                                  }

                                  retval.Tree = root_0;
                              }
                          }
                          break;

                      case 2:
                          DebugEnterAlt(2);
                          // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:34:5: Value
                          {
                              root_0 = (object)adaptor.Nil();

                              DebugLocation(34, 5);
                              Value17      = (IToken)Match(input, Value, Follow._Value_in_atom206);
                              Value17_tree = (object)adaptor.Create(Value17);
                              adaptor.AddChild(root_0, Value17_tree);
                          }
                          break;

                      case 3:
                          DebugEnterAlt(3);
                          // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:35:5: '(' compound ')'
                          {
                              root_0 = (object)adaptor.Nil();

                              DebugLocation(35, 8);
                              char_literal18 = (IToken)Match(input, 17, Follow._17_in_atom213);
                              DebugLocation(35, 10);
                              PushFollow(Follow._compound_in_atom216);
                              compound19 = compound();
                              PopFollow();

                              adaptor.AddChild(root_0, compound19.Tree);
                              DebugLocation(35, 22);
                              char_literal20 = (IToken)Match(input, 18, Follow._18_in_atom218);
                          }
                          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", 6);
                      LeaveRule("atom", 6);
                      Leave_atom();
                  }
                  DebugLocation(35, 22); } finally { DebugExitRule(GrammarFileName, "atom"); }
            return(retval);
        }
Пример #2
0
        private PointcutParser.criteria_return criteria()
        {
            Enter_criteria();
            EnterRule("criteria", 5);
            TraceIn("criteria", 5);
            PointcutParser.criteria_return retval = new PointcutParser.criteria_return();
            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken Identifier12   = null;
            IToken char_literal13 = null;

            PointcutParser.atom_return  atom11  = default(PointcutParser.atom_return);
            PointcutParser.array_return array14 = default(PointcutParser.array_return);

            object Identifier12_tree                   = default(object);
            object char_literal13_tree                 = default(object);
            RewriteRuleITokenStream  stream_15         = new RewriteRuleITokenStream(adaptor, "token 15");
            RewriteRuleITokenStream  stream_Identifier = new RewriteRuleITokenStream(adaptor, "token Identifier");
            RewriteRuleSubtreeStream stream_array      = new RewriteRuleSubtreeStream(adaptor, "rule array");

            try { DebugEnterRule(GrammarFileName, "criteria");
                  DebugLocation(30, 60);
                  try
                  {
                      // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:30:10: ( atom | ( Identifier ( ':' array )? ) -> ^( CRITERIA Identifier ( array )? ) )
                      int alt7 = 2;
                      try { DebugEnterDecision(7, decisionCanBacktrack[7]);
                            int LA7_0 = input.LA(1);

                            if ((LA7_0 == Value || (LA7_0 >= 16 && LA7_0 <= 17)))
                            {
                                alt7 = 1;
                            }
                            else if ((LA7_0 == Identifier))
                            {
                                alt7 = 2;
                            }
                            else
                            {
                                NoViableAltException nvae = new NoViableAltException("", 7, 0, input);

                                DebugRecognitionException(nvae);
                                throw nvae;
                            } } finally { DebugExitDecision(7); }
                      switch (alt7)
                      {
                      case 1:
                          DebugEnterAlt(1);
                          // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:30:12: atom
                          {
                              root_0 = (object)adaptor.Nil();

                              DebugLocation(30, 12);
                              PushFollow(Follow._atom_in_criteria157);
                              atom11 = atom();
                              PopFollow();

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

                      case 2:
                          DebugEnterAlt(2);
                          // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:31:4: ( Identifier ( ':' array )? )
                          {
                              DebugLocation(31, 4);
                              // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:31:4: ( Identifier ( ':' array )? )
                              DebugEnterAlt(1);
                              // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:31:5: Identifier ( ':' array )?
                              {
                                  DebugLocation(31, 5);
                                  Identifier12 = (IToken)Match(input, Identifier, Follow._Identifier_in_criteria163);
                                  stream_Identifier.Add(Identifier12);

                                  DebugLocation(31, 16);
                                  // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:31:16: ( ':' array )?
                                  int alt6 = 2;
                                  try { DebugEnterSubRule(6);
                                        try { DebugEnterDecision(6, decisionCanBacktrack[6]);
                                              int LA6_0 = input.LA(1);

                                              if ((LA6_0 == 15))
                                              {
                                                  alt6 = 1;
                                              }
                                        } finally { DebugExitDecision(6); }
                                        switch (alt6)
                                        {
                                        case 1:
                                            DebugEnterAlt(1);
                                            // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:31:17: ':' array
                                            {
                                                DebugLocation(31, 17);
                                                char_literal13 = (IToken)Match(input, 15, Follow._15_in_criteria166);
                                                stream_15.Add(char_literal13);

                                                DebugLocation(31, 21);
                                                PushFollow(Follow._array_in_criteria168);
                                                array14 = array();
                                                PopFollow();

                                                stream_array.Add(array14.Tree);
                                            }
                                            break;
                                        }
                                  } finally { DebugExitSubRule(6); }
                              }



                              {
                                  // AST REWRITE
                                  // elements: array, Identifier
                                  // token labels:
                                  // rule labels: retval
                                  // token list labels:
                                  // rule list labels:
                                  // wildcard labels:
                                  retval.Tree = root_0;
                                  RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null?retval.Tree:null);

                                  root_0 = (object)adaptor.Nil();
                                  // 31:29: -> ^( CRITERIA Identifier ( array )? )
                                  {
                                      DebugLocation(31, 32);
                                      // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:31:32: ^( CRITERIA Identifier ( array )? )
                                      {
                                          object root_1 = (object)adaptor.Nil();
                                          DebugLocation(31, 34);
                                          root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(CRITERIA, "CRITERIA"), root_1);

                                          DebugLocation(31, 43);
                                          adaptor.AddChild(root_1, stream_Identifier.NextNode());
                                          DebugLocation(31, 54);
                                          // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:31:54: ( array )?
                                          if (stream_array.HasNext)
                                          {
                                              DebugLocation(31, 54);
                                              adaptor.AddChild(root_1, stream_array.NextTree());
                                          }
                                          stream_array.Reset();

                                          adaptor.AddChild(root_0, root_1);
                                      }
                                  }

                                  retval.Tree = root_0;
                              }
                          }
                          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("criteria", 5);
                      LeaveRule("criteria", 5);
                      Leave_criteria();
                  }
                  DebugLocation(31, 60); } finally { DebugExitRule(GrammarFileName, "criteria"); }
            return(retval);
        }