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));
		}
Beispiel #2
0
	private AstParserRuleReturnScope<object, IToken> additive_operator()
	{
		EnterRule_additive_operator();
		EnterRule("additive_operator", 10);
		TraceIn("additive_operator", 10);
		AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
		retval.Start = (IToken)input.LT(1);

		object root_0 = default(object);

		IToken string_literal34 = default(IToken);
		IToken char_literal35 = default(IToken);
		IToken string_literal36 = default(IToken);
		IToken char_literal37 = default(IToken);

		object string_literal34_tree = default(object);
		object char_literal35_tree = default(object);
		object string_literal36_tree = default(object);
		object char_literal37_tree = default(object);
		RewriteRuleITokenStream stream_59=new RewriteRuleITokenStream(adaptor,"token 59");
		RewriteRuleITokenStream stream_46=new RewriteRuleITokenStream(adaptor,"token 46");
		RewriteRuleITokenStream stream_76=new RewriteRuleITokenStream(adaptor,"token 76");
		RewriteRuleITokenStream stream_48=new RewriteRuleITokenStream(adaptor,"token 48");
		try { DebugEnterRule(GrammarFileName, "additive_operator");
		DebugLocation(129, 4);
		try
		{
			// Queries\\PomonaQuery.g:130:5: ( ( 'add' | '+' ) -> ADD_OP | ( 'sub' | '-' ) -> SUB_OP )
			int alt16=2;
			try { DebugEnterDecision(16, false);
			int LA16_1 = input.LA(1);

			if ((LA16_1==46||LA16_1==59))
			{
				alt16 = 1;
			}
			else if ((LA16_1==48||LA16_1==76))
			{
				alt16 = 2;
			}
			else
			{
				NoViableAltException nvae = new NoViableAltException("", 16, 0, input, 1);
				DebugRecognitionException(nvae);
				throw nvae;
			}
			} finally { DebugExitDecision(16); }
			switch (alt16)
			{
			case 1:
				DebugEnterAlt(1);
				// Queries\\PomonaQuery.g:130:7: ( 'add' | '+' )
				{
				DebugLocation(130, 7);
				// Queries\\PomonaQuery.g:130:7: ( 'add' | '+' )
				int alt14=2;
				try { DebugEnterSubRule(14);
				try { DebugEnterDecision(14, false);
				int LA14_1 = input.LA(1);

				if ((LA14_1==59))
				{
					alt14 = 1;
				}
				else if ((LA14_1==46))
				{
					alt14 = 2;
				}
				else
				{
					NoViableAltException nvae = new NoViableAltException("", 14, 0, input, 1);
					DebugRecognitionException(nvae);
					throw nvae;
				}
				} finally { DebugExitDecision(14); }
				switch (alt14)
				{
				case 1:
					DebugEnterAlt(1);
					// Queries\\PomonaQuery.g:130:8: 'add'
					{
					DebugLocation(130, 8);
					string_literal34=(IToken)Match(input,59,Follow._59_in_additive_operator787);  
					stream_59.Add(string_literal34);


					}
					break;
				case 2:
					DebugEnterAlt(2);
					// Queries\\PomonaQuery.g:130:14: '+'
					{
					DebugLocation(130, 14);
					char_literal35=(IToken)Match(input,46,Follow._46_in_additive_operator789);  
					stream_46.Add(char_literal35);


					}
					break;

				}
				} finally { DebugExitSubRule(14); }



				{
				// AST REWRITE
				// elements: 
				// 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();
				// 130:19: -> ADD_OP
				{
					DebugLocation(130, 22);
					adaptor.AddChild(root_0, (object)adaptor.Create(ADD_OP, "ADD_OP"));

				}

				retval.Tree = root_0;
				}

				}
				break;
			case 2:
				DebugEnterAlt(2);
				// Queries\\PomonaQuery.g:131:7: ( 'sub' | '-' )
				{
				DebugLocation(131, 7);
				// Queries\\PomonaQuery.g:131:7: ( 'sub' | '-' )
				int alt15=2;
				try { DebugEnterSubRule(15);
				try { DebugEnterDecision(15, false);
				int LA15_1 = input.LA(1);

				if ((LA15_1==76))
				{
					alt15 = 1;
				}
				else if ((LA15_1==48))
				{
					alt15 = 2;
				}
				else
				{
					NoViableAltException nvae = new NoViableAltException("", 15, 0, input, 1);
					DebugRecognitionException(nvae);
					throw nvae;
				}
				} finally { DebugExitDecision(15); }
				switch (alt15)
				{
				case 1:
					DebugEnterAlt(1);
					// Queries\\PomonaQuery.g:131:8: 'sub'
					{
					DebugLocation(131, 8);
					string_literal36=(IToken)Match(input,76,Follow._76_in_additive_operator803);  
					stream_76.Add(string_literal36);


					}
					break;
				case 2:
					DebugEnterAlt(2);
					// Queries\\PomonaQuery.g:131:14: '-'
					{
					DebugLocation(131, 14);
					char_literal37=(IToken)Match(input,48,Follow._48_in_additive_operator805);  
					stream_48.Add(char_literal37);


					}
					break;

				}
				} finally { DebugExitSubRule(15); }



				{
				// AST REWRITE
				// elements: 
				// 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();
				// 131:19: -> SUB_OP
				{
					DebugLocation(131, 22);
					adaptor.AddChild(root_0, (object)adaptor.Create(SUB_OP, "SUB_OP"));

				}

				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("additive_operator", 10);
			LeaveRule("additive_operator", 10);
			LeaveRule_additive_operator();
		}
		DebugLocation(132, 4);
		} finally { DebugExitRule(GrammarFileName, "additive_operator"); }
		return retval;

	}
		// $ANTLR start "name"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:92:1: name : x= ID -> NAME[$x] ;
		public name_return name() // throws RecognitionException [1]
		{
			var retval = new name_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken x = null;

			CommonTree x_tree = null;
			var stream_ID = new RewriteRuleTokenStream( adaptor, "token ID" );

			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:93:2: (x= ID -> NAME[$x] )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:93:4: x= ID
				{
					x = (IToken)Match( input, ID, FOLLOW_ID_in_name371 );
					stream_ID.Add( x );


					// AST REWRITE
					// elements:          
					// token labels:      
					// rule labels:       retval
					// token list labels: 
					// rule list labels:  
					// wildcard labels: 
					retval.Tree = root_0;
					var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 93:9: -> NAME[$x]
					{
						adaptor.AddChild( root_0, adaptor.Create( NAME, x ) );
					}

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

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

				retval.Tree = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "baseClassDeclaration"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:82:1: baseClassDeclaration : ':' name 'where' expression -> ^( BASE_CLASS name ^( DISCRIMINATOR expression ) ) ;
		public baseClassDeclaration_return baseClassDeclaration() // throws RecognitionException [1]
		{
			var retval = new baseClassDeclaration_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken char_literal8 = null;
			IToken string_literal10 = null;
			name_return name9 = default( name_return );

			expression_return expression11 = default( expression_return );


			CommonTree char_literal8_tree = null;
			CommonTree string_literal10_tree = null;
			var stream_59 = new RewriteRuleTokenStream( adaptor, "token 59" );
			var stream_58 = new RewriteRuleTokenStream( adaptor, "token 58" );
			var stream_expression = new RewriteRuleSubtreeStream( adaptor, "rule expression" );
			var stream_name = new RewriteRuleSubtreeStream( adaptor, "rule name" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:83:2: ( ':' name 'where' expression -> ^( BASE_CLASS name ^( DISCRIMINATOR expression ) ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:83:4: ':' name 'where' expression
				{
					char_literal8 = (IToken)Match( input, 58, FOLLOW_58_in_baseClassDeclaration294 );
					stream_58.Add( char_literal8 );

					PushFollow( FOLLOW_name_in_baseClassDeclaration296 );
					name9 = name();
					state.followingStackPointer--;

					stream_name.Add( name9.Tree );
					string_literal10 = (IToken)Match( input, 59, FOLLOW_59_in_baseClassDeclaration298 );
					stream_59.Add( string_literal10 );

					PushFollow( FOLLOW_expression_in_baseClassDeclaration300 );
					expression11 = expression();
					state.followingStackPointer--;

					stream_expression.Add( expression11.Tree );


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

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 83:32: -> ^( BASE_CLASS name ^( DISCRIMINATOR expression ) )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:83:35: ^( BASE_CLASS name ^( DISCRIMINATOR expression ) )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( BASE_CLASS, "BASE_CLASS" ), root_1 );

							adaptor.AddChild( root_1, stream_name.NextTree() );
							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:83:54: ^( DISCRIMINATOR expression )
							{
								var root_2 = (CommonTree)adaptor.GetNilNode();
								root_2 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( DISCRIMINATOR, "DISCRIMINATOR" ), root_2 );

								adaptor.AddChild( root_2, stream_expression.NextTree() );

								adaptor.AddChild( root_1, root_2 );
							}

							adaptor.AddChild( root_0, root_1 );
						}
					}

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

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

				retval.Tree = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "identifier"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:262:1: identifier : ID -> ^( IDENTIFIER ID ) ;
		public identifier_return identifier() // throws RecognitionException [1]
		{
			var retval = new identifier_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken ID92 = null;

			CommonTree ID92_tree = null;
			var stream_ID = new RewriteRuleTokenStream( adaptor, "token ID" );

			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:263:2: ( ID -> ^( IDENTIFIER ID ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:263:4: ID
				{
					ID92 = (IToken)Match( input, ID, FOLLOW_ID_in_identifier1399 );
					stream_ID.Add( ID92 );


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

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 263:7: -> ^( IDENTIFIER ID )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:263:10: ^( IDENTIFIER ID )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( IDENTIFIER, "IDENTIFIER" ), 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 = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "criteria"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:248:1: criteria : '[' expression ']' -> ^( CRITERIA expression ) ;
		public criteria_return criteria() // throws RecognitionException [1]
		{
			var retval = new criteria_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken char_literal84 = null;
			IToken char_literal86 = null;
			expression_return expression85 = default( expression_return );


			CommonTree char_literal84_tree = null;
			CommonTree char_literal86_tree = null;
			var stream_93 = new RewriteRuleTokenStream( adaptor, "token 93" );
			var stream_92 = new RewriteRuleTokenStream( adaptor, "token 92" );
			var stream_expression = new RewriteRuleSubtreeStream( adaptor, "rule expression" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:249:2: ( '[' expression ']' -> ^( CRITERIA expression ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:249:4: '[' expression ']'
				{
					char_literal84 = (IToken)Match( input, 92, FOLLOW_92_in_criteria1320 );
					stream_92.Add( char_literal84 );

					PushFollow( FOLLOW_expression_in_criteria1322 );
					expression85 = expression();
					state.followingStackPointer--;

					stream_expression.Add( expression85.Tree );
					char_literal86 = (IToken)Match( input, 93, FOLLOW_93_in_criteria1324 );
					stream_93.Add( char_literal86 );


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

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 249:23: -> ^( CRITERIA expression )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:249:26: ^( CRITERIA expression )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( CRITERIA, "CRITERIA" ), root_1 );

							adaptor.AddChild( root_1, stream_expression.NextTree() );

							adaptor.AddChild( root_0, root_1 );
						}
					}

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

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

				retval.Tree = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "assignmentOp"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:224:1: assignmentOp : x= '=' -> OP_ASSIGN[$x] ;
		public assignmentOp_return assignmentOp() // throws RecognitionException [1]
		{
			var retval = new assignmentOp_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken x = null;

			CommonTree x_tree = null;
			var stream_68 = new RewriteRuleTokenStream( adaptor, "token 68" );

			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:225:2: (x= '=' -> OP_ASSIGN[$x] )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:225:4: x= '='
				{
					x = (IToken)Match( input, 68, FOLLOW_68_in_assignmentOp1201 );
					stream_68.Add( x );


					// AST REWRITE
					// elements:          
					// token labels:      
					// rule labels:       retval
					// token list labels: 
					// rule list labels:  
					// wildcard labels: 
					retval.Tree = root_0;
					var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 225:10: -> OP_ASSIGN[$x]
					{
						adaptor.AddChild( root_0, adaptor.Create( OP_ASSIGN, x ) );
					}

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

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

				retval.Tree = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "equalsOp"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:189:1: equalsOp : (x= '==' -> OP_EQ[$x] | x= '=' -> OP_EQ[$x] );
		public equalsOp_return equalsOp() // throws RecognitionException [1]
		{
			var retval = new equalsOp_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken x = null;

			CommonTree x_tree = null;
			var stream_79 = new RewriteRuleTokenStream( adaptor, "token 79" );
			var stream_68 = new RewriteRuleTokenStream( adaptor, "token 68" );

			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:190:2: (x= '==' -> OP_EQ[$x] | x= '=' -> OP_EQ[$x] )
				int alt26 = 2;
				int LA26_0 = input.LA( 1 );

				if ( ( LA26_0 == 79 ) )
					alt26 = 1;
				else if ( ( LA26_0 == 68 ) )
					alt26 = 2;
				else
				{
					var nvae_d26s0 =
							new NoViableAltException( "", 26, 0, input );

					throw nvae_d26s0;
				}
				switch ( alt26 )
				{
					case 1:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:190:4: x= '=='
						{
							x = (IToken)Match( input, 79, FOLLOW_79_in_equalsOp988 );
							stream_79.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 190:11: -> OP_EQ[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_EQ, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
					case 2:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:191:4: x= '='
						{
							x = (IToken)Match( input, 68, FOLLOW_68_in_equalsOp1001 );
							stream_68.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 191:11: -> OP_EQ[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_EQ, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
				}
				retval.Stop = input.LT( -1 );

				retval.Tree = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
Beispiel #9
0
	private AstParserRuleReturnScope<object, IToken> lambda_expression()
	{
		EnterRule_lambda_expression();
		EnterRule("lambda_expression", 4);
		TraceIn("lambda_expression", 4);
		AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
		retval.Start = (IToken)input.LT(1);

		object root_0 = default(object);

		IToken char_literal8 = default(IToken);
		AstParserRuleReturnScope<object, IToken> or_expression7 = default(AstParserRuleReturnScope<object, IToken>);
		AstParserRuleReturnScope<object, IToken> or_expression9 = default(AstParserRuleReturnScope<object, IToken>);

		object char_literal8_tree = default(object);
		RewriteRuleITokenStream stream_51=new RewriteRuleITokenStream(adaptor,"token 51");
		RewriteRuleSubtreeStream stream_or_expression=new RewriteRuleSubtreeStream(adaptor,"rule or_expression");
		try { DebugEnterRule(GrammarFileName, "lambda_expression");
		DebugLocation(89, 1);
		try
		{
			// Queries\\PomonaQuery.g:90:2: ( or_expression ( ':' or_expression )? -> ^( LAMBDA_OP ( or_expression )+ ) )
			DebugEnterAlt(1);
			// Queries\\PomonaQuery.g:90:4: or_expression ( ':' or_expression )?
			{
			DebugLocation(90, 4);
			PushFollow(Follow._or_expression_in_lambda_expression559);
			or_expression7=or_expression();
			PopFollow();

			stream_or_expression.Add(or_expression7.Tree);
			DebugLocation(90, 18);
			// Queries\\PomonaQuery.g:90:18: ( ':' or_expression )?
			int alt2=2;
			try { DebugEnterSubRule(2);
			try { DebugEnterDecision(2, false);
			int LA2_1 = input.LA(1);

			if ((LA2_1==51))
			{
				alt2 = 1;
			}
			} finally { DebugExitDecision(2); }
			switch (alt2)
			{
			case 1:
				DebugEnterAlt(1);
				// Queries\\PomonaQuery.g:90:20: ':' or_expression
				{
				DebugLocation(90, 20);
				char_literal8=(IToken)Match(input,51,Follow._51_in_lambda_expression563);  
				stream_51.Add(char_literal8);

				DebugLocation(90, 24);
				PushFollow(Follow._or_expression_in_lambda_expression565);
				or_expression9=or_expression();
				PopFollow();

				stream_or_expression.Add(or_expression9.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(2); }



			{
			// AST REWRITE
			// elements: or_expression
			// 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();
			// 90:41: -> ^( LAMBDA_OP ( or_expression )+ )
			{
				DebugLocation(90, 44);
				// Queries\\PomonaQuery.g:90:44: ^( LAMBDA_OP ( or_expression )+ )
				{
				object root_1 = (object)adaptor.Nil();
				DebugLocation(90, 46);
				root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(LAMBDA_OP, "LAMBDA_OP"), root_1);

				DebugLocation(90, 56);
				if (!(stream_or_expression.HasNext))
				{
					throw new RewriteEarlyExitException();
				}
				while ( stream_or_expression.HasNext )
				{
					DebugLocation(90, 56);
					adaptor.AddChild(root_1, stream_or_expression.NextTree());

				}
				stream_or_expression.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("lambda_expression", 4);
			LeaveRule("lambda_expression", 4);
			LeaveRule_lambda_expression();
		}
		DebugLocation(91, 1);
		} finally { DebugExitRule(GrammarFileName, "lambda_expression"); }
		return retval;

	}
Beispiel #10
0
	private AstParserRuleReturnScope<object, IToken> orderby_expr()
	{
		EnterRule_orderby_expr();
		EnterRule("orderby_expr", 20);
		TraceIn("orderby_expr", 20);
		AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
		retval.Start = (IToken)input.LT(1);

		object root_0 = default(object);

		AstParserRuleReturnScope<object, IToken> exp84 = default(AstParserRuleReturnScope<object, IToken>);
		AstParserRuleReturnScope<object, IToken> sortorder_operator85 = default(AstParserRuleReturnScope<object, IToken>);

		RewriteRuleSubtreeStream stream_exp=new RewriteRuleSubtreeStream(adaptor,"rule exp");
		RewriteRuleSubtreeStream stream_sortorder_operator=new RewriteRuleSubtreeStream(adaptor,"rule sortorder_operator");
		try { DebugEnterRule(GrammarFileName, "orderby_expr");
		DebugLocation(184, 1);
		try
		{
			// Queries\\PomonaQuery.g:185:2: ( exp ( sortorder_operator )? -> ^( ORDERBY_ASC exp ( sortorder_operator )? ) )
			DebugEnterAlt(1);
			// Queries\\PomonaQuery.g:185:4: exp ( sortorder_operator )?
			{
			DebugLocation(185, 4);
			PushFollow(Follow._exp_in_orderby_expr1167);
			exp84=exp();
			PopFollow();

			stream_exp.Add(exp84.Tree);
			DebugLocation(185, 8);
			// Queries\\PomonaQuery.g:185:8: ( sortorder_operator )?
			int alt27=2;
			try { DebugEnterSubRule(27);
			try { DebugEnterDecision(27, false);
			int LA27_1 = input.LA(1);

			if (((LA27_1>=62 && LA27_1<=63)))
			{
				alt27 = 1;
			}
			} finally { DebugExitDecision(27); }
			switch (alt27)
			{
			case 1:
				DebugEnterAlt(1);
				// Queries\\PomonaQuery.g:185:9: sortorder_operator
				{
				DebugLocation(185, 9);
				PushFollow(Follow._sortorder_operator_in_orderby_expr1170);
				sortorder_operator85=sortorder_operator();
				PopFollow();

				stream_sortorder_operator.Add(sortorder_operator85.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(27); }



			{
			// AST REWRITE
			// elements: exp, sortorder_operator
			// 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();
			// 185:30: -> ^( ORDERBY_ASC exp ( sortorder_operator )? )
			{
				DebugLocation(185, 33);
				// Queries\\PomonaQuery.g:185:33: ^( ORDERBY_ASC exp ( sortorder_operator )? )
				{
				object root_1 = (object)adaptor.Nil();
				DebugLocation(185, 35);
				root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(ORDERBY_ASC, "ORDERBY_ASC"), root_1);

				DebugLocation(185, 47);
				adaptor.AddChild(root_1, stream_exp.NextTree());
				DebugLocation(185, 51);
				// Queries\\PomonaQuery.g:185:51: ( sortorder_operator )?
				if (stream_sortorder_operator.HasNext)
				{
					DebugLocation(185, 51);
					adaptor.AddChild(root_1, stream_sortorder_operator.NextTree());

				}
				stream_sortorder_operator.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("orderby_expr", 20);
			LeaveRule("orderby_expr", 20);
			LeaveRule_orderby_expr();
		}
		DebugLocation(186, 1);
		} finally { DebugExitRule(GrammarFileName, "orderby_expr"); }
		return retval;

	}
Beispiel #11
0
	private AstParserRuleReturnScope<object, IToken> as_expression()
	{
		EnterRule_as_expression();
		EnterRule("as_expression", 3);
		TraceIn("as_expression", 3);
		AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
		retval.Start = (IToken)input.LT(1);

		object root_0 = default(object);

		IToken string_literal5 = default(IToken);
		AstParserRuleReturnScope<object, IToken> lambda_expression4 = default(AstParserRuleReturnScope<object, IToken>);
		AstParserRuleReturnScope<object, IToken> lambda_expression6 = default(AstParserRuleReturnScope<object, IToken>);

		object string_literal5_tree = default(object);
		RewriteRuleITokenStream stream_61=new RewriteRuleITokenStream(adaptor,"token 61");
		RewriteRuleSubtreeStream stream_lambda_expression=new RewriteRuleSubtreeStream(adaptor,"rule lambda_expression");
		try { DebugEnterRule(GrammarFileName, "as_expression");
		DebugLocation(85, 1);
		try
		{
			// Queries\\PomonaQuery.g:86:2: ( lambda_expression ( 'as' lambda_expression )? -> ^( AS_OP ( lambda_expression )+ ) )
			DebugEnterAlt(1);
			// Queries\\PomonaQuery.g:86:4: lambda_expression ( 'as' lambda_expression )?
			{
			DebugLocation(86, 4);
			PushFollow(Follow._lambda_expression_in_as_expression530);
			lambda_expression4=lambda_expression();
			PopFollow();

			stream_lambda_expression.Add(lambda_expression4.Tree);
			DebugLocation(86, 22);
			// Queries\\PomonaQuery.g:86:22: ( 'as' lambda_expression )?
			int alt1=2;
			try { DebugEnterSubRule(1);
			try { DebugEnterDecision(1, false);
			int LA1_1 = input.LA(1);

			if ((LA1_1==61))
			{
				alt1 = 1;
			}
			} finally { DebugExitDecision(1); }
			switch (alt1)
			{
			case 1:
				DebugEnterAlt(1);
				// Queries\\PomonaQuery.g:86:24: 'as' lambda_expression
				{
				DebugLocation(86, 24);
				string_literal5=(IToken)Match(input,61,Follow._61_in_as_expression534);  
				stream_61.Add(string_literal5);

				DebugLocation(86, 29);
				PushFollow(Follow._lambda_expression_in_as_expression536);
				lambda_expression6=lambda_expression();
				PopFollow();

				stream_lambda_expression.Add(lambda_expression6.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(1); }



			{
			// AST REWRITE
			// elements: lambda_expression
			// 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();
			// 86:50: -> ^( AS_OP ( lambda_expression )+ )
			{
				DebugLocation(86, 53);
				// Queries\\PomonaQuery.g:86:53: ^( AS_OP ( lambda_expression )+ )
				{
				object root_1 = (object)adaptor.Nil();
				DebugLocation(86, 55);
				root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(AS_OP, "AS_OP"), root_1);

				DebugLocation(86, 61);
				if (!(stream_lambda_expression.HasNext))
				{
					throw new RewriteEarlyExitException();
				}
				while ( stream_lambda_expression.HasNext )
				{
					DebugLocation(86, 61);
					adaptor.AddChild(root_1, stream_lambda_expression.NextTree());

				}
				stream_lambda_expression.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("as_expression", 3);
			LeaveRule("as_expression", 3);
			LeaveRule_as_expression();
		}
		DebugLocation(87, 1);
		} finally { DebugExitRule(GrammarFileName, "as_expression"); }
		return retval;

	}
Beispiel #12
0
	private AstParserRuleReturnScope<object, IToken> postfix_expr()
	{
		EnterRule_postfix_expr();
		EnterRule("postfix_expr", 18);
		TraceIn("postfix_expr", 18);
		AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
		retval.Start = (IToken)input.LT(1);

		object root_0 = default(object);

		IToken ID59 = default(IToken);
		IToken char_literal60 = default(IToken);
		IToken char_literal62 = default(IToken);
		IToken ID63 = default(IToken);
		IToken char_literal64 = default(IToken);
		IToken char_literal65 = default(IToken);
		IToken ID66 = default(IToken);
		IToken char_literal67 = default(IToken);
		IToken char_literal69 = default(IToken);
		IToken ID70 = default(IToken);
		IToken char_literal71 = default(IToken);
		IToken char_literal72 = default(IToken);
		IToken ID73 = default(IToken);
		IToken STRING74 = default(IToken);
		IToken INT75 = default(IToken);
		IToken char_literal76 = default(IToken);
		IToken char_literal78 = default(IToken);
		IToken char_literal79 = default(IToken);
		IToken char_literal81 = default(IToken);
		IToken PREFIXED_STRING82 = default(IToken);
		AstParserRuleReturnScope<object, IToken> arglist_expr61 = default(AstParserRuleReturnScope<object, IToken>);
		AstParserRuleReturnScope<object, IToken> arglist_expr68 = default(AstParserRuleReturnScope<object, IToken>);
		AstParserRuleReturnScope<object, IToken> orderby_expr77 = default(AstParserRuleReturnScope<object, IToken>);
		AstParserRuleReturnScope<object, IToken> arglist_expr80 = default(AstParserRuleReturnScope<object, IToken>);

		object ID59_tree = default(object);
		object char_literal60_tree = default(object);
		object char_literal62_tree = default(object);
		object ID63_tree = default(object);
		object char_literal64_tree = default(object);
		object char_literal65_tree = default(object);
		object ID66_tree = default(object);
		object char_literal67_tree = default(object);
		object char_literal69_tree = default(object);
		object ID70_tree = default(object);
		object char_literal71_tree = default(object);
		object char_literal72_tree = default(object);
		object ID73_tree = default(object);
		object STRING74_tree = default(object);
		object INT75_tree = default(object);
		object char_literal76_tree = default(object);
		object char_literal78_tree = default(object);
		object char_literal79_tree = default(object);
		object char_literal81_tree = default(object);
		object PREFIXED_STRING82_tree = default(object);
		RewriteRuleITokenStream stream_ID=new RewriteRuleITokenStream(adaptor,"token ID");
		RewriteRuleITokenStream stream_43=new RewriteRuleITokenStream(adaptor,"token 43");
		RewriteRuleITokenStream stream_44=new RewriteRuleITokenStream(adaptor,"token 44");
		RewriteRuleITokenStream stream_57=new RewriteRuleITokenStream(adaptor,"token 57");
		RewriteRuleITokenStream stream_58=new RewriteRuleITokenStream(adaptor,"token 58");
		RewriteRuleSubtreeStream stream_arglist_expr=new RewriteRuleSubtreeStream(adaptor,"rule arglist_expr");
		try { DebugEnterRule(GrammarFileName, "postfix_expr");
		DebugLocation(166, 1);
		try
		{
			// Queries\\PomonaQuery.g:167:2: ( ID ( '(' arglist_expr ')' ) -> ^( METHOD_CALL ID arglist_expr ) | ID ( '(' ')' ) -> ^( METHOD_CALL ID ) | ID ( '[' arglist_expr ']' ) -> ^( INDEXER_ACCESS ID arglist_expr ) | ID ( '[' ']' ) -> ^( INDEXER_ACCESS ID ) | ID | STRING | INT | '(' ! orderby_expr ')' !| '[' arglist_expr ']' -> ^( ARRAY_LITERAL arglist_expr ) | PREFIXED_STRING )
			int alt26=10;
			try { DebugEnterDecision(26, false);
			switch (input.LA(1))
			{
			case ID:
				{
				switch (input.LA(2))
				{
				case 43:
					{
					int LA26_3 = input.LA(3);

					if ((LA26_3==44))
					{
						alt26 = 2;
					}
					else if ((LA26_3==ID||LA26_3==INT||LA26_3==PREFIXED_STRING||LA26_3==STRING||LA26_3==39||LA26_3==43||LA26_3==57||LA26_3==74))
					{
						alt26 = 1;
					}
					else
					{
						NoViableAltException nvae = new NoViableAltException("", 26, 7, input, 3);
						DebugRecognitionException(nvae);
						throw nvae;
					}
					}
					break;
				case 57:
					{
					int LA26_3 = input.LA(3);

					if ((LA26_3==58))
					{
						alt26 = 4;
					}
					else if ((LA26_3==ID||LA26_3==INT||LA26_3==PREFIXED_STRING||LA26_3==STRING||LA26_3==39||LA26_3==43||LA26_3==57||LA26_3==74))
					{
						alt26 = 3;
					}
					else
					{
						NoViableAltException nvae = new NoViableAltException("", 26, 8, input, 3);
						DebugRecognitionException(nvae);
						throw nvae;
					}
					}
					break;
				case EOF:
				case 40:
				case 41:
				case 42:
				case 44:
				case 45:
				case 46:
				case 47:
				case 48:
				case 49:
				case 50:
				case 51:
				case 52:
				case 53:
				case 54:
				case 55:
				case 56:
				case 58:
				case 59:
				case 60:
				case 61:
				case 62:
				case 63:
				case 64:
				case 65:
				case 66:
				case 67:
				case 68:
				case 69:
				case 70:
				case 71:
				case 72:
				case 73:
				case 75:
				case 76:
				case 77:
					{
					alt26 = 5;
					}
					break;
				default:
					{
						NoViableAltException nvae = new NoViableAltException("", 26, 1, input, 2);
						DebugRecognitionException(nvae);
						throw nvae;
					}
				}

				}
				break;
			case STRING:
				{
				alt26 = 6;
				}
				break;
			case INT:
				{
				alt26 = 7;
				}
				break;
			case 43:
				{
				alt26 = 8;
				}
				break;
			case 57:
				{
				alt26 = 9;
				}
				break;
			case PREFIXED_STRING:
				{
				alt26 = 10;
				}
				break;
			default:
				{
					NoViableAltException nvae = new NoViableAltException("", 26, 0, input, 1);
					DebugRecognitionException(nvae);
					throw nvae;
				}
			}

			} finally { DebugExitDecision(26); }
			switch (alt26)
			{
			case 1:
				DebugEnterAlt(1);
				// Queries\\PomonaQuery.g:167:4: ID ( '(' arglist_expr ')' )
				{
				DebugLocation(167, 4);
				ID59=(IToken)Match(input,ID,Follow._ID_in_postfix_expr1005);  
				stream_ID.Add(ID59);

				DebugLocation(167, 7);
				// Queries\\PomonaQuery.g:167:7: ( '(' arglist_expr ')' )
				DebugEnterAlt(1);
				// Queries\\PomonaQuery.g:167:9: '(' arglist_expr ')'
				{
				DebugLocation(167, 9);
				char_literal60=(IToken)Match(input,43,Follow._43_in_postfix_expr1009);  
				stream_43.Add(char_literal60);

				DebugLocation(167, 13);
				PushFollow(Follow._arglist_expr_in_postfix_expr1011);
				arglist_expr61=arglist_expr();
				PopFollow();

				stream_arglist_expr.Add(arglist_expr61.Tree);
				DebugLocation(167, 26);
				char_literal62=(IToken)Match(input,44,Follow._44_in_postfix_expr1013);  
				stream_44.Add(char_literal62);


				}



				{
				// AST REWRITE
				// elements: ID, arglist_expr
				// 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();
				// 167:32: -> ^( METHOD_CALL ID arglist_expr )
				{
					DebugLocation(167, 35);
					// Queries\\PomonaQuery.g:167:35: ^( METHOD_CALL ID arglist_expr )
					{
					object root_1 = (object)adaptor.Nil();
					DebugLocation(167, 37);
					root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(METHOD_CALL, "METHOD_CALL"), root_1);

					DebugLocation(167, 49);
					adaptor.AddChild(root_1, stream_ID.NextNode());
					DebugLocation(167, 52);
					adaptor.AddChild(root_1, stream_arglist_expr.NextTree());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}

				}
				break;
			case 2:
				DebugEnterAlt(2);
				// Queries\\PomonaQuery.g:168:4: ID ( '(' ')' )
				{
				DebugLocation(168, 4);
				ID63=(IToken)Match(input,ID,Follow._ID_in_postfix_expr1030);  
				stream_ID.Add(ID63);

				DebugLocation(168, 7);
				// Queries\\PomonaQuery.g:168:7: ( '(' ')' )
				DebugEnterAlt(1);
				// Queries\\PomonaQuery.g:168:9: '(' ')'
				{
				DebugLocation(168, 9);
				char_literal64=(IToken)Match(input,43,Follow._43_in_postfix_expr1034);  
				stream_43.Add(char_literal64);

				DebugLocation(168, 13);
				char_literal65=(IToken)Match(input,44,Follow._44_in_postfix_expr1036);  
				stream_44.Add(char_literal65);


				}



				{
				// 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 = (object)adaptor.Nil();
				// 168:19: -> ^( METHOD_CALL ID )
				{
					DebugLocation(168, 22);
					// Queries\\PomonaQuery.g:168:22: ^( METHOD_CALL ID )
					{
					object root_1 = (object)adaptor.Nil();
					DebugLocation(168, 24);
					root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(METHOD_CALL, "METHOD_CALL"), root_1);

					DebugLocation(168, 36);
					adaptor.AddChild(root_1, stream_ID.NextNode());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}

				}
				break;
			case 3:
				DebugEnterAlt(3);
				// Queries\\PomonaQuery.g:169:4: ID ( '[' arglist_expr ']' )
				{
				DebugLocation(169, 4);
				ID66=(IToken)Match(input,ID,Follow._ID_in_postfix_expr1051);  
				stream_ID.Add(ID66);

				DebugLocation(169, 7);
				// Queries\\PomonaQuery.g:169:7: ( '[' arglist_expr ']' )
				DebugEnterAlt(1);
				// Queries\\PomonaQuery.g:169:9: '[' arglist_expr ']'
				{
				DebugLocation(169, 9);
				char_literal67=(IToken)Match(input,57,Follow._57_in_postfix_expr1055);  
				stream_57.Add(char_literal67);

				DebugLocation(169, 13);
				PushFollow(Follow._arglist_expr_in_postfix_expr1057);
				arglist_expr68=arglist_expr();
				PopFollow();

				stream_arglist_expr.Add(arglist_expr68.Tree);
				DebugLocation(169, 26);
				char_literal69=(IToken)Match(input,58,Follow._58_in_postfix_expr1059);  
				stream_58.Add(char_literal69);


				}



				{
				// AST REWRITE
				// elements: ID, arglist_expr
				// 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();
				// 169:32: -> ^( INDEXER_ACCESS ID arglist_expr )
				{
					DebugLocation(169, 35);
					// Queries\\PomonaQuery.g:169:35: ^( INDEXER_ACCESS ID arglist_expr )
					{
					object root_1 = (object)adaptor.Nil();
					DebugLocation(169, 37);
					root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(INDEXER_ACCESS, "INDEXER_ACCESS"), root_1);

					DebugLocation(169, 52);
					adaptor.AddChild(root_1, stream_ID.NextNode());
					DebugLocation(169, 55);
					adaptor.AddChild(root_1, stream_arglist_expr.NextTree());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}

				}
				break;
			case 4:
				DebugEnterAlt(4);
				// Queries\\PomonaQuery.g:170:4: ID ( '[' ']' )
				{
				DebugLocation(170, 4);
				ID70=(IToken)Match(input,ID,Follow._ID_in_postfix_expr1076);  
				stream_ID.Add(ID70);

				DebugLocation(170, 7);
				// Queries\\PomonaQuery.g:170:7: ( '[' ']' )
				DebugEnterAlt(1);
				// Queries\\PomonaQuery.g:170:9: '[' ']'
				{
				DebugLocation(170, 9);
				char_literal71=(IToken)Match(input,57,Follow._57_in_postfix_expr1080);  
				stream_57.Add(char_literal71);

				DebugLocation(170, 13);
				char_literal72=(IToken)Match(input,58,Follow._58_in_postfix_expr1082);  
				stream_58.Add(char_literal72);


				}



				{
				// 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 = (object)adaptor.Nil();
				// 170:19: -> ^( INDEXER_ACCESS ID )
				{
					DebugLocation(170, 22);
					// Queries\\PomonaQuery.g:170:22: ^( INDEXER_ACCESS ID )
					{
					object root_1 = (object)adaptor.Nil();
					DebugLocation(170, 24);
					root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(INDEXER_ACCESS, "INDEXER_ACCESS"), root_1);

					DebugLocation(170, 39);
					adaptor.AddChild(root_1, stream_ID.NextNode());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}

				}
				break;
			case 5:
				DebugEnterAlt(5);
				// Queries\\PomonaQuery.g:171:4: ID
				{
				root_0 = (object)adaptor.Nil();

				DebugLocation(171, 4);
				ID73=(IToken)Match(input,ID,Follow._ID_in_postfix_expr1097); 
				ID73_tree = (object)adaptor.Create(ID73);
				adaptor.AddChild(root_0, ID73_tree);

				}
				break;
			case 6:
				DebugEnterAlt(6);
				// Queries\\PomonaQuery.g:172:4: STRING
				{
				root_0 = (object)adaptor.Nil();

				DebugLocation(172, 4);
				STRING74=(IToken)Match(input,STRING,Follow._STRING_in_postfix_expr1102); 
				STRING74_tree = (object)adaptor.Create(STRING74);
				adaptor.AddChild(root_0, STRING74_tree);

				}
				break;
			case 7:
				DebugEnterAlt(7);
				// Queries\\PomonaQuery.g:173:4: INT
				{
				root_0 = (object)adaptor.Nil();

				DebugLocation(173, 4);
				INT75=(IToken)Match(input,INT,Follow._INT_in_postfix_expr1107); 
				INT75_tree = (object)adaptor.Create(INT75);
				adaptor.AddChild(root_0, INT75_tree);

				}
				break;
			case 8:
				DebugEnterAlt(8);
				// Queries\\PomonaQuery.g:174:4: '(' ! orderby_expr ')' !
				{
				root_0 = (object)adaptor.Nil();

				DebugLocation(174, 7);
				char_literal76=(IToken)Match(input,43,Follow._43_in_postfix_expr1112); 
				DebugLocation(174, 9);
				PushFollow(Follow._orderby_expr_in_postfix_expr1115);
				orderby_expr77=orderby_expr();
				PopFollow();

				adaptor.AddChild(root_0, orderby_expr77.Tree);
				DebugLocation(174, 25);
				char_literal78=(IToken)Match(input,44,Follow._44_in_postfix_expr1117); 

				}
				break;
			case 9:
				DebugEnterAlt(9);
				// Queries\\PomonaQuery.g:175:4: '[' arglist_expr ']'
				{
				DebugLocation(175, 4);
				char_literal79=(IToken)Match(input,57,Follow._57_in_postfix_expr1123);  
				stream_57.Add(char_literal79);

				DebugLocation(175, 8);
				PushFollow(Follow._arglist_expr_in_postfix_expr1125);
				arglist_expr80=arglist_expr();
				PopFollow();

				stream_arglist_expr.Add(arglist_expr80.Tree);
				DebugLocation(175, 21);
				char_literal81=(IToken)Match(input,58,Follow._58_in_postfix_expr1127);  
				stream_58.Add(char_literal81);



				{
				// AST REWRITE
				// elements: arglist_expr
				// 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();
				// 175:25: -> ^( ARRAY_LITERAL arglist_expr )
				{
					DebugLocation(175, 28);
					// Queries\\PomonaQuery.g:175:28: ^( ARRAY_LITERAL arglist_expr )
					{
					object root_1 = (object)adaptor.Nil();
					DebugLocation(175, 30);
					root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(ARRAY_LITERAL, "ARRAY_LITERAL"), root_1);

					DebugLocation(175, 44);
					adaptor.AddChild(root_1, stream_arglist_expr.NextTree());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}

				}
				break;
			case 10:
				DebugEnterAlt(10);
				// Queries\\PomonaQuery.g:176:4: PREFIXED_STRING
				{
				root_0 = (object)adaptor.Nil();

				DebugLocation(176, 4);
				PREFIXED_STRING82=(IToken)Match(input,PREFIXED_STRING,Follow._PREFIXED_STRING_in_postfix_expr1140); 
				PREFIXED_STRING82_tree = (object)adaptor.Create(PREFIXED_STRING82);
				adaptor.AddChild(root_0, PREFIXED_STRING82_tree);

				}
				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("postfix_expr", 18);
			LeaveRule("postfix_expr", 18);
			LeaveRule_postfix_expr();
		}
		DebugLocation(177, 1);
		} finally { DebugExitRule(GrammarFileName, "postfix_expr"); }
		return retval;

	}
Beispiel #13
0
	private AstParserRuleReturnScope<object, IToken> dot_operator()
	{
		EnterRule_dot_operator();
		EnterRule("dot_operator", 15);
		TraceIn("dot_operator", 15);
		AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
		retval.Start = (IToken)input.LT(1);

		object root_0 = default(object);

		IToken char_literal52 = default(IToken);

		object char_literal52_tree = default(object);
		RewriteRuleITokenStream stream_49=new RewriteRuleITokenStream(adaptor,"token 49");
		try { DebugEnterRule(GrammarFileName, "dot_operator");
		DebugLocation(152, 1);
		try
		{
			// Queries\\PomonaQuery.g:153:2: ( '.' -> DOT_OP )
			DebugEnterAlt(1);
			// Queries\\PomonaQuery.g:153:4: '.'
			{
			DebugLocation(153, 4);
			char_literal52=(IToken)Match(input,49,Follow._49_in_dot_operator948);  
			stream_49.Add(char_literal52);



			{
			// AST REWRITE
			// elements: 
			// 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();
			// 153:8: -> DOT_OP
			{
				DebugLocation(153, 11);
				adaptor.AddChild(root_0, (object)adaptor.Create(DOT_OP, "DOT_OP"));

			}

			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("dot_operator", 15);
			LeaveRule("dot_operator", 15);
			LeaveRule_dot_operator();
		}
		DebugLocation(154, 1);
		} finally { DebugExitRule(GrammarFileName, "dot_operator"); }
		return retval;

	}
Beispiel #14
0
	private AstParserRuleReturnScope<object, IToken> unary_operator()
	{
		EnterRule_unary_operator();
		EnterRule("unary_operator", 14);
		TraceIn("unary_operator", 14);
		AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
		retval.Start = (IToken)input.LT(1);

		object root_0 = default(object);

		IToken string_literal50 = default(IToken);
		IToken char_literal51 = default(IToken);

		object string_literal50_tree = default(object);
		object char_literal51_tree = default(object);
		RewriteRuleITokenStream stream_74=new RewriteRuleITokenStream(adaptor,"token 74");
		RewriteRuleITokenStream stream_39=new RewriteRuleITokenStream(adaptor,"token 39");
		try { DebugEnterRule(GrammarFileName, "unary_operator");
		DebugLocation(148, 1);
		try
		{
			// Queries\\PomonaQuery.g:149:2: ( ( 'not' | '!' ) -> NOT_OP )
			DebugEnterAlt(1);
			// Queries\\PomonaQuery.g:149:4: ( 'not' | '!' )
			{
			DebugLocation(149, 4);
			// Queries\\PomonaQuery.g:149:4: ( 'not' | '!' )
			int alt23=2;
			try { DebugEnterSubRule(23);
			try { DebugEnterDecision(23, false);
			int LA23_1 = input.LA(1);

			if ((LA23_1==74))
			{
				alt23 = 1;
			}
			else if ((LA23_1==39))
			{
				alt23 = 2;
			}
			else
			{
				NoViableAltException nvae = new NoViableAltException("", 23, 0, input, 1);
				DebugRecognitionException(nvae);
				throw nvae;
			}
			} finally { DebugExitDecision(23); }
			switch (alt23)
			{
			case 1:
				DebugEnterAlt(1);
				// Queries\\PomonaQuery.g:149:5: 'not'
				{
				DebugLocation(149, 5);
				string_literal50=(IToken)Match(input,74,Follow._74_in_unary_operator930);  
				stream_74.Add(string_literal50);


				}
				break;
			case 2:
				DebugEnterAlt(2);
				// Queries\\PomonaQuery.g:149:11: '!'
				{
				DebugLocation(149, 11);
				char_literal51=(IToken)Match(input,39,Follow._39_in_unary_operator932);  
				stream_39.Add(char_literal51);


				}
				break;

			}
			} finally { DebugExitSubRule(23); }



			{
			// AST REWRITE
			// elements: 
			// 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();
			// 149:16: -> NOT_OP
			{
				DebugLocation(149, 19);
				adaptor.AddChild(root_0, (object)adaptor.Create(NOT_OP, "NOT_OP"));

			}

			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("unary_operator", 14);
			LeaveRule("unary_operator", 14);
			LeaveRule_unary_operator();
		}
		DebugLocation(150, 1);
		} finally { DebugExitRule(GrammarFileName, "unary_operator"); }
		return retval;

	}
Beispiel #15
0
	private AstParserRuleReturnScope<object, IToken> multiplicative_operator()
	{
		EnterRule_multiplicative_operator();
		EnterRule("multiplicative_operator", 12);
		TraceIn("multiplicative_operator", 12);
		AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
		retval.Start = (IToken)input.LT(1);

		object root_0 = default(object);

		IToken string_literal41 = default(IToken);
		IToken char_literal42 = default(IToken);
		IToken string_literal43 = default(IToken);
		IToken char_literal44 = default(IToken);
		IToken string_literal45 = default(IToken);
		IToken char_literal46 = default(IToken);

		object string_literal41_tree = default(object);
		object char_literal42_tree = default(object);
		object string_literal43_tree = default(object);
		object char_literal44_tree = default(object);
		object string_literal45_tree = default(object);
		object char_literal46_tree = default(object);
		RewriteRuleITokenStream stream_72=new RewriteRuleITokenStream(adaptor,"token 72");
		RewriteRuleITokenStream stream_45=new RewriteRuleITokenStream(adaptor,"token 45");
		RewriteRuleITokenStream stream_64=new RewriteRuleITokenStream(adaptor,"token 64");
		RewriteRuleITokenStream stream_50=new RewriteRuleITokenStream(adaptor,"token 50");
		RewriteRuleITokenStream stream_71=new RewriteRuleITokenStream(adaptor,"token 71");
		RewriteRuleITokenStream stream_41=new RewriteRuleITokenStream(adaptor,"token 41");
		try { DebugEnterRule(GrammarFileName, "multiplicative_operator");
		DebugLocation(138, 4);
		try
		{
			// Queries\\PomonaQuery.g:139:5: ( ( 'mul' | '*' ) -> MUL_OP | ( 'div' | '/' ) -> DIV_OP | ( 'mod' | '%' ) -> MOD_OP )
			int alt21=3;
			try { DebugEnterDecision(21, false);
			switch (input.LA(1))
			{
			case 45:
			case 72:
				{
				alt21 = 1;
				}
				break;
			case 50:
			case 64:
				{
				alt21 = 2;
				}
				break;
			case 41:
			case 71:
				{
				alt21 = 3;
				}
				break;
			default:
				{
					NoViableAltException nvae = new NoViableAltException("", 21, 0, input, 1);
					DebugRecognitionException(nvae);
					throw nvae;
				}
			}

			} finally { DebugExitDecision(21); }
			switch (alt21)
			{
			case 1:
				DebugEnterAlt(1);
				// Queries\\PomonaQuery.g:139:9: ( 'mul' | '*' )
				{
				DebugLocation(139, 9);
				// Queries\\PomonaQuery.g:139:9: ( 'mul' | '*' )
				int alt18=2;
				try { DebugEnterSubRule(18);
				try { DebugEnterDecision(18, false);
				int LA18_1 = input.LA(1);

				if ((LA18_1==72))
				{
					alt18 = 1;
				}
				else if ((LA18_1==45))
				{
					alt18 = 2;
				}
				else
				{
					NoViableAltException nvae = new NoViableAltException("", 18, 0, input, 1);
					DebugRecognitionException(nvae);
					throw nvae;
				}
				} finally { DebugExitDecision(18); }
				switch (alt18)
				{
				case 1:
					DebugEnterAlt(1);
					// Queries\\PomonaQuery.g:139:10: 'mul'
					{
					DebugLocation(139, 10);
					string_literal41=(IToken)Match(input,72,Follow._72_in_multiplicative_operator852);  
					stream_72.Add(string_literal41);


					}
					break;
				case 2:
					DebugEnterAlt(2);
					// Queries\\PomonaQuery.g:139:16: '*'
					{
					DebugLocation(139, 16);
					char_literal42=(IToken)Match(input,45,Follow._45_in_multiplicative_operator854);  
					stream_45.Add(char_literal42);


					}
					break;

				}
				} finally { DebugExitSubRule(18); }



				{
				// AST REWRITE
				// elements: 
				// 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();
				// 139:21: -> MUL_OP
				{
					DebugLocation(139, 24);
					adaptor.AddChild(root_0, (object)adaptor.Create(MUL_OP, "MUL_OP"));

				}

				retval.Tree = root_0;
				}

				}
				break;
			case 2:
				DebugEnterAlt(2);
				// Queries\\PomonaQuery.g:140:9: ( 'div' | '/' )
				{
				DebugLocation(140, 9);
				// Queries\\PomonaQuery.g:140:9: ( 'div' | '/' )
				int alt19=2;
				try { DebugEnterSubRule(19);
				try { DebugEnterDecision(19, false);
				int LA19_1 = input.LA(1);

				if ((LA19_1==64))
				{
					alt19 = 1;
				}
				else if ((LA19_1==50))
				{
					alt19 = 2;
				}
				else
				{
					NoViableAltException nvae = new NoViableAltException("", 19, 0, input, 1);
					DebugRecognitionException(nvae);
					throw nvae;
				}
				} finally { DebugExitDecision(19); }
				switch (alt19)
				{
				case 1:
					DebugEnterAlt(1);
					// Queries\\PomonaQuery.g:140:10: 'div'
					{
					DebugLocation(140, 10);
					string_literal43=(IToken)Match(input,64,Follow._64_in_multiplicative_operator870);  
					stream_64.Add(string_literal43);


					}
					break;
				case 2:
					DebugEnterAlt(2);
					// Queries\\PomonaQuery.g:140:16: '/'
					{
					DebugLocation(140, 16);
					char_literal44=(IToken)Match(input,50,Follow._50_in_multiplicative_operator872);  
					stream_50.Add(char_literal44);


					}
					break;

				}
				} finally { DebugExitSubRule(19); }



				{
				// AST REWRITE
				// elements: 
				// 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();
				// 140:21: -> DIV_OP
				{
					DebugLocation(140, 24);
					adaptor.AddChild(root_0, (object)adaptor.Create(DIV_OP, "DIV_OP"));

				}

				retval.Tree = root_0;
				}

				}
				break;
			case 3:
				DebugEnterAlt(3);
				// Queries\\PomonaQuery.g:141:6: ( 'mod' | '%' )
				{
				DebugLocation(141, 6);
				// Queries\\PomonaQuery.g:141:6: ( 'mod' | '%' )
				int alt20=2;
				try { DebugEnterSubRule(20);
				try { DebugEnterDecision(20, false);
				int LA20_1 = input.LA(1);

				if ((LA20_1==71))
				{
					alt20 = 1;
				}
				else if ((LA20_1==41))
				{
					alt20 = 2;
				}
				else
				{
					NoViableAltException nvae = new NoViableAltException("", 20, 0, input, 1);
					DebugRecognitionException(nvae);
					throw nvae;
				}
				} finally { DebugExitDecision(20); }
				switch (alt20)
				{
				case 1:
					DebugEnterAlt(1);
					// Queries\\PomonaQuery.g:141:7: 'mod'
					{
					DebugLocation(141, 7);
					string_literal45=(IToken)Match(input,71,Follow._71_in_multiplicative_operator885);  
					stream_71.Add(string_literal45);


					}
					break;
				case 2:
					DebugEnterAlt(2);
					// Queries\\PomonaQuery.g:141:13: '%'
					{
					DebugLocation(141, 13);
					char_literal46=(IToken)Match(input,41,Follow._41_in_multiplicative_operator887);  
					stream_41.Add(char_literal46);


					}
					break;

				}
				} finally { DebugExitSubRule(20); }



				{
				// AST REWRITE
				// elements: 
				// 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();
				// 141:18: -> MOD_OP
				{
					DebugLocation(141, 21);
					adaptor.AddChild(root_0, (object)adaptor.Create(MOD_OP, "MOD_OP"));

				}

				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("multiplicative_operator", 12);
			LeaveRule("multiplicative_operator", 12);
			LeaveRule_multiplicative_operator();
		}
		DebugLocation(142, 4);
		} finally { DebugExitRule(GrammarFileName, "multiplicative_operator"); }
		return retval;

	}
		// $ANTLR start "andOp"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:181:1: andOp : (x= 'and' -> OP_AND[$x] | x= '&&' -> OP_AND[$x] );
		public andOp_return andOp() // throws RecognitionException [1]
		{
			var retval = new andOp_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken x = null;

			CommonTree x_tree = null;
			var stream_75 = new RewriteRuleTokenStream( adaptor, "token 75" );
			var stream_76 = new RewriteRuleTokenStream( adaptor, "token 76" );

			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:182:2: (x= 'and' -> OP_AND[$x] | x= '&&' -> OP_AND[$x] )
				int alt24 = 2;
				int LA24_0 = input.LA( 1 );

				if ( ( LA24_0 == 75 ) )
					alt24 = 1;
				else if ( ( LA24_0 == 76 ) )
					alt24 = 2;
				else
				{
					var nvae_d24s0 =
							new NoViableAltException( "", 24, 0, input );

					throw nvae_d24s0;
				}
				switch ( alt24 )
				{
					case 1:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:182:4: x= 'and'
						{
							x = (IToken)Match( input, 75, FOLLOW_75_in_andOp927 );
							stream_75.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 182:12: -> OP_AND[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_AND, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
					case 2:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:183:4: x= '&&'
						{
							x = (IToken)Match( input, 76, FOLLOW_76_in_andOp939 );
							stream_76.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 183:12: -> OP_AND[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_AND, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
				}
				retval.Stop = input.LT( -1 );

				retval.Tree = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "modulusOp"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:185:1: modulusOp : (x= 'mod' -> OP_MODULUS[$x] | x= '%' -> OP_MODULUS[$x] );
		public modulusOp_return modulusOp() // throws RecognitionException [1]
		{
			var retval = new modulusOp_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken x = null;

			CommonTree x_tree = null;
			var stream_78 = new RewriteRuleTokenStream( adaptor, "token 78" );
			var stream_77 = new RewriteRuleTokenStream( adaptor, "token 77" );

			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:186:2: (x= 'mod' -> OP_MODULUS[$x] | x= '%' -> OP_MODULUS[$x] )
				int alt25 = 2;
				int LA25_0 = input.LA( 1 );

				if ( ( LA25_0 == 77 ) )
					alt25 = 1;
				else if ( ( LA25_0 == 78 ) )
					alt25 = 2;
				else
				{
					var nvae_d25s0 =
							new NoViableAltException( "", 25, 0, input );

					throw nvae_d25s0;
				}
				switch ( alt25 )
				{
					case 1:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:186:4: x= 'mod'
						{
							x = (IToken)Match( input, 77, FOLLOW_77_in_modulusOp957 );
							stream_77.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 186:12: -> OP_MODULUS[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_MODULUS, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
					case 2:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:187:4: x= '%'
						{
							x = (IToken)Match( input, 78, FOLLOW_78_in_modulusOp969 );
							stream_78.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 187:12: -> OP_MODULUS[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_MODULUS, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
				}
				retval.Stop = input.LT( -1 );

				retval.Tree = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
Beispiel #18
0
	private AstParserRuleReturnScope<object, IToken> or_expression()
	{
		EnterRule_or_expression();
		EnterRule("or_expression", 5);
		TraceIn("or_expression", 5);
		AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
		retval.Start = (IToken)input.LT(1);

		object root_0 = default(object);

		IToken string_literal11 = default(IToken);
		IToken string_literal12 = default(IToken);
		AstParserRuleReturnScope<object, IToken> and_expression10 = default(AstParserRuleReturnScope<object, IToken>);
		AstParserRuleReturnScope<object, IToken> and_expression13 = default(AstParserRuleReturnScope<object, IToken>);

		object string_literal11_tree = default(object);
		object string_literal12_tree = default(object);
		RewriteRuleITokenStream stream_75=new RewriteRuleITokenStream(adaptor,"token 75");
		RewriteRuleITokenStream stream_77=new RewriteRuleITokenStream(adaptor,"token 77");
		RewriteRuleSubtreeStream stream_and_expression=new RewriteRuleSubtreeStream(adaptor,"rule and_expression");
		try { DebugEnterRule(GrammarFileName, "or_expression");
		DebugLocation(93, 1);
		try
		{
			// Queries\\PomonaQuery.g:94:2: ( and_expression ( ( 'or' | '||' ) and_expression )* -> ^( OR_OP ( and_expression )+ ) )
			DebugEnterAlt(1);
			// Queries\\PomonaQuery.g:94:4: and_expression ( ( 'or' | '||' ) and_expression )*
			{
			DebugLocation(94, 4);
			PushFollow(Follow._and_expression_in_or_expression588);
			and_expression10=and_expression();
			PopFollow();

			stream_and_expression.Add(and_expression10.Tree);
			DebugLocation(94, 19);
			// Queries\\PomonaQuery.g:94:19: ( ( 'or' | '||' ) and_expression )*
			try { DebugEnterSubRule(4);
			while (true)
			{
				int alt4=2;
				try { DebugEnterDecision(4, false);
				int LA4_1 = input.LA(1);

				if ((LA4_1==75||LA4_1==77))
				{
					alt4 = 1;
				}


				} finally { DebugExitDecision(4); }
				switch ( alt4 )
				{
				case 1:
					DebugEnterAlt(1);
					// Queries\\PomonaQuery.g:94:21: ( 'or' | '||' ) and_expression
					{
					DebugLocation(94, 21);
					// Queries\\PomonaQuery.g:94:21: ( 'or' | '||' )
					int alt3=2;
					try { DebugEnterSubRule(3);
					try { DebugEnterDecision(3, false);
					int LA3_1 = input.LA(1);

					if ((LA3_1==75))
					{
						alt3 = 1;
					}
					else if ((LA3_1==77))
					{
						alt3 = 2;
					}
					else
					{
						NoViableAltException nvae = new NoViableAltException("", 3, 0, input, 1);
						DebugRecognitionException(nvae);
						throw nvae;
					}
					} finally { DebugExitDecision(3); }
					switch (alt3)
					{
					case 1:
						DebugEnterAlt(1);
						// Queries\\PomonaQuery.g:94:22: 'or'
						{
						DebugLocation(94, 22);
						string_literal11=(IToken)Match(input,75,Follow._75_in_or_expression593);  
						stream_75.Add(string_literal11);


						}
						break;
					case 2:
						DebugEnterAlt(2);
						// Queries\\PomonaQuery.g:94:27: '||'
						{
						DebugLocation(94, 27);
						string_literal12=(IToken)Match(input,77,Follow._77_in_or_expression595);  
						stream_77.Add(string_literal12);


						}
						break;

					}
					} finally { DebugExitSubRule(3); }

					DebugLocation(94, 33);
					PushFollow(Follow._and_expression_in_or_expression598);
					and_expression13=and_expression();
					PopFollow();

					stream_and_expression.Add(and_expression13.Tree);

					}
					break;

				default:
					goto loop4;
				}
			}

			loop4:
				;

			} finally { DebugExitSubRule(4); }



			{
			// AST REWRITE
			// elements: and_expression
			// 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();
			// 94:51: -> ^( OR_OP ( and_expression )+ )
			{
				DebugLocation(94, 54);
				// Queries\\PomonaQuery.g:94:54: ^( OR_OP ( and_expression )+ )
				{
				object root_1 = (object)adaptor.Nil();
				DebugLocation(94, 56);
				root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(OR_OP, "OR_OP"), root_1);

				DebugLocation(94, 62);
				if (!(stream_and_expression.HasNext))
				{
					throw new RewriteEarlyExitException();
				}
				while ( stream_and_expression.HasNext )
				{
					DebugLocation(94, 62);
					adaptor.AddChild(root_1, stream_and_expression.NextTree());

				}
				stream_and_expression.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("or_expression", 5);
			LeaveRule("or_expression", 5);
			LeaveRule_or_expression();
		}
		DebugLocation(95, 1);
		} finally { DebugExitRule(GrammarFileName, "or_expression"); }
		return retval;

	}
		// $ANTLR start "notEqualsOp"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:193:1: notEqualsOp : (x= '!=' -> OP_NE[$x] | x= '<>' -> OP_NE[$x] );
		public notEqualsOp_return notEqualsOp() // throws RecognitionException [1]
		{
			var retval = new notEqualsOp_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken x = null;

			CommonTree x_tree = null;
			var stream_80 = new RewriteRuleTokenStream( adaptor, "token 80" );
			var stream_81 = new RewriteRuleTokenStream( adaptor, "token 81" );

			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:194:2: (x= '!=' -> OP_NE[$x] | x= '<>' -> OP_NE[$x] )
				int alt27 = 2;
				int LA27_0 = input.LA( 1 );

				if ( ( LA27_0 == 80 ) )
					alt27 = 1;
				else if ( ( LA27_0 == 81 ) )
					alt27 = 2;
				else
				{
					var nvae_d27s0 =
							new NoViableAltException( "", 27, 0, input );

					throw nvae_d27s0;
				}
				switch ( alt27 )
				{
					case 1:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:194:4: x= '!='
						{
							x = (IToken)Match( input, 80, FOLLOW_80_in_notEqualsOp1019 );
							stream_80.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 194:11: -> OP_NE[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_NE, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
					case 2:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:195:4: x= '<>'
						{
							x = (IToken)Match( input, 81, FOLLOW_81_in_notEqualsOp1031 );
							stream_81.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 195:11: -> OP_NE[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_NE, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
				}
				retval.Stop = input.LT( -1 );

				retval.Tree = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
Beispiel #20
0
	private AstParserRuleReturnScope<object, IToken> and_expression()
	{
		EnterRule_and_expression();
		EnterRule("and_expression", 7);
		TraceIn("and_expression", 7);
		AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
		retval.Start = (IToken)input.LT(1);

		object root_0 = default(object);

		AstParserRuleReturnScope<object, IToken> relational_expr15 = default(AstParserRuleReturnScope<object, IToken>);
		AstParserRuleReturnScope<object, IToken> and_operator16 = default(AstParserRuleReturnScope<object, IToken>);
		AstParserRuleReturnScope<object, IToken> relational_expr17 = default(AstParserRuleReturnScope<object, IToken>);

		RewriteRuleSubtreeStream stream_relational_expr=new RewriteRuleSubtreeStream(adaptor,"rule relational_expr");
		RewriteRuleSubtreeStream stream_and_operator=new RewriteRuleSubtreeStream(adaptor,"rule and_operator");
		try { DebugEnterRule(GrammarFileName, "and_expression");
		DebugLocation(101, 1);
		try
		{
			// Queries\\PomonaQuery.g:102:2: ( relational_expr ( and_operator relational_expr )* -> ^( AND_OP ( relational_expr )+ ) )
			DebugEnterAlt(1);
			// Queries\\PomonaQuery.g:102:4: relational_expr ( and_operator relational_expr )*
			{
			DebugLocation(102, 4);
			PushFollow(Follow._relational_expr_in_and_expression637);
			relational_expr15=relational_expr();
			PopFollow();

			stream_relational_expr.Add(relational_expr15.Tree);
			DebugLocation(102, 20);
			// Queries\\PomonaQuery.g:102:20: ( and_operator relational_expr )*
			try { DebugEnterSubRule(5);
			while (true)
			{
				int alt5=2;
				try { DebugEnterDecision(5, false);
				int LA5_1 = input.LA(1);

				if ((LA5_1==42||LA5_1==60))
				{
					alt5 = 1;
				}


				} finally { DebugExitDecision(5); }
				switch ( alt5 )
				{
				case 1:
					DebugEnterAlt(1);
					// Queries\\PomonaQuery.g:102:22: and_operator relational_expr
					{
					DebugLocation(102, 22);
					PushFollow(Follow._and_operator_in_and_expression641);
					and_operator16=and_operator();
					PopFollow();

					stream_and_operator.Add(and_operator16.Tree);
					DebugLocation(102, 35);
					PushFollow(Follow._relational_expr_in_and_expression643);
					relational_expr17=relational_expr();
					PopFollow();

					stream_relational_expr.Add(relational_expr17.Tree);

					}
					break;

				default:
					goto loop5;
				}
			}

			loop5:
				;

			} finally { DebugExitSubRule(5); }



			{
			// AST REWRITE
			// elements: relational_expr
			// 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();
			// 102:54: -> ^( AND_OP ( relational_expr )+ )
			{
				DebugLocation(102, 57);
				// Queries\\PomonaQuery.g:102:57: ^( AND_OP ( relational_expr )+ )
				{
				object root_1 = (object)adaptor.Nil();
				DebugLocation(102, 59);
				root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(AND_OP, "AND_OP"), root_1);

				DebugLocation(102, 66);
				if (!(stream_relational_expr.HasNext))
				{
					throw new RewriteEarlyExitException();
				}
				while ( stream_relational_expr.HasNext )
				{
					DebugLocation(102, 66);
					adaptor.AddChild(root_1, stream_relational_expr.NextTree());

				}
				stream_relational_expr.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("and_expression", 7);
			LeaveRule("and_expression", 7);
			LeaveRule_and_expression();
		}
		DebugLocation(103, 1);
		} finally { DebugExitRule(GrammarFileName, "and_expression"); }
		return retval;

	}
		// $ANTLR start "classDeclaration"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:79:1: classDeclaration : 'class' name ( baseClassDeclaration )? classStatementBlock -> ^( CLASS name ( baseClassDeclaration )? classStatementBlock ) ;
		public classDeclaration_return classDeclaration() // throws RecognitionException [1]
		{
			var retval = new classDeclaration_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken string_literal4 = null;
			name_return name5 = default( name_return );

			baseClassDeclaration_return baseClassDeclaration6 = default( baseClassDeclaration_return );

			classStatementBlock_return classStatementBlock7 = default( classStatementBlock_return );


			CommonTree string_literal4_tree = null;
			var stream_57 = new RewriteRuleTokenStream( adaptor, "token 57" );
			var stream_classStatementBlock = new RewriteRuleSubtreeStream( adaptor, "rule classStatementBlock" );
			var stream_name = new RewriteRuleSubtreeStream( adaptor, "rule name" );
			var stream_baseClassDeclaration = new RewriteRuleSubtreeStream( adaptor, "rule baseClassDeclaration" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:2: ( 'class' name ( baseClassDeclaration )? classStatementBlock -> ^( CLASS name ( baseClassDeclaration )? classStatementBlock ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:4: 'class' name ( baseClassDeclaration )? classStatementBlock
				{
					string_literal4 = (IToken)Match( input, 57, FOLLOW_57_in_classDeclaration262 );
					stream_57.Add( string_literal4 );

					PushFollow( FOLLOW_name_in_classDeclaration264 );
					name5 = name();
					state.followingStackPointer--;

					stream_name.Add( name5.Tree );
					// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:17: ( baseClassDeclaration )?
					int alt3 = 2;
					int LA3_0 = input.LA( 1 );

					if ( ( LA3_0 == 58 ) )
						alt3 = 1;
					switch ( alt3 )
					{
						case 1:
							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:17: baseClassDeclaration
							{
								PushFollow( FOLLOW_baseClassDeclaration_in_classDeclaration266 );
								baseClassDeclaration6 = baseClassDeclaration();
								state.followingStackPointer--;

								stream_baseClassDeclaration.Add( baseClassDeclaration6.Tree );
							}
							break;
					}

					PushFollow( FOLLOW_classStatementBlock_in_classDeclaration269 );
					classStatementBlock7 = classStatementBlock();
					state.followingStackPointer--;

					stream_classStatementBlock.Add( classStatementBlock7.Tree );


					// AST REWRITE
					// elements:          name, classStatementBlock, baseClassDeclaration
					// token labels:      
					// rule labels:       retval
					// token list labels: 
					// rule list labels:  
					// wildcard labels: 
					retval.Tree = root_0;
					var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 80:59: -> ^( CLASS name ( baseClassDeclaration )? classStatementBlock )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:62: ^( CLASS name ( baseClassDeclaration )? classStatementBlock )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( CLASS, "CLASS" ), root_1 );

							adaptor.AddChild( root_1, stream_name.NextTree() );
							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:76: ( baseClassDeclaration )?
							if ( stream_baseClassDeclaration.HasNext() )
								adaptor.AddChild( root_1, stream_baseClassDeclaration.NextTree() );
							stream_baseClassDeclaration.Reset();
							adaptor.AddChild( root_1, stream_classStatementBlock.NextTree() );

							adaptor.AddChild( root_0, root_1 );
						}
					}

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

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

				retval.Tree = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "propertyModifiers"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:100:1: propertyModifiers : ( exclusivePropertyModifier -> ^( MODIFIERS exclusivePropertyModifier ) | ( propertyModifier )+ -> ^( MODIFIERS ( propertyModifier )+ ) );
		public propertyModifiers_return propertyModifiers() // throws RecognitionException [1]
		{
			var retval = new propertyModifiers_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			exclusivePropertyModifier_return exclusivePropertyModifier21 = default( exclusivePropertyModifier_return );

			propertyModifier_return propertyModifier22 = default( propertyModifier_return );


			var stream_propertyModifier = new RewriteRuleSubtreeStream( adaptor, "rule propertyModifier" );
			var stream_exclusivePropertyModifier = new RewriteRuleSubtreeStream( adaptor, "rule exclusivePropertyModifier" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:101:2: ( exclusivePropertyModifier -> ^( MODIFIERS exclusivePropertyModifier ) | ( propertyModifier )+ -> ^( MODIFIERS ( propertyModifier )+ ) )
				int alt8 = 2;
				int LA8_0 = input.LA( 1 );

				if ( ( LA8_0 == 64 ) )
					alt8 = 1;
				else if ( ( ( LA8_0 >= 65 && LA8_0 <= 66 ) ) )
					alt8 = 2;
				else
				{
					var nvae_d8s0 =
							new NoViableAltException( "", 8, 0, input );

					throw nvae_d8s0;
				}
				switch ( alt8 )
				{
					case 1:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:101:4: exclusivePropertyModifier
						{
							PushFollow( FOLLOW_exclusivePropertyModifier_in_propertyModifiers419 );
							exclusivePropertyModifier21 = exclusivePropertyModifier();
							state.followingStackPointer--;

							stream_exclusivePropertyModifier.Add( exclusivePropertyModifier21.Tree );


							// AST REWRITE
							// elements:          exclusivePropertyModifier
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 101:30: -> ^( MODIFIERS exclusivePropertyModifier )
							{
								// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:101:33: ^( MODIFIERS exclusivePropertyModifier )
								{
									var root_1 = (CommonTree)adaptor.GetNilNode();
									root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( MODIFIERS, "MODIFIERS" ), root_1 );

									adaptor.AddChild( root_1, stream_exclusivePropertyModifier.NextTree() );

									adaptor.AddChild( root_0, root_1 );
								}
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
					case 2:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:102:4: ( propertyModifier )+
						{
							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:102:4: ( propertyModifier )+
							int cnt7 = 0;
							do
							{
								int alt7 = 2;
								int LA7_0 = input.LA( 1 );

								if ( ( ( LA7_0 >= 65 && LA7_0 <= 66 ) ) )
									alt7 = 1;


								switch ( alt7 )
								{
									case 1:
										// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:102:4: propertyModifier
										{
											PushFollow( FOLLOW_propertyModifier_in_propertyModifiers434 );
											propertyModifier22 = propertyModifier();
											state.followingStackPointer--;

											stream_propertyModifier.Add( propertyModifier22.Tree );
										}
										break;

									default:
										if ( cnt7 >= 1 ) goto loop7;
										var eee7 =
												new EarlyExitException( 7, input );
										throw eee7;
								}
								cnt7++;
							} while ( true );

							loop7:
							; // Stops C# compiler whining that label 'loop7' has no statements


							// AST REWRITE
							// elements:          propertyModifier
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 102:22: -> ^( MODIFIERS ( propertyModifier )+ )
							{
								// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:102:25: ^( MODIFIERS ( propertyModifier )+ )
								{
									var root_1 = (CommonTree)adaptor.GetNilNode();
									root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( MODIFIERS, "MODIFIERS" ), root_1 );

									if ( !( stream_propertyModifier.HasNext() ) ) throw new RewriteEarlyExitException();
									while ( stream_propertyModifier.HasNext() )
										adaptor.AddChild( root_1, stream_propertyModifier.NextTree() );
									stream_propertyModifier.Reset();

									adaptor.AddChild( root_0, root_1 );
								}
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
				}
				retval.Stop = input.LT( -1 );

				retval.Tree = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "functionCall"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:255:1: functionCall : x= ID '(' ( expression ( ',' expression )* )? ')' -> ^( FUNCTION[$x] ( expression )* ) ;
		public functionCall_return functionCall() // throws RecognitionException [1]
		{
			var retval = new functionCall_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken x = null;
			IToken char_literal87 = null;
			IToken char_literal89 = null;
			IToken char_literal91 = null;
			expression_return expression88 = default( expression_return );

			expression_return expression90 = default( expression_return );


			CommonTree x_tree = null;
			CommonTree char_literal87_tree = null;
			CommonTree char_literal89_tree = null;
			CommonTree char_literal91_tree = null;
			var stream_69 = new RewriteRuleTokenStream( adaptor, "token 69" );
			var stream_94 = new RewriteRuleTokenStream( adaptor, "token 94" );
			var stream_ID = new RewriteRuleTokenStream( adaptor, "token ID" );
			var stream_70 = new RewriteRuleTokenStream( adaptor, "token 70" );
			var stream_expression = new RewriteRuleSubtreeStream( adaptor, "rule expression" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:2: (x= ID '(' ( expression ( ',' expression )* )? ')' -> ^( FUNCTION[$x] ( expression )* ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:4: x= ID '(' ( expression ( ',' expression )* )? ')'
				{
					x = (IToken)Match( input, ID, FOLLOW_ID_in_functionCall1352 );
					stream_ID.Add( x );

					char_literal87 = (IToken)Match( input, 69, FOLLOW_69_in_functionCall1354 );
					stream_69.Add( char_literal87 );

					// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:13: ( expression ( ',' expression )* )?
					int alt33 = 2;
					int LA33_0 = input.LA( 1 );

					if ( ( ( LA33_0 >= ID && LA33_0 <= FLOAT ) || LA33_0 == 69 || ( LA33_0 >= 71 && LA33_0 <= 72 ) || LA33_0 == 87 || LA33_0 == 91 || ( LA33_0 >= 95 && LA33_0 <= 96 ) ) )
						alt33 = 1;
					switch ( alt33 )
					{
						case 1:
							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:15: expression ( ',' expression )*
							{
								PushFollow( FOLLOW_expression_in_functionCall1358 );
								expression88 = expression();
								state.followingStackPointer--;

								stream_expression.Add( expression88.Tree );
								// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:26: ( ',' expression )*
								do
								{
									int alt32 = 2;
									int LA32_0 = input.LA( 1 );

									if ( ( LA32_0 == 94 ) )
										alt32 = 1;


									switch ( alt32 )
									{
										case 1:
											// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:28: ',' expression
											{
												char_literal89 = (IToken)Match( input, 94, FOLLOW_94_in_functionCall1362 );
												stream_94.Add( char_literal89 );

												PushFollow( FOLLOW_expression_in_functionCall1364 );
												expression90 = expression();
												state.followingStackPointer--;

												stream_expression.Add( expression90.Tree );
											}
											break;

										default:
											goto loop32;
									}
								} while ( true );

								loop32:
								; // Stops C# compiler whining that label 'loop32' has no statements
							}
							break;
					}

					char_literal91 = (IToken)Match( input, 70, FOLLOW_70_in_functionCall1372 );
					stream_70.Add( char_literal91 );


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

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 256:53: -> ^( FUNCTION[$x] ( expression )* )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:56: ^( FUNCTION[$x] ( expression )* )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( FUNCTION, x ), root_1 );

							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:72: ( expression )*
							while ( stream_expression.HasNext() )
								adaptor.AddChild( root_1, stream_expression.NextTree() );
							stream_expression.Reset();

							adaptor.AddChild( root_0, root_1 );
						}
					}

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

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

				retval.Tree = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "relationshipDeclaration"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:113:1: relationshipDeclaration : 'relationship' name '=' relationshipJoinDeclaration ';' -> ^( RELATIONSHIP name relationshipJoinDeclaration ) ;
		public relationshipDeclaration_return relationshipDeclaration() // throws RecognitionException [1]
		{
			var retval = new relationshipDeclaration_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken string_literal25 = null;
			IToken char_literal27 = null;
			IToken char_literal29 = null;
			name_return name26 = default( name_return );

			relationshipJoinDeclaration_return relationshipJoinDeclaration28 = default( relationshipJoinDeclaration_return );


			CommonTree string_literal25_tree = null;
			CommonTree char_literal27_tree = null;
			CommonTree char_literal29_tree = null;
			var stream_67 = new RewriteRuleTokenStream( adaptor, "token 67" );
			var stream_68 = new RewriteRuleTokenStream( adaptor, "token 68" );
			var stream_63 = new RewriteRuleTokenStream( adaptor, "token 63" );
			var stream_name = new RewriteRuleSubtreeStream( adaptor, "rule name" );
			var stream_relationshipJoinDeclaration = new RewriteRuleSubtreeStream( adaptor, "rule relationshipJoinDeclaration" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:114:2: ( 'relationship' name '=' relationshipJoinDeclaration ';' -> ^( RELATIONSHIP name relationshipJoinDeclaration ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:114:4: 'relationship' name '=' relationshipJoinDeclaration ';'
				{
					string_literal25 = (IToken)Match( input, 67, FOLLOW_67_in_relationshipDeclaration484 );
					stream_67.Add( string_literal25 );

					PushFollow( FOLLOW_name_in_relationshipDeclaration486 );
					name26 = name();
					state.followingStackPointer--;

					stream_name.Add( name26.Tree );
					char_literal27 = (IToken)Match( input, 68, FOLLOW_68_in_relationshipDeclaration488 );
					stream_68.Add( char_literal27 );

					PushFollow( FOLLOW_relationshipJoinDeclaration_in_relationshipDeclaration490 );
					relationshipJoinDeclaration28 = relationshipJoinDeclaration();
					state.followingStackPointer--;

					stream_relationshipJoinDeclaration.Add( relationshipJoinDeclaration28.Tree );
					char_literal29 = (IToken)Match( input, 63, FOLLOW_63_in_relationshipDeclaration492 );
					stream_63.Add( char_literal29 );


					// AST REWRITE
					// elements:          name, relationshipJoinDeclaration
					// token labels:      
					// rule labels:       retval
					// token list labels: 
					// rule list labels:  
					// wildcard labels: 
					retval.Tree = root_0;
					var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 114:60: -> ^( RELATIONSHIP name relationshipJoinDeclaration )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:114:63: ^( RELATIONSHIP name relationshipJoinDeclaration )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( RELATIONSHIP, "RELATIONSHIP" ), root_1 );

							adaptor.AddChild( root_1, stream_name.NextTree() );
							adaptor.AddChild( root_1, stream_relationshipJoinDeclaration.NextTree() );

							adaptor.AddChild( root_0, root_1 );
						}
					}

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

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

				retval.Tree = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "booleanValue"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:269:1: booleanValue : (x= 'true' -> TRUE[$x] | x= 'false' -> FALSE[$x] );
		public booleanValue_return booleanValue() // throws RecognitionException [1]
		{
			var retval = new booleanValue_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken x = null;

			CommonTree x_tree = null;
			var stream_96 = new RewriteRuleTokenStream( adaptor, "token 96" );
			var stream_95 = new RewriteRuleTokenStream( adaptor, "token 95" );

			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:270:2: (x= 'true' -> TRUE[$x] | x= 'false' -> FALSE[$x] )
				int alt34 = 2;
				int LA34_0 = input.LA( 1 );

				if ( ( LA34_0 == 95 ) )
					alt34 = 1;
				else if ( ( LA34_0 == 96 ) )
					alt34 = 2;
				else
				{
					var nvae_d34s0 =
							new NoViableAltException( "", 34, 0, input );

					throw nvae_d34s0;
				}
				switch ( alt34 )
				{
					case 1:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:270:4: x= 'true'
						{
							x = (IToken)Match( input, 95, FOLLOW_95_in_booleanValue1440 );
							stream_95.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 270:13: -> TRUE[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( TRUE, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
					case 2:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:271:4: x= 'false'
						{
							x = (IToken)Match( input, 96, FOLLOW_96_in_booleanValue1452 );
							stream_96.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 271:14: -> FALSE[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( FALSE, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
				}
				retval.Stop = input.LT( -1 );

				retval.Tree = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "relationshipJoinDeclaration"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:116:1: relationshipJoinDeclaration : name 'where' expression -> ^( JOIN ^( TARGET name ) ^( CRITERIA expression ) ) ;
		public relationshipJoinDeclaration_return relationshipJoinDeclaration() // throws RecognitionException [1]
		{
			var retval = new relationshipJoinDeclaration_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken string_literal31 = null;
			name_return name30 = default( name_return );

			expression_return expression32 = default( expression_return );


			CommonTree string_literal31_tree = null;
			var stream_59 = new RewriteRuleTokenStream( adaptor, "token 59" );
			var stream_expression = new RewriteRuleSubtreeStream( adaptor, "rule expression" );
			var stream_name = new RewriteRuleSubtreeStream( adaptor, "rule name" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:117:2: ( name 'where' expression -> ^( JOIN ^( TARGET name ) ^( CRITERIA expression ) ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:117:4: name 'where' expression
				{
					PushFollow( FOLLOW_name_in_relationshipJoinDeclaration514 );
					name30 = name();
					state.followingStackPointer--;

					stream_name.Add( name30.Tree );
					string_literal31 = (IToken)Match( input, 59, FOLLOW_59_in_relationshipJoinDeclaration516 );
					stream_59.Add( string_literal31 );

					PushFollow( FOLLOW_expression_in_relationshipJoinDeclaration518 );
					expression32 = expression();
					state.followingStackPointer--;

					stream_expression.Add( expression32.Tree );


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

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 117:28: -> ^( JOIN ^( TARGET name ) ^( CRITERIA expression ) )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:117:31: ^( JOIN ^( TARGET name ) ^( CRITERIA expression ) )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( JOIN, "JOIN" ), root_1 );

							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:117:39: ^( TARGET name )
							{
								var root_2 = (CommonTree)adaptor.GetNilNode();
								root_2 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( TARGET, "TARGET" ), root_2 );

								adaptor.AddChild( root_2, stream_name.NextTree() );

								adaptor.AddChild( root_1, root_2 );
							}
							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:117:56: ^( CRITERIA expression )
							{
								var root_2 = (CommonTree)adaptor.GetNilNode();
								root_2 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( CRITERIA, "CRITERIA" ), root_2 );

								adaptor.AddChild( root_2, stream_expression.NextTree() );

								adaptor.AddChild( root_1, root_2 );
							}

							adaptor.AddChild( root_0, root_1 );
						}
					}

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

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

				retval.Tree = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "classStatementBlock"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:85:1: classStatementBlock : '{' ( classLevelStatement )* '}' -> ^( STATEMENT_BLOCK ( classLevelStatement )* ) ;
		public classStatementBlock_return classStatementBlock() // throws RecognitionException [1]
		{
			var retval = new classStatementBlock_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken char_literal12 = null;
			IToken char_literal14 = null;
			classLevelStatement_return classLevelStatement13 = default( classLevelStatement_return );


			CommonTree char_literal12_tree = null;
			CommonTree char_literal14_tree = null;
			var stream_60 = new RewriteRuleTokenStream( adaptor, "token 60" );
			var stream_61 = new RewriteRuleTokenStream( adaptor, "token 61" );
			var stream_classLevelStatement = new RewriteRuleSubtreeStream( adaptor, "rule classLevelStatement" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:2: ( '{' ( classLevelStatement )* '}' -> ^( STATEMENT_BLOCK ( classLevelStatement )* ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:4: '{' ( classLevelStatement )* '}'
				{
					char_literal12 = (IToken)Match( input, 60, FOLLOW_60_in_classStatementBlock328 );
					stream_60.Add( char_literal12 );

					// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:8: ( classLevelStatement )*
					do
					{
						int alt4 = 2;
						int LA4_0 = input.LA( 1 );

						if ( ( LA4_0 == 62 || LA4_0 == 67 ) )
							alt4 = 1;


						switch ( alt4 )
						{
							case 1:
								// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:8: classLevelStatement
								{
									PushFollow( FOLLOW_classLevelStatement_in_classStatementBlock330 );
									classLevelStatement13 = classLevelStatement();
									state.followingStackPointer--;

									stream_classLevelStatement.Add( classLevelStatement13.Tree );
								}
								break;

							default:
								goto loop4;
						}
					} while ( true );

					loop4:
					; // Stops C# compiler whining that label 'loop4' has no statements

					char_literal14 = (IToken)Match( input, 61, FOLLOW_61_in_classStatementBlock333 );
					stream_61.Add( char_literal14 );


					// AST REWRITE
					// elements:          classLevelStatement
					// token labels:      
					// rule labels:       retval
					// token list labels: 
					// rule list labels:  
					// wildcard labels: 
					retval.Tree = root_0;
					var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 86:33: -> ^( STATEMENT_BLOCK ( classLevelStatement )* )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:36: ^( STATEMENT_BLOCK ( classLevelStatement )* )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( STATEMENT_BLOCK, "STATEMENT_BLOCK" ), root_1 );

							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:55: ( classLevelStatement )*
							while ( stream_classLevelStatement.HasNext() )
								adaptor.AddChild( root_1, stream_classLevelStatement.NextTree() );
							stream_classLevelStatement.Reset();

							adaptor.AddChild( root_0, root_1 );
						}
					}

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

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

				retval.Tree = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "formulaDeclaration"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:125:1: formulaDeclaration : entityChainNoFilter assignmentOp expression ';' -> ^( FORMULA ^( assignmentOp entityChainNoFilter expression ) ) ;
		public formulaDeclaration_return formulaDeclaration() // throws RecognitionException [1]
		{
			var retval = new formulaDeclaration_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken char_literal36 = null;
			entityChainNoFilter_return entityChainNoFilter33 = default( entityChainNoFilter_return );

			assignmentOp_return assignmentOp34 = default( assignmentOp_return );

			expression_return expression35 = default( expression_return );


			CommonTree char_literal36_tree = null;
			var stream_63 = new RewriteRuleTokenStream( adaptor, "token 63" );
			var stream_entityChainNoFilter = new RewriteRuleSubtreeStream( adaptor, "rule entityChainNoFilter" );
			var stream_expression = new RewriteRuleSubtreeStream( adaptor, "rule expression" );
			var stream_assignmentOp = new RewriteRuleSubtreeStream( adaptor, "rule assignmentOp" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:126:2: ( entityChainNoFilter assignmentOp expression ';' -> ^( FORMULA ^( assignmentOp entityChainNoFilter expression ) ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:126:4: entityChainNoFilter assignmentOp expression ';'
				{
					PushFollow( FOLLOW_entityChainNoFilter_in_formulaDeclaration558 );
					entityChainNoFilter33 = entityChainNoFilter();
					state.followingStackPointer--;

					stream_entityChainNoFilter.Add( entityChainNoFilter33.Tree );
					PushFollow( FOLLOW_assignmentOp_in_formulaDeclaration560 );
					assignmentOp34 = assignmentOp();
					state.followingStackPointer--;

					stream_assignmentOp.Add( assignmentOp34.Tree );
					PushFollow( FOLLOW_expression_in_formulaDeclaration562 );
					expression35 = expression();
					state.followingStackPointer--;

					stream_expression.Add( expression35.Tree );
					char_literal36 = (IToken)Match( input, 63, FOLLOW_63_in_formulaDeclaration564 );
					stream_63.Add( char_literal36 );


					// AST REWRITE
					// elements:          assignmentOp, entityChainNoFilter, expression
					// token labels:      
					// rule labels:       retval
					// token list labels: 
					// rule list labels:  
					// wildcard labels: 
					retval.Tree = root_0;
					var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 126:52: -> ^( FORMULA ^( assignmentOp entityChainNoFilter expression ) )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:126:55: ^( FORMULA ^( assignmentOp entityChainNoFilter expression ) )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( FORMULA, "FORMULA" ), root_1 );

							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:126:66: ^( assignmentOp entityChainNoFilter expression )
							{
								var root_2 = (CommonTree)adaptor.GetNilNode();
								root_2 = (CommonTree)adaptor.BecomeRoot( stream_assignmentOp.NextNode(), root_2 );

								adaptor.AddChild( root_2, stream_entityChainNoFilter.NextTree() );
								adaptor.AddChild( root_2, stream_expression.NextTree() );

								adaptor.AddChild( root_1, root_2 );
							}

							adaptor.AddChild( root_0, root_1 );
						}
					}

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

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

				retval.Tree = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "propertyDeclaration"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:97:1: propertyDeclaration : 'property' name ( propertyModifiers )? ';' -> ^( PROPERTY name ( propertyModifiers )? ) ;
		public propertyDeclaration_return propertyDeclaration() // throws RecognitionException [1]
		{
			var retval = new propertyDeclaration_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken string_literal17 = null;
			IToken char_literal20 = null;
			name_return name18 = default( name_return );

			propertyModifiers_return propertyModifiers19 = default( propertyModifiers_return );


			CommonTree string_literal17_tree = null;
			CommonTree char_literal20_tree = null;
			var stream_62 = new RewriteRuleTokenStream( adaptor, "token 62" );
			var stream_63 = new RewriteRuleTokenStream( adaptor, "token 63" );
			var stream_propertyModifiers = new RewriteRuleSubtreeStream( adaptor, "rule propertyModifiers" );
			var stream_name = new RewriteRuleSubtreeStream( adaptor, "rule name" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:98:2: ( 'property' name ( propertyModifiers )? ';' -> ^( PROPERTY name ( propertyModifiers )? ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:98:4: 'property' name ( propertyModifiers )? ';'
				{
					string_literal17 = (IToken)Match( input, 62, FOLLOW_62_in_propertyDeclaration389 );
					stream_62.Add( string_literal17 );

					PushFollow( FOLLOW_name_in_propertyDeclaration391 );
					name18 = name();
					state.followingStackPointer--;

					stream_name.Add( name18.Tree );
					// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:98:20: ( propertyModifiers )?
					int alt6 = 2;
					int LA6_0 = input.LA( 1 );

					if ( ( ( LA6_0 >= 64 && LA6_0 <= 66 ) ) )
						alt6 = 1;
					switch ( alt6 )
					{
						case 1:
							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:98:20: propertyModifiers
							{
								PushFollow( FOLLOW_propertyModifiers_in_propertyDeclaration393 );
								propertyModifiers19 = propertyModifiers();
								state.followingStackPointer--;

								stream_propertyModifiers.Add( propertyModifiers19.Tree );
							}
							break;
					}

					char_literal20 = (IToken)Match( input, 63, FOLLOW_63_in_propertyDeclaration396 );
					stream_63.Add( char_literal20 );


					// AST REWRITE
					// elements:          name, propertyModifiers
					// token labels:      
					// rule labels:       retval
					// token list labels: 
					// rule list labels:  
					// wildcard labels: 
					retval.Tree = root_0;
					var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 98:43: -> ^( PROPERTY name ( propertyModifiers )? )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:98:46: ^( PROPERTY name ( propertyModifiers )? )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( PROPERTY, "PROPERTY" ), root_1 );

							adaptor.AddChild( root_1, stream_name.NextTree() );
							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:98:63: ( propertyModifiers )?
							if ( stream_propertyModifiers.HasNext() )
								adaptor.AddChild( root_1, stream_propertyModifiers.NextTree() );
							stream_propertyModifiers.Reset();

							adaptor.AddChild( root_0, root_1 );
						}
					}

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

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

				retval.Tree = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "orOp"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:177:1: orOp : (x= 'or' -> OP_OR[$x] | x= '||' -> OP_OR[$x] );
		public orOp_return orOp() // throws RecognitionException [1]
		{
			var retval = new orOp_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken x = null;

			CommonTree x_tree = null;
			var stream_73 = new RewriteRuleTokenStream( adaptor, "token 73" );
			var stream_74 = new RewriteRuleTokenStream( adaptor, "token 74" );

			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:178:2: (x= 'or' -> OP_OR[$x] | x= '||' -> OP_OR[$x] )
				int alt23 = 2;
				int LA23_0 = input.LA( 1 );

				if ( ( LA23_0 == 73 ) )
					alt23 = 1;
				else if ( ( LA23_0 == 74 ) )
					alt23 = 2;
				else
				{
					var nvae_d23s0 =
							new NoViableAltException( "", 23, 0, input );

					throw nvae_d23s0;
				}
				switch ( alt23 )
				{
					case 1:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:178:4: x= 'or'
						{
							x = (IToken)Match( input, 73, FOLLOW_73_in_orOp898 );
							stream_73.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 178:11: -> OP_OR[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_OR, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
					case 2:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:179:4: x= '||'
						{
							x = (IToken)Match( input, 74, FOLLOW_74_in_orOp910 );
							stream_74.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 179:11: -> OP_OR[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_OR, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
				}
				retval.Stop = input.LT( -1 );

				retval.Tree = 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 = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}