public void CheckRRSubtreeStreamBehaviourWithElements()
        {
            RewriteRuleSubtreeStream subtreeTest =
                new RewriteRuleSubtreeStream(CreateTreeAdaptor(),
                                             "RewriteRuleSubtreeStream test");

            IToken token1 = CreateToken(1, "test token without any real context");
            ITree  tree1  = CreateTree(token1);

            // Test Add()
            subtreeTest.Add(tree1);
            Assert.AreEqual(1, subtreeTest.Size(), "subtreeTest should have the size 1 (1).");
            Assert.IsTrue(subtreeTest.HasNext(), "HasNext() should be true here (1).");

            // Test NextNode()
            Assert.AreEqual(tree1, (ITree)subtreeTest.NextNode(),
                            "The returned tree should be equal to the given tree (1).");
            Assert.AreEqual(1, subtreeTest.Size(), "subtreeTest should have the size 1 (2).");
            Assert.IsFalse(subtreeTest.HasNext(), "HasNext() should be false here (1).");
            subtreeTest.Reset();
            Assert.AreEqual(1, subtreeTest.Size(), "subtreeTest should have the size 1 (3).");
            Assert.IsTrue(subtreeTest.HasNext(), "HasNext() should be true here (2).");

            // Test NextTree()
            CommonTree returnedTree = (CommonTree)subtreeTest.NextTree();

            Assert.AreEqual(token1, returnedTree.Token,
                            "The returned token should be equal to the given token (3).");
            Assert.AreEqual(1, subtreeTest.Size(), "subtreeTest should have the size 1 (4).");
            Assert.IsFalse(subtreeTest.HasNext(), "HasNext() should be false here (2).");
            subtreeTest.Reset();
            Assert.AreEqual(1, subtreeTest.Size(), "subtreeTest should have the size 1 (5).");
            Assert.IsTrue(subtreeTest.HasNext(), "HasNext() should be true here (3).");

            // Test, what happens with two elements
            IToken token2 = CreateToken(2, "test token without any real context");
            ITree  tree2  = CreateTree(token2);

            subtreeTest.Add(tree2);
            Assert.AreEqual(2, subtreeTest.Size(), "subtreeTest should have the size 2 (1).");
            Assert.IsTrue(subtreeTest.HasNext(), "HasNext() should be true here (4).");
            returnedTree = (CommonTree)subtreeTest.NextTree();
            Assert.AreEqual(token1, returnedTree.Token,
                            "The returned token should be equal to the given token (4).");
            Assert.AreEqual(2, subtreeTest.Size(), "subtreeTest should have the size 2 (2).");
            Assert.IsTrue(subtreeTest.HasNext(), "HasNext() should be true here (5).");
            returnedTree = (CommonTree)subtreeTest.NextTree();
            Assert.AreEqual(token2, returnedTree.Token,
                            "The returned token should be equal to the given token (5).");
            Assert.IsFalse(subtreeTest.HasNext(), "HasNext() should be false here (3).");

            // Test exception
            subtreeTest.NextTree();
        }
        public void CheckRewriteRuleSubtreeStreamConstructors()
        {
            RewriteRuleSubtreeStream subtreeTest1 =
                new RewriteRuleSubtreeStream(CreateTreeAdaptor(),
                                             "RewriteRuleSubtreeStream test1");

            RewriteRuleSubtreeStream subtreeTest2 =
                new RewriteRuleSubtreeStream(CreateTreeAdaptor(),
                                             "RewriteRuleSubtreeStream test2", CreateToken(1,
                                                                                           "test token without any real context"));

            RewriteRuleSubtreeStream subtreeTest3 =
                new RewriteRuleSubtreeStream(CreateTreeAdaptor(),
                                             "RewriteRuleSubtreeStream test3", CreateTokenList(4));
        }
        public void CheckRRSubtreeStreamBehaviourWhileEmpty1()
        {
            string description = "RewriteRuleSubtreeStream test";
            RewriteRuleSubtreeStream subtreeTest =
                new RewriteRuleSubtreeStream(CreateTreeAdaptor(), description);

            Assert.IsFalse(subtreeTest.HasNext(), "HasNext() has to give back false here.");
            Assert.AreEqual(description.ToString(), subtreeTest.Description,
                            "Description strings should be equal.");
            Assert.AreEqual(0, subtreeTest.Size(), "The number of elements should be zero.");
            subtreeTest.Reset();
            Assert.IsTrue(true, "Reset() shouldn't make any problems here.");
            Assert.AreEqual(0, subtreeTest.Size(),
                            "The number of elements should be still zero.");
            subtreeTest.NextNode();
        }
예제 #4
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> elseClause()
	{
		EnterRule_elseClause();
		EnterRule("elseClause", 45);
		TraceIn("elseClause", 45);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken ELSE152 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> statement153 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree ELSE152_tree = default(CommonTree);
		RewriteRuleITokenStream stream_ELSE=new RewriteRuleITokenStream(adaptor,"token ELSE");
		RewriteRuleSubtreeStream stream_statement=new RewriteRuleSubtreeStream(adaptor,"rule statement");
		try { DebugEnterRule(GrammarFileName, "elseClause");
		DebugLocation(423, 1);
		try
		{
			// AS3.g:424:2: ( ELSE statement -> ^( ELSE_CLAUSE ELSE statement ) )
			DebugEnterAlt(1);
			// AS3.g:424:4: ELSE statement
			{
			DebugLocation(424, 4);
			ELSE152=(IToken)Match(input,ELSE,Follow._ELSE_in_elseClause2266); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_ELSE.Add(ELSE152);

			DebugLocation(424, 9);
			PushFollow(Follow._statement_in_elseClause2268);
			statement153=statement();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_statement.Add(statement153.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 425:9: -> ^( ELSE_CLAUSE ELSE statement )
			{
				DebugLocation(425, 12);
				// AS3.g:425:12: ^( ELSE_CLAUSE ELSE statement )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(425, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(ELSE_CLAUSE, "ELSE_CLAUSE"), root_1);

				DebugLocation(425, 26);
				adaptor.AddChild(root_1, stream_ELSE.NextNode());
				DebugLocation(425, 31);
				adaptor.AddChild(root_1, stream_statement.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("elseClause", 45);
			LeaveRule("elseClause", 45);
			LeaveRule_elseClause();
		}
		DebugLocation(426, 1);
		} finally { DebugExitRule(GrammarFileName, "elseClause"); }
		return retval;

	}
예제 #5
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> expressionStatement()
	{
		EnterRule_expressionStatement();
		EnterRule("expressionStatement", 43);
		TraceIn("expressionStatement", 43);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		AstParserRuleReturnScope<CommonTree, IToken> s = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> expressionList147 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		RewriteRuleSubtreeStream stream_expressionList=new RewriteRuleSubtreeStream(adaptor,"rule expressionList");
		RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
		try { DebugEnterRule(GrammarFileName, "expressionStatement");
		DebugLocation(411, 1);
		try
		{
			// AS3.g:412:2: ( expressionList s= semi -> ^( EXPR_STMNT expressionList ) )
			DebugEnterAlt(1);
			// AS3.g:412:4: expressionList s= semi
			{
			DebugLocation(412, 4);
			PushFollow(Follow._expressionList_in_expressionStatement2189);
			expressionList147=expressionList();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_expressionList.Add(expressionList147.Tree);
			DebugLocation(412, 20);
			PushFollow(Follow._semi_in_expressionStatement2193);
			s=semi();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_semi.Add(s.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 413:3: -> ^( EXPR_STMNT expressionList )
			{
				DebugLocation(413, 6);
				// AS3.g:413:6: ^( EXPR_STMNT expressionList )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(413, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(EXPR_STMNT, "EXPR_STMNT"), root_1);

				DebugLocation(413, 19);
				adaptor.AddChild(root_1, stream_expressionList.NextTree());
				DebugLocation(413, 34);
				adaptor.AddChild(root_1, maybeSemi(s));

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("expressionStatement", 43);
			LeaveRule("expressionStatement", 43);
			LeaveRule_expressionStatement();
		}
		DebugLocation(414, 1);
		} finally { DebugExitRule(GrammarFileName, "expressionStatement"); }
		return retval;

	}
예제 #6
0
        private AstParserRuleReturnScope <object, IToken> oslc_search_terms()
        {
            EnterRule_oslc_search_terms();
            EnterRule("oslc_search_terms", 1);
            TraceIn("oslc_search_terms", 1);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken char_literal2 = default(IToken);
            AstParserRuleReturnScope <object, IToken> string_esc1 = default(AstParserRuleReturnScope <object, IToken>);
            AstParserRuleReturnScope <object, IToken> string_esc3 = default(AstParserRuleReturnScope <object, IToken>);

            object char_literal2_tree                  = default(object);
            RewriteRuleITokenStream  stream_COMMA      = new RewriteRuleITokenStream(adaptor, "token COMMA");
            RewriteRuleSubtreeStream stream_string_esc = new RewriteRuleSubtreeStream(adaptor, "rule string_esc");

            try { DebugEnterRule(GrammarFileName, "oslc_search_terms");
                  DebugLocation(41, 1);
                  try
                  {
                      // ../Grammars/OslcSearchTerms.g:41:22: ( string_esc ( ',' string_esc )* -> ^( 'string_list' string_esc ( string_esc )* ) )
                      DebugEnterAlt(1);
                      // ../Grammars/OslcSearchTerms.g:41:24: string_esc ( ',' string_esc )*
                      {
                          DebugLocation(41, 24);
                          PushFollow(Follow._string_esc_in_oslc_search_terms60);
                          string_esc1 = string_esc();
                          PopFollow();

                          stream_string_esc.Add(string_esc1.Tree);
                          DebugLocation(41, 35);
                          // ../Grammars/OslcSearchTerms.g:41:35: ( ',' string_esc )*
                          try { DebugEnterSubRule(1);
                                while (true)
                                {
                                    int alt1 = 2;
                                    try { DebugEnterDecision(1, false);
                                          int LA1_1 = input.LA(1);

                                          if ((LA1_1 == COMMA))
                                          {
                                              alt1 = 1;
                                          }
                                    } finally { DebugExitDecision(1); }
                                    switch (alt1)
                                    {
                                    case 1:
                                        DebugEnterAlt(1);
                                        // ../Grammars/OslcSearchTerms.g:41:37: ',' string_esc
                                        {
                                            DebugLocation(41, 37);
                                            char_literal2 = (IToken)Match(input, COMMA, Follow._COMMA_in_oslc_search_terms64);
                                            stream_COMMA.Add(char_literal2);

                                            DebugLocation(41, 41);
                                            PushFollow(Follow._string_esc_in_oslc_search_terms66);
                                            string_esc3 = string_esc();
                                            PopFollow();

                                            stream_string_esc.Add(string_esc3.Tree);
                                        }
                                        break;

                                    default:
                                        goto loop1;
                                    }
                                }

loop1:
                                ; } finally { DebugExitSubRule(1); }



                          {
                              // AST REWRITE
                              // elements: string_esc, STRING_LIST, string_esc
                              // 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();
                              // 41:55: -> ^( 'string_list' string_esc ( string_esc )* )
                              {
                                  DebugLocation(41, 58);
                                  // ../Grammars/OslcSearchTerms.g:41:58: ^( 'string_list' string_esc ( string_esc )* )
                                  {
                                      object root_1 = (object)adaptor.Nil();
                                      DebugLocation(41, 60);
                                      root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(STRING_LIST, "STRING_LIST"), root_1);

                                      DebugLocation(41, 74);
                                      adaptor.AddChild(root_1, stream_string_esc.NextTree());
                                      DebugLocation(41, 85);
                                      // ../Grammars/OslcSearchTerms.g:41:85: ( string_esc )*
                                      while (stream_string_esc.HasNext)
                                      {
                                          DebugLocation(41, 86);
                                          adaptor.AddChild(root_1, stream_string_esc.NextTree());
                                      }
                                      stream_string_esc.Reset();

                                      adaptor.AddChild(root_0, root_1);
                                  }
                              }

                              retval.Tree = root_0;
                          }
                      }

                      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("oslc_search_terms", 1);
                      LeaveRule("oslc_search_terms", 1);
                      LeaveRule_oslc_search_terms();
                  }
                  DebugLocation(42, 1); } finally { DebugExitRule(GrammarFileName, "oslc_search_terms"); }
            return(retval);
        }
예제 #7
0
        private AstParserRuleReturnScope <object, IToken> plain_elem_list()
        {
            EnterRule_plain_elem_list();
            EnterRule("plain_elem_list", 4);
            TraceIn("plain_elem_list", 4);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            List <object> list_p = null;
            AstParserRuleReturnScope <object, IToken> p = default(AstParserRuleReturnScope <object, IToken>);
            RewriteRuleSubtreeStream stream_plain_elem  = new RewriteRuleSubtreeStream(adaptor, "rule plain_elem");

            try { DebugEnterRule(GrammarFileName, "plain_elem_list");
                  DebugLocation(43, 1);
                  try
                  {
                      // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:43:16: ( (p+= plain_elem )+ -> ^( PLAIN_ELEM_LIST ( $p)+ ) )
                      DebugEnterAlt(1);
                      // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:44:2: (p+= plain_elem )+
                      {
                          DebugLocation(44, 3);
                          // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:44:3: (p+= plain_elem )+
                          int cnt2 = 0;
                          try { DebugEnterSubRule(2);
                                while (true)
                                {
                                    int alt2 = 2;
                                    try { DebugEnterDecision(2, false);
                                          int LA2_0 = input.LA(1);

                                          if ((LA2_0 == ID))
                                          {
                                              alt2 = 1;
                                          }
                                    } finally { DebugExitDecision(2); }
                                    switch (alt2)
                                    {
                                    case 1:
                                        DebugEnterAlt(1);
                                        // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:44:3: p+= plain_elem
                                        {
                                            DebugLocation(44, 3);
                                            PushFollow(Follow._plain_elem_in_plain_elem_list157);
                                            p = plain_elem();
                                            PopFollow();

                                            stream_plain_elem.Add(p.Tree);
                                            if (list_p == null)
                                            {
                                                list_p = new List <object>();
                                            }
                                            list_p.Add(p.Tree);
                                        }
                                        break;

                                    default:
                                        if (cnt2 >= 1)
                                        {
                                            goto loop2;
                                        }

                                        EarlyExitException eee2 = new EarlyExitException(2, input);
                                        DebugRecognitionException(eee2);
                                        throw eee2;
                                    }
                                    cnt2++;
                                }
loop2:
                                ; } finally { DebugExitSubRule(2); }



                          {
                              // AST REWRITE
                              // elements: p
                              // token labels:
                              // rule labels: retval
                              // token list labels:
                              // rule list labels: p
                              // wildcard labels:
                              retval.Tree = root_0;
                              RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null?retval.Tree:null);
                              RewriteRuleSubtreeStream stream_p      = new RewriteRuleSubtreeStream(adaptor, "token p", list_p);
                              root_0 = (object)adaptor.Nil();
                              // 44:17: -> ^( PLAIN_ELEM_LIST ( $p)+ )
                              {
                                  DebugLocation(44, 20);
                                  // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:44:20: ^( PLAIN_ELEM_LIST ( $p)+ )
                                  {
                                      object root_1 = (object)adaptor.Nil();
                                      DebugLocation(44, 22);
                                      root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(PLAIN_ELEM_LIST, "PLAIN_ELEM_LIST"), root_1);

                                      DebugLocation(44, 39);
                                      if (!(stream_p.HasNext))
                                      {
                                          throw new RewriteEarlyExitException();
                                      }
                                      while (stream_p.HasNext)
                                      {
                                          DebugLocation(44, 39);
                                          adaptor.AddChild(root_1, stream_p.NextTree());
                                      }
                                      stream_p.Reset();

                                      adaptor.AddChild(root_0, root_1);
                                  }
                              }

                              retval.Tree = root_0;
                          }
                      }

                      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("plain_elem_list", 4);
                      LeaveRule("plain_elem_list", 4);
                      LeaveRule_plain_elem_list();
                  }
                  DebugLocation(45, 1); } finally { DebugExitRule(GrammarFileName, "plain_elem_list"); }
            return(retval);
        }
예제 #8
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> doWhileStatement()
	{
		EnterRule_doWhileStatement();
		EnterRule("doWhileStatement", 68);
		TraceIn("doWhileStatement", 68);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken DO218 = default(IToken);
		IToken WHILE220 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> statement219 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> condition221 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> semi222 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree DO218_tree = default(CommonTree);
		CommonTree WHILE220_tree = default(CommonTree);
		RewriteRuleITokenStream stream_DO=new RewriteRuleITokenStream(adaptor,"token DO");
		RewriteRuleITokenStream stream_WHILE=new RewriteRuleITokenStream(adaptor,"token WHILE");
		RewriteRuleSubtreeStream stream_statement=new RewriteRuleSubtreeStream(adaptor,"rule statement");
		RewriteRuleSubtreeStream stream_condition=new RewriteRuleSubtreeStream(adaptor,"rule condition");
		RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
		try { DebugEnterRule(GrammarFileName, "doWhileStatement");
		DebugLocation(553, 1);
		try
		{
			// AS3.g:554:2: ( DO statement WHILE condition semi -> ^( DO_WHILE_LOOP DO statement WHILE condition ) )
			DebugEnterAlt(1);
			// AS3.g:554:4: DO statement WHILE condition semi
			{
			DebugLocation(554, 4);
			DO218=(IToken)Match(input,DO,Follow._DO_in_doWhileStatement2989); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_DO.Add(DO218);

			DebugLocation(554, 7);
			PushFollow(Follow._statement_in_doWhileStatement2991);
			statement219=statement();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_statement.Add(statement219.Tree);
			DebugLocation(554, 17);
			WHILE220=(IToken)Match(input,WHILE,Follow._WHILE_in_doWhileStatement2993); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_WHILE.Add(WHILE220);

			DebugLocation(554, 23);
			PushFollow(Follow._condition_in_doWhileStatement2995);
			condition221=condition();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_condition.Add(condition221.Tree);
			DebugLocation(554, 33);
			PushFollow(Follow._semi_in_doWhileStatement2997);
			semi222=semi();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_semi.Add(semi222.Tree);


			{
			// AST REWRITE
			// elements: DO, statement, WHILE, condition
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 555:3: -> ^( DO_WHILE_LOOP DO statement WHILE condition )
			{
				DebugLocation(555, 6);
				// AS3.g:555:6: ^( DO_WHILE_LOOP DO statement WHILE condition )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(555, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(DO_WHILE_LOOP, "DO_WHILE_LOOP"), root_1);

				DebugLocation(555, 22);
				adaptor.AddChild(root_1, stream_DO.NextNode());
				DebugLocation(555, 25);
				adaptor.AddChild(root_1, stream_statement.NextTree());
				DebugLocation(555, 35);
				adaptor.AddChild(root_1, stream_WHILE.NextNode());
				DebugLocation(555, 41);
				adaptor.AddChild(root_1, stream_condition.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("doWhileStatement", 68);
			LeaveRule("doWhileStatement", 68);
			LeaveRule_doWhileStatement();
		}
		DebugLocation(556, 1);
		} finally { DebugExitRule(GrammarFileName, "doWhileStatement"); }
		return retval;

	}
예제 #9
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> forStatement()
	{
		EnterRule_forStatement();
		EnterRule("forStatement", 59);
		TraceIn("forStatement", 59);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken FOR190 = default(IToken);
		IToken LPAREN191 = default(IToken);
		IToken RPAREN193 = default(IToken);
		IToken RPAREN196 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> forInClause192 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> statement194 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> traditionalForClause195 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> statement197 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree FOR190_tree = default(CommonTree);
		CommonTree LPAREN191_tree = default(CommonTree);
		CommonTree RPAREN193_tree = default(CommonTree);
		CommonTree RPAREN196_tree = default(CommonTree);
		RewriteRuleITokenStream stream_FOR=new RewriteRuleITokenStream(adaptor,"token FOR");
		RewriteRuleITokenStream stream_LPAREN=new RewriteRuleITokenStream(adaptor,"token LPAREN");
		RewriteRuleITokenStream stream_RPAREN=new RewriteRuleITokenStream(adaptor,"token RPAREN");
		RewriteRuleSubtreeStream stream_forInClause=new RewriteRuleSubtreeStream(adaptor,"rule forInClause");
		RewriteRuleSubtreeStream stream_statement=new RewriteRuleSubtreeStream(adaptor,"rule statement");
		RewriteRuleSubtreeStream stream_traditionalForClause=new RewriteRuleSubtreeStream(adaptor,"rule traditionalForClause");
		try { DebugEnterRule(GrammarFileName, "forStatement");
		DebugLocation(500, 1);
		try
		{
			// AS3.g:502:2: ( FOR LPAREN ( forInClause RPAREN statement -> ^( FOR_IN_LOOP FOR LPAREN forInClause RPAREN statement ) | traditionalForClause RPAREN statement -> ^( FOR_LOOP FOR LPAREN traditionalForClause RPAREN statement ) ) )
			DebugEnterAlt(1);
			// AS3.g:502:4: FOR LPAREN ( forInClause RPAREN statement -> ^( FOR_IN_LOOP FOR LPAREN forInClause RPAREN statement ) | traditionalForClause RPAREN statement -> ^( FOR_LOOP FOR LPAREN traditionalForClause RPAREN statement ) )
			{
			DebugLocation(502, 4);
			FOR190=(IToken)Match(input,FOR,Follow._FOR_in_forStatement2717); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_FOR.Add(FOR190);

			DebugLocation(503, 3);
			LPAREN191=(IToken)Match(input,LPAREN,Follow._LPAREN_in_forStatement2721); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_LPAREN.Add(LPAREN191);

			DebugLocation(504, 3);
			// AS3.g:504:3: ( forInClause RPAREN statement -> ^( FOR_IN_LOOP FOR LPAREN forInClause RPAREN statement ) | traditionalForClause RPAREN statement -> ^( FOR_LOOP FOR LPAREN traditionalForClause RPAREN statement ) )
			int alt43=2;
			try { DebugEnterSubRule(43);
			try { DebugEnterDecision(43, false);
			try
			{
				alt43 = dfa43.Predict(input);
			}
			catch (NoViableAltException nvae)
			{
				DebugRecognitionException(nvae);
				throw;
			}
			} finally { DebugExitDecision(43); }
			switch (alt43)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:504:5: forInClause RPAREN statement
				{
				DebugLocation(504, 5);
				PushFollow(Follow._forInClause_in_forStatement2727);
				forInClause192=forInClause();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_forInClause.Add(forInClause192.Tree);
				DebugLocation(504, 17);
				RPAREN193=(IToken)Match(input,RPAREN,Follow._RPAREN_in_forStatement2729); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_RPAREN.Add(RPAREN193);

				DebugLocation(504, 24);
				PushFollow(Follow._statement_in_forStatement2731);
				statement194=statement();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_statement.Add(statement194.Tree);


				{
				// AST REWRITE
				// elements: FOR, LPAREN, forInClause, RPAREN, statement
				// token labels: 
				// rule labels: retval
				// token list labels: 
				// rule list labels: 
				// wildcard labels: 
				if (state.backtracking == 0) {
				retval.Tree = root_0;
				RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

				root_0 = (CommonTree)adaptor.Nil();
				// 505:4: -> ^( FOR_IN_LOOP FOR LPAREN forInClause RPAREN statement )
				{
					DebugLocation(505, 7);
					// AS3.g:505:7: ^( FOR_IN_LOOP FOR LPAREN forInClause RPAREN statement )
					{
					CommonTree root_1 = (CommonTree)adaptor.Nil();
					DebugLocation(505, 9);
					root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(FOR_IN_LOOP, "FOR_IN_LOOP"), root_1);

					DebugLocation(505, 21);
					adaptor.AddChild(root_1, stream_FOR.NextNode());
					DebugLocation(505, 25);
					adaptor.AddChild(root_1, stream_LPAREN.NextNode());
					DebugLocation(505, 32);
					adaptor.AddChild(root_1, stream_forInClause.NextTree());
					DebugLocation(505, 44);
					adaptor.AddChild(root_1, stream_RPAREN.NextNode());
					DebugLocation(505, 51);
					adaptor.AddChild(root_1, stream_statement.NextTree());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}
				}

				}
				break;
			case 2:
				DebugEnterAlt(2);
				// AS3.g:507:5: traditionalForClause RPAREN statement
				{
				DebugLocation(507, 5);
				PushFollow(Follow._traditionalForClause_in_forStatement2757);
				traditionalForClause195=traditionalForClause();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_traditionalForClause.Add(traditionalForClause195.Tree);
				DebugLocation(507, 26);
				RPAREN196=(IToken)Match(input,RPAREN,Follow._RPAREN_in_forStatement2759); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_RPAREN.Add(RPAREN196);

				DebugLocation(507, 33);
				PushFollow(Follow._statement_in_forStatement2761);
				statement197=statement();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_statement.Add(statement197.Tree);


				{
				// AST REWRITE
				// elements: FOR, LPAREN, traditionalForClause, RPAREN, statement
				// token labels: 
				// rule labels: retval
				// token list labels: 
				// rule list labels: 
				// wildcard labels: 
				if (state.backtracking == 0) {
				retval.Tree = root_0;
				RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

				root_0 = (CommonTree)adaptor.Nil();
				// 508:4: -> ^( FOR_LOOP FOR LPAREN traditionalForClause RPAREN statement )
				{
					DebugLocation(508, 7);
					// AS3.g:508:7: ^( FOR_LOOP FOR LPAREN traditionalForClause RPAREN statement )
					{
					CommonTree root_1 = (CommonTree)adaptor.Nil();
					DebugLocation(508, 9);
					root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(FOR_LOOP, "FOR_LOOP"), root_1);

					DebugLocation(508, 18);
					adaptor.AddChild(root_1, stream_FOR.NextNode());
					DebugLocation(508, 22);
					adaptor.AddChild(root_1, stream_LPAREN.NextNode());
					DebugLocation(508, 29);
					adaptor.AddChild(root_1, stream_traditionalForClause.NextTree());
					DebugLocation(508, 50);
					adaptor.AddChild(root_1, stream_RPAREN.NextNode());
					DebugLocation(508, 57);
					adaptor.AddChild(root_1, stream_statement.NextTree());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}
				}

				}
				break;

			}
			} finally { DebugExitSubRule(43); }


			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("forStatement", 59);
			LeaveRule("forStatement", 59);
			LeaveRule_forStatement();
		}
		DebugLocation(510, 1);
		} finally { DebugExitRule(GrammarFileName, "forStatement"); }
		return retval;

	}
예제 #10
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> switchStatement()
	{
		EnterRule_switchStatement();
		EnterRule("switchStatement", 53);
		TraceIn("switchStatement", 53);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken SWITCH172 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> condition173 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> switchBlock174 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree SWITCH172_tree = default(CommonTree);
		RewriteRuleITokenStream stream_SWITCH=new RewriteRuleITokenStream(adaptor,"token SWITCH");
		RewriteRuleSubtreeStream stream_condition=new RewriteRuleSubtreeStream(adaptor,"rule condition");
		RewriteRuleSubtreeStream stream_switchBlock=new RewriteRuleSubtreeStream(adaptor,"rule switchBlock");
		try { DebugEnterRule(GrammarFileName, "switchStatement");
		DebugLocation(465, 1);
		try
		{
			// AS3.g:466:2: ( SWITCH condition switchBlock -> ^( SWITCH_STATEMENT SWITCH condition switchBlock ) )
			DebugEnterAlt(1);
			// AS3.g:466:4: SWITCH condition switchBlock
			{
			DebugLocation(466, 4);
			SWITCH172=(IToken)Match(input,SWITCH,Follow._SWITCH_in_switchStatement2528); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_SWITCH.Add(SWITCH172);

			DebugLocation(466, 11);
			PushFollow(Follow._condition_in_switchStatement2530);
			condition173=condition();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_condition.Add(condition173.Tree);
			DebugLocation(467, 3);
			PushFollow(Follow._switchBlock_in_switchStatement2534);
			switchBlock174=switchBlock();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_switchBlock.Add(switchBlock174.Tree);


			{
			// AST REWRITE
			// elements: SWITCH, condition, switchBlock
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 468:9: -> ^( SWITCH_STATEMENT SWITCH condition switchBlock )
			{
				DebugLocation(468, 12);
				// AS3.g:468:12: ^( SWITCH_STATEMENT SWITCH condition switchBlock )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(468, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(SWITCH_STATEMENT, "SWITCH_STATEMENT"), root_1);

				DebugLocation(468, 31);
				adaptor.AddChild(root_1, stream_SWITCH.NextNode());
				DebugLocation(468, 38);
				adaptor.AddChild(root_1, stream_condition.NextTree());
				DebugLocation(468, 48);
				adaptor.AddChild(root_1, stream_switchBlock.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("switchStatement", 53);
			LeaveRule("switchStatement", 53);
			LeaveRule_switchStatement();
		}
		DebugLocation(469, 1);
		} finally { DebugExitRule(GrammarFileName, "switchStatement"); }
		return retval;

	}
예제 #11
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);
        }
예제 #12
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);
        }
예제 #13
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);
        }
예제 #14
0
        private AstParserRuleReturnScope <object, IToken> identifier()
        {
            EnterRule_identifier();
            EnterRule("identifier", 5);
            TraceIn("identifier", 5);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken ASTERISK12 = default(IToken);
            AstParserRuleReturnScope <object, IToken> prefixedName11 = default(AstParserRuleReturnScope <object, IToken>);

            object ASTERISK12_tree = default(object);
            RewriteRuleITokenStream  stream_ASTERISK     = new RewriteRuleITokenStream(adaptor, "token ASTERISK");
            RewriteRuleSubtreeStream stream_prefixedName = new RewriteRuleSubtreeStream(adaptor, "rule prefixedName");

            try { DebugEnterRule(GrammarFileName, "identifier");
                  DebugLocation(56, 1);
                  try
                  {
                      // ../Grammars/OslcSelect.g:56:12: ( prefixedName -> ^( 'prefixed_name' prefixedName ) | ASTERISK -> ^( 'wildcard' ) )
                      int alt3 = 2;
                      try { DebugEnterDecision(3, false);
                            int LA3_1 = input.LA(1);

                            if (((LA3_1 >= PNAME_LN && LA3_1 <= PNAME_NS)))
                            {
                                alt3 = 1;
                            }
                            else if ((LA3_1 == ASTERISK))
                            {
                                alt3 = 2;
                            }
                            else
                            {
                                NoViableAltException nvae = new NoViableAltException("", 3, 0, input, 1);
                                DebugRecognitionException(nvae);
                                throw nvae;
                            } } finally { DebugExitDecision(3); }
                      switch (alt3)
                      {
                      case 1:
                          DebugEnterAlt(1);
                          // ../Grammars/OslcSelect.g:56:14: prefixedName
                          {
                              DebugLocation(56, 14);
                              PushFollow(Follow._prefixedName_in_identifier173);
                              prefixedName11 = prefixedName();
                              PopFollow();

                              stream_prefixedName.Add(prefixedName11.Tree);


                              {
                                  // AST REWRITE
                                  // elements: prefixedName, PREFIXED_NAME
                                  // 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();
                                  // 56:27: -> ^( 'prefixed_name' prefixedName )
                                  {
                                      DebugLocation(56, 30);
                                      // ../Grammars/OslcSelect.g:56:30: ^( 'prefixed_name' prefixedName )
                                      {
                                          object root_1 = (object)adaptor.Nil();
                                          DebugLocation(56, 33);
                                          root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(PREFIXED_NAME, "PREFIXED_NAME"), root_1);

                                          DebugLocation(56, 49);
                                          adaptor.AddChild(root_1, stream_prefixedName.NextTree());

                                          adaptor.AddChild(root_0, root_1);
                                      }
                                  }

                                  retval.Tree = root_0;
                              }
                          }
                          break;

                      case 2:
                          DebugEnterAlt(2);
                          // ../Grammars/OslcSelect.g:57:7: ASTERISK
                          {
                              DebugLocation(57, 7);
                              ASTERISK12 = (IToken)Match(input, ASTERISK, Follow._ASTERISK_in_identifier191);
                              stream_ASTERISK.Add(ASTERISK12);



                              {
                                  // AST REWRITE
                                  // elements: WILDCARD
                                  // 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();
                                  // 57:16: -> ^( 'wildcard' )
                                  {
                                      DebugLocation(57, 19);
                                      // ../Grammars/OslcSelect.g:57:19: ^( 'wildcard' )
                                      {
                                          object root_1 = (object)adaptor.Nil();
                                          DebugLocation(57, 22);
                                          root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(WILDCARD, "WILDCARD"), root_1);

                                          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("identifier", 5);
                      LeaveRule("identifier", 5);
                      LeaveRule_identifier();
                  }
                  DebugLocation(58, 1); } finally { DebugExitRule(GrammarFileName, "identifier"); }
            return(retval);
        }
예제 #15
0
        private AstParserRuleReturnScope <object, IToken> nested_property()
        {
            EnterRule_nested_property();
            EnterRule("nested_property", 4);
            TraceIn("nested_property", 4);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken OPEN_CURLY_BRACE8   = default(IToken);
            IToken CLOSE_CURLY_BRACE10 = default(IToken);
            AstParserRuleReturnScope <object, IToken> identifier7 = default(AstParserRuleReturnScope <object, IToken>);
            AstParserRuleReturnScope <object, IToken> properties9 = default(AstParserRuleReturnScope <object, IToken>);

            object OPEN_CURLY_BRACE8_tree   = default(object);
            object CLOSE_CURLY_BRACE10_tree = default(object);
            RewriteRuleITokenStream  stream_CLOSE_CURLY_BRACE = new RewriteRuleITokenStream(adaptor, "token CLOSE_CURLY_BRACE");
            RewriteRuleITokenStream  stream_OPEN_CURLY_BRACE  = new RewriteRuleITokenStream(adaptor, "token OPEN_CURLY_BRACE");
            RewriteRuleSubtreeStream stream_properties        = new RewriteRuleSubtreeStream(adaptor, "rule properties");
            RewriteRuleSubtreeStream stream_identifier        = new RewriteRuleSubtreeStream(adaptor, "rule identifier");

            try { DebugEnterRule(GrammarFileName, "nested_property");
                  DebugLocation(53, 1);
                  try
                  {
                      // ../Grammars/OslcSelect.g:53:17: ( identifier OPEN_CURLY_BRACE properties CLOSE_CURLY_BRACE -> ^( 'nested_property' identifier properties ) )
                      DebugEnterAlt(1);
                      // ../Grammars/OslcSelect.g:53:19: identifier OPEN_CURLY_BRACE properties CLOSE_CURLY_BRACE
                      {
                          DebugLocation(53, 19);
                          PushFollow(Follow._identifier_in_nested_property145);
                          identifier7 = identifier();
                          PopFollow();

                          stream_identifier.Add(identifier7.Tree);
                          DebugLocation(53, 30);
                          OPEN_CURLY_BRACE8 = (IToken)Match(input, OPEN_CURLY_BRACE, Follow._OPEN_CURLY_BRACE_in_nested_property147);
                          stream_OPEN_CURLY_BRACE.Add(OPEN_CURLY_BRACE8);

                          DebugLocation(53, 47);
                          PushFollow(Follow._properties_in_nested_property149);
                          properties9 = properties();
                          PopFollow();

                          stream_properties.Add(properties9.Tree);
                          DebugLocation(53, 58);
                          CLOSE_CURLY_BRACE10 = (IToken)Match(input, CLOSE_CURLY_BRACE, Follow._CLOSE_CURLY_BRACE_in_nested_property151);
                          stream_CLOSE_CURLY_BRACE.Add(CLOSE_CURLY_BRACE10);



                          {
                              // AST REWRITE
                              // elements: properties, NESTED_PROPERTIES, 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();
                              // 53:76: -> ^( 'nested_property' identifier properties )
                              {
                                  DebugLocation(53, 79);
                                  // ../Grammars/OslcSelect.g:53:79: ^( 'nested_property' identifier properties )
                                  {
                                      object root_1 = (object)adaptor.Nil();
                                      DebugLocation(53, 82);
                                      root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(NESTED_PROPERTIES, "NESTED_PROPERTIES"), root_1);

                                      DebugLocation(53, 100);
                                      adaptor.AddChild(root_1, stream_identifier.NextTree());
                                      DebugLocation(53, 111);
                                      adaptor.AddChild(root_1, stream_properties.NextTree());

                                      adaptor.AddChild(root_0, root_1);
                                  }
                              }

                              retval.Tree = root_0;
                          }
                      }

                      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("nested_property", 4);
                      LeaveRule("nested_property", 4);
                      LeaveRule_nested_property();
                  }
                  DebugLocation(54, 1); } finally { DebugExitRule(GrammarFileName, "nested_property"); }
            return(retval);
        }
예제 #16
0
        private AstParserRuleReturnScope <object, IToken> properties()
        {
            EnterRule_properties();
            EnterRule("properties", 2);
            TraceIn("properties", 2);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken char_literal3 = default(IToken);
            AstParserRuleReturnScope <object, IToken> property2 = default(AstParserRuleReturnScope <object, IToken>);
            AstParserRuleReturnScope <object, IToken> property4 = default(AstParserRuleReturnScope <object, IToken>);

            object char_literal3_tree                = default(object);
            RewriteRuleITokenStream  stream_COMMA    = new RewriteRuleITokenStream(adaptor, "token COMMA");
            RewriteRuleSubtreeStream stream_property = new RewriteRuleSubtreeStream(adaptor, "rule property");

            try { DebugEnterRule(GrammarFileName, "properties");
                  DebugLocation(47, 1);
                  try
                  {
                      // ../Grammars/OslcSelect.g:47:12: ( property ( ',' property )* -> ^( 'properties' property ( property )* ) )
                      DebugEnterAlt(1);
                      // ../Grammars/OslcSelect.g:47:14: property ( ',' property )*
                      {
                          DebugLocation(47, 14);
                          PushFollow(Follow._property_in_properties88);
                          property2 = property();
                          PopFollow();

                          stream_property.Add(property2.Tree);
                          DebugLocation(47, 24);
                          // ../Grammars/OslcSelect.g:47:24: ( ',' property )*
                          try { DebugEnterSubRule(1);
                                while (true)
                                {
                                    int alt1 = 2;
                                    try { DebugEnterDecision(1, false);
                                          int LA1_1 = input.LA(1);

                                          if ((LA1_1 == COMMA))
                                          {
                                              alt1 = 1;
                                          }
                                    } finally { DebugExitDecision(1); }
                                    switch (alt1)
                                    {
                                    case 1:
                                        DebugEnterAlt(1);
                                        // ../Grammars/OslcSelect.g:47:26: ',' property
                                        {
                                            DebugLocation(47, 26);
                                            char_literal3 = (IToken)Match(input, COMMA, Follow._COMMA_in_properties93);
                                            stream_COMMA.Add(char_literal3);

                                            DebugLocation(47, 30);
                                            PushFollow(Follow._property_in_properties95);
                                            property4 = property();
                                            PopFollow();

                                            stream_property.Add(property4.Tree);
                                        }
                                        break;

                                    default:
                                        goto loop1;
                                    }
                                }

loop1:
                                ; } finally { DebugExitSubRule(1); }



                          {
                              // AST REWRITE
                              // elements: PROPERTIES, property, property
                              // 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();
                              // 47:43: -> ^( 'properties' property ( property )* )
                              {
                                  DebugLocation(47, 46);
                                  // ../Grammars/OslcSelect.g:47:46: ^( 'properties' property ( property )* )
                                  {
                                      object root_1 = (object)adaptor.Nil();
                                      DebugLocation(47, 49);
                                      root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(PROPERTIES, "PROPERTIES"), root_1);

                                      DebugLocation(47, 62);
                                      adaptor.AddChild(root_1, stream_property.NextTree());
                                      DebugLocation(47, 71);
                                      // ../Grammars/OslcSelect.g:47:71: ( property )*
                                      while (stream_property.HasNext)
                                      {
                                          DebugLocation(47, 72);
                                          adaptor.AddChild(root_1, stream_property.NextTree());
                                      }
                                      stream_property.Reset();

                                      adaptor.AddChild(root_0, root_1);
                                  }
                              }

                              retval.Tree = root_0;
                          }
                      }

                      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("properties", 2);
                      LeaveRule("properties", 2);
                      LeaveRule_properties();
                  }
                  DebugLocation(48, 1); } finally { DebugExitRule(GrammarFileName, "properties"); }
            return(retval);
        }
예제 #17
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> tryStatement()
	{
		EnterRule_tryStatement();
		EnterRule("tryStatement", 47);
		TraceIn("tryStatement", 47);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken string_literal156 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> block157 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> catchBlock158 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> finallyBlock159 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree string_literal156_tree = default(CommonTree);
		RewriteRuleITokenStream stream_254=new RewriteRuleITokenStream(adaptor,"token 254");
		RewriteRuleSubtreeStream stream_block=new RewriteRuleSubtreeStream(adaptor,"rule block");
		RewriteRuleSubtreeStream stream_catchBlock=new RewriteRuleSubtreeStream(adaptor,"rule catchBlock");
		RewriteRuleSubtreeStream stream_finallyBlock=new RewriteRuleSubtreeStream(adaptor,"rule finallyBlock");
		try { DebugEnterRule(GrammarFileName, "tryStatement");
		DebugLocation(433, 1);
		try
		{
			// AS3.g:434:2: ( 'try' block ( catchBlock )* ( finallyBlock )? -> ^( TRY_STATEMENT 'try' block ( catchBlock )* ( finallyBlock )? ) )
			DebugEnterAlt(1);
			// AS3.g:434:4: 'try' block ( catchBlock )* ( finallyBlock )?
			{
			DebugLocation(434, 4);
			string_literal156=(IToken)Match(input,254,Follow._254_in_tryStatement2335); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_254.Add(string_literal156);

			DebugLocation(435, 3);
			PushFollow(Follow._block_in_tryStatement2339);
			block157=block();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_block.Add(block157.Tree);
			DebugLocation(436, 3);
			// AS3.g:436:3: ( catchBlock )*
			try { DebugEnterSubRule(36);
			while (true)
			{
				int alt36=2;
				try { DebugEnterDecision(36, false);
				int LA36_1 = input.LA(1);

				if ((LA36_1==242))
				{
					alt36 = 1;
				}


				} finally { DebugExitDecision(36); }
				switch ( alt36 )
				{
				case 1:
					DebugEnterAlt(1);
					// AS3.g:436:3: catchBlock
					{
					DebugLocation(436, 3);
					PushFollow(Follow._catchBlock_in_tryStatement2343);
					catchBlock158=catchBlock();
					PopFollow();
					if (state.failed) return retval;
					if (state.backtracking == 0) stream_catchBlock.Add(catchBlock158.Tree);

					}
					break;

				default:
					goto loop36;
				}
			}

			loop36:
				;

			} finally { DebugExitSubRule(36); }

			DebugLocation(437, 3);
			// AS3.g:437:3: ( finallyBlock )?
			int alt37=2;
			try { DebugEnterSubRule(37);
			try { DebugEnterDecision(37, false);
			int LA37_1 = input.LA(1);

			if ((LA37_1==247))
			{
				alt37 = 1;
			}
			} finally { DebugExitDecision(37); }
			switch (alt37)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:437:3: finallyBlock
				{
				DebugLocation(437, 3);
				PushFollow(Follow._finallyBlock_in_tryStatement2348);
				finallyBlock159=finallyBlock();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_finallyBlock.Add(finallyBlock159.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(37); }



			{
			// AST REWRITE
			// elements: 254, block, catchBlock, finallyBlock
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 438:9: -> ^( TRY_STATEMENT 'try' block ( catchBlock )* ( finallyBlock )? )
			{
				DebugLocation(438, 12);
				// AS3.g:438:12: ^( TRY_STATEMENT 'try' block ( catchBlock )* ( finallyBlock )? )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(438, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(TRY_STATEMENT, "TRY_STATEMENT"), root_1);

				DebugLocation(438, 28);
				adaptor.AddChild(root_1, stream_254.NextNode());
				DebugLocation(438, 34);
				adaptor.AddChild(root_1, stream_block.NextTree());
				DebugLocation(438, 40);
				// AS3.g:438:40: ( catchBlock )*
				while ( stream_catchBlock.HasNext )
				{
					DebugLocation(438, 40);
					adaptor.AddChild(root_1, stream_catchBlock.NextTree());

				}
				stream_catchBlock.Reset();
				DebugLocation(438, 52);
				// AS3.g:438:52: ( finallyBlock )?
				if (stream_finallyBlock.HasNext)
				{
					DebugLocation(438, 52);
					adaptor.AddChild(root_1, stream_finallyBlock.NextTree());

				}
				stream_finallyBlock.Reset();

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("tryStatement", 47);
			LeaveRule("tryStatement", 47);
			LeaveRule_tryStatement();
		}
		DebugLocation(439, 1);
		} finally { DebugExitRule(GrammarFileName, "tryStatement"); }
		return retval;

	}
예제 #18
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> continueStatement()
	{
		EnterRule_continueStatement();
		EnterRule("continueStatement", 51);
		TraceIn("continueStatement", 51);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken CONTINUE170 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> s = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree CONTINUE170_tree = default(CommonTree);
		RewriteRuleITokenStream stream_CONTINUE=new RewriteRuleITokenStream(adaptor,"token CONTINUE");
		RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
		try { DebugEnterRule(GrammarFileName, "continueStatement");
		DebugLocation(455, 1);
		try
		{
			// AS3.g:456:2: ( CONTINUE s= semi -> ^( CONTINUE_STATEMENT CONTINUE ) )
			DebugEnterAlt(1);
			// AS3.g:456:4: CONTINUE s= semi
			{
			DebugLocation(456, 4);
			CONTINUE170=(IToken)Match(input,CONTINUE,Follow._CONTINUE_in_continueStatement2462); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_CONTINUE.Add(CONTINUE170);

			DebugLocation(456, 14);
			PushFollow(Follow._semi_in_continueStatement2466);
			s=semi();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_semi.Add(s.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 457:9: -> ^( CONTINUE_STATEMENT CONTINUE )
			{
				DebugLocation(457, 12);
				// AS3.g:457:12: ^( CONTINUE_STATEMENT CONTINUE )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(457, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(CONTINUE_STATEMENT, "CONTINUE_STATEMENT"), root_1);

				DebugLocation(457, 33);
				adaptor.AddChild(root_1, stream_CONTINUE.NextNode());
				DebugLocation(457, 42);
				adaptor.AddChild(root_1, maybeSemi(s));

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("continueStatement", 51);
			LeaveRule("continueStatement", 51);
			LeaveRule_continueStatement();
		}
		DebugLocation(458, 1);
		} finally { DebugExitRule(GrammarFileName, "continueStatement"); }
		return retval;

	}
예제 #19
0
        private AstParserRuleReturnScope <object, IToken> oslc_prefixes()
        {
            EnterRule_oslc_prefixes();
            EnterRule("oslc_prefixes", 1);
            TraceIn("oslc_prefixes", 1);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken char_literal2 = default(IToken);
            AstParserRuleReturnScope <object, IToken> prefix_binding1 = default(AstParserRuleReturnScope <object, IToken>);
            AstParserRuleReturnScope <object, IToken> prefix_binding3 = default(AstParserRuleReturnScope <object, IToken>);

            object char_literal2_tree                      = default(object);
            RewriteRuleITokenStream  stream_COMMA          = new RewriteRuleITokenStream(adaptor, "token COMMA");
            RewriteRuleSubtreeStream stream_prefix_binding = new RewriteRuleSubtreeStream(adaptor, "rule prefix_binding");

            try { DebugEnterRule(GrammarFileName, "oslc_prefixes");
                  DebugLocation(43, 1);
                  try
                  {
                      // ../Grammars/OslcPrefix.g:43:18: ( prefix_binding ( ',' prefix_binding )* -> ^( 'prefix_list' prefix_binding ( prefix_binding )* ) )
                      DebugEnterAlt(1);
                      // ../Grammars/OslcPrefix.g:43:20: prefix_binding ( ',' prefix_binding )*
                      {
                          DebugLocation(43, 20);
                          PushFollow(Follow._prefix_binding_in_oslc_prefixes69);
                          prefix_binding1 = prefix_binding();
                          PopFollow();

                          stream_prefix_binding.Add(prefix_binding1.Tree);
                          DebugLocation(43, 35);
                          // ../Grammars/OslcPrefix.g:43:35: ( ',' prefix_binding )*
                          try { DebugEnterSubRule(1);
                                while (true)
                                {
                                    int alt1 = 2;
                                    try { DebugEnterDecision(1, false);
                                          int LA1_1 = input.LA(1);

                                          if ((LA1_1 == COMMA))
                                          {
                                              alt1 = 1;
                                          }
                                    } finally { DebugExitDecision(1); }
                                    switch (alt1)
                                    {
                                    case 1:
                                        DebugEnterAlt(1);
                                        // ../Grammars/OslcPrefix.g:43:37: ',' prefix_binding
                                        {
                                            DebugLocation(43, 37);
                                            char_literal2 = (IToken)Match(input, COMMA, Follow._COMMA_in_oslc_prefixes73);
                                            stream_COMMA.Add(char_literal2);

                                            DebugLocation(43, 41);
                                            PushFollow(Follow._prefix_binding_in_oslc_prefixes75);
                                            prefix_binding3 = prefix_binding();
                                            PopFollow();

                                            stream_prefix_binding.Add(prefix_binding3.Tree);
                                        }
                                        break;

                                    default:
                                        goto loop1;
                                    }
                                }

loop1:
                                ; } finally { DebugExitSubRule(1); }



                          {
                              // AST REWRITE
                              // elements: prefix_binding, PREFIX_LIST, prefix_binding
                              // 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();
                              // 43:59: -> ^( 'prefix_list' prefix_binding ( prefix_binding )* )
                              {
                                  DebugLocation(43, 62);
                                  // ../Grammars/OslcPrefix.g:43:62: ^( 'prefix_list' prefix_binding ( prefix_binding )* )
                                  {
                                      object root_1 = (object)adaptor.Nil();
                                      DebugLocation(43, 65);
                                      root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(PREFIX_LIST, "PREFIX_LIST"), root_1);

                                      DebugLocation(43, 79);
                                      adaptor.AddChild(root_1, stream_prefix_binding.NextTree());
                                      DebugLocation(43, 94);
                                      // ../Grammars/OslcPrefix.g:43:94: ( prefix_binding )*
                                      while (stream_prefix_binding.HasNext)
                                      {
                                          DebugLocation(43, 95);
                                          adaptor.AddChild(root_1, stream_prefix_binding.NextTree());
                                      }
                                      stream_prefix_binding.Reset();

                                      adaptor.AddChild(root_0, root_1);
                                  }
                              }

                              retval.Tree = root_0;
                          }
                      }

                      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("oslc_prefixes", 1);
                      LeaveRule("oslc_prefixes", 1);
                      LeaveRule_oslc_prefixes();
                  }
                  DebugLocation(44, 1); } finally { DebugExitRule(GrammarFileName, "oslc_prefixes"); }
            return(retval);
        }
예제 #20
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> switchStatementList()
	{
		EnterRule_switchStatementList();
		EnterRule("switchStatementList", 57);
		TraceIn("switchStatementList", 57);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		AstParserRuleReturnScope<CommonTree, IToken> statement184 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		RewriteRuleSubtreeStream stream_statement=new RewriteRuleSubtreeStream(adaptor,"rule statement");
		try { DebugEnterRule(GrammarFileName, "switchStatementList");
		DebugLocation(487, 1);
		try
		{
			// AS3.g:488:2: ( ( statement )* -> ^( SWITCH_STATEMENT_LIST ( statement )* ) )
			DebugEnterAlt(1);
			// AS3.g:488:4: ( statement )*
			{
			DebugLocation(488, 4);
			// AS3.g:488:4: ( statement )*
			try { DebugEnterSubRule(42);
			while (true)
			{
				int alt42=2;
				try { DebugEnterDecision(42, false);
				int LA42_1 = input.LA(1);

				if ((LA42_1==DEFAULT))
				{
					int LA42_2 = input.LA(2);

					if ((LA42_2==XML))
					{
						alt42 = 1;
					}


				}
				else if ((LA42_1==AS||LA42_1==BNOT||LA42_1==BREAK||LA42_1==CONST||LA42_1==CONTINUE||(LA42_1>=DEC && LA42_1<=DECIMAL_LITERAL)||LA42_1==DO||(LA42_1>=DYNAMIC && LA42_1<=E4X_ATTRI)||(LA42_1>=FALSE && LA42_1<=FOR)||LA42_1==FUNCTION||LA42_1==GET||(LA42_1>=HEX_LITERAL && LA42_1<=IDENT)||LA42_1==IF||LA42_1==INC||(LA42_1>=INTERNAL && LA42_1<=IS)||(LA42_1>=LBRACK && LA42_1<=LCURLY)||LA42_1==LNOT||LA42_1==LPAREN||LA42_1==MINUS||LA42_1==NAMESPACE||LA42_1==NEW||LA42_1==NULL||LA42_1==OCTAL_LITERAL||LA42_1==PLUS||LA42_1==PRIVATE||(LA42_1>=PROTECTED && LA42_1<=PUBLIC)||LA42_1==REGEX_LITERAL||LA42_1==RETURN||(LA42_1>=SEMI && LA42_1<=SET)||(LA42_1>=STRING_LITERAL_DOUBLE && LA42_1<=SWITCH)||LA42_1==TRUE||(LA42_1>=USE && LA42_1<=VAR)||LA42_1==WHILE||LA42_1==WITH||LA42_1==XML||LA42_1==XML_LITERAL||LA42_1==243||(LA42_1>=253 && LA42_1<=257)))
				{
					alt42 = 1;
				}


				} finally { DebugExitDecision(42); }
				switch ( alt42 )
				{
				case 1:
					DebugEnterAlt(1);
					// AS3.g:488:4: statement
					{
					DebugLocation(488, 4);
					PushFollow(Follow._statement_in_switchStatementList2649);
					statement184=statement();
					PopFollow();
					if (state.failed) return retval;
					if (state.backtracking == 0) stream_statement.Add(statement184.Tree);

					}
					break;

				default:
					goto loop42;
				}
			}

			loop42:
				;

			} finally { DebugExitSubRule(42); }



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

			root_0 = (CommonTree)adaptor.Nil();
			// 488:15: -> ^( SWITCH_STATEMENT_LIST ( statement )* )
			{
				DebugLocation(488, 18);
				// AS3.g:488:18: ^( SWITCH_STATEMENT_LIST ( statement )* )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(488, 20);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(SWITCH_STATEMENT_LIST, "SWITCH_STATEMENT_LIST"), root_1);

				DebugLocation(488, 42);
				// AS3.g:488:42: ( statement )*
				while ( stream_statement.HasNext )
				{
					DebugLocation(488, 42);
					adaptor.AddChild(root_1, stream_statement.NextTree());

				}
				stream_statement.Reset();

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("switchStatementList", 57);
			LeaveRule("switchStatementList", 57);
			LeaveRule_switchStatementList();
		}
		DebugLocation(489, 1);
		} finally { DebugExitRule(GrammarFileName, "switchStatementList"); }
		return retval;

	}
예제 #21
0
        private AstParserRuleReturnScope <object, IToken> prefix_binding()
        {
            EnterRule_prefix_binding();
            EnterRule("prefix_binding", 2);
            TraceIn("prefix_binding", 2);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken PN_PREFIX4    = default(IToken);
            IToken char_literal5 = default(IToken);
            IToken IRI_REF6      = default(IToken);

            object PN_PREFIX4_tree    = default(object);
            object char_literal5_tree = default(object);
            object IRI_REF6_tree      = default(object);
            RewriteRuleITokenStream stream_PN_PREFIX = new RewriteRuleITokenStream(adaptor, "token PN_PREFIX");
            RewriteRuleITokenStream stream_IRI_REF   = new RewriteRuleITokenStream(adaptor, "token IRI_REF");
            RewriteRuleITokenStream stream_21        = new RewriteRuleITokenStream(adaptor, "token 21");

            try { DebugEnterRule(GrammarFileName, "prefix_binding");
                  DebugLocation(46, 4);
                  try
                  {
                      // ../Grammars/OslcPrefix.g:46:16: ( PN_PREFIX '=' IRI_REF -> ^( 'prefix' PN_PREFIX IRI_REF ) )
                      DebugEnterAlt(1);
                      // ../Grammars/OslcPrefix.g:46:18: PN_PREFIX '=' IRI_REF
                      {
                          DebugLocation(46, 18);
                          PN_PREFIX4 = (IToken)Match(input, PN_PREFIX, Follow._PN_PREFIX_in_prefix_binding105);
                          stream_PN_PREFIX.Add(PN_PREFIX4);

                          DebugLocation(46, 28);
                          char_literal5 = (IToken)Match(input, 21, Follow._21_in_prefix_binding107);
                          stream_21.Add(char_literal5);

                          DebugLocation(46, 32);
                          IRI_REF6 = (IToken)Match(input, IRI_REF, Follow._IRI_REF_in_prefix_binding109);
                          stream_IRI_REF.Add(IRI_REF6);



                          {
                              // AST REWRITE
                              // elements: IRI_REF, PREFIX, PN_PREFIX
                              // 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();
                              // 46:40: -> ^( 'prefix' PN_PREFIX IRI_REF )
                              {
                                  DebugLocation(46, 43);
                                  // ../Grammars/OslcPrefix.g:46:43: ^( 'prefix' PN_PREFIX IRI_REF )
                                  {
                                      object root_1 = (object)adaptor.Nil();
                                      DebugLocation(46, 46);
                                      root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(PREFIX, "PREFIX"), root_1);

                                      DebugLocation(46, 55);
                                      adaptor.AddChild(root_1, stream_PN_PREFIX.NextNode());
                                      DebugLocation(46, 65);
                                      adaptor.AddChild(root_1, stream_IRI_REF.NextNode());

                                      adaptor.AddChild(root_0, root_1);
                                  }
                              }

                              retval.Tree = root_0;
                          }
                      }

                      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("prefix_binding", 2);
                      LeaveRule("prefix_binding", 2);
                      LeaveRule_prefix_binding();
                  }
                  DebugLocation(47, 4); } finally { DebugExitRule(GrammarFileName, "prefix_binding"); }
            return(retval);
        }
예제 #22
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> forIter()
	{
		EnterRule_forIter();
		EnterRule("forIter", 66);
		TraceIn("forIter", 66);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		AstParserRuleReturnScope<CommonTree, IToken> expressionList214 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		RewriteRuleSubtreeStream stream_expressionList=new RewriteRuleSubtreeStream(adaptor,"rule expressionList");
		try { DebugEnterRule(GrammarFileName, "forIter");
		DebugLocation(543, 1);
		try
		{
			// AS3.g:544:2: ( ( expressionList )? -> ^( FOR_ITERATOR ( expressionList )? ) )
			DebugEnterAlt(1);
			// AS3.g:544:4: ( expressionList )?
			{
			DebugLocation(544, 4);
			// AS3.g:544:4: ( expressionList )?
			int alt48=2;
			try { DebugEnterSubRule(48);
			try { DebugEnterDecision(48, false);
			int LA48_1 = input.LA(1);

			if ((LA48_1==AS||LA48_1==BNOT||(LA48_1>=DEC && LA48_1<=DECIMAL_LITERAL)||(LA48_1>=DYNAMIC && LA48_1<=E4X_ATTRI)||(LA48_1>=FALSE && LA48_1<=FLOAT_LITERAL)||LA48_1==FUNCTION||LA48_1==GET||(LA48_1>=HEX_LITERAL && LA48_1<=IDENT)||LA48_1==INC||(LA48_1>=INTERNAL && LA48_1<=IS)||(LA48_1>=LBRACK && LA48_1<=LCURLY)||LA48_1==LNOT||LA48_1==LPAREN||LA48_1==MINUS||LA48_1==NAMESPACE||LA48_1==NEW||LA48_1==NULL||LA48_1==OCTAL_LITERAL||LA48_1==PLUS||LA48_1==PRIVATE||(LA48_1>=PROTECTED && LA48_1<=PUBLIC)||LA48_1==REGEX_LITERAL||LA48_1==SET||(LA48_1>=STRING_LITERAL_DOUBLE && LA48_1<=SUPER)||LA48_1==TRUE||LA48_1==USE||LA48_1==XML||LA48_1==XML_LITERAL||LA48_1==243||(LA48_1>=255 && LA48_1<=257)))
			{
				alt48 = 1;
			}
			} finally { DebugExitDecision(48); }
			switch (alt48)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:544:4: expressionList
				{
				DebugLocation(544, 4);
				PushFollow(Follow._expressionList_in_forIter2939);
				expressionList214=expressionList();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_expressionList.Add(expressionList214.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(48); }



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

			root_0 = (CommonTree)adaptor.Nil();
			// 545:3: -> ^( FOR_ITERATOR ( expressionList )? )
			{
				DebugLocation(545, 6);
				// AS3.g:545:6: ^( FOR_ITERATOR ( expressionList )? )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(545, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(FOR_ITERATOR, "FOR_ITERATOR"), root_1);

				DebugLocation(545, 21);
				// AS3.g:545:21: ( expressionList )?
				if (stream_expressionList.HasNext)
				{
					DebugLocation(545, 21);
					adaptor.AddChild(root_1, stream_expressionList.NextTree());

				}
				stream_expressionList.Reset();

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("forIter", 66);
			LeaveRule("forIter", 66);
			LeaveRule_forIter();
		}
		DebugLocation(546, 1);
		} finally { DebugExitRule(GrammarFileName, "forIter"); }
		return retval;

	}
예제 #23
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> parameterRestDeclaration()
	{
		EnterRule_parameterRestDeclaration();
		EnterRule("parameterRestDeclaration", 37);
		TraceIn("parameterRestDeclaration", 37);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken REST120 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> ident121 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> typeExpression122 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree REST120_tree = default(CommonTree);
		RewriteRuleITokenStream stream_REST=new RewriteRuleITokenStream(adaptor,"token REST");
		RewriteRuleSubtreeStream stream_ident=new RewriteRuleSubtreeStream(adaptor,"rule ident");
		RewriteRuleSubtreeStream stream_typeExpression=new RewriteRuleSubtreeStream(adaptor,"rule typeExpression");
		try { DebugEnterRule(GrammarFileName, "parameterRestDeclaration");
		DebugLocation(353, 1);
		try
		{
			// AS3.g:354:2: ( REST ( ident )? ( typeExpression )? -> ^( PARAM REST ( ident )? ( typeExpression )? ) )
			DebugEnterAlt(1);
			// AS3.g:354:4: REST ( ident )? ( typeExpression )?
			{
			DebugLocation(354, 4);
			REST120=(IToken)Match(input,REST,Follow._REST_in_parameterRestDeclaration1932); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_REST.Add(REST120);

			DebugLocation(354, 9);
			// AS3.g:354:9: ( ident )?
			int alt31=2;
			try { DebugEnterSubRule(31);
			try { DebugEnterDecision(31, false);
			int LA31_1 = input.LA(1);

			if ((LA31_1==AS||LA31_1==DYNAMIC||LA31_1==GET||LA31_1==IDENT||LA31_1==IS||LA31_1==NAMESPACE||LA31_1==SET||LA31_1==SUPER||LA31_1==USE||LA31_1==XML))
			{
				alt31 = 1;
			}
			} finally { DebugExitDecision(31); }
			switch (alt31)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:354:9: ident
				{
				DebugLocation(354, 9);
				PushFollow(Follow._ident_in_parameterRestDeclaration1934);
				ident121=ident();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_ident.Add(ident121.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(31); }

			DebugLocation(354, 16);
			// AS3.g:354:16: ( typeExpression )?
			int alt32=2;
			try { DebugEnterSubRule(32);
			try { DebugEnterDecision(32, false);
			int LA32_1 = input.LA(1);

			if ((LA32_1==COLON))
			{
				alt32 = 1;
			}
			} finally { DebugExitDecision(32); }
			switch (alt32)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:354:16: typeExpression
				{
				DebugLocation(354, 16);
				PushFollow(Follow._typeExpression_in_parameterRestDeclaration1937);
				typeExpression122=typeExpression();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_typeExpression.Add(typeExpression122.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(32); }



			{
			// AST REWRITE
			// elements: REST, ident, typeExpression
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 355:3: -> ^( PARAM REST ( ident )? ( typeExpression )? )
			{
				DebugLocation(355, 6);
				// AS3.g:355:6: ^( PARAM REST ( ident )? ( typeExpression )? )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(355, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(PARAM, "PARAM"), root_1);

				DebugLocation(355, 14);
				adaptor.AddChild(root_1, stream_REST.NextNode());
				DebugLocation(355, 19);
				// AS3.g:355:19: ( ident )?
				if (stream_ident.HasNext)
				{
					DebugLocation(355, 19);
					adaptor.AddChild(root_1, stream_ident.NextTree());

				}
				stream_ident.Reset();
				DebugLocation(355, 26);
				// AS3.g:355:26: ( typeExpression )?
				if (stream_typeExpression.HasNext)
				{
					DebugLocation(355, 26);
					adaptor.AddChild(root_1, stream_typeExpression.NextTree());

				}
				stream_typeExpression.Reset();

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("parameterRestDeclaration", 37);
			LeaveRule("parameterRestDeclaration", 37);
			LeaveRule_parameterRestDeclaration();
		}
		DebugLocation(356, 1);
		} finally { DebugExitRule(GrammarFileName, "parameterRestDeclaration"); }
		return retval;

	}
예제 #24
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> typeExpression()
	{
		EnterRule_typeExpression();
		EnterRule("typeExpression", 71);
		TraceIn("typeExpression", 71);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken COLON232 = default(IToken);
		IToken string_literal234 = default(IToken);
		IToken STAR235 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> typeIdentifier233 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree COLON232_tree = default(CommonTree);
		CommonTree string_literal234_tree = default(CommonTree);
		CommonTree STAR235_tree = default(CommonTree);
		RewriteRuleITokenStream stream_COLON=new RewriteRuleITokenStream(adaptor,"token COLON");
		RewriteRuleITokenStream stream_257=new RewriteRuleITokenStream(adaptor,"token 257");
		RewriteRuleITokenStream stream_STAR=new RewriteRuleITokenStream(adaptor,"token STAR");
		RewriteRuleSubtreeStream stream_typeIdentifier=new RewriteRuleSubtreeStream(adaptor,"rule typeIdentifier");
		try { DebugEnterRule(GrammarFileName, "typeExpression");
		DebugLocation(567, 4);
		try
		{
			// AS3.g:568:2: ( COLON ( typeIdentifier | 'void' | STAR ) -> ^( TYPE_SPEC COLON ( typeIdentifier )? ( 'void' )? ( STAR )? ) )
			DebugEnterAlt(1);
			// AS3.g:569:3: COLON ( typeIdentifier | 'void' | STAR )
			{
			DebugLocation(569, 3);
			COLON232=(IToken)Match(input,COLON,Follow._COLON_in_typeExpression3075); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_COLON.Add(COLON232);

			DebugLocation(569, 9);
			// AS3.g:569:9: ( typeIdentifier | 'void' | STAR )
			int alt49=3;
			try { DebugEnterSubRule(49);
			try { DebugEnterDecision(49, false);
			switch (input.LA(1))
			{
			case AS:
			case DYNAMIC:
			case GET:
			case IDENT:
			case IS:
			case NAMESPACE:
			case SET:
			case SUPER:
			case USE:
			case XML:
				{
				alt49 = 1;
				}
				break;
			case 257:
				{
				alt49 = 2;
				}
				break;
			case STAR:
				{
				alt49 = 3;
				}
				break;
			default:
				{
					if (state.backtracking>0) {state.failed=true; return retval;}
					NoViableAltException nvae = new NoViableAltException("", 49, 0, input, 1);
					DebugRecognitionException(nvae);
					throw nvae;
				}
			}

			} finally { DebugExitDecision(49); }
			switch (alt49)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:569:10: typeIdentifier
				{
				DebugLocation(569, 10);
				PushFollow(Follow._typeIdentifier_in_typeExpression3078);
				typeIdentifier233=typeIdentifier();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_typeIdentifier.Add(typeIdentifier233.Tree);

				}
				break;
			case 2:
				DebugEnterAlt(2);
				// AS3.g:569:27: 'void'
				{
				DebugLocation(569, 27);
				string_literal234=(IToken)Match(input,257,Follow._257_in_typeExpression3082); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_257.Add(string_literal234);


				}
				break;
			case 3:
				DebugEnterAlt(3);
				// AS3.g:569:36: STAR
				{
				DebugLocation(569, 36);
				STAR235=(IToken)Match(input,STAR,Follow._STAR_in_typeExpression3086); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_STAR.Add(STAR235);


				}
				break;

			}
			} finally { DebugExitSubRule(49); }



			{
			// AST REWRITE
			// elements: COLON, typeIdentifier, 257, STAR
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 570:3: -> ^( TYPE_SPEC COLON ( typeIdentifier )? ( 'void' )? ( STAR )? )
			{
				DebugLocation(570, 6);
				// AS3.g:570:6: ^( TYPE_SPEC COLON ( typeIdentifier )? ( 'void' )? ( STAR )? )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(570, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(TYPE_SPEC, "TYPE_SPEC"), root_1);

				DebugLocation(570, 18);
				adaptor.AddChild(root_1, stream_COLON.NextNode());
				DebugLocation(570, 24);
				// AS3.g:570:24: ( typeIdentifier )?
				if (stream_typeIdentifier.HasNext)
				{
					DebugLocation(570, 24);
					adaptor.AddChild(root_1, stream_typeIdentifier.NextTree());

				}
				stream_typeIdentifier.Reset();
				DebugLocation(570, 40);
				// AS3.g:570:40: ( 'void' )?
				if (stream_257.HasNext)
				{
					DebugLocation(570, 40);
					adaptor.AddChild(root_1, stream_257.NextNode());

				}
				stream_257.Reset();
				DebugLocation(570, 48);
				// AS3.g:570:48: ( STAR )?
				if (stream_STAR.HasNext)
				{
					DebugLocation(570, 48);
					adaptor.AddChild(root_1, stream_STAR.NextNode());

				}
				stream_STAR.Reset();

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("typeExpression", 71);
			LeaveRule("typeExpression", 71);
			LeaveRule_typeExpression();
		}
		DebugLocation(571, 4);
		} finally { DebugExitRule(GrammarFileName, "typeExpression"); }
		return retval;

	}
예제 #25
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> condition()
	{
		EnterRule_condition();
		EnterRule("condition", 40);
		TraceIn("condition", 40);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken LPAREN127 = default(IToken);
		IToken RPAREN129 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> expression128 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree LPAREN127_tree = default(CommonTree);
		CommonTree RPAREN129_tree = default(CommonTree);
		RewriteRuleITokenStream stream_LPAREN=new RewriteRuleITokenStream(adaptor,"token LPAREN");
		RewriteRuleITokenStream stream_RPAREN=new RewriteRuleITokenStream(adaptor,"token RPAREN");
		RewriteRuleSubtreeStream stream_expression=new RewriteRuleSubtreeStream(adaptor,"rule expression");
		try { DebugEnterRule(GrammarFileName, "condition");
		DebugLocation(366, 1);
		try
		{
			// AS3.g:367:2: ( LPAREN expression RPAREN -> ^( CONDITION expression ) )
			DebugEnterAlt(1);
			// AS3.g:367:4: LPAREN expression RPAREN
			{
			DebugLocation(367, 4);
			LPAREN127=(IToken)Match(input,LPAREN,Follow._LPAREN_in_condition2006); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_LPAREN.Add(LPAREN127);

			DebugLocation(367, 11);
			PushFollow(Follow._expression_in_condition2008);
			expression128=expression();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_expression.Add(expression128.Tree);
			DebugLocation(367, 22);
			RPAREN129=(IToken)Match(input,RPAREN,Follow._RPAREN_in_condition2010); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_RPAREN.Add(RPAREN129);



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

			root_0 = (CommonTree)adaptor.Nil();
			// 368:3: -> ^( CONDITION expression )
			{
				DebugLocation(368, 6);
				// AS3.g:368:6: ^( CONDITION expression )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(368, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(CONDITION, "CONDITION"), root_1);

				DebugLocation(368, 18);
				adaptor.AddChild(root_1, stream_expression.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("condition", 40);
			LeaveRule("condition", 40);
			LeaveRule_condition();
		}
		DebugLocation(369, 1);
		} finally { DebugExitRule(GrammarFileName, "condition"); }
		return retval;

	}
예제 #26
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> basicParameterDeclaration()
	{
		EnterRule_basicParameterDeclaration();
		EnterRule("basicParameterDeclaration", 35);
		TraceIn("basicParameterDeclaration", 35);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken CONST114 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> ident115 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> typeExpression116 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> parameterDefault117 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree CONST114_tree = default(CommonTree);
		RewriteRuleITokenStream stream_CONST=new RewriteRuleITokenStream(adaptor,"token CONST");
		RewriteRuleSubtreeStream stream_ident=new RewriteRuleSubtreeStream(adaptor,"rule ident");
		RewriteRuleSubtreeStream stream_typeExpression=new RewriteRuleSubtreeStream(adaptor,"rule typeExpression");
		RewriteRuleSubtreeStream stream_parameterDefault=new RewriteRuleSubtreeStream(adaptor,"rule parameterDefault");
		try { DebugEnterRule(GrammarFileName, "basicParameterDeclaration");
		DebugLocation(343, 1);
		try
		{
			// AS3.g:344:2: ( ( CONST )? ident ( typeExpression )? ( parameterDefault )? -> ^( PARAM ( CONST )? ident ( typeExpression )? ( parameterDefault )? ) )
			DebugEnterAlt(1);
			// AS3.g:344:4: ( CONST )? ident ( typeExpression )? ( parameterDefault )?
			{
			DebugLocation(344, 4);
			// AS3.g:344:4: ( CONST )?
			int alt28=2;
			try { DebugEnterSubRule(28);
			try { DebugEnterDecision(28, false);
			int LA28_1 = input.LA(1);

			if ((LA28_1==CONST))
			{
				alt28 = 1;
			}
			} finally { DebugExitDecision(28); }
			switch (alt28)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:344:4: CONST
				{
				DebugLocation(344, 4);
				CONST114=(IToken)Match(input,CONST,Follow._CONST_in_basicParameterDeclaration1877); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_CONST.Add(CONST114);


				}
				break;

			}
			} finally { DebugExitSubRule(28); }

			DebugLocation(344, 11);
			PushFollow(Follow._ident_in_basicParameterDeclaration1880);
			ident115=ident();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_ident.Add(ident115.Tree);
			DebugLocation(344, 17);
			// AS3.g:344:17: ( typeExpression )?
			int alt29=2;
			try { DebugEnterSubRule(29);
			try { DebugEnterDecision(29, false);
			int LA29_1 = input.LA(1);

			if ((LA29_1==COLON))
			{
				alt29 = 1;
			}
			} finally { DebugExitDecision(29); }
			switch (alt29)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:344:17: typeExpression
				{
				DebugLocation(344, 17);
				PushFollow(Follow._typeExpression_in_basicParameterDeclaration1882);
				typeExpression116=typeExpression();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_typeExpression.Add(typeExpression116.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(29); }

			DebugLocation(344, 33);
			// AS3.g:344:33: ( parameterDefault )?
			int alt30=2;
			try { DebugEnterSubRule(30);
			try { DebugEnterDecision(30, false);
			int LA30_1 = input.LA(1);

			if ((LA30_1==ASSIGN))
			{
				alt30 = 1;
			}
			} finally { DebugExitDecision(30); }
			switch (alt30)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:344:33: parameterDefault
				{
				DebugLocation(344, 33);
				PushFollow(Follow._parameterDefault_in_basicParameterDeclaration1885);
				parameterDefault117=parameterDefault();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_parameterDefault.Add(parameterDefault117.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(30); }



			{
			// AST REWRITE
			// elements: CONST, ident, typeExpression, parameterDefault
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 345:3: -> ^( PARAM ( CONST )? ident ( typeExpression )? ( parameterDefault )? )
			{
				DebugLocation(345, 6);
				// AS3.g:345:6: ^( PARAM ( CONST )? ident ( typeExpression )? ( parameterDefault )? )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(345, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(PARAM, "PARAM"), root_1);

				DebugLocation(345, 14);
				// AS3.g:345:14: ( CONST )?
				if (stream_CONST.HasNext)
				{
					DebugLocation(345, 14);
					adaptor.AddChild(root_1, stream_CONST.NextNode());

				}
				stream_CONST.Reset();
				DebugLocation(345, 21);
				adaptor.AddChild(root_1, stream_ident.NextTree());
				DebugLocation(345, 27);
				// AS3.g:345:27: ( typeExpression )?
				if (stream_typeExpression.HasNext)
				{
					DebugLocation(345, 27);
					adaptor.AddChild(root_1, stream_typeExpression.NextTree());

				}
				stream_typeExpression.Reset();
				DebugLocation(345, 43);
				// AS3.g:345:43: ( parameterDefault )?
				if (stream_parameterDefault.HasNext)
				{
					DebugLocation(345, 43);
					adaptor.AddChild(root_1, stream_parameterDefault.NextTree());

				}
				stream_parameterDefault.Reset();

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("basicParameterDeclaration", 35);
			LeaveRule("basicParameterDeclaration", 35);
			LeaveRule_basicParameterDeclaration();
		}
		DebugLocation(346, 1);
		} finally { DebugExitRule(GrammarFileName, "basicParameterDeclaration"); }
		return retval;

	}
예제 #27
0
        private AstParserRuleReturnScope <object, IToken> plain_elem()
        {
            EnterRule_plain_elem();
            EnterRule("plain_elem", 5);
            TraceIn("plain_elem", 5);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken i1       = default(IToken);
            IToken i2       = default(IToken);
            IToken al       = default(IToken);
            IToken ID12     = default(IToken);
            IToken FROM13   = default(IToken);
            IToken TO14     = default(IToken);
            IToken ID15     = default(IToken);
            IToken LENGTH16 = default(IToken);

            object i1_tree       = default(object);
            object i2_tree       = default(object);
            object al_tree       = default(object);
            object ID12_tree     = default(object);
            object FROM13_tree   = default(object);
            object TO14_tree     = default(object);
            object ID15_tree     = default(object);
            object LENGTH16_tree = default(object);
            RewriteRuleITokenStream stream_INT         = new RewriteRuleITokenStream(adaptor, "token INT");
            RewriteRuleITokenStream stream_ALIGN_RIGHT = new RewriteRuleITokenStream(adaptor, "token ALIGN_RIGHT");
            RewriteRuleITokenStream stream_ID          = new RewriteRuleITokenStream(adaptor, "token ID");
            RewriteRuleITokenStream stream_FROM        = new RewriteRuleITokenStream(adaptor, "token FROM");
            RewriteRuleITokenStream stream_TO          = new RewriteRuleITokenStream(adaptor, "token TO");
            RewriteRuleITokenStream stream_ALIGN_LEFT  = new RewriteRuleITokenStream(adaptor, "token ALIGN_LEFT");
            RewriteRuleITokenStream stream_LENGTH      = new RewriteRuleITokenStream(adaptor, "token LENGTH");

            try { DebugEnterRule(GrammarFileName, "plain_elem");
                  DebugLocation(47, 2);
                  try
                  {
                      // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:47:11: ( ID FROM i1= INT TO i2= INT (al= ALIGN_LEFT |al= ALIGN_RIGHT )? -> ^( ID $i1 $i2 ( $al)? ) | ID LENGTH i1= INT (al= ALIGN_LEFT |al= ALIGN_RIGHT )? -> ^( ID $i1 ( $al)? ) )
                      int alt5 = 2;
                      try { DebugEnterDecision(5, false);
                            int LA5_0 = input.LA(1);

                            if ((LA5_0 == ID))
                            {
                                int LA5_1 = input.LA(2);

                                if ((LA5_1 == FROM))
                                {
                                    alt5 = 1;
                                }
                                else if ((LA5_1 == LENGTH))
                                {
                                    alt5 = 2;
                                }
                                else
                                {
                                    NoViableAltException nvae = new NoViableAltException("", 5, 1, input);
                                    DebugRecognitionException(nvae);
                                    throw nvae;
                                }
                            }
                            else
                            {
                                NoViableAltException nvae = new NoViableAltException("", 5, 0, input);
                                DebugRecognitionException(nvae);
                                throw nvae;
                            } } finally { DebugExitDecision(5); }
                      switch (alt5)
                      {
                      case 1:
                          DebugEnterAlt(1);
                          // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:48:3: ID FROM i1= INT TO i2= INT (al= ALIGN_LEFT |al= ALIGN_RIGHT )?
                          {
                              DebugLocation(48, 3);
                              ID12 = (IToken)Match(input, ID, Follow._ID_in_plain_elem181);
                              stream_ID.Add(ID12);

                              DebugLocation(48, 6);
                              FROM13 = (IToken)Match(input, FROM, Follow._FROM_in_plain_elem183);
                              stream_FROM.Add(FROM13);

                              DebugLocation(48, 13);
                              i1 = (IToken)Match(input, INT, Follow._INT_in_plain_elem187);
                              stream_INT.Add(i1);

                              DebugLocation(48, 18);
                              TO14 = (IToken)Match(input, TO, Follow._TO_in_plain_elem189);
                              stream_TO.Add(TO14);

                              DebugLocation(48, 23);
                              i2 = (IToken)Match(input, INT, Follow._INT_in_plain_elem193);
                              stream_INT.Add(i2);

                              DebugLocation(48, 28);
                              // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:48:28: (al= ALIGN_LEFT |al= ALIGN_RIGHT )?
                              int alt3 = 3;
                              try { DebugEnterSubRule(3);
                                    try { DebugEnterDecision(3, false);
                                          int LA3_0 = input.LA(1);

                                          if ((LA3_0 == ALIGN_LEFT))
                                          {
                                              alt3 = 1;
                                          }
                                          else if ((LA3_0 == ALIGN_RIGHT))
                                          {
                                              alt3 = 2;
                                          }
                                    } finally { DebugExitDecision(3); }
                                    switch (alt3)
                                    {
                                    case 1:
                                        DebugEnterAlt(1);
                                        // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:48:29: al= ALIGN_LEFT
                                        {
                                            DebugLocation(48, 31);
                                            al = (IToken)Match(input, ALIGN_LEFT, Follow._ALIGN_LEFT_in_plain_elem198);
                                            stream_ALIGN_LEFT.Add(al);
                                        }
                                        break;

                                    case 2:
                                        DebugEnterAlt(2);
                                        // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:48:45: al= ALIGN_RIGHT
                                        {
                                            DebugLocation(48, 47);
                                            al = (IToken)Match(input, ALIGN_RIGHT, Follow._ALIGN_RIGHT_in_plain_elem204);
                                            stream_ALIGN_RIGHT.Add(al);
                                        }
                                        break;
                                    }
                              } finally { DebugExitSubRule(3); }



                              {
                                  // AST REWRITE
                                  // elements: i2, ID, al, i1
                                  // token labels: al, i2, i1
                                  // rule labels: retval
                                  // token list labels:
                                  // rule list labels:
                                  // wildcard labels:
                                  retval.Tree = root_0;
                                  RewriteRuleITokenStream  stream_al     = new RewriteRuleITokenStream(adaptor, "token al", al);
                                  RewriteRuleITokenStream  stream_i2     = new RewriteRuleITokenStream(adaptor, "token i2", i2);
                                  RewriteRuleITokenStream  stream_i1     = new RewriteRuleITokenStream(adaptor, "token i1", i1);
                                  RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null?retval.Tree:null);

                                  root_0 = (object)adaptor.Nil();
                                  // 48:62: -> ^( ID $i1 $i2 ( $al)? )
                                  {
                                      DebugLocation(48, 65);
                                      // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:48:65: ^( ID $i1 $i2 ( $al)? )
                                      {
                                          object root_1 = (object)adaptor.Nil();
                                          DebugLocation(48, 67);
                                          root_1 = (object)adaptor.BecomeRoot(stream_ID.NextNode(), root_1);

                                          DebugLocation(48, 71);
                                          adaptor.AddChild(root_1, stream_i1.NextNode());
                                          DebugLocation(48, 75);
                                          adaptor.AddChild(root_1, stream_i2.NextNode());
                                          DebugLocation(48, 79);
                                          // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:48:79: ( $al)?
                                          if (stream_al.HasNext)
                                          {
                                              DebugLocation(48, 79);
                                              adaptor.AddChild(root_1, stream_al.NextNode());
                                          }
                                          stream_al.Reset();

                                          adaptor.AddChild(root_0, root_1);
                                      }
                                  }

                                  retval.Tree = root_0;
                              }
                          }
                          break;

                      case 2:
                          DebugEnterAlt(2);
                          // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:50:3: ID LENGTH i1= INT (al= ALIGN_LEFT |al= ALIGN_RIGHT )?
                          {
                              DebugLocation(50, 3);
                              ID15 = (IToken)Match(input, ID, Follow._ID_in_plain_elem230);
                              stream_ID.Add(ID15);

                              DebugLocation(50, 6);
                              LENGTH16 = (IToken)Match(input, LENGTH, Follow._LENGTH_in_plain_elem232);
                              stream_LENGTH.Add(LENGTH16);

                              DebugLocation(50, 15);
                              i1 = (IToken)Match(input, INT, Follow._INT_in_plain_elem236);
                              stream_INT.Add(i1);

                              DebugLocation(50, 20);
                              // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:50:20: (al= ALIGN_LEFT |al= ALIGN_RIGHT )?
                              int alt4 = 3;
                              try { DebugEnterSubRule(4);
                                    try { DebugEnterDecision(4, false);
                                          int LA4_0 = input.LA(1);

                                          if ((LA4_0 == ALIGN_LEFT))
                                          {
                                              alt4 = 1;
                                          }
                                          else if ((LA4_0 == ALIGN_RIGHT))
                                          {
                                              alt4 = 2;
                                          }
                                    } finally { DebugExitDecision(4); }
                                    switch (alt4)
                                    {
                                    case 1:
                                        DebugEnterAlt(1);
                                        // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:50:21: al= ALIGN_LEFT
                                        {
                                            DebugLocation(50, 23);
                                            al = (IToken)Match(input, ALIGN_LEFT, Follow._ALIGN_LEFT_in_plain_elem241);
                                            stream_ALIGN_LEFT.Add(al);
                                        }
                                        break;

                                    case 2:
                                        DebugEnterAlt(2);
                                        // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:50:37: al= ALIGN_RIGHT
                                        {
                                            DebugLocation(50, 39);
                                            al = (IToken)Match(input, ALIGN_RIGHT, Follow._ALIGN_RIGHT_in_plain_elem247);
                                            stream_ALIGN_RIGHT.Add(al);
                                        }
                                        break;
                                    }
                              } finally { DebugExitSubRule(4); }



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

                                  root_0 = (object)adaptor.Nil();
                                  // 50:54: -> ^( ID $i1 ( $al)? )
                                  {
                                      DebugLocation(50, 57);
                                      // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:50:57: ^( ID $i1 ( $al)? )
                                      {
                                          object root_1 = (object)adaptor.Nil();
                                          DebugLocation(50, 59);
                                          root_1 = (object)adaptor.BecomeRoot(stream_ID.NextNode(), root_1);

                                          DebugLocation(50, 63);
                                          adaptor.AddChild(root_1, stream_i1.NextNode());
                                          DebugLocation(50, 67);
                                          // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:50:67: ( $al)?
                                          if (stream_al.HasNext)
                                          {
                                              DebugLocation(50, 67);
                                              adaptor.AddChild(root_1, stream_al.NextNode());
                                          }
                                          stream_al.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("plain_elem", 5);
                      LeaveRule("plain_elem", 5);
                      LeaveRule_plain_elem();
                  }
                  DebugLocation(51, 2); } finally { DebugExitRule(GrammarFileName, "plain_elem"); }
            return(retval);
        }
예제 #28
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> block()
	{
		EnterRule_block();
		EnterRule("block", 38);
		TraceIn("block", 38);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken LCURLY123 = default(IToken);
		IToken RCURLY125 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> blockEntry124 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree LCURLY123_tree = default(CommonTree);
		CommonTree RCURLY125_tree = default(CommonTree);
		RewriteRuleITokenStream stream_LCURLY=new RewriteRuleITokenStream(adaptor,"token LCURLY");
		RewriteRuleITokenStream stream_RCURLY=new RewriteRuleITokenStream(adaptor,"token RCURLY");
		RewriteRuleSubtreeStream stream_blockEntry=new RewriteRuleSubtreeStream(adaptor,"rule blockEntry");
		try { DebugEnterRule(GrammarFileName, "block");
		DebugLocation(357, 1);
		try
		{
			// AS3.g:358:2: ( LCURLY ( blockEntry )* RCURLY -> ^( BLOCK LCURLY ( blockEntry )* RCURLY ) )
			DebugEnterAlt(1);
			// AS3.g:358:4: LCURLY ( blockEntry )* RCURLY
			{
			DebugLocation(358, 4);
			LCURLY123=(IToken)Match(input,LCURLY,Follow._LCURLY_in_block1964); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_LCURLY.Add(LCURLY123);

			DebugLocation(358, 11);
			// AS3.g:358:11: ( blockEntry )*
			try { DebugEnterSubRule(33);
			while (true)
			{
				int alt33=2;
				try { DebugEnterDecision(33, false);
				int LA33_1 = input.LA(1);

				if ((LA33_1==AS||LA33_1==BNOT||LA33_1==BREAK||LA33_1==CONST||LA33_1==CONTINUE||(LA33_1>=DEC && LA33_1<=DECIMAL_LITERAL)||LA33_1==DEFAULT||LA33_1==DO||(LA33_1>=DYNAMIC && LA33_1<=E4X_ATTRI)||(LA33_1>=FALSE && LA33_1<=FOR)||LA33_1==FUNCTION||LA33_1==GET||(LA33_1>=HEX_LITERAL && LA33_1<=IDENT)||LA33_1==IF||LA33_1==INC||(LA33_1>=INTERNAL && LA33_1<=IS)||(LA33_1>=LBRACK && LA33_1<=LCURLY)||LA33_1==LNOT||LA33_1==LPAREN||LA33_1==MINUS||LA33_1==NAMESPACE||LA33_1==NEW||LA33_1==NULL||LA33_1==OCTAL_LITERAL||LA33_1==PLUS||LA33_1==PRIVATE||(LA33_1>=PROTECTED && LA33_1<=PUBLIC)||LA33_1==REGEX_LITERAL||LA33_1==RETURN||(LA33_1>=SEMI && LA33_1<=SET)||(LA33_1>=STRING_LITERAL_DOUBLE && LA33_1<=SWITCH)||LA33_1==TRUE||(LA33_1>=USE && LA33_1<=VAR)||LA33_1==WHILE||LA33_1==WITH||LA33_1==XML||LA33_1==XML_LITERAL||LA33_1==243||(LA33_1>=253 && LA33_1<=257)))
				{
					alt33 = 1;
				}


				} finally { DebugExitDecision(33); }
				switch ( alt33 )
				{
				case 1:
					DebugEnterAlt(1);
					// AS3.g:358:11: blockEntry
					{
					DebugLocation(358, 11);
					PushFollow(Follow._blockEntry_in_block1966);
					blockEntry124=blockEntry();
					PopFollow();
					if (state.failed) return retval;
					if (state.backtracking == 0) stream_blockEntry.Add(blockEntry124.Tree);

					}
					break;

				default:
					goto loop33;
				}
			}

			loop33:
				;

			} finally { DebugExitSubRule(33); }

			DebugLocation(358, 23);
			RCURLY125=(IToken)Match(input,RCURLY,Follow._RCURLY_in_block1969); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_RCURLY.Add(RCURLY125);



			{
			// AST REWRITE
			// elements: LCURLY, blockEntry, RCURLY
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 359:3: -> ^( BLOCK LCURLY ( blockEntry )* RCURLY )
			{
				DebugLocation(359, 6);
				// AS3.g:359:6: ^( BLOCK LCURLY ( blockEntry )* RCURLY )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(359, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(BLOCK, "BLOCK"), root_1);

				DebugLocation(359, 14);
				adaptor.AddChild(root_1, stream_LCURLY.NextNode());
				DebugLocation(359, 21);
				// AS3.g:359:21: ( blockEntry )*
				while ( stream_blockEntry.HasNext )
				{
					DebugLocation(359, 21);
					adaptor.AddChild(root_1, stream_blockEntry.NextTree());

				}
				stream_blockEntry.Reset();
				DebugLocation(359, 33);
				adaptor.AddChild(root_1, stream_RCURLY.NextNode());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("block", 38);
			LeaveRule("block", 38);
			LeaveRule_block();
		}
		DebugLocation(360, 1);
		} finally { DebugExitRule(GrammarFileName, "block"); }
		return retval;

	}
예제 #29
0
    // $ANTLR start "funcwithparams"
    // abevformula.g:24:0: funcwithparams : '[' func ',' paramlist ']' -> ^( FUNC func paramlist ) ;
    private abevformulaParser.funcwithparams_return funcwithparams(  )
    {
        abevformulaParser.funcwithparams_return retval = new abevformulaParser.funcwithparams_return();
        retval.start = input.LT(1);
        int        funcwithparams_StartIndex = input.Index;
        CommonTree root_0 = null;

        IToken char_literal2 = null;
        IToken char_literal4 = null;
        IToken char_literal6 = null;

        abevformulaParser.func_return      func3      = default(abevformulaParser.func_return);
        abevformulaParser.paramlist_return paramlist5 = default(abevformulaParser.paramlist_return);

        CommonTree char_literal2_tree             = null;
        CommonTree char_literal4_tree             = null;
        CommonTree char_literal6_tree             = null;
        RewriteRuleITokenStream  stream_9         = new RewriteRuleITokenStream(adaptor, "token 9");
        RewriteRuleITokenStream  stream_8         = new RewriteRuleITokenStream(adaptor, "token 8");
        RewriteRuleITokenStream  stream_10        = new RewriteRuleITokenStream(adaptor, "token 10");
        RewriteRuleSubtreeStream stream_func      = new RewriteRuleSubtreeStream(adaptor, "rule func");
        RewriteRuleSubtreeStream stream_paramlist = new RewriteRuleSubtreeStream(adaptor, "rule paramlist");

        try
        {
            if (state.backtracking > 0 && AlreadyParsedRule(input, 2))
            {
                return(retval);
            }
            // abevformula.g:24:18: ( '[' func ',' paramlist ']' -> ^( FUNC func paramlist ) )
            // abevformula.g:24:18: '[' func ',' paramlist ']'
            {
                char_literal2 = (IToken)Match(input, 9, Follow._9_in_funcwithparams109); if (state.failed)
                {
                    return(retval);
                }
                if (state.backtracking == 0)
                {
                    stream_9.Add(char_literal2);
                }

                PushFollow(Follow._func_in_funcwithparams111);
                func3 = func();

                state._fsp--;
                if (state.failed)
                {
                    return(retval);
                }
                if (state.backtracking == 0)
                {
                    stream_func.Add(func3.Tree);
                }
                char_literal4 = (IToken)Match(input, 8, Follow._8_in_funcwithparams113); if (state.failed)
                {
                    return(retval);
                }
                if (state.backtracking == 0)
                {
                    stream_8.Add(char_literal4);
                }

                PushFollow(Follow._paramlist_in_funcwithparams115);
                paramlist5 = paramlist();

                state._fsp--;
                if (state.failed)
                {
                    return(retval);
                }
                if (state.backtracking == 0)
                {
                    stream_paramlist.Add(paramlist5.Tree);
                }
                char_literal6 = (IToken)Match(input, 10, Follow._10_in_funcwithparams117); if (state.failed)
                {
                    return(retval);
                }
                if (state.backtracking == 0)
                {
                    stream_10.Add(char_literal6);
                }



                {
                    // AST REWRITE
                    // elements: func, paramlist
                    // token labels:
                    // rule labels: retval
                    // token list labels:
                    // rule list labels:
                    // wildcard labels:
                    if (state.backtracking == 0)
                    {
                        retval.tree = root_0;
                        RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null?retval.tree:null);

                        root_0 = (CommonTree)adaptor.Nil();
                        // 24:45: -> ^( FUNC func paramlist )
                        {
                            // abevformula.g:24:48: ^( FUNC func paramlist )
                            {
                                CommonTree root_1 = (CommonTree)adaptor.Nil();
                                root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(FUNC, "FUNC"), root_1);

                                adaptor.AddChild(root_1, stream_func.NextTree());
                                adaptor.AddChild(root_1, stream_paramlist.NextTree());

                                adaptor.AddChild(root_0, root_1);
                            }
                        }

                        retval.tree = root_0;
                    }
                }
            }

            retval.stop = input.LT(-1);

            if (state.backtracking == 0)
            {
                retval.tree = (CommonTree)adaptor.RulePostProcessing(root_0);
                adaptor.SetTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re)
        {
            ReportError(re);
            Recover(input, re);
            retval.tree = (CommonTree)adaptor.ErrorNode(input, retval.start, input.LT(-1), re);
        }
        finally
        {
            if (state.backtracking > 0)
            {
                Memoize(input, 2, funcwithparams_StartIndex);
            }
        }
        return(retval);
    }
예제 #30
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> declarationStatement()
	{
		EnterRule_declarationStatement();
		EnterRule("declarationStatement", 42);
		TraceIn("declarationStatement", 42);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		AstParserRuleReturnScope<CommonTree, IToken> s = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> declaration146 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		RewriteRuleSubtreeStream stream_declaration=new RewriteRuleSubtreeStream(adaptor,"rule declaration");
		RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
		try { DebugEnterRule(GrammarFileName, "declarationStatement");
		DebugLocation(406, 1);
		try
		{
			// AS3.g:407:2: ( declaration s= semi -> ^( DECL_STMT declaration ) )
			DebugEnterAlt(1);
			// AS3.g:407:4: declaration s= semi
			{
			DebugLocation(407, 4);
			PushFollow(Follow._declaration_in_declarationStatement2158);
			declaration146=declaration();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_declaration.Add(declaration146.Tree);
			DebugLocation(407, 17);
			PushFollow(Follow._semi_in_declarationStatement2162);
			s=semi();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_semi.Add(s.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 408:7: -> ^( DECL_STMT declaration )
			{
				DebugLocation(408, 10);
				// AS3.g:408:10: ^( DECL_STMT declaration )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(408, 12);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(DECL_STMT, "DECL_STMT"), root_1);

				DebugLocation(408, 22);
				adaptor.AddChild(root_1, stream_declaration.NextTree());
				DebugLocation(408, 34);
				adaptor.AddChild(root_1, maybeSemi(s));

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("declarationStatement", 42);
			LeaveRule("declarationStatement", 42);
			LeaveRule_declarationStatement();
		}
		DebugLocation(409, 1);
		} finally { DebugExitRule(GrammarFileName, "declarationStatement"); }
		return retval;

	}
예제 #31
0
    // $ANTLR start "paramlist"
    // abevformula.g:26:0: paramlist : param ( ',' param )* -> ( param )+ ;
    private abevformulaParser.paramlist_return paramlist(  )
    {
        abevformulaParser.paramlist_return retval = new abevformulaParser.paramlist_return();
        retval.start = input.LT(1);
        int        paramlist_StartIndex = input.Index;
        CommonTree root_0 = null;

        IToken char_literal9 = null;

        abevformulaParser.param_return param8  = default(abevformulaParser.param_return);
        abevformulaParser.param_return param10 = default(abevformulaParser.param_return);

        CommonTree char_literal9_tree         = null;
        RewriteRuleITokenStream  stream_8     = new RewriteRuleITokenStream(adaptor, "token 8");
        RewriteRuleSubtreeStream stream_param = new RewriteRuleSubtreeStream(adaptor, "rule param");

        try
        {
            if (state.backtracking > 0 && AlreadyParsedRule(input, 4))
            {
                return(retval);
            }
            // abevformula.g:26:13: ( param ( ',' param )* -> ( param )+ )
            // abevformula.g:26:13: param ( ',' param )*
            {
                PushFollow(Follow._param_in_paramlist143);
                param8 = param();

                state._fsp--;
                if (state.failed)
                {
                    return(retval);
                }
                if (state.backtracking == 0)
                {
                    stream_param.Add(param8.Tree);
                }
                // abevformula.g:26:19: ( ',' param )*
                for ( ; ;)
                {
                    int alt1  = 2;
                    int LA1_0 = input.LA(1);

                    if ((LA1_0 == 8))
                    {
                        alt1 = 1;
                    }


                    switch (alt1)
                    {
                    case 1:
                        // abevformula.g:26:20: ',' param
                    {
                        char_literal9 = (IToken)Match(input, 8, Follow._8_in_paramlist146); if (state.failed)
                        {
                            return(retval);
                        }
                        if (state.backtracking == 0)
                        {
                            stream_8.Add(char_literal9);
                        }

                        PushFollow(Follow._param_in_paramlist148);
                        param10 = param();

                        state._fsp--;
                        if (state.failed)
                        {
                            return(retval);
                        }
                        if (state.backtracking == 0)
                        {
                            stream_param.Add(param10.Tree);
                        }
                    }
                    break;

                    default:
                        goto loop1;
                    }
                }

loop1:
                ;



                {
                    // AST REWRITE
                    // elements: param
                    // token labels:
                    // rule labels: retval
                    // token list labels:
                    // rule list labels:
                    // wildcard labels:
                    if (state.backtracking == 0)
                    {
                        retval.tree = root_0;
                        RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null?retval.tree:null);

                        root_0 = (CommonTree)adaptor.Nil();
                        // 26:32: -> ( param )+
                        {
                            if (!(stream_param.HasNext))
                            {
                                throw new RewriteEarlyExitException();
                            }
                            while (stream_param.HasNext)
                            {
                                adaptor.AddChild(root_0, stream_param.NextTree());
                            }
                            stream_param.Reset();
                        }

                        retval.tree = root_0;
                    }
                }
            }

            retval.stop = input.LT(-1);

            if (state.backtracking == 0)
            {
                retval.tree = (CommonTree)adaptor.RulePostProcessing(root_0);
                adaptor.SetTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re)
        {
            ReportError(re);
            Recover(input, re);
            retval.tree = (CommonTree)adaptor.ErrorNode(input, retval.start, input.LT(-1), re);
        }
        finally
        {
            if (state.backtracking > 0)
            {
                Memoize(input, 4, paramlist_StartIndex);
            }
        }
        return(retval);
    }
예제 #32
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> ifStatement()
	{
		EnterRule_ifStatement();
		EnterRule("ifStatement", 44);
		TraceIn("ifStatement", 44);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken IF148 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> condition149 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> statement150 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> elseClause151 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree IF148_tree = default(CommonTree);
		RewriteRuleITokenStream stream_IF=new RewriteRuleITokenStream(adaptor,"token IF");
		RewriteRuleSubtreeStream stream_condition=new RewriteRuleSubtreeStream(adaptor,"rule condition");
		RewriteRuleSubtreeStream stream_statement=new RewriteRuleSubtreeStream(adaptor,"rule statement");
		RewriteRuleSubtreeStream stream_elseClause=new RewriteRuleSubtreeStream(adaptor,"rule elseClause");
		try { DebugEnterRule(GrammarFileName, "ifStatement");
		DebugLocation(417, 1);
		try
		{
			// AS3.g:418:2: ( IF condition statement ( ( ELSE )=> elseClause )? -> ^( IF_STMT IF condition statement ( elseClause )? ) )
			DebugEnterAlt(1);
			// AS3.g:418:4: IF condition statement ( ( ELSE )=> elseClause )?
			{
			DebugLocation(418, 4);
			IF148=(IToken)Match(input,IF,Follow._IF_in_ifStatement2217); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_IF.Add(IF148);

			DebugLocation(418, 7);
			PushFollow(Follow._condition_in_ifStatement2219);
			condition149=condition();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_condition.Add(condition149.Tree);
			DebugLocation(418, 17);
			PushFollow(Follow._statement_in_ifStatement2221);
			statement150=statement();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_statement.Add(statement150.Tree);
			DebugLocation(419, 3);
			// AS3.g:419:3: ( ( ELSE )=> elseClause )?
			int alt35=2;
			try { DebugEnterSubRule(35);
			try { DebugEnterDecision(35, false);
			int LA35_1 = input.LA(1);

			if ((LA35_1==ELSE))
			{
				int LA35_2 = input.LA(2);

				if ((EvaluatePredicate(synpred14_AS3_fragment)))
				{
					alt35 = 1;
				}
			}
			} finally { DebugExitDecision(35); }
			switch (alt35)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:419:4: ( ELSE )=> elseClause
				{
				DebugLocation(419, 12);
				PushFollow(Follow._elseClause_in_ifStatement2230);
				elseClause151=elseClause();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_elseClause.Add(elseClause151.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(35); }



			{
			// AST REWRITE
			// elements: IF, condition, statement, elseClause
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 420:9: -> ^( IF_STMT IF condition statement ( elseClause )? )
			{
				DebugLocation(420, 12);
				// AS3.g:420:12: ^( IF_STMT IF condition statement ( elseClause )? )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(420, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(IF_STMT, "IF_STMT"), root_1);

				DebugLocation(420, 22);
				adaptor.AddChild(root_1, stream_IF.NextNode());
				DebugLocation(420, 25);
				adaptor.AddChild(root_1, stream_condition.NextTree());
				DebugLocation(420, 35);
				adaptor.AddChild(root_1, stream_statement.NextTree());
				DebugLocation(420, 45);
				// AS3.g:420:45: ( elseClause )?
				if (stream_elseClause.HasNext)
				{
					DebugLocation(420, 45);
					adaptor.AddChild(root_1, stream_elseClause.NextTree());

				}
				stream_elseClause.Reset();

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("ifStatement", 44);
			LeaveRule("ifStatement", 44);
			LeaveRule_ifStatement();
		}
		DebugLocation(421, 1);
		} finally { DebugExitRule(GrammarFileName, "ifStatement"); }
		return retval;

	}
예제 #33
0
        private AstParserRuleReturnScope <object, IToken> sort_terms()
        {
            EnterRule_sort_terms();
            EnterRule("sort_terms", 2);
            TraceIn("sort_terms", 2);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken char_literal3 = default(IToken);
            AstParserRuleReturnScope <object, IToken> sort_term2 = default(AstParserRuleReturnScope <object, IToken>);
            AstParserRuleReturnScope <object, IToken> sort_term4 = default(AstParserRuleReturnScope <object, IToken>);

            object char_literal3_tree                 = default(object);
            RewriteRuleITokenStream  stream_COMMA     = new RewriteRuleITokenStream(adaptor, "token COMMA");
            RewriteRuleSubtreeStream stream_sort_term = new RewriteRuleSubtreeStream(adaptor, "rule sort_term");

            try
            {
                DebugEnterRule(GrammarFileName, "sort_terms");
                DebugLocation(46, 1);
                try
                {
                    // ../Grammars/OslcOrderBy.g:46:13: ( sort_term ( ',' sort_term )* -> ^( 'terms' sort_term ( sort_term )* ) )
                    DebugEnterAlt(1);
                    // ../Grammars/OslcOrderBy.g:46:15: sort_term ( ',' sort_term )*
                    {
                        DebugLocation(46, 15);
                        PushFollow(Follow._sort_term_in_sort_terms82);
                        sort_term2 = sort_term();
                        PopFollow();

                        stream_sort_term.Add(sort_term2.Tree);
                        DebugLocation(46, 25);
                        // ../Grammars/OslcOrderBy.g:46:25: ( ',' sort_term )*
                        try
                        {
                            DebugEnterSubRule(1);
                            while (true)
                            {
                                int alt1 = 2;
                                try
                                {
                                    DebugEnterDecision(1, false);
                                    int LA1_1 = input.LA(1);

                                    if ((LA1_1 == COMMA))
                                    {
                                        alt1 = 1;
                                    }
                                }
                                finally { DebugExitDecision(1); }
                                switch (alt1)
                                {
                                case 1:
                                    DebugEnterAlt(1);
                                    // ../Grammars/OslcOrderBy.g:46:27: ',' sort_term
                                    {
                                        DebugLocation(46, 27);
                                        char_literal3 = (IToken)Match(input, COMMA, Follow._COMMA_in_sort_terms86);
                                        stream_COMMA.Add(char_literal3);

                                        DebugLocation(46, 31);
                                        PushFollow(Follow._sort_term_in_sort_terms88);
                                        sort_term4 = sort_term();
                                        PopFollow();

                                        stream_sort_term.Add(sort_term4.Tree);
                                    }
                                    break;

                                default:
                                    goto loop1;
                                }
                            }

loop1:
                            ;
                        }
                        finally { DebugExitSubRule(1); }



                        {
                            // AST REWRITE
                            // elements: sort_term, sort_term, TERMS
                            // 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();
                            // 46:45: -> ^( 'terms' sort_term ( sort_term )* )
                            {
                                DebugLocation(46, 48);
                                // ../Grammars/OslcOrderBy.g:46:48: ^( 'terms' sort_term ( sort_term )* )
                                {
                                    object root_1 = (object)adaptor.Nil();
                                    DebugLocation(46, 51);
                                    root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(TERMS, "TERMS"), root_1);

                                    DebugLocation(46, 59);
                                    adaptor.AddChild(root_1, stream_sort_term.NextTree());
                                    DebugLocation(46, 69);
                                    // ../Grammars/OslcOrderBy.g:46:69: ( sort_term )*
                                    while (stream_sort_term.HasNext)
                                    {
                                        DebugLocation(46, 70);
                                        adaptor.AddChild(root_1, stream_sort_term.NextTree());
                                    }
                                    stream_sort_term.Reset();

                                    adaptor.AddChild(root_0, root_1);
                                }
                            }

                            retval.Tree = root_0;
                        }
                    }

                    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("sort_terms", 2);
                    LeaveRule("sort_terms", 2);
                    LeaveRule_sort_terms();
                }
                DebugLocation(47, 1);
            }
            finally { DebugExitRule(GrammarFileName, "sort_terms"); }
            return(retval);
        }
예제 #34
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> throwStatement()
	{
		EnterRule_throwStatement();
		EnterRule("throwStatement", 46);
		TraceIn("throwStatement", 46);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken string_literal154 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> s = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> expression155 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree string_literal154_tree = default(CommonTree);
		RewriteRuleITokenStream stream_253=new RewriteRuleITokenStream(adaptor,"token 253");
		RewriteRuleSubtreeStream stream_expression=new RewriteRuleSubtreeStream(adaptor,"rule expression");
		RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
		try { DebugEnterRule(GrammarFileName, "throwStatement");
		DebugLocation(428, 1);
		try
		{
			// AS3.g:429:2: ( 'throw' expression s= semi -> ^( THROW_STATEMENT 'throw' expression ) )
			DebugEnterAlt(1);
			// AS3.g:429:4: 'throw' expression s= semi
			{
			DebugLocation(429, 4);
			string_literal154=(IToken)Match(input,253,Follow._253_in_throwStatement2298); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_253.Add(string_literal154);

			DebugLocation(429, 12);
			PushFollow(Follow._expression_in_throwStatement2300);
			expression155=expression();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_expression.Add(expression155.Tree);
			DebugLocation(429, 24);
			PushFollow(Follow._semi_in_throwStatement2304);
			s=semi();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_semi.Add(s.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 430:9: -> ^( THROW_STATEMENT 'throw' expression )
			{
				DebugLocation(430, 12);
				// AS3.g:430:12: ^( THROW_STATEMENT 'throw' expression )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(430, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(THROW_STATEMENT, "THROW_STATEMENT"), root_1);

				DebugLocation(430, 30);
				adaptor.AddChild(root_1, stream_253.NextNode());
				DebugLocation(430, 38);
				adaptor.AddChild(root_1, stream_expression.NextTree());
				DebugLocation(430, 49);
				adaptor.AddChild(root_1, maybeSemi(s));

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("throwStatement", 46);
			LeaveRule("throwStatement", 46);
			LeaveRule_throwStatement();
		}
		DebugLocation(431, 1);
		} finally { DebugExitRule(GrammarFileName, "throwStatement"); }
		return retval;

	}
예제 #35
0
        private AstParserRuleReturnScope <object, IToken> sort_term()
        {
            EnterRule_sort_term();
            EnterRule("sort_term", 3);
            TraceIn("sort_term", 3);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken DIRECTION6 = default(IToken);
            AstParserRuleReturnScope <object, IToken> scoped_sort_term5 = default(AstParserRuleReturnScope <object, IToken>);
            AstParserRuleReturnScope <object, IToken> identifier7       = default(AstParserRuleReturnScope <object, IToken>);

            object DIRECTION6_tree = default(object);
            RewriteRuleITokenStream  stream_DIRECTION  = new RewriteRuleITokenStream(adaptor, "token DIRECTION");
            RewriteRuleSubtreeStream stream_identifier = new RewriteRuleSubtreeStream(adaptor, "rule identifier");

            try
            {
                DebugEnterRule(GrammarFileName, "sort_term");
                DebugLocation(49, 1);
                try
                {
                    // ../Grammars/OslcOrderBy.g:49:13: ( scoped_sort_term | DIRECTION identifier -> ^( 'simple_term' identifier DIRECTION ) )
                    int alt2 = 2;
                    try
                    {
                        DebugEnterDecision(2, false);
                        int LA2_1 = input.LA(1);

                        if (((LA2_1 >= PNAME_LN && LA2_1 <= PNAME_NS)))
                        {
                            alt2 = 1;
                        }
                        else if ((LA2_1 == DIRECTION))
                        {
                            alt2 = 2;
                        }
                        else
                        {
                            NoViableAltException nvae = new NoViableAltException("", 2, 0, input, 1);
                            DebugRecognitionException(nvae);
                            throw nvae;
                        }
                    }
                    finally { DebugExitDecision(2); }
                    switch (alt2)
                    {
                    case 1:
                        DebugEnterAlt(1);
                        // ../Grammars/OslcOrderBy.g:49:15: scoped_sort_term
                        {
                            root_0 = (object)adaptor.Nil();

                            DebugLocation(49, 15);
                            PushFollow(Follow._scoped_sort_term_in_sort_term120);
                            scoped_sort_term5 = scoped_sort_term();
                            PopFollow();

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

                    case 2:
                        DebugEnterAlt(2);
                        // ../Grammars/OslcOrderBy.g:49:34: DIRECTION identifier
                        {
                            DebugLocation(49, 34);
                            DIRECTION6 = (IToken)Match(input, DIRECTION, Follow._DIRECTION_in_sort_term124);
                            stream_DIRECTION.Add(DIRECTION6);

                            DebugLocation(49, 44);
                            PushFollow(Follow._identifier_in_sort_term126);
                            identifier7 = identifier();
                            PopFollow();

                            stream_identifier.Add(identifier7.Tree);


                            {
                                // AST REWRITE
                                // elements: identifier, DIRECTION, SIMPLE_TERM
                                // 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();
                                // 49:55: -> ^( 'simple_term' identifier DIRECTION )
                                {
                                    DebugLocation(49, 58);
                                    // ../Grammars/OslcOrderBy.g:49:58: ^( 'simple_term' identifier DIRECTION )
                                    {
                                        object root_1 = (object)adaptor.Nil();
                                        DebugLocation(49, 61);
                                        root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(SIMPLE_TERM, "SIMPLE_TERM"), root_1);

                                        DebugLocation(49, 75);
                                        adaptor.AddChild(root_1, stream_identifier.NextTree());
                                        DebugLocation(49, 86);
                                        adaptor.AddChild(root_1, stream_DIRECTION.NextNode());

                                        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("sort_term", 3);
                    LeaveRule("sort_term", 3);
                    LeaveRule_sort_term();
                }
                DebugLocation(50, 1);
            }
            finally { DebugExitRule(GrammarFileName, "sort_term"); }
            return(retval);
        }
예제 #36
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> returnStatement()
	{
		EnterRule_returnStatement();
		EnterRule("returnStatement", 50);
		TraceIn("returnStatement", 50);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken RETURN168 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> s = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> expression169 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree RETURN168_tree = default(CommonTree);
		RewriteRuleITokenStream stream_RETURN=new RewriteRuleITokenStream(adaptor,"token RETURN");
		RewriteRuleSubtreeStream stream_expression=new RewriteRuleSubtreeStream(adaptor,"rule expression");
		RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
		try { DebugEnterRule(GrammarFileName, "returnStatement");
		DebugLocation(450, 1);
		try
		{
			// AS3.g:451:2: ( RETURN ( expression )? s= semi -> ^( RETURN_STATEMENT RETURN ( expression )? ) )
			DebugEnterAlt(1);
			// AS3.g:451:4: RETURN ( expression )? s= semi
			{
			DebugLocation(451, 4);
			RETURN168=(IToken)Match(input,RETURN,Follow._RETURN_in_returnStatement2421); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_RETURN.Add(RETURN168);

			DebugLocation(451, 11);
			// AS3.g:451:11: ( expression )?
			int alt39=2;
			try { DebugEnterSubRule(39);
			try { DebugEnterDecision(39, false);
			int LA39_1 = input.LA(1);

			if ((LA39_1==AS||LA39_1==BNOT||(LA39_1>=DEC && LA39_1<=DECIMAL_LITERAL)||(LA39_1>=DYNAMIC && LA39_1<=E4X_ATTRI)||(LA39_1>=FALSE && LA39_1<=FLOAT_LITERAL)||LA39_1==FUNCTION||LA39_1==GET||(LA39_1>=HEX_LITERAL && LA39_1<=IDENT)||LA39_1==INC||(LA39_1>=INTERNAL && LA39_1<=IS)||(LA39_1>=LBRACK && LA39_1<=LCURLY)||LA39_1==LNOT||LA39_1==LPAREN||LA39_1==MINUS||LA39_1==NAMESPACE||LA39_1==NEW||LA39_1==NULL||LA39_1==OCTAL_LITERAL||LA39_1==PLUS||LA39_1==PRIVATE||(LA39_1>=PROTECTED && LA39_1<=PUBLIC)||LA39_1==REGEX_LITERAL||LA39_1==SET||(LA39_1>=STRING_LITERAL_DOUBLE && LA39_1<=SUPER)||LA39_1==TRUE||LA39_1==USE||LA39_1==XML||LA39_1==XML_LITERAL||LA39_1==243||(LA39_1>=255 && LA39_1<=257)))
			{
				alt39 = 1;
			}
			} finally { DebugExitDecision(39); }
			switch (alt39)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:451:11: expression
				{
				DebugLocation(451, 11);
				PushFollow(Follow._expression_in_returnStatement2423);
				expression169=expression();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_expression.Add(expression169.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(39); }

			DebugLocation(451, 24);
			PushFollow(Follow._semi_in_returnStatement2428);
			s=semi();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_semi.Add(s.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 452:9: -> ^( RETURN_STATEMENT RETURN ( expression )? )
			{
				DebugLocation(452, 12);
				// AS3.g:452:12: ^( RETURN_STATEMENT RETURN ( expression )? )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(452, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(RETURN_STATEMENT, "RETURN_STATEMENT"), root_1);

				DebugLocation(452, 31);
				adaptor.AddChild(root_1, stream_RETURN.NextNode());
				DebugLocation(452, 38);
				// AS3.g:452:38: ( expression )?
				if (stream_expression.HasNext)
				{
					DebugLocation(452, 38);
					adaptor.AddChild(root_1, stream_expression.NextTree());

				}
				stream_expression.Reset();
				DebugLocation(452, 50);
				adaptor.AddChild(root_1, maybeSemi(s));

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("returnStatement", 50);
			LeaveRule("returnStatement", 50);
			LeaveRule_returnStatement();
		}
		DebugLocation(453, 1);
		} finally { DebugExitRule(GrammarFileName, "returnStatement"); }
		return retval;

	}
예제 #37
0
        private AstParserRuleReturnScope <object, IToken> scoped_sort_term()
        {
            EnterRule_scoped_sort_term();
            EnterRule("scoped_sort_term", 4);
            TraceIn("scoped_sort_term", 4);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken char_literal9  = default(IToken);
            IToken char_literal11 = default(IToken);
            AstParserRuleReturnScope <object, IToken> identifier8  = default(AstParserRuleReturnScope <object, IToken>);
            AstParserRuleReturnScope <object, IToken> sort_terms10 = default(AstParserRuleReturnScope <object, IToken>);

            object char_literal9_tree  = default(object);
            object char_literal11_tree = default(object);
            RewriteRuleITokenStream  stream_CLOSE_CURLY_BRACE = new RewriteRuleITokenStream(adaptor, "token CLOSE_CURLY_BRACE");
            RewriteRuleITokenStream  stream_OPEN_CURLY_BRACE  = new RewriteRuleITokenStream(adaptor, "token OPEN_CURLY_BRACE");
            RewriteRuleSubtreeStream stream_sort_terms        = new RewriteRuleSubtreeStream(adaptor, "rule sort_terms");
            RewriteRuleSubtreeStream stream_identifier        = new RewriteRuleSubtreeStream(adaptor, "rule identifier");

            try
            {
                DebugEnterRule(GrammarFileName, "scoped_sort_term");
                DebugLocation(52, 4);
                try
                {
                    // ../Grammars/OslcOrderBy.g:52:18: ( identifier '{' sort_terms '}' -> ^( 'scoped_term' identifier sort_terms ) )
                    DebugEnterAlt(1);
                    // ../Grammars/OslcOrderBy.g:52:20: identifier '{' sort_terms '}'
                    {
                        DebugLocation(52, 20);
                        PushFollow(Follow._identifier_in_scoped_sort_term148);
                        identifier8 = identifier();
                        PopFollow();

                        stream_identifier.Add(identifier8.Tree);
                        DebugLocation(52, 31);
                        char_literal9 = (IToken)Match(input, OPEN_CURLY_BRACE, Follow._OPEN_CURLY_BRACE_in_scoped_sort_term150);
                        stream_OPEN_CURLY_BRACE.Add(char_literal9);

                        DebugLocation(52, 35);
                        PushFollow(Follow._sort_terms_in_scoped_sort_term152);
                        sort_terms10 = sort_terms();
                        PopFollow();

                        stream_sort_terms.Add(sort_terms10.Tree);
                        DebugLocation(52, 46);
                        char_literal11 = (IToken)Match(input, CLOSE_CURLY_BRACE, Follow._CLOSE_CURLY_BRACE_in_scoped_sort_term154);
                        stream_CLOSE_CURLY_BRACE.Add(char_literal11);



                        {
                            // AST REWRITE
                            // elements: SCOPED_TERM, identifier, sort_terms
                            // 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();
                            // 52:50: -> ^( 'scoped_term' identifier sort_terms )
                            {
                                DebugLocation(52, 53);
                                // ../Grammars/OslcOrderBy.g:52:53: ^( 'scoped_term' identifier sort_terms )
                                {
                                    object root_1 = (object)adaptor.Nil();
                                    DebugLocation(52, 56);
                                    root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(SCOPED_TERM, "SCOPED_TERM"), root_1);

                                    DebugLocation(52, 70);
                                    adaptor.AddChild(root_1, stream_identifier.NextTree());
                                    DebugLocation(52, 81);
                                    adaptor.AddChild(root_1, stream_sort_terms.NextTree());

                                    adaptor.AddChild(root_0, root_1);
                                }
                            }

                            retval.Tree = root_0;
                        }
                    }

                    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("scoped_sort_term", 4);
                    LeaveRule("scoped_sort_term", 4);
                    LeaveRule_scoped_sort_term();
                }
                DebugLocation(53, 4);
            }
            finally { DebugExitRule(GrammarFileName, "scoped_sort_term"); }
            return(retval);
        }
예제 #38
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> breakStatement()
	{
		EnterRule_breakStatement();
		EnterRule("breakStatement", 52);
		TraceIn("breakStatement", 52);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken BREAK171 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> s = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree BREAK171_tree = default(CommonTree);
		RewriteRuleITokenStream stream_BREAK=new RewriteRuleITokenStream(adaptor,"token BREAK");
		RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
		try { DebugEnterRule(GrammarFileName, "breakStatement");
		DebugLocation(460, 1);
		try
		{
			// AS3.g:461:2: ( BREAK s= semi -> ^( BREAK_STATEMENT BREAK ) )
			DebugEnterAlt(1);
			// AS3.g:461:4: BREAK s= semi
			{
			DebugLocation(461, 4);
			BREAK171=(IToken)Match(input,BREAK,Follow._BREAK_in_breakStatement2495); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_BREAK.Add(BREAK171);

			DebugLocation(461, 11);
			PushFollow(Follow._semi_in_breakStatement2499);
			s=semi();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_semi.Add(s.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 462:9: -> ^( BREAK_STATEMENT BREAK )
			{
				DebugLocation(462, 12);
				// AS3.g:462:12: ^( BREAK_STATEMENT BREAK )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(462, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(BREAK_STATEMENT, "BREAK_STATEMENT"), root_1);

				DebugLocation(462, 30);
				adaptor.AddChild(root_1, stream_BREAK.NextNode());
				DebugLocation(462, 36);
				adaptor.AddChild(root_1, maybeSemi(s));

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("breakStatement", 52);
			LeaveRule("breakStatement", 52);
			LeaveRule_breakStatement();
		}
		DebugLocation(463, 1);
		} finally { DebugExitRule(GrammarFileName, "breakStatement"); }
		return retval;

	}
예제 #39
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> namespaceDefinition()
	{
		EnterRule_namespaceDefinition();
		EnterRule("namespaceDefinition", 25);
		TraceIn("namespaceDefinition", 25);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken NAMESPACE86 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> modifiers85 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> namespaceName87 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree NAMESPACE86_tree = default(CommonTree);
		RewriteRuleITokenStream stream_NAMESPACE=new RewriteRuleITokenStream(adaptor,"token NAMESPACE");
		RewriteRuleSubtreeStream stream_modifiers=new RewriteRuleSubtreeStream(adaptor,"rule modifiers");
		RewriteRuleSubtreeStream stream_namespaceName=new RewriteRuleSubtreeStream(adaptor,"rule namespaceName");
		try { DebugEnterRule(GrammarFileName, "namespaceDefinition");
		DebugLocation(286, 1);
		try
		{
			// AS3.g:287:2: ( modifiers NAMESPACE namespaceName -> ^( NAMESPACE_DEF modifiers NAMESPACE namespaceName ) )
			DebugEnterAlt(1);
			// AS3.g:287:4: modifiers NAMESPACE namespaceName
			{
			DebugLocation(287, 4);
			PushFollow(Follow._modifiers_in_namespaceDefinition1573);
			modifiers85=modifiers();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_modifiers.Add(modifiers85.Tree);
			DebugLocation(287, 14);
			NAMESPACE86=(IToken)Match(input,NAMESPACE,Follow._NAMESPACE_in_namespaceDefinition1575); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_NAMESPACE.Add(NAMESPACE86);

			DebugLocation(287, 24);
			PushFollow(Follow._namespaceName_in_namespaceDefinition1577);
			namespaceName87=namespaceName();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_namespaceName.Add(namespaceName87.Tree);


			{
			// AST REWRITE
			// elements: modifiers, NAMESPACE, namespaceName
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 288:3: -> ^( NAMESPACE_DEF modifiers NAMESPACE namespaceName )
			{
				DebugLocation(288, 6);
				// AS3.g:288:6: ^( NAMESPACE_DEF modifiers NAMESPACE namespaceName )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(288, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(NAMESPACE_DEF, "NAMESPACE_DEF"), root_1);

				DebugLocation(288, 22);
				adaptor.AddChild(root_1, stream_modifiers.NextTree());
				DebugLocation(288, 32);
				adaptor.AddChild(root_1, stream_NAMESPACE.NextNode());
				DebugLocation(288, 42);
				adaptor.AddChild(root_1, stream_namespaceName.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("namespaceDefinition", 25);
			LeaveRule("namespaceDefinition", 25);
			LeaveRule_namespaceDefinition();
		}
		DebugLocation(289, 1);
		} finally { DebugExitRule(GrammarFileName, "namespaceDefinition"); }
		return retval;

	}
예제 #40
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> switchBlock()
	{
		EnterRule_switchBlock();
		EnterRule("switchBlock", 54);
		TraceIn("switchBlock", 54);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken LCURLY175 = default(IToken);
		IToken RCURLY178 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> caseStatement176 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> defaultStatement177 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree LCURLY175_tree = default(CommonTree);
		CommonTree RCURLY178_tree = default(CommonTree);
		RewriteRuleITokenStream stream_LCURLY=new RewriteRuleITokenStream(adaptor,"token LCURLY");
		RewriteRuleITokenStream stream_RCURLY=new RewriteRuleITokenStream(adaptor,"token RCURLY");
		RewriteRuleSubtreeStream stream_caseStatement=new RewriteRuleSubtreeStream(adaptor,"rule caseStatement");
		RewriteRuleSubtreeStream stream_defaultStatement=new RewriteRuleSubtreeStream(adaptor,"rule defaultStatement");
		try { DebugEnterRule(GrammarFileName, "switchBlock");
		DebugLocation(471, 1);
		try
		{
			// AS3.g:472:2: ( LCURLY ( caseStatement )* ( defaultStatement )? RCURLY -> ^( BLOCK ( caseStatement )* ( defaultStatement )? ) )
			DebugEnterAlt(1);
			// AS3.g:472:4: LCURLY ( caseStatement )* ( defaultStatement )? RCURLY
			{
			DebugLocation(472, 4);
			LCURLY175=(IToken)Match(input,LCURLY,Follow._LCURLY_in_switchBlock2565); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_LCURLY.Add(LCURLY175);

			DebugLocation(473, 3);
			// AS3.g:473:3: ( caseStatement )*
			try { DebugEnterSubRule(40);
			while (true)
			{
				int alt40=2;
				try { DebugEnterDecision(40, false);
				int LA40_1 = input.LA(1);

				if ((LA40_1==CASE))
				{
					alt40 = 1;
				}


				} finally { DebugExitDecision(40); }
				switch ( alt40 )
				{
				case 1:
					DebugEnterAlt(1);
					// AS3.g:473:4: caseStatement
					{
					DebugLocation(473, 4);
					PushFollow(Follow._caseStatement_in_switchBlock2570);
					caseStatement176=caseStatement();
					PopFollow();
					if (state.failed) return retval;
					if (state.backtracking == 0) stream_caseStatement.Add(caseStatement176.Tree);

					}
					break;

				default:
					goto loop40;
				}
			}

			loop40:
				;

			} finally { DebugExitSubRule(40); }

			DebugLocation(474, 3);
			// AS3.g:474:3: ( defaultStatement )?
			int alt41=2;
			try { DebugEnterSubRule(41);
			try { DebugEnterDecision(41, false);
			int LA41_1 = input.LA(1);

			if ((LA41_1==DEFAULT))
			{
				alt41 = 1;
			}
			} finally { DebugExitDecision(41); }
			switch (alt41)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:474:4: defaultStatement
				{
				DebugLocation(474, 4);
				PushFollow(Follow._defaultStatement_in_switchBlock2577);
				defaultStatement177=defaultStatement();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_defaultStatement.Add(defaultStatement177.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(41); }

			DebugLocation(475, 3);
			RCURLY178=(IToken)Match(input,RCURLY,Follow._RCURLY_in_switchBlock2583); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_RCURLY.Add(RCURLY178);



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

			root_0 = (CommonTree)adaptor.Nil();
			// 476:3: -> ^( BLOCK ( caseStatement )* ( defaultStatement )? )
			{
				DebugLocation(476, 6);
				// AS3.g:476:6: ^( BLOCK ( caseStatement )* ( defaultStatement )? )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(476, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(BLOCK, "BLOCK"), root_1);

				DebugLocation(476, 14);
				// AS3.g:476:14: ( caseStatement )*
				while ( stream_caseStatement.HasNext )
				{
					DebugLocation(476, 14);
					adaptor.AddChild(root_1, stream_caseStatement.NextTree());

				}
				stream_caseStatement.Reset();
				DebugLocation(476, 29);
				// AS3.g:476:29: ( defaultStatement )?
				if (stream_defaultStatement.HasNext)
				{
					DebugLocation(476, 29);
					adaptor.AddChild(root_1, stream_defaultStatement.NextTree());

				}
				stream_defaultStatement.Reset();

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("switchBlock", 54);
			LeaveRule("switchBlock", 54);
			LeaveRule_switchBlock();
		}
		DebugLocation(477, 1);
		} finally { DebugExitRule(GrammarFileName, "switchBlock"); }
		return retval;

	}
예제 #41
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> variableDefinition()
	{
		EnterRule_variableDefinition();
		EnterRule("variableDefinition", 27);
		TraceIn("variableDefinition", 27);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken COMMA94 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> decl = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> s = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> modifiers92 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> variableDeclarator93 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> variableDeclarator95 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree COMMA94_tree = default(CommonTree);
		RewriteRuleITokenStream stream_COMMA=new RewriteRuleITokenStream(adaptor,"token COMMA");
		RewriteRuleSubtreeStream stream_modifiers=new RewriteRuleSubtreeStream(adaptor,"rule modifiers");
		RewriteRuleSubtreeStream stream_varOrConst=new RewriteRuleSubtreeStream(adaptor,"rule varOrConst");
		RewriteRuleSubtreeStream stream_variableDeclarator=new RewriteRuleSubtreeStream(adaptor,"rule variableDeclarator");
		RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
		try { DebugEnterRule(GrammarFileName, "variableDefinition");
		DebugLocation(295, 1);
		try
		{
			// AS3.g:296:2: ( modifiers decl= varOrConst variableDeclarator ( COMMA variableDeclarator )* s= semi -> ^( VARIABLE_DEF modifiers $decl ( variableDeclarator )+ ) )
			DebugEnterAlt(1);
			// AS3.g:296:4: modifiers decl= varOrConst variableDeclarator ( COMMA variableDeclarator )* s= semi
			{
			DebugLocation(296, 4);
			PushFollow(Follow._modifiers_in_variableDefinition1619);
			modifiers92=modifiers();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_modifiers.Add(modifiers92.Tree);
			DebugLocation(297, 7);
			PushFollow(Follow._varOrConst_in_variableDefinition1625);
			decl=varOrConst();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_varOrConst.Add(decl.Tree);
			DebugLocation(297, 19);
			PushFollow(Follow._variableDeclarator_in_variableDefinition1627);
			variableDeclarator93=variableDeclarator();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_variableDeclarator.Add(variableDeclarator93.Tree);
			DebugLocation(298, 3);
			// AS3.g:298:3: ( COMMA variableDeclarator )*
			try { DebugEnterSubRule(21);
			while (true)
			{
				int alt21=2;
				try { DebugEnterDecision(21, false);
				int LA21_1 = input.LA(1);

				if ((LA21_1==COMMA))
				{
					alt21 = 1;
				}


				} finally { DebugExitDecision(21); }
				switch ( alt21 )
				{
				case 1:
					DebugEnterAlt(1);
					// AS3.g:298:4: COMMA variableDeclarator
					{
					DebugLocation(298, 4);
					COMMA94=(IToken)Match(input,COMMA,Follow._COMMA_in_variableDefinition1632); if (state.failed) return retval; 
					if (state.backtracking == 0) stream_COMMA.Add(COMMA94);

					DebugLocation(298, 10);
					PushFollow(Follow._variableDeclarator_in_variableDefinition1634);
					variableDeclarator95=variableDeclarator();
					PopFollow();
					if (state.failed) return retval;
					if (state.backtracking == 0) stream_variableDeclarator.Add(variableDeclarator95.Tree);

					}
					break;

				default:
					goto loop21;
				}
			}

			loop21:
				;

			} finally { DebugExitSubRule(21); }

			DebugLocation(299, 4);
			PushFollow(Follow._semi_in_variableDefinition1642);
			s=semi();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_semi.Add(s.Tree);


			{
			// AST REWRITE
			// elements: modifiers, decl, variableDeclarator
			// token labels: 
			// rule labels: decl, retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_decl=new RewriteRuleSubtreeStream(adaptor,"rule decl",decl!=null?decl.Tree:null);
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 300:3: -> ^( VARIABLE_DEF modifiers $decl ( variableDeclarator )+ )
			{
				DebugLocation(300, 6);
				// AS3.g:300:6: ^( VARIABLE_DEF modifiers $decl ( variableDeclarator )+ )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(300, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(VARIABLE_DEF, "VARIABLE_DEF"), root_1);

				DebugLocation(300, 21);
				adaptor.AddChild(root_1, stream_modifiers.NextTree());
				DebugLocation(300, 32);
				adaptor.AddChild(root_1, stream_decl.NextTree());
				DebugLocation(300, 37);
				if (!(stream_variableDeclarator.HasNext))
				{
					throw new RewriteEarlyExitException();
				}
				while ( stream_variableDeclarator.HasNext )
				{
					DebugLocation(300, 37);
					adaptor.AddChild(root_1, stream_variableDeclarator.NextTree());

				}
				stream_variableDeclarator.Reset();
				DebugLocation(300, 57);
				adaptor.AddChild(root_1, maybeSemi(s));

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("variableDefinition", 27);
			LeaveRule("variableDefinition", 27);
			LeaveRule_variableDefinition();
		}
		DebugLocation(301, 1);
		} finally { DebugExitRule(GrammarFileName, "variableDefinition"); }
		return retval;

	}
예제 #42
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> forEachStatement()
	{
		EnterRule_forEachStatement();
		EnterRule("forEachStatement", 58);
		TraceIn("forEachStatement", 58);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken f = default(IToken);
		IToken EACH185 = default(IToken);
		IToken LPAREN186 = default(IToken);
		IToken RPAREN188 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> forInClause187 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> statement189 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree f_tree = default(CommonTree);
		CommonTree EACH185_tree = default(CommonTree);
		CommonTree LPAREN186_tree = default(CommonTree);
		CommonTree RPAREN188_tree = default(CommonTree);
		RewriteRuleITokenStream stream_FOR=new RewriteRuleITokenStream(adaptor,"token FOR");
		RewriteRuleITokenStream stream_EACH=new RewriteRuleITokenStream(adaptor,"token EACH");
		RewriteRuleITokenStream stream_LPAREN=new RewriteRuleITokenStream(adaptor,"token LPAREN");
		RewriteRuleITokenStream stream_RPAREN=new RewriteRuleITokenStream(adaptor,"token RPAREN");
		RewriteRuleSubtreeStream stream_forInClause=new RewriteRuleSubtreeStream(adaptor,"rule forInClause");
		RewriteRuleSubtreeStream stream_statement=new RewriteRuleSubtreeStream(adaptor,"rule statement");
		try { DebugEnterRule(GrammarFileName, "forEachStatement");
		DebugLocation(491, 1);
		try
		{
			// AS3.g:492:2: (f= FOR EACH LPAREN forInClause RPAREN statement -> ^( FOR_EACH_LOOP $f forInClause statement ) )
			DebugEnterAlt(1);
			// AS3.g:492:4: f= FOR EACH LPAREN forInClause RPAREN statement
			{
			DebugLocation(492, 5);
			f=(IToken)Match(input,FOR,Follow._FOR_in_forEachStatement2672); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_FOR.Add(f);

			DebugLocation(492, 10);
			EACH185=(IToken)Match(input,EACH,Follow._EACH_in_forEachStatement2674); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_EACH.Add(EACH185);

			DebugLocation(493, 3);
			LPAREN186=(IToken)Match(input,LPAREN,Follow._LPAREN_in_forEachStatement2678); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_LPAREN.Add(LPAREN186);

			DebugLocation(494, 3);
			PushFollow(Follow._forInClause_in_forEachStatement2682);
			forInClause187=forInClause();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_forInClause.Add(forInClause187.Tree);
			DebugLocation(495, 3);
			RPAREN188=(IToken)Match(input,RPAREN,Follow._RPAREN_in_forEachStatement2686); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_RPAREN.Add(RPAREN188);

			DebugLocation(496, 3);
			PushFollow(Follow._statement_in_forEachStatement2690);
			statement189=statement();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_statement.Add(statement189.Tree);


			{
			// AST REWRITE
			// elements: f, forInClause, statement
			// token labels: f
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleITokenStream stream_f=new RewriteRuleITokenStream(adaptor,"token f",f);
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 497:3: -> ^( FOR_EACH_LOOP $f forInClause statement )
			{
				DebugLocation(497, 6);
				// AS3.g:497:6: ^( FOR_EACH_LOOP $f forInClause statement )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(497, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(FOR_EACH_LOOP, "FOR_EACH_LOOP"), root_1);

				DebugLocation(497, 23);
				adaptor.AddChild(root_1, stream_f.NextNode());
				DebugLocation(497, 25);
				adaptor.AddChild(root_1, stream_forInClause.NextTree());
				DebugLocation(497, 37);
				adaptor.AddChild(root_1, stream_statement.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("forEachStatement", 58);
			LeaveRule("forEachStatement", 58);
			LeaveRule_forEachStatement();
		}
		DebugLocation(498, 1);
		} finally { DebugExitRule(GrammarFileName, "forEachStatement"); }
		return retval;

	}
예제 #43
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> declaration()
	{
		EnterRule_declaration();
		EnterRule("declaration", 28);
		TraceIn("declaration", 28);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		AstParserRuleReturnScope<CommonTree, IToken> varOrConst96 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> variableDeclarator97 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> declarationTail98 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		RewriteRuleSubtreeStream stream_varOrConst=new RewriteRuleSubtreeStream(adaptor,"rule varOrConst");
		RewriteRuleSubtreeStream stream_variableDeclarator=new RewriteRuleSubtreeStream(adaptor,"rule variableDeclarator");
		RewriteRuleSubtreeStream stream_declarationTail=new RewriteRuleSubtreeStream(adaptor,"rule declarationTail");
		try { DebugEnterRule(GrammarFileName, "declaration");
		DebugLocation(303, 1);
		try
		{
			// AS3.g:304:2: ( varOrConst variableDeclarator declarationTail -> ^( DECLARATION varOrConst variableDeclarator declarationTail ) )
			DebugEnterAlt(1);
			// AS3.g:304:4: varOrConst variableDeclarator declarationTail
			{
			DebugLocation(304, 4);
			PushFollow(Follow._varOrConst_in_declaration1671);
			varOrConst96=varOrConst();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_varOrConst.Add(varOrConst96.Tree);
			DebugLocation(304, 15);
			PushFollow(Follow._variableDeclarator_in_declaration1673);
			variableDeclarator97=variableDeclarator();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_variableDeclarator.Add(variableDeclarator97.Tree);
			DebugLocation(304, 34);
			PushFollow(Follow._declarationTail_in_declaration1675);
			declarationTail98=declarationTail();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_declarationTail.Add(declarationTail98.Tree);


			{
			// AST REWRITE
			// elements: varOrConst, variableDeclarator, declarationTail
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 305:9: -> ^( DECLARATION varOrConst variableDeclarator declarationTail )
			{
				DebugLocation(305, 12);
				// AS3.g:305:12: ^( DECLARATION varOrConst variableDeclarator declarationTail )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(305, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(DECLARATION, "DECLARATION"), root_1);

				DebugLocation(305, 26);
				adaptor.AddChild(root_1, stream_varOrConst.NextTree());
				DebugLocation(305, 37);
				adaptor.AddChild(root_1, stream_variableDeclarator.NextTree());
				DebugLocation(305, 56);
				adaptor.AddChild(root_1, stream_declarationTail.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("declaration", 28);
			LeaveRule("declaration", 28);
			LeaveRule_declaration();
		}
		DebugLocation(306, 1);
		} finally { DebugExitRule(GrammarFileName, "declaration"); }
		return retval;

	}
예제 #44
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> packageDecl()
	{
		EnterRule_packageDecl();
		EnterRule("packageDecl", 5);
		TraceIn("packageDecl", 5);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken PACKAGE11 = default(IToken);
		IToken LCURLY13 = default(IToken);
		IToken RCURLY15 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> identifierStar12 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> packageBlockEntry14 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree PACKAGE11_tree = default(CommonTree);
		CommonTree LCURLY13_tree = default(CommonTree);
		CommonTree RCURLY15_tree = default(CommonTree);
		RewriteRuleITokenStream stream_PACKAGE=new RewriteRuleITokenStream(adaptor,"token PACKAGE");
		RewriteRuleITokenStream stream_LCURLY=new RewriteRuleITokenStream(adaptor,"token LCURLY");
		RewriteRuleITokenStream stream_RCURLY=new RewriteRuleITokenStream(adaptor,"token RCURLY");
		RewriteRuleSubtreeStream stream_identifierStar=new RewriteRuleSubtreeStream(adaptor,"rule identifierStar");
		RewriteRuleSubtreeStream stream_packageBlockEntry=new RewriteRuleSubtreeStream(adaptor,"rule packageBlockEntry");
		try { DebugEnterRule(GrammarFileName, "packageDecl");
		DebugLocation(139, 1);
		try
		{
			// AS3.g:140:2: ( PACKAGE ( identifierStar )? LCURLY ( packageBlockEntry )* RCURLY -> ^( PACKAGE_DECL PACKAGE ( identifierStar )? LCURLY ( packageBlockEntry )* RCURLY ) )
			DebugEnterAlt(1);
			// AS3.g:140:4: PACKAGE ( identifierStar )? LCURLY ( packageBlockEntry )* RCURLY
			{
			DebugLocation(140, 4);
			PACKAGE11=(IToken)Match(input,PACKAGE,Follow._PACKAGE_in_packageDecl590); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_PACKAGE.Add(PACKAGE11);

			DebugLocation(140, 12);
			// AS3.g:140:12: ( identifierStar )?
			int alt5=2;
			try { DebugEnterSubRule(5);
			try { DebugEnterDecision(5, false);
			int LA5_1 = input.LA(1);

			if ((LA5_1==AS||LA5_1==DYNAMIC||LA5_1==GET||LA5_1==IDENT||LA5_1==IS||LA5_1==NAMESPACE||LA5_1==SET||LA5_1==SUPER||LA5_1==USE||LA5_1==XML))
			{
				alt5 = 1;
			}
			} finally { DebugExitDecision(5); }
			switch (alt5)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:140:12: identifierStar
				{
				DebugLocation(140, 12);
				PushFollow(Follow._identifierStar_in_packageDecl592);
				identifierStar12=identifierStar();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_identifierStar.Add(identifierStar12.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(5); }

			DebugLocation(141, 3);
			LCURLY13=(IToken)Match(input,LCURLY,Follow._LCURLY_in_packageDecl597); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_LCURLY.Add(LCURLY13);

			DebugLocation(142, 9);
			// AS3.g:142:9: ( packageBlockEntry )*
			try { DebugEnterSubRule(6);
			while (true)
			{
				int alt6=2;
				try { DebugEnterDecision(6, false);
				int LA6_1 = input.LA(1);

				if ((LA6_1==AS||LA6_1==BNOT||LA6_1==BREAK||LA6_1==CLASS||LA6_1==CONST||LA6_1==CONTINUE||(LA6_1>=DEC && LA6_1<=DECIMAL_LITERAL)||LA6_1==DEFAULT||LA6_1==DO||(LA6_1>=DYNAMIC && LA6_1<=E4X_ATTRI)||(LA6_1>=FALSE && LA6_1<=FOR)||LA6_1==FUNCTION||LA6_1==GET||(LA6_1>=HEX_LITERAL && LA6_1<=IDENT)||LA6_1==IF||LA6_1==IMPORT||LA6_1==INC||LA6_1==INTERFACE||(LA6_1>=INTERNAL && LA6_1<=IS)||(LA6_1>=LBRACK && LA6_1<=LCURLY)||LA6_1==LNOT||LA6_1==LPAREN||LA6_1==MINUS||LA6_1==NAMESPACE||LA6_1==NEW||LA6_1==NULL||LA6_1==OCTAL_LITERAL||LA6_1==PLUS||LA6_1==PRIVATE||(LA6_1>=PROTECTED && LA6_1<=PUBLIC)||LA6_1==REGEX_LITERAL||LA6_1==RETURN||(LA6_1>=SEMI && LA6_1<=SET)||LA6_1==STATIC||(LA6_1>=STRING_LITERAL_DOUBLE && LA6_1<=SWITCH)||LA6_1==TRUE||(LA6_1>=USE && LA6_1<=VAR)||LA6_1==WHILE||LA6_1==WITH||LA6_1==XML||LA6_1==XML_LITERAL||(LA6_1>=243 && LA6_1<=246)||LA6_1==248||LA6_1==250||(LA6_1>=252 && LA6_1<=257)))
				{
					alt6 = 1;
				}


				} finally { DebugExitDecision(6); }
				switch ( alt6 )
				{
				case 1:
					DebugEnterAlt(1);
					// AS3.g:142:9: packageBlockEntry
					{
					DebugLocation(142, 9);
					PushFollow(Follow._packageBlockEntry_in_packageDecl608);
					packageBlockEntry14=packageBlockEntry();
					PopFollow();
					if (state.failed) return retval;
					if (state.backtracking == 0) stream_packageBlockEntry.Add(packageBlockEntry14.Tree);

					}
					break;

				default:
					goto loop6;
				}
			}

			loop6:
				;

			} finally { DebugExitSubRule(6); }

			DebugLocation(143, 3);
			RCURLY15=(IToken)Match(input,RCURLY,Follow._RCURLY_in_packageDecl613); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_RCURLY.Add(RCURLY15);



			{
			// AST REWRITE
			// elements: PACKAGE, identifierStar, LCURLY, packageBlockEntry, RCURLY
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 144:3: -> ^( PACKAGE_DECL PACKAGE ( identifierStar )? LCURLY ( packageBlockEntry )* RCURLY )
			{
				DebugLocation(144, 6);
				// AS3.g:144:6: ^( PACKAGE_DECL PACKAGE ( identifierStar )? LCURLY ( packageBlockEntry )* RCURLY )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(144, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(PACKAGE_DECL, "PACKAGE_DECL"), root_1);

				DebugLocation(144, 21);
				adaptor.AddChild(root_1, stream_PACKAGE.NextNode());
				DebugLocation(144, 29);
				// AS3.g:144:29: ( identifierStar )?
				if (stream_identifierStar.HasNext)
				{
					DebugLocation(144, 29);
					adaptor.AddChild(root_1, stream_identifierStar.NextTree());

				}
				stream_identifierStar.Reset();
				DebugLocation(144, 45);
				adaptor.AddChild(root_1, stream_LCURLY.NextNode());
				DebugLocation(144, 52);
				// AS3.g:144:52: ( packageBlockEntry )*
				while ( stream_packageBlockEntry.HasNext )
				{
					DebugLocation(144, 52);
					adaptor.AddChild(root_1, stream_packageBlockEntry.NextTree());

				}
				stream_packageBlockEntry.Reset();
				DebugLocation(144, 71);
				adaptor.AddChild(root_1, stream_RCURLY.NextNode());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("packageDecl", 5);
			LeaveRule("packageDecl", 5);
			LeaveRule_packageDecl();
		}
		DebugLocation(145, 1);
		} finally { DebugExitRule(GrammarFileName, "packageDecl"); }
		return retval;

	}
예제 #45
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> variableInitializer()
	{
		EnterRule_variableInitializer();
		EnterRule("variableInitializer", 31);
		TraceIn("variableInitializer", 31);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken ASSIGN102 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> expression103 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree ASSIGN102_tree = default(CommonTree);
		RewriteRuleITokenStream stream_ASSIGN=new RewriteRuleITokenStream(adaptor,"token ASSIGN");
		RewriteRuleSubtreeStream stream_expression=new RewriteRuleSubtreeStream(adaptor,"rule expression");
		try { DebugEnterRule(GrammarFileName, "variableInitializer");
		DebugLocation(316, 1);
		try
		{
			// AS3.g:317:2: ( ASSIGN expression -> ^( VAR_INITIALIZER ASSIGN expression ) )
			DebugEnterAlt(1);
			// AS3.g:317:4: ASSIGN expression
			{
			DebugLocation(317, 4);
			ASSIGN102=(IToken)Match(input,ASSIGN,Follow._ASSIGN_in_variableInitializer1737); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_ASSIGN.Add(ASSIGN102);

			DebugLocation(317, 11);
			PushFollow(Follow._expression_in_variableInitializer1739);
			expression103=expression();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_expression.Add(expression103.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 318:9: -> ^( VAR_INITIALIZER ASSIGN expression )
			{
				DebugLocation(318, 12);
				// AS3.g:318:12: ^( VAR_INITIALIZER ASSIGN expression )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(318, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(VAR_INITIALIZER, "VAR_INITIALIZER"), root_1);

				DebugLocation(318, 30);
				adaptor.AddChild(root_1, stream_ASSIGN.NextNode());
				DebugLocation(318, 37);
				adaptor.AddChild(root_1, stream_expression.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("variableInitializer", 31);
			LeaveRule("variableInitializer", 31);
			LeaveRule_variableInitializer();
		}
		DebugLocation(319, 1);
		} finally { DebugExitRule(GrammarFileName, "variableInitializer"); }
		return retval;

	}
예제 #46
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> whileStatement()
	{
		EnterRule_whileStatement();
		EnterRule("whileStatement", 67);
		TraceIn("whileStatement", 67);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken WHILE215 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> condition216 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> statement217 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree WHILE215_tree = default(CommonTree);
		RewriteRuleITokenStream stream_WHILE=new RewriteRuleITokenStream(adaptor,"token WHILE");
		RewriteRuleSubtreeStream stream_condition=new RewriteRuleSubtreeStream(adaptor,"rule condition");
		RewriteRuleSubtreeStream stream_statement=new RewriteRuleSubtreeStream(adaptor,"rule statement");
		try { DebugEnterRule(GrammarFileName, "whileStatement");
		DebugLocation(548, 1);
		try
		{
			// AS3.g:549:2: ( WHILE condition statement -> ^( WHILE_LOOP condition statement ) )
			DebugEnterAlt(1);
			// AS3.g:549:4: WHILE condition statement
			{
			DebugLocation(549, 4);
			WHILE215=(IToken)Match(input,WHILE,Follow._WHILE_in_whileStatement2962); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_WHILE.Add(WHILE215);

			DebugLocation(549, 10);
			PushFollow(Follow._condition_in_whileStatement2964);
			condition216=condition();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_condition.Add(condition216.Tree);
			DebugLocation(549, 20);
			PushFollow(Follow._statement_in_whileStatement2966);
			statement217=statement();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_statement.Add(statement217.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 550:3: -> ^( WHILE_LOOP condition statement )
			{
				DebugLocation(550, 6);
				// AS3.g:550:6: ^( WHILE_LOOP condition statement )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(550, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(WHILE_LOOP, "WHILE_LOOP"), root_1);

				DebugLocation(550, 19);
				adaptor.AddChild(root_1, stream_condition.NextTree());
				DebugLocation(550, 29);
				adaptor.AddChild(root_1, stream_statement.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("whileStatement", 67);
			LeaveRule("whileStatement", 67);
			LeaveRule_whileStatement();
		}
		DebugLocation(551, 1);
		} finally { DebugExitRule(GrammarFileName, "whileStatement"); }
		return retval;

	}
예제 #47
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> variableDeclarator()
	{
		EnterRule_variableDeclarator();
		EnterRule("variableDeclarator", 32);
		TraceIn("variableDeclarator", 32);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		AstParserRuleReturnScope<CommonTree, IToken> ident104 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> typeExpression105 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> variableInitializer106 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		RewriteRuleSubtreeStream stream_ident=new RewriteRuleSubtreeStream(adaptor,"rule ident");
		RewriteRuleSubtreeStream stream_typeExpression=new RewriteRuleSubtreeStream(adaptor,"rule typeExpression");
		RewriteRuleSubtreeStream stream_variableInitializer=new RewriteRuleSubtreeStream(adaptor,"rule variableInitializer");
		try { DebugEnterRule(GrammarFileName, "variableDeclarator");
		DebugLocation(321, 1);
		try
		{
			// AS3.g:322:2: ( ident ( typeExpression )? ( variableInitializer )? -> ^( VAR_DECLARATION ident ( typeExpression )? ( variableInitializer )? ) )
			DebugEnterAlt(1);
			// AS3.g:322:4: ident ( typeExpression )? ( variableInitializer )?
			{
			DebugLocation(322, 4);
			PushFollow(Follow._ident_in_variableDeclarator1768);
			ident104=ident();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_ident.Add(ident104.Tree);
			DebugLocation(322, 10);
			// AS3.g:322:10: ( typeExpression )?
			int alt23=2;
			try { DebugEnterSubRule(23);
			try { DebugEnterDecision(23, false);
			int LA23_1 = input.LA(1);

			if ((LA23_1==COLON))
			{
				alt23 = 1;
			}
			} finally { DebugExitDecision(23); }
			switch (alt23)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:322:10: typeExpression
				{
				DebugLocation(322, 10);
				PushFollow(Follow._typeExpression_in_variableDeclarator1770);
				typeExpression105=typeExpression();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_typeExpression.Add(typeExpression105.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(23); }

			DebugLocation(322, 26);
			// AS3.g:322:26: ( variableInitializer )?
			int alt24=2;
			try { DebugEnterSubRule(24);
			try { DebugEnterDecision(24, false);
			int LA24_1 = input.LA(1);

			if ((LA24_1==ASSIGN))
			{
				alt24 = 1;
			}
			} finally { DebugExitDecision(24); }
			switch (alt24)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:322:26: variableInitializer
				{
				DebugLocation(322, 26);
				PushFollow(Follow._variableInitializer_in_variableDeclarator1773);
				variableInitializer106=variableInitializer();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_variableInitializer.Add(variableInitializer106.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(24); }



			{
			// AST REWRITE
			// elements: ident, typeExpression, variableInitializer
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 323:9: -> ^( VAR_DECLARATION ident ( typeExpression )? ( variableInitializer )? )
			{
				DebugLocation(323, 12);
				// AS3.g:323:12: ^( VAR_DECLARATION ident ( typeExpression )? ( variableInitializer )? )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(323, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(VAR_DECLARATION, "VAR_DECLARATION"), root_1);

				DebugLocation(323, 30);
				adaptor.AddChild(root_1, stream_ident.NextTree());
				DebugLocation(323, 36);
				// AS3.g:323:36: ( typeExpression )?
				if (stream_typeExpression.HasNext)
				{
					DebugLocation(323, 36);
					adaptor.AddChild(root_1, stream_typeExpression.NextTree());

				}
				stream_typeExpression.Reset();
				DebugLocation(323, 52);
				// AS3.g:323:52: ( variableInitializer )?
				if (stream_variableInitializer.HasNext)
				{
					DebugLocation(323, 52);
					adaptor.AddChild(root_1, stream_variableInitializer.NextTree());

				}
				stream_variableInitializer.Reset();

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("variableDeclarator", 32);
			LeaveRule("variableDeclarator", 32);
			LeaveRule_variableDeclarator();
		}
		DebugLocation(324, 1);
		} finally { DebugExitRule(GrammarFileName, "variableDeclarator"); }
		return retval;

	}
예제 #48
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> defaultXMLNamespaceStatement()
	{
		EnterRule_defaultXMLNamespaceStatement();
		EnterRule("defaultXMLNamespaceStatement", 70);
		TraceIn("defaultXMLNamespaceStatement", 70);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken DEFAULT226 = default(IToken);
		IToken XML227 = default(IToken);
		IToken NAMESPACE228 = default(IToken);
		IToken ASSIGN229 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> expression230 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> semi231 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree DEFAULT226_tree = default(CommonTree);
		CommonTree XML227_tree = default(CommonTree);
		CommonTree NAMESPACE228_tree = default(CommonTree);
		CommonTree ASSIGN229_tree = default(CommonTree);
		RewriteRuleITokenStream stream_DEFAULT=new RewriteRuleITokenStream(adaptor,"token DEFAULT");
		RewriteRuleITokenStream stream_XML=new RewriteRuleITokenStream(adaptor,"token XML");
		RewriteRuleITokenStream stream_NAMESPACE=new RewriteRuleITokenStream(adaptor,"token NAMESPACE");
		RewriteRuleITokenStream stream_ASSIGN=new RewriteRuleITokenStream(adaptor,"token ASSIGN");
		RewriteRuleSubtreeStream stream_expression=new RewriteRuleSubtreeStream(adaptor,"rule expression");
		RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
		try { DebugEnterRule(GrammarFileName, "defaultXMLNamespaceStatement");
		DebugLocation(562, 1);
		try
		{
			// AS3.g:563:2: ( DEFAULT XML NAMESPACE ASSIGN expression semi -> ^( DEFAULT_XML_NAMESPACE expression ) )
			DebugEnterAlt(1);
			// AS3.g:563:4: DEFAULT XML NAMESPACE ASSIGN expression semi
			{
			DebugLocation(563, 4);
			DEFAULT226=(IToken)Match(input,DEFAULT,Follow._DEFAULT_in_defaultXMLNamespaceStatement3040); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_DEFAULT.Add(DEFAULT226);

			DebugLocation(563, 12);
			XML227=(IToken)Match(input,XML,Follow._XML_in_defaultXMLNamespaceStatement3042); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_XML.Add(XML227);

			DebugLocation(563, 16);
			NAMESPACE228=(IToken)Match(input,NAMESPACE,Follow._NAMESPACE_in_defaultXMLNamespaceStatement3044); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_NAMESPACE.Add(NAMESPACE228);

			DebugLocation(563, 26);
			ASSIGN229=(IToken)Match(input,ASSIGN,Follow._ASSIGN_in_defaultXMLNamespaceStatement3046); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_ASSIGN.Add(ASSIGN229);

			DebugLocation(563, 33);
			PushFollow(Follow._expression_in_defaultXMLNamespaceStatement3048);
			expression230=expression();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_expression.Add(expression230.Tree);
			DebugLocation(563, 44);
			PushFollow(Follow._semi_in_defaultXMLNamespaceStatement3050);
			semi231=semi();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_semi.Add(semi231.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 564:3: -> ^( DEFAULT_XML_NAMESPACE expression )
			{
				DebugLocation(564, 6);
				// AS3.g:564:6: ^( DEFAULT_XML_NAMESPACE expression )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(564, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(DEFAULT_XML_NAMESPACE, "DEFAULT_XML_NAMESPACE"), root_1);

				DebugLocation(564, 30);
				adaptor.AddChild(root_1, stream_expression.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("defaultXMLNamespaceStatement", 70);
			LeaveRule("defaultXMLNamespaceStatement", 70);
			LeaveRule_defaultXMLNamespaceStatement();
		}
		DebugLocation(565, 1);
		} finally { DebugExitRule(GrammarFileName, "defaultXMLNamespaceStatement"); }
		return retval;

	}
예제 #49
0
파일: AS3Parser.cs 프로젝트: jbakst/xas
	private AstParserRuleReturnScope<CommonTree, IToken> parameterDeclarationList()
	{
		EnterRule_parameterDeclarationList();
		EnterRule("parameterDeclarationList", 33);
		TraceIn("parameterDeclarationList", 33);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken LPAREN107 = default(IToken);
		IToken COMMA109 = default(IToken);
		IToken RPAREN111 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> parameterDeclaration108 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> parameterDeclaration110 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree LPAREN107_tree = default(CommonTree);
		CommonTree COMMA109_tree = default(CommonTree);
		CommonTree RPAREN111_tree = default(CommonTree);
		RewriteRuleITokenStream stream_LPAREN=new RewriteRuleITokenStream(adaptor,"token LPAREN");
		RewriteRuleITokenStream stream_COMMA=new RewriteRuleITokenStream(adaptor,"token COMMA");
		RewriteRuleITokenStream stream_RPAREN=new RewriteRuleITokenStream(adaptor,"token RPAREN");
		RewriteRuleSubtreeStream stream_parameterDeclaration=new RewriteRuleSubtreeStream(adaptor,"rule parameterDeclaration");
		try { DebugEnterRule(GrammarFileName, "parameterDeclarationList");
		DebugLocation(329, 1);
		try
		{
			// AS3.g:330:2: ( LPAREN ( parameterDeclaration ( COMMA parameterDeclaration )* )? RPAREN -> ^( PARAMS LPAREN ( parameterDeclaration )* RPAREN ) )
			DebugEnterAlt(1);
			// AS3.g:330:4: LPAREN ( parameterDeclaration ( COMMA parameterDeclaration )* )? RPAREN
			{
			DebugLocation(330, 4);
			LPAREN107=(IToken)Match(input,LPAREN,Follow._LPAREN_in_parameterDeclarationList1810); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_LPAREN.Add(LPAREN107);

			DebugLocation(331, 3);
			// AS3.g:331:3: ( parameterDeclaration ( COMMA parameterDeclaration )* )?
			int alt26=2;
			try { DebugEnterSubRule(26);
			try { DebugEnterDecision(26, false);
			int LA26_1 = input.LA(1);

			if ((LA26_1==AS||LA26_1==CONST||LA26_1==DYNAMIC||LA26_1==GET||LA26_1==IDENT||LA26_1==IS||LA26_1==NAMESPACE||LA26_1==REST||LA26_1==SET||LA26_1==SUPER||LA26_1==USE||LA26_1==XML))
			{
				alt26 = 1;
			}
			} finally { DebugExitDecision(26); }
			switch (alt26)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:331:5: parameterDeclaration ( COMMA parameterDeclaration )*
				{
				DebugLocation(331, 5);
				PushFollow(Follow._parameterDeclaration_in_parameterDeclarationList1816);
				parameterDeclaration108=parameterDeclaration();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_parameterDeclaration.Add(parameterDeclaration108.Tree);
				DebugLocation(332, 4);
				// AS3.g:332:4: ( COMMA parameterDeclaration )*
				try { DebugEnterSubRule(25);
				while (true)
				{
					int alt25=2;
					try { DebugEnterDecision(25, false);
					int LA25_1 = input.LA(1);

					if ((LA25_1==COMMA))
					{
						alt25 = 1;
					}


					} finally { DebugExitDecision(25); }
					switch ( alt25 )
					{
					case 1:
						DebugEnterAlt(1);
						// AS3.g:332:5: COMMA parameterDeclaration
						{
						DebugLocation(332, 5);
						COMMA109=(IToken)Match(input,COMMA,Follow._COMMA_in_parameterDeclarationList1822); if (state.failed) return retval; 
						if (state.backtracking == 0) stream_COMMA.Add(COMMA109);

						DebugLocation(332, 11);
						PushFollow(Follow._parameterDeclaration_in_parameterDeclarationList1824);
						parameterDeclaration110=parameterDeclaration();
						PopFollow();
						if (state.failed) return retval;
						if (state.backtracking == 0) stream_parameterDeclaration.Add(parameterDeclaration110.Tree);

						}
						break;

					default:
						goto loop25;
					}
				}

				loop25:
					;

				} finally { DebugExitSubRule(25); }


				}
				break;

			}
			} finally { DebugExitSubRule(26); }

			DebugLocation(334, 3);
			RPAREN111=(IToken)Match(input,RPAREN,Follow._RPAREN_in_parameterDeclarationList1835); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_RPAREN.Add(RPAREN111);



			{
			// AST REWRITE
			// elements: LPAREN, parameterDeclaration, RPAREN
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 335:3: -> ^( PARAMS LPAREN ( parameterDeclaration )* RPAREN )
			{
				DebugLocation(335, 6);
				// AS3.g:335:6: ^( PARAMS LPAREN ( parameterDeclaration )* RPAREN )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(335, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(PARAMS, "PARAMS"), root_1);

				DebugLocation(335, 15);
				adaptor.AddChild(root_1, stream_LPAREN.NextNode());
				DebugLocation(335, 22);
				// AS3.g:335:22: ( parameterDeclaration )*
				while ( stream_parameterDeclaration.HasNext )
				{
					DebugLocation(335, 22);
					adaptor.AddChild(root_1, stream_parameterDeclaration.NextTree());

				}
				stream_parameterDeclaration.Reset();
				DebugLocation(335, 44);
				adaptor.AddChild(root_1, stream_RPAREN.NextNode());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("parameterDeclarationList", 33);
			LeaveRule("parameterDeclarationList", 33);
			LeaveRule_parameterDeclarationList();
		}
		DebugLocation(336, 1);
		} finally { DebugExitRule(GrammarFileName, "parameterDeclarationList"); }
		return retval;

	}
예제 #50
0
    // $ANTLR start "start"
    // D:\\Szkolenia\\Artykuł ProgramistaMag - DSL\\Code\\DSLSamples\\HelloWorld\\Simple.g:13:0: start : ID EOF -> ^( START ID ) ;
    public SimpleParser.start_return start() // throws RecognitionException [1]
    {
        SimpleParser.start_return retval = new SimpleParser.start_return();
        retval.Start = input.LT(1);

        CommonTree root_0 = null;

        IToken ID1  = null;
        IToken EOF2 = null;

        CommonTree             ID1_tree   = null;
        CommonTree             EOF2_tree  = null;
        RewriteRuleTokenStream stream_ID  = new RewriteRuleTokenStream(adaptor, "token ID");
        RewriteRuleTokenStream stream_EOF = new RewriteRuleTokenStream(adaptor, "token EOF");

        try
        {
            // D:\\Szkolenia\\Artykuł ProgramistaMag - DSL\\Code\\DSLSamples\\HelloWorld\\Simple.g:13:8: ( ID EOF -> ^( START ID ) )
            // D:\\Szkolenia\\Artykuł ProgramistaMag - DSL\\Code\\DSLSamples\\HelloWorld\\Simple.g:13:8: ID EOF
            {
                ID1 = (IToken)Match(input, ID, FOLLOW_ID_in_start50);
                stream_ID.Add(ID1);

                EOF2 = (IToken)Match(input, EOF, FOLLOW_EOF_in_start52);
                stream_EOF.Add(EOF2);



                // AST REWRITE
                // elements:          ID
                // 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 = (CommonTree)adaptor.GetNilNode();
                // 13:15: -> ^( START ID )
                {
                    // D:\\Szkolenia\\Artykuł ProgramistaMag - DSL\\Code\\DSLSamples\\HelloWorld\\Simple.g:13:18: ^( START ID )
                    {
                        CommonTree root_1 = (CommonTree)adaptor.GetNilNode();
                        root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(START, "START"), root_1);

                        adaptor.AddChild(root_1, stream_ID.NextNode());

                        adaptor.AddChild(root_0, root_1);
                    }
                }

                retval.Tree = root_0; retval.Tree = root_0;
            }

            retval.Stop = input.LT(-1);

            retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
            adaptor.SetTokenBoundaries(retval.Tree, (IToken)retval.Start, (IToken)retval.Stop);
        }
        catch (RecognitionException re)
        {
            ReportError(re);
            Recover(input, re);
            // Conversion of the second argument necessary, but harmless
            retval.Tree = (CommonTree)adaptor.ErrorNode(input, (IToken)retval.Start, input.LT(-1), re);
        }
        finally
        {
        }
        return(retval);
    }
예제 #51
0
        private AstParserRuleReturnScope <object, IToken> plain_descr()
        {
            EnterRule_plain_descr();
            EnterRule("plain_descr", 2);
            TraceIn("plain_descr", 2);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken PLAIN3        = default(IToken);
            IToken ID4           = default(IToken);
            IToken BEGIN5        = default(IToken);
            IToken END6          = default(IToken);
            IToken char_literal7 = default(IToken);
            AstParserRuleReturnScope <object, IToken> pl = default(AstParserRuleReturnScope <object, IToken>);

            object PLAIN3_tree                              = default(object);
            object ID4_tree                                 = default(object);
            object BEGIN5_tree                              = default(object);
            object END6_tree                                = default(object);
            object char_literal7_tree                       = default(object);
            RewriteRuleITokenStream  stream_ID              = new RewriteRuleITokenStream(adaptor, "token ID");
            RewriteRuleITokenStream  stream_END             = new RewriteRuleITokenStream(adaptor, "token END");
            RewriteRuleITokenStream  stream_PLAIN           = new RewriteRuleITokenStream(adaptor, "token PLAIN");
            RewriteRuleITokenStream  stream_24              = new RewriteRuleITokenStream(adaptor, "token 24");
            RewriteRuleITokenStream  stream_BEGIN           = new RewriteRuleITokenStream(adaptor, "token BEGIN");
            RewriteRuleSubtreeStream stream_plain_elem_list = new RewriteRuleSubtreeStream(adaptor, "rule plain_elem_list");

            try { DebugEnterRule(GrammarFileName, "plain_descr");
                  DebugLocation(30, 1);
                  try
                  {
                      // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:30:12: ( PLAIN ID BEGIN pl= plain_elem_list END ';' -> ^( PLAIN_FILE ID $pl) )
                      DebugEnterAlt(1);
                      // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:31:2: PLAIN ID BEGIN pl= plain_elem_list END ';'
                      {
                          DebugLocation(31, 2);
                          PLAIN3 = (IToken)Match(input, PLAIN, Follow._PLAIN_in_plain_descr99);
                          stream_PLAIN.Add(PLAIN3);

                          DebugLocation(31, 8);
                          ID4 = (IToken)Match(input, ID, Follow._ID_in_plain_descr101);
                          stream_ID.Add(ID4);

                          DebugLocation(32, 2);
                          BEGIN5 = (IToken)Match(input, BEGIN, Follow._BEGIN_in_plain_descr104);
                          stream_BEGIN.Add(BEGIN5);

                          DebugLocation(33, 6);
                          PushFollow(Follow._plain_elem_list_in_plain_descr111);
                          pl = plain_elem_list();
                          PopFollow();

                          stream_plain_elem_list.Add(pl.Tree);
                          DebugLocation(34, 2);
                          END6 = (IToken)Match(input, END, Follow._END_in_plain_descr114);
                          stream_END.Add(END6);

                          DebugLocation(34, 6);
                          char_literal7 = (IToken)Match(input, 24, Follow._24_in_plain_descr116);
                          stream_24.Add(char_literal7);



                          {
                              // AST REWRITE
                              // elements: pl, ID
                              // token labels:
                              // rule labels: retval, pl
                              // 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);
                              RewriteRuleSubtreeStream stream_pl     = new RewriteRuleSubtreeStream(adaptor, "rule pl", pl != null?pl.Tree:null);

                              root_0 = (object)adaptor.Nil();
                              // 34:10: -> ^( PLAIN_FILE ID $pl)
                              {
                                  DebugLocation(34, 13);
                                  // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:34:13: ^( PLAIN_FILE ID $pl)
                                  {
                                      object root_1 = (object)adaptor.Nil();
                                      DebugLocation(34, 15);
                                      root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(PLAIN_FILE, "PLAIN_FILE"), root_1);

                                      DebugLocation(34, 26);
                                      adaptor.AddChild(root_1, stream_ID.NextNode());
                                      DebugLocation(34, 30);
                                      adaptor.AddChild(root_1, stream_pl.NextTree());

                                      adaptor.AddChild(root_0, root_1);
                                  }
                              }

                              retval.Tree = root_0;
                          }
                      }

                      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("plain_descr", 2);
                      LeaveRule("plain_descr", 2);
                      LeaveRule_plain_descr();
                  }
                  DebugLocation(35, 1); } finally { DebugExitRule(GrammarFileName, "plain_descr"); }
            return(retval);
        }