예제 #1
0
	private AstParserRuleReturnScope<object, IToken> nameSpace()
	{
		EnterRule_nameSpace();
		EnterRule("nameSpace", 4);
		TraceIn("nameSpace", 4);
		AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
		retval.Start = (IToken)input.LT(1);

		object root_0 = default(object);

		IToken ID6 = default(IToken);
		IToken char_literal7 = default(IToken);
		IToken ID8 = default(IToken);

		object ID6_tree = default(object);
		object char_literal7_tree = default(object);
		object ID8_tree = default(object);
		RewriteRuleITokenStream stream_ID=new RewriteRuleITokenStream(adaptor,"token ID");
		RewriteRuleITokenStream stream_16=new RewriteRuleITokenStream(adaptor,"token 16");
		try { DebugEnterRule(GrammarFileName, "nameSpace");
		DebugLocation(31, 1);
		try
		{
			// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:31:12: ( ID ( '.' ID )* -> ^( NAMESPACE ID ( '.' ID )* ) )
			DebugEnterAlt(1);
			// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:31:14: ID ( '.' ID )*
			{
			DebugLocation(31, 14);
			ID6=(IToken)Match(input,ID,Follow._ID_in_nameSpace142); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_ID.Add(ID6);

			DebugLocation(31, 18);
			// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:31:18: ( '.' ID )*
			try { DebugEnterSubRule(3);
			while (true)
			{
				int alt3=2;
				try { DebugEnterDecision(3, false);
				int LA3_0 = input.LA(1);

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

					if ((LA3_2==ID))
					{
						alt3 = 1;
					}


				}


				} finally { DebugExitDecision(3); }
				switch ( alt3 )
				{
				case 1:
					DebugEnterAlt(1);
					// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:31:20: '.' ID
					{
					DebugLocation(31, 20);
					char_literal7=(IToken)Match(input,16,Follow._16_in_nameSpace147); if (state.failed) return retval; 
					if (state.backtracking == 0) stream_16.Add(char_literal7);

					DebugLocation(31, 24);
					ID8=(IToken)Match(input,ID,Follow._ID_in_nameSpace149); if (state.failed) return retval; 
					if (state.backtracking == 0) stream_ID.Add(ID8);


					}
					break;

				default:
					goto loop3;
				}
			}

			loop3:
				;

			} finally { DebugExitSubRule(3); }



			{
			// AST REWRITE
			// elements: ID, 16, ID
			// 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 = (object)adaptor.Nil();
			// 31:30: -> ^( NAMESPACE ID ( '.' ID )* )
			{
				DebugLocation(31, 33);
				// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:31:33: ^( NAMESPACE ID ( '.' ID )* )
				{
				object root_1 = (object)adaptor.Nil();
				DebugLocation(31, 35);
				root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(NAMESPACE, "NAMESPACE"), root_1);

				DebugLocation(31, 45);
				adaptor.AddChild(root_1, stream_ID.NextNode());
				DebugLocation(31, 49);
				// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:31:49: ( '.' ID )*
				while ( stream_ID.HasNext||stream_16.HasNext )
				{
					DebugLocation(31, 51);
					adaptor.AddChild(root_1, stream_16.NextNode());
					DebugLocation(31, 55);
					adaptor.AddChild(root_1, stream_ID.NextNode());

				}
				stream_ID.Reset();
				stream_16.Reset();

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

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

			if (state.backtracking == 0) {
			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("nameSpace", 4);
			LeaveRule("nameSpace", 4);
			LeaveRule_nameSpace();
		}
		DebugLocation(32, 1);
		} finally { DebugExitRule(GrammarFileName, "nameSpace"); }
		return retval;

	}
예제 #2
0
	private AstParserRuleReturnScope<object, IToken> type()
	{
		EnterRule_type();
		EnterRule("type", 8);
		TraceIn("type", 8);
		AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
		retval.Start = (IToken)input.LT(1);

		object root_0 = default(object);

		IToken ID21 = default(IToken);
		IToken char_literal22 = default(IToken);

		object ID21_tree = default(object);
		object char_literal22_tree = default(object);
		RewriteRuleITokenStream stream_ID=new RewriteRuleITokenStream(adaptor,"token ID");
		RewriteRuleITokenStream stream_18=new RewriteRuleITokenStream(adaptor,"token 18");
		try { DebugEnterRule(GrammarFileName, "type");
		DebugLocation(48, 1);
		try
		{
			// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:49:2: ( ID ( '?' )? -> ^( TYPE ID ( '?' )? ) )
			DebugEnterAlt(1);
			// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:49:4: ID ( '?' )?
			{
			DebugLocation(49, 4);
			ID21=(IToken)Match(input,ID,Follow._ID_in_type321); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_ID.Add(ID21);

			DebugLocation(49, 7);
			// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:49:7: ( '?' )?
			int alt6=2;
			try { DebugEnterSubRule(6);
			try { DebugEnterDecision(6, false);
			int LA6_0 = input.LA(1);

			if ((LA6_0==18))
			{
				alt6 = 1;
			}
			} finally { DebugExitDecision(6); }
			switch (alt6)
			{
			case 1:
				DebugEnterAlt(1);
				// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:49:7: '?'
				{
				DebugLocation(49, 7);
				char_literal22=(IToken)Match(input,18,Follow._18_in_type323); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_18.Add(char_literal22);


				}
				break;

			}
			} finally { DebugExitSubRule(6); }



			{
			// AST REWRITE
			// elements: ID, 18
			// 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 = (object)adaptor.Nil();
			// 49:12: -> ^( TYPE ID ( '?' )? )
			{
				DebugLocation(49, 15);
				// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:49:15: ^( TYPE ID ( '?' )? )
				{
				object root_1 = (object)adaptor.Nil();
				DebugLocation(49, 17);
				root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(TYPE, "TYPE"), root_1);

				DebugLocation(49, 22);
				adaptor.AddChild(root_1, stream_ID.NextNode());
				DebugLocation(49, 25);
				// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:49:25: ( '?' )?
				if (stream_18.HasNext)
				{
					DebugLocation(49, 25);
					adaptor.AddChild(root_1, stream_18.NextNode());

				}
				stream_18.Reset();

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

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

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

		}
		finally
		{
			TraceOut("type", 8);
			LeaveRule("type", 8);
			LeaveRule_type();
		}
		DebugLocation(50, 1);
		} finally { DebugExitRule(GrammarFileName, "type"); }
		return retval;

	}