Ejemplo n.º 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;

	}
Ejemplo n.º 2
0
	private AstParserRuleReturnScope<object, IToken> outputToken()
	{
		EnterRule_outputToken();
		EnterRule("outputToken", 6);
		TraceIn("outputToken", 6);
		AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
		retval.Start = (IToken)input.LT(1);

		object root_0 = default(object);

		IToken id = default(IToken);
		IToken char_literal12 = default(IToken);
		IToken char_literal14 = default(IToken);
		IToken char_literal15 = default(IToken);
		IToken char_literal16 = default(IToken);
		AstParserRuleReturnScope<object, IToken> type13 = default(AstParserRuleReturnScope<object, IToken>);
		AstParserRuleReturnScope<object, IToken> type17 = default(AstParserRuleReturnScope<object, IToken>);

		object id_tree = default(object);
		object char_literal12_tree = default(object);
		object char_literal14_tree = default(object);
		object char_literal15_tree = default(object);
		object char_literal16_tree = default(object);
		RewriteRuleITokenStream stream_21=new RewriteRuleITokenStream(adaptor,"token 21");
		RewriteRuleITokenStream stream_20=new RewriteRuleITokenStream(adaptor,"token 20");
		RewriteRuleITokenStream stream_ID=new RewriteRuleITokenStream(adaptor,"token ID");
		RewriteRuleITokenStream stream_17=new RewriteRuleITokenStream(adaptor,"token 17");
		RewriteRuleSubtreeStream stream_type=new RewriteRuleSubtreeStream(adaptor,"rule type");
		try { DebugEnterRule(GrammarFileName, "outputToken");
		DebugLocation(39, 1);
		try
		{
			// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:40:2: ( ( ID ':' )=>id= ID ':' type -> ^( OUTPUT_TOKEN $id type ) | ( '[' ID ']' )=> '[' id= ID ']' ':' type -> ^( OUTPUT_TOKEN $id type ) )
			int alt5=2;
			try { DebugEnterDecision(5, false);
			int LA5_0 = input.LA(1);

			if ((LA5_0==ID) && (EvaluatePredicate(synpred2_TypeSql_fragment)))
			{
				alt5 = 1;
			}
			else if ((LA5_0==20) && (EvaluatePredicate(synpred3_TypeSql_fragment)))
			{
				alt5 = 2;
			}
			else
			{
				if (state.backtracking>0) {state.failed=true; return retval;}
				NoViableAltException nvae = new NoViableAltException("", 5, 0, input);
				DebugRecognitionException(nvae);
				throw nvae;
			}
			} finally { DebugExitDecision(5); }
			switch (alt5)
			{
			case 1:
				DebugEnterAlt(1);
				// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:40:4: ( ID ':' )=>id= ID ':' type
				{
				DebugLocation(40, 17);
				id=(IToken)Match(input,ID,Follow._ID_in_outputToken228); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_ID.Add(id);

				DebugLocation(40, 21);
				char_literal12=(IToken)Match(input,17,Follow._17_in_outputToken230); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_17.Add(char_literal12);

				DebugLocation(40, 25);
				PushFollow(Follow._type_in_outputToken232);
				type13=type();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_type.Add(type13.Tree);


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

				root_0 = (object)adaptor.Nil();
				// 40:30: -> ^( OUTPUT_TOKEN $id type )
				{
					DebugLocation(40, 33);
					// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:40:33: ^( OUTPUT_TOKEN $id type )
					{
					object root_1 = (object)adaptor.Nil();
					DebugLocation(40, 35);
					root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(OUTPUT_TOKEN, "OUTPUT_TOKEN"), root_1);

					DebugLocation(40, 49);
					adaptor.AddChild(root_1, stream_id.NextNode());
					DebugLocation(40, 52);
					adaptor.AddChild(root_1, stream_type.NextTree());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}
				}

				}
				break;
			case 2:
				DebugEnterAlt(2);
				// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:41:4: ( '[' ID ']' )=> '[' id= ID ']' ':' type
				{
				DebugLocation(41, 18);
				char_literal14=(IToken)Match(input,20,Follow._20_in_outputToken256); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_20.Add(char_literal14);

				DebugLocation(41, 24);
				id=(IToken)Match(input,ID,Follow._ID_in_outputToken260); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_ID.Add(id);

				DebugLocation(41, 28);
				char_literal15=(IToken)Match(input,21,Follow._21_in_outputToken262); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_21.Add(char_literal15);

				DebugLocation(41, 32);
				char_literal16=(IToken)Match(input,17,Follow._17_in_outputToken264); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_17.Add(char_literal16);

				DebugLocation(41, 36);
				PushFollow(Follow._type_in_outputToken266);
				type17=type();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_type.Add(type17.Tree);


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

				root_0 = (object)adaptor.Nil();
				// 41:41: -> ^( OUTPUT_TOKEN $id type )
				{
					DebugLocation(41, 44);
					// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:41:44: ^( OUTPUT_TOKEN $id type )
					{
					object root_1 = (object)adaptor.Nil();
					DebugLocation(41, 46);
					root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(OUTPUT_TOKEN, "OUTPUT_TOKEN"), root_1);

					DebugLocation(41, 60);
					adaptor.AddChild(root_1, stream_id.NextNode());
					DebugLocation(41, 63);
					adaptor.AddChild(root_1, stream_type.NextTree());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}
				}

				}
				break;

			}
			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("outputToken", 6);
			LeaveRule("outputToken", 6);
			LeaveRule_outputToken();
		}
		DebugLocation(42, 1);
		} finally { DebugExitRule(GrammarFileName, "outputToken"); }
		return retval;

	}
Ejemplo n.º 3
0
	private AstParserRuleReturnScope<object, IToken> usingNamespace()
	{
		EnterRule_usingNamespace();
		EnterRule("usingNamespace", 3);
		TraceIn("usingNamespace", 3);
		AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
		retval.Start = (IToken)input.LT(1);

		object root_0 = default(object);

		IToken USING4 = default(IToken);
		AstParserRuleReturnScope<object, IToken> nameSpace5 = default(AstParserRuleReturnScope<object, IToken>);

		object USING4_tree = default(object);
		RewriteRuleITokenStream stream_USING=new RewriteRuleITokenStream(adaptor,"token USING");
		RewriteRuleSubtreeStream stream_nameSpace=new RewriteRuleSubtreeStream(adaptor,"rule nameSpace");
		try { DebugEnterRule(GrammarFileName, "usingNamespace");
		DebugLocation(28, 1);
		try
		{
			// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:28:16: ( USING nameSpace -> ^( USING nameSpace ) )
			DebugEnterAlt(1);
			// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:28:18: USING nameSpace
			{
			DebugLocation(28, 18);
			USING4=(IToken)Match(input,USING,Follow._USING_in_usingNamespace120); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_USING.Add(USING4);

			DebugLocation(28, 24);
			PushFollow(Follow._nameSpace_in_usingNamespace122);
			nameSpace5=nameSpace();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_nameSpace.Add(nameSpace5.Tree);


			{
			// AST REWRITE
			// elements: nameSpace, USING
			// 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();
			// 28:34: -> ^( USING nameSpace )
			{
				DebugLocation(28, 37);
				// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:28:37: ^( USING nameSpace )
				{
				object root_1 = (object)adaptor.Nil();
				DebugLocation(28, 39);
				root_1 = (object)adaptor.BecomeRoot(stream_USING.NextNode(), root_1);

				DebugLocation(28, 45);
				adaptor.AddChild(root_1, stream_nameSpace.NextTree());

				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("usingNamespace", 3);
			LeaveRule("usingNamespace", 3);
			LeaveRule_usingNamespace();
		}
		DebugLocation(29, 1);
		} finally { DebugExitRule(GrammarFileName, "usingNamespace"); }
		return retval;

	}
Ejemplo n.º 4
0
	private AstParserRuleReturnScope<object, IToken> sql()
	{
		EnterRule_sql();
		EnterRule("sql", 2);
		TraceIn("sql", 2);
		AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
		retval.Start = (IToken)input.LT(1);

		object root_0 = default(object);

		AstParserRuleReturnScope<object, IToken> token3 = default(AstParserRuleReturnScope<object, IToken>);

		RewriteRuleSubtreeStream stream_token=new RewriteRuleSubtreeStream(adaptor,"rule token");
		try { DebugEnterRule(GrammarFileName, "sql");
		DebugLocation(25, 1);
		try
		{
			// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:25:5: ( ( token )* -> ^( SQL ( token )* ) )
			DebugEnterAlt(1);
			// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:25:7: ( token )*
			{
			DebugLocation(25, 7);
			// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:25:7: ( token )*
			try { DebugEnterSubRule(2);
			while (true)
			{
				int alt2=2;
				try { DebugEnterDecision(2, false);
				int LA2_0 = input.LA(1);

				if (((LA2_0>=ANY && LA2_0<=21)))
				{
					alt2 = 1;
				}


				} finally { DebugExitDecision(2); }
				switch ( alt2 )
				{
				case 1:
					DebugEnterAlt(1);
					// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:25:7: token
					{
					DebugLocation(25, 7);
					PushFollow(Follow._token_in_sql100);
					token3=token();
					PopFollow();
					if (state.failed) return retval;
					if (state.backtracking == 0) stream_token.Add(token3.Tree);

					}
					break;

				default:
					goto loop2;
				}
			}

			loop2:
				;

			} finally { DebugExitSubRule(2); }



			{
			// AST REWRITE
			// elements: token
			// 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();
			// 25:14: -> ^( SQL ( token )* )
			{
				DebugLocation(25, 17);
				// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:25:17: ^( SQL ( token )* )
				{
				object root_1 = (object)adaptor.Nil();
				DebugLocation(25, 19);
				root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(SQL, "SQL"), root_1);

				DebugLocation(25, 23);
				// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:25:23: ( token )*
				while ( stream_token.HasNext )
				{
					DebugLocation(25, 23);
					adaptor.AddChild(root_1, stream_token.NextTree());

				}
				stream_token.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("sql", 2);
			LeaveRule("sql", 2);
			LeaveRule_sql();
		}
		DebugLocation(26, 1);
		} finally { DebugExitRule(GrammarFileName, "sql"); }
		return retval;

	}
Ejemplo n.º 5
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;

	}
Ejemplo n.º 6
0
	private AstParserRuleReturnScope<object, IToken> inputToken()
	{
		EnterRule_inputToken();
		EnterRule("inputToken", 7);
		TraceIn("inputToken", 7);
		AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
		retval.Start = (IToken)input.LT(1);

		object root_0 = default(object);

		IToken id = default(IToken);
		IToken char_literal18 = default(IToken);
		IToken char_literal19 = default(IToken);
		AstParserRuleReturnScope<object, IToken> type20 = default(AstParserRuleReturnScope<object, IToken>);

		object id_tree = default(object);
		object char_literal18_tree = default(object);
		object char_literal19_tree = default(object);
		RewriteRuleITokenStream stream_19=new RewriteRuleITokenStream(adaptor,"token 19");
		RewriteRuleITokenStream stream_ID=new RewriteRuleITokenStream(adaptor,"token ID");
		RewriteRuleITokenStream stream_17=new RewriteRuleITokenStream(adaptor,"token 17");
		RewriteRuleSubtreeStream stream_type=new RewriteRuleSubtreeStream(adaptor,"rule type");
		try { DebugEnterRule(GrammarFileName, "inputToken");
		DebugLocation(44, 1);
		try
		{
			// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:45:2: ( '@' id= ID ':' type -> ^( INPUT_TOKEN $id type ) )
			DebugEnterAlt(1);
			// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:45:5: '@' id= ID ':' type
			{
			DebugLocation(45, 5);
			char_literal18=(IToken)Match(input,19,Follow._19_in_inputToken290); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_19.Add(char_literal18);

			DebugLocation(45, 11);
			id=(IToken)Match(input,ID,Follow._ID_in_inputToken294); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_ID.Add(id);

			DebugLocation(45, 15);
			char_literal19=(IToken)Match(input,17,Follow._17_in_inputToken296); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_17.Add(char_literal19);

			DebugLocation(45, 19);
			PushFollow(Follow._type_in_inputToken298);
			type20=type();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_type.Add(type20.Tree);


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

			root_0 = (object)adaptor.Nil();
			// 45:24: -> ^( INPUT_TOKEN $id type )
			{
				DebugLocation(45, 27);
				// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:45:27: ^( INPUT_TOKEN $id type )
				{
				object root_1 = (object)adaptor.Nil();
				DebugLocation(45, 29);
				root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(INPUT_TOKEN, "INPUT_TOKEN"), root_1);

				DebugLocation(45, 42);
				adaptor.AddChild(root_1, stream_id.NextNode());
				DebugLocation(45, 45);
				adaptor.AddChild(root_1, stream_type.NextTree());

				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("inputToken", 7);
			LeaveRule("inputToken", 7);
			LeaveRule_inputToken();
		}
		DebugLocation(46, 1);
		} finally { DebugExitRule(GrammarFileName, "inputToken"); }
		return retval;

	}
Ejemplo n.º 7
0
	public AstParserRuleReturnScope<object, IToken> typesql()
	{
		EnterRule_typesql();
		EnterRule("typesql", 1);
		TraceIn("typesql", 1);
		AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
		retval.Start = (IToken)input.LT(1);

		object root_0 = default(object);

		AstParserRuleReturnScope<object, IToken> usingNamespace1 = default(AstParserRuleReturnScope<object, IToken>);
		AstParserRuleReturnScope<object, IToken> sql2 = default(AstParserRuleReturnScope<object, IToken>);

		RewriteRuleSubtreeStream stream_sql=new RewriteRuleSubtreeStream(adaptor,"rule sql");
		RewriteRuleSubtreeStream stream_usingNamespace=new RewriteRuleSubtreeStream(adaptor,"rule usingNamespace");
		try { DebugEnterRule(GrammarFileName, "typesql");
		DebugLocation(21, 1);
		try
		{
			// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:21:16: ( ( usingNamespace )* sql -> ^( TYPESQL ( usingNamespace )* sql ) )
			DebugEnterAlt(1);
			// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:21:18: ( usingNamespace )* sql
			{
			DebugLocation(21, 18);
			// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:21:18: ( usingNamespace )*
			try { DebugEnterSubRule(1);
			while (true)
			{
				int alt1=2;
				try { DebugEnterDecision(1, false);
				int LA1_0 = input.LA(1);

				if ((LA1_0==USING))
				{
					int LA1_2 = input.LA(2);

					if ((LA1_2==ID))
					{
						alt1 = 1;
					}


				}


				} finally { DebugExitDecision(1); }
				switch ( alt1 )
				{
				case 1:
					DebugEnterAlt(1);
					// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:21:18: usingNamespace
					{
					DebugLocation(21, 18);
					PushFollow(Follow._usingNamespace_in_typesql75);
					usingNamespace1=usingNamespace();
					PopFollow();
					if (state.failed) return retval;
					if (state.backtracking == 0) stream_usingNamespace.Add(usingNamespace1.Tree);

					}
					break;

				default:
					goto loop1;
				}
			}

			loop1:
				;

			} finally { DebugExitSubRule(1); }

			DebugLocation(21, 34);
			PushFollow(Follow._sql_in_typesql78);
			sql2=sql();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_sql.Add(sql2.Tree);


			{
			// AST REWRITE
			// elements: usingNamespace, sql
			// 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();
			// 21:38: -> ^( TYPESQL ( usingNamespace )* sql )
			{
				DebugLocation(21, 41);
				// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:21:41: ^( TYPESQL ( usingNamespace )* sql )
				{
				object root_1 = (object)adaptor.Nil();
				DebugLocation(21, 43);
				root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(TYPESQL, "TYPESQL"), root_1);

				DebugLocation(21, 51);
				// C:\\Users\\mjr\\src\\TypeSql\\TypeSql\\Parsing\\TypeSql.g:21:51: ( usingNamespace )*
				while ( stream_usingNamespace.HasNext )
				{
					DebugLocation(21, 51);
					adaptor.AddChild(root_1, stream_usingNamespace.NextTree());

				}
				stream_usingNamespace.Reset();
				DebugLocation(21, 67);
				adaptor.AddChild(root_1, stream_sql.NextTree());

				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("typesql", 1);
			LeaveRule("typesql", 1);
			LeaveRule_typesql();
		}
		DebugLocation(23, 1);
		} finally { DebugExitRule(GrammarFileName, "typesql"); }
		return retval;

	}