Example #1
0
        public LiteralExpressionParser.typeNamespace_return typeNamespace()
        {
            Enter_typeNamespace();
            EnterRule("typeNamespace", 3);
            TraceIn("typeNamespace", 3);
            LiteralExpressionParser.typeNamespace_return retval = new LiteralExpressionParser.typeNamespace_return();
            retval.Start = (IToken)input.LT(1);

            object root_0 = null;

            IToken set12 = null;

            LiteralExpressionParser.namespaceFragment_return namespaceFragment11 = default(LiteralExpressionParser.namespaceFragment_return);

            object set12_tree = null;

            try { DebugEnterRule(GrammarFileName, "typeNamespace");
                  DebugLocation(18, 38);
                  try
                  {
                      // D:\\Dev\\Codeplex\\sheepaop\\SheepAop\\Saql\\Ast\\LiteralExpression.g:20:2: ( ( namespaceFragment ( '.' | '..' ) )* )
                      DebugEnterAlt(1);
                      // D:\\Dev\\Codeplex\\sheepaop\\SheepAop\\Saql\\Ast\\LiteralExpression.g:20:4: ( namespaceFragment ( '.' | '..' ) )*
                      {
                          root_0 = (object)adaptor.Nil();

                          DebugLocation(20, 4);
                          // D:\\Dev\\Codeplex\\sheepaop\\SheepAop\\Saql\\Ast\\LiteralExpression.g:20:4: ( namespaceFragment ( '.' | '..' ) )*
                          try { DebugEnterSubRule(3);
                                while (true)
                                {
                                    int alt3 = 2;
                                    try { DebugEnterDecision(3, decisionCanBacktrack[3]);
                                          int LA3_0 = input.LA(1);

                                          if ((LA3_0 == IDENTIFIER))
                                          {
                                              int LA3_2 = input.LA(2);

                                              if ((LA3_2 == 8))
                                              {
                                                  switch (input.LA(3))
                                                  {
                                                  case ACCESSOR:
                                                  {
                                                      int LA3_5 = input.LA(4);

                                                      if ((LA3_5 == 8 || LA3_5 == 10 || LA3_5 == 13))
                                                      {
                                                          alt3 = 1;
                                                      }
                                                  }
                                                  break;

                                                  case IDENTIFIER:
                                                  {
                                                      int LA3_6 = input.LA(4);

                                                      if ((LA3_6 == 8 || (LA3_6 >= 10 && LA3_6 <= 11) || LA3_6 == 13))
                                                      {
                                                          alt3 = 1;
                                                      }
                                                  }
                                                  break;

                                                  case 12:
                                                  {
                                                      alt3 = 1;
                                                  }
                                                  break;
                                                  }
                                              }
                                              else if ((LA3_2 == 11))
                                              {
                                                  alt3 = 1;
                                              }
                                          }
                                          else if ((LA3_0 == 12))
                                          {
                                              alt3 = 1;
                                          }
                                    } finally { DebugExitDecision(3); }
                                    switch (alt3)
                                    {
                                    case 1:
                                        DebugEnterAlt(1);
                                        // D:\\Dev\\Codeplex\\sheepaop\\SheepAop\\Saql\\Ast\\LiteralExpression.g:20:5: namespaceFragment ( '.' | '..' )
                                        {
                                            DebugLocation(20, 5);
                                            PushFollow(Follow._namespaceFragment_in_typeNamespace99);
                                            namespaceFragment11 = namespaceFragment();
                                            PopFollow();

                                            adaptor.AddChild(root_0, namespaceFragment11.Tree);
                                            DebugLocation(20, 23);
                                            set12 = (IToken)input.LT(1);
                                            set12 = (IToken)input.LT(1);
                                            if (input.LA(1) == 8 || input.LA(1) == 11)
                                            {
                                                input.Consume();
                                                root_0 = (object)adaptor.BecomeRoot((object)adaptor.Create(set12), root_0);
                                                state.errorRecovery = false;
                                            }
                                            else
                                            {
                                                MismatchedSetException mse = new MismatchedSetException(null, input);
                                                DebugRecognitionException(mse);
                                                throw mse;
                                            }
                                        }
                                        break;

                                    default:
                                        goto loop3;
                                    }
                                }

loop3:
                                ; } finally { DebugExitSubRule(3); }
                      }

                      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("typeNamespace", 3);
                      LeaveRule("typeNamespace", 3);
                      Leave_typeNamespace();
                  }
                  DebugLocation(20, 38); } finally { DebugExitRule(GrammarFileName, "typeNamespace"); }
            return(retval);
        }
Example #2
0
        public LiteralExpressionParser.type_return type()
        {
            Enter_type();
            EnterRule("type", 2);
            TraceIn("type", 2);
            LiteralExpressionParser.type_return retval = new LiteralExpressionParser.type_return();
            retval.Start = (IToken)input.LT(1);

            object root_0 = null;

            IToken IDENTIFIER10 = null;

            LiteralExpressionParser.typeNamespace_return typeNamespace8 = default(LiteralExpressionParser.typeNamespace_return);
            LiteralExpressionParser.keyword_return       keyword9       = default(LiteralExpressionParser.keyword_return);

            object IDENTIFIER10_tree = null;

            try { DebugEnterRule(GrammarFileName, "type");
                  DebugLocation(15, 43);
                  try
                  {
                      // D:\\Dev\\Codeplex\\sheepaop\\SheepAop\\Saql\\Ast\\LiteralExpression.g:16:6: ( typeNamespace ( keyword | IDENTIFIER ) )
                      DebugEnterAlt(1);
                      // D:\\Dev\\Codeplex\\sheepaop\\SheepAop\\Saql\\Ast\\LiteralExpression.g:16:8: typeNamespace ( keyword | IDENTIFIER )
                      {
                          root_0 = (object)adaptor.Nil();

                          DebugLocation(16, 8);
                          PushFollow(Follow._typeNamespace_in_type79);
                          typeNamespace8 = typeNamespace();
                          PopFollow();

                          adaptor.AddChild(root_0, typeNamespace8.Tree);
                          DebugLocation(16, 22);
                          // D:\\Dev\\Codeplex\\sheepaop\\SheepAop\\Saql\\Ast\\LiteralExpression.g:16:22: ( keyword | IDENTIFIER )
                          int alt2 = 2;
                          try { DebugEnterSubRule(2);
                                try { DebugEnterDecision(2, decisionCanBacktrack[2]);
                                      int LA2_0 = input.LA(1);

                                      if ((LA2_0 == ACCESSOR))
                                      {
                                          alt2 = 1;
                                      }
                                      else if ((LA2_0 == IDENTIFIER))
                                      {
                                          alt2 = 2;
                                      }
                                      else
                                      {
                                          NoViableAltException nvae = new NoViableAltException("", 2, 0, input);

                                          DebugRecognitionException(nvae);
                                          throw nvae;
                                      } } finally { DebugExitDecision(2); }
                                switch (alt2)
                                {
                                case 1:
                                    DebugEnterAlt(1);
                                    // D:\\Dev\\Codeplex\\sheepaop\\SheepAop\\Saql\\Ast\\LiteralExpression.g:16:23: keyword
                                    {
                                        DebugLocation(16, 23);
                                        PushFollow(Follow._keyword_in_type82);
                                        keyword9 = keyword();
                                        PopFollow();

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

                                case 2:
                                    DebugEnterAlt(2);
                                    // D:\\Dev\\Codeplex\\sheepaop\\SheepAop\\Saql\\Ast\\LiteralExpression.g:16:33: IDENTIFIER
                                    {
                                        DebugLocation(16, 33);
                                        IDENTIFIER10      = (IToken)Match(input, IDENTIFIER, Follow._IDENTIFIER_in_type86);
                                        IDENTIFIER10_tree = (object)adaptor.Create(IDENTIFIER10);
                                        adaptor.AddChild(root_0, IDENTIFIER10_tree);
                                    }
                                    break;
                                }
                          } 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("type", 2);
                      LeaveRule("type", 2);
                      Leave_type();
                  }
                  DebugLocation(16, 43); } finally { DebugExitRule(GrammarFileName, "type"); }
            return(retval);
        }