Ejemplo n.º 1
0
        private PointcutParser.array_return array()
        {
            Enter_array();
            EnterRule("array", 3);
            TraceIn("array", 3);
            PointcutParser.array_return retval = new PointcutParser.array_return();
            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken char_literal7 = null;

            PointcutParser.negation_return negation6 = default(PointcutParser.negation_return);
            PointcutParser.negation_return negation8 = default(PointcutParser.negation_return);

            object char_literal7_tree                = default(object);
            RewriteRuleITokenStream  stream_14       = new RewriteRuleITokenStream(adaptor, "token 14");
            RewriteRuleSubtreeStream stream_negation = new RewriteRuleSubtreeStream(adaptor, "rule negation");

            try { DebugEnterRule(GrammarFileName, "array");
                  DebugLocation(23, 3);
                  try
                  {
                      // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:23:7: ( negation ( ( ',' negation )+ -> ^( ARRAY ( negation )* ) | -> negation ) )
                      DebugEnterAlt(1);
                      // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:23:9: negation ( ( ',' negation )+ -> ^( ARRAY ( negation )* ) | -> negation )
                      {
                          DebugLocation(23, 9);
                          PushFollow(Follow._negation_in_array100);
                          negation6 = negation();
                          PopFollow();

                          stream_negation.Add(negation6.Tree);
                          DebugLocation(23, 18);
                          // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:23:18: ( ( ',' negation )+ -> ^( ARRAY ( negation )* ) | -> negation )
                          int alt4 = 2;
                          try { DebugEnterSubRule(4);
                                try { DebugEnterDecision(4, decisionCanBacktrack[4]);
                                      int LA4_0 = input.LA(1);

                                      if ((LA4_0 == 14))
                                      {
                                          alt4 = 1;
                                      }
                                      else if ((LA4_0 == EOF || (LA4_0 >= And && LA4_0 <= Or) || LA4_0 == 18))
                                      {
                                          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\\SheepAspect\\Saql\\Ast\\Pointcut.g:24:4: ( ',' negation )+
                                    {
                                        DebugLocation(24, 4);
                                        // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:24:4: ( ',' negation )+
                                        int cnt3 = 0;
                                        try { DebugEnterSubRule(3);
                                              while (true)
                                              {
                                                  int alt3 = 2;
                                                  try { DebugEnterDecision(3, decisionCanBacktrack[3]);
                                                        int LA3_0 = input.LA(1);

                                                        if ((LA3_0 == 14))
                                                        {
                                                            alt3 = 1;
                                                        }
                                                  } finally { DebugExitDecision(3); }
                                                  switch (alt3)
                                                  {
                                                  case 1:
                                                      DebugEnterAlt(1);
                                                      // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:24:5: ',' negation
                                                      {
                                                          DebugLocation(24, 5);
                                                          char_literal7 = (IToken)Match(input, 14, Follow._14_in_array108);
                                                          stream_14.Add(char_literal7);

                                                          DebugLocation(24, 9);
                                                          PushFollow(Follow._negation_in_array110);
                                                          negation8 = negation();
                                                          PopFollow();

                                                          stream_negation.Add(negation8.Tree);
                                                      }
                                                      break;

                                                  default:
                                                      if (cnt3 >= 1)
                                                      {
                                                          goto loop3;
                                                      }

                                                      EarlyExitException eee3 = new EarlyExitException(3, input);
                                                      DebugRecognitionException(eee3);
                                                      throw eee3;
                                                  }
                                                  cnt3++;
                                              }
loop3:
                                              ; } finally { DebugExitSubRule(3); }



                                        {
                                            // AST REWRITE
                                            // elements: negation
                                            // 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();
                                            // 24:20: -> ^( ARRAY ( negation )* )
                                            {
                                                DebugLocation(24, 23);
                                                // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:24:23: ^( ARRAY ( negation )* )
                                                {
                                                    object root_1 = (object)adaptor.Nil();
                                                    DebugLocation(24, 25);
                                                    root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(ARRAY, "ARRAY"), root_1);

                                                    DebugLocation(24, 31);
                                                    // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:24:31: ( negation )*
                                                    while (stream_negation.HasNext)
                                                    {
                                                        DebugLocation(24, 31);
                                                        adaptor.AddChild(root_1, stream_negation.NextTree());
                                                    }
                                                    stream_negation.Reset();

                                                    adaptor.AddChild(root_0, root_1);
                                                }
                                            }

                                            retval.Tree = root_0;
                                        }
                                    }
                                    break;

                                case 2:
                                    DebugEnterAlt(2);
                                    // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:25:7:
                                    {
                                        {
                                            // AST REWRITE
                                            // elements: negation
                                            // 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();
                                            // 25:7: -> negation
                                            {
                                                DebugLocation(25, 10);
                                                adaptor.AddChild(root_0, stream_negation.NextTree());
                                            }

                                            retval.Tree = root_0;
                                        }
                                    }
                                    break;
                                }
                          } finally { DebugExitSubRule(4); }
                      }

                      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("array", 3);
                      LeaveRule("array", 3);
                      Leave_array();
                  }
                  DebugLocation(26, 3); } finally { DebugExitRule(GrammarFileName, "array"); }
            return(retval);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        private PointcutParser.compound_return compound()
        {
            Enter_compound();
            EnterRule("compound", 2);
            TraceIn("compound", 2);
            PointcutParser.compound_return retval = new PointcutParser.compound_return();
            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken set4 = null;

            PointcutParser.array_return array3 = default(PointcutParser.array_return);
            PointcutParser.array_return array5 = default(PointcutParser.array_return);

            object set4_tree = default(object);

            try { DebugEnterRule(GrammarFileName, "compound");
                  DebugLocation(21, 34);
                  try
                  {
                      // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:21:9: ( array ( ( And | Or ) array )* )
                      DebugEnterAlt(1);
                      // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:21:11: array ( ( And | Or ) array )*
                      {
                          root_0 = (object)adaptor.Nil();

                          DebugLocation(21, 11);
                          PushFollow(Follow._array_in_compound80);
                          array3 = array();
                          PopFollow();

                          adaptor.AddChild(root_0, array3.Tree);
                          DebugLocation(21, 17);
                          // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:21:17: ( ( And | Or ) array )*
                          try { DebugEnterSubRule(2);
                                while (true)
                                {
                                    int alt2 = 2;
                                    try { DebugEnterDecision(2, decisionCanBacktrack[2]);
                                          int LA2_0 = input.LA(1);

                                          if (((LA2_0 >= And && LA2_0 <= Or)))
                                          {
                                              alt2 = 1;
                                          }
                                    } finally { DebugExitDecision(2); }
                                    switch (alt2)
                                    {
                                    case 1:
                                        DebugEnterAlt(1);
                                        // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:21:18: ( And | Or ) array
                                        {
                                            DebugLocation(21, 18);
                                            set4 = (IToken)input.LT(1);
                                            set4 = (IToken)input.LT(1);
                                            if ((input.LA(1) >= And && input.LA(1) <= Or))
                                            {
                                                input.Consume();
                                                root_0 = (object)adaptor.BecomeRoot((object)adaptor.Create(set4), root_0);
                                                state.errorRecovery = false;
                                            }
                                            else
                                            {
                                                MismatchedSetException mse = new MismatchedSetException(null, input);
                                                DebugRecognitionException(mse);
                                                throw mse;
                                            }

                                            DebugLocation(21, 28);
                                            PushFollow(Follow._array_in_compound90);
                                            array5 = array();
                                            PopFollow();

                                            adaptor.AddChild(root_0, array5.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("compound", 2);
                      LeaveRule("compound", 2);
                      Leave_compound();
                  }
                  DebugLocation(21, 34); } finally { DebugExitRule(GrammarFileName, "compound"); }
            return(retval);
        }