Example #1
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);
        }
Example #2
0
        private PointcutParser.negation_return negation()
        {
            Enter_negation();
            EnterRule("negation", 4);
            TraceIn("negation", 4);
            PointcutParser.negation_return retval = new PointcutParser.negation_return();
            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken NOT9 = null;

            PointcutParser.criteria_return criteria10 = default(PointcutParser.criteria_return);

            object NOT9_tree = default(object);

            try { DebugEnterRule(GrammarFileName, "negation");
                  DebugLocation(28, 27);
                  try
                  {
                      // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:28:10: ( ( NOT )? criteria )
                      DebugEnterAlt(1);
                      // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:28:12: ( NOT )? criteria
                      {
                          root_0 = (object)adaptor.Nil();

                          DebugLocation(28, 12);
                          // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:28:12: ( NOT )?
                          int alt5 = 2;
                          try { DebugEnterSubRule(5);
                                try { DebugEnterDecision(5, decisionCanBacktrack[5]);
                                      int LA5_0 = input.LA(1);

                                      if ((LA5_0 == NOT))
                                      {
                                          alt5 = 1;
                                      }
                                } finally { DebugExitDecision(5); }
                                switch (alt5)
                                {
                                case 1:
                                    DebugEnterAlt(1);
                                    // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:28:13: NOT
                                    {
                                        DebugLocation(28, 16);
                                        NOT9      = (IToken)Match(input, NOT, Follow._NOT_in_negation144);
                                        NOT9_tree = (object)adaptor.Create(NOT9);
                                        root_0    = (object)adaptor.BecomeRoot(NOT9_tree, root_0);
                                    }
                                    break;
                                }
                          } finally { DebugExitSubRule(5); }

                          DebugLocation(28, 20);
                          PushFollow(Follow._criteria_in_negation149);
                          criteria10 = criteria();
                          PopFollow();

                          adaptor.AddChild(root_0, criteria10.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("negation", 4);
                      LeaveRule("negation", 4);
                      Leave_negation();
                  }
                  DebugLocation(28, 27); } finally { DebugExitRule(GrammarFileName, "negation"); }
            return(retval);
        }