Пример #1
0
	private AstParserRuleReturnScope<CommonTree, IToken> stmt_modify()
	{
		EnterRule_stmt_modify();
		EnterRule("stmt_modify", 57);
		TraceIn("stmt_modify", 57);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken WS554 = default(IToken);
		IToken WS556 = default(IToken);
		IToken WS558 = default(IToken);
		IToken string_literal559 = default(IToken);
		IToken WS560 = default(IToken);
		IToken WS562 = default(IToken);
		IToken string_literal563 = default(IToken);
		IToken WS564 = default(IToken);
		IToken WS566 = default(IToken);
		IToken string_literal567 = default(IToken);
		IToken WS568 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> lvalue553 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> modify_expr_op555 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> where_expr557 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> where_expr561 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> where_expr565 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> where_expr569 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree WS554_tree = default(CommonTree);
		CommonTree WS556_tree = default(CommonTree);
		CommonTree WS558_tree = default(CommonTree);
		CommonTree string_literal559_tree = default(CommonTree);
		CommonTree WS560_tree = default(CommonTree);
		CommonTree WS562_tree = default(CommonTree);
		CommonTree string_literal563_tree = default(CommonTree);
		CommonTree WS564_tree = default(CommonTree);
		CommonTree WS566_tree = default(CommonTree);
		CommonTree string_literal567_tree = default(CommonTree);
		CommonTree WS568_tree = default(CommonTree);
		RewriteRuleITokenStream stream_117=new RewriteRuleITokenStream(adaptor,"token 117");
		RewriteRuleITokenStream stream_127=new RewriteRuleITokenStream(adaptor,"token 127");
		RewriteRuleITokenStream stream_WS=new RewriteRuleITokenStream(adaptor,"token WS");
		RewriteRuleITokenStream stream_130=new RewriteRuleITokenStream(adaptor,"token 130");
		RewriteRuleSubtreeStream stream_lvalue=new RewriteRuleSubtreeStream(adaptor,"rule lvalue");
		RewriteRuleSubtreeStream stream_modify_expr_op=new RewriteRuleSubtreeStream(adaptor,"rule modify_expr_op");
		RewriteRuleSubtreeStream stream_where_expr=new RewriteRuleSubtreeStream(adaptor,"rule where_expr");
		try { DebugEnterRule(GrammarFileName, "stmt_modify");
		DebugLocation(523, 1);
		try
		{
			// SugarCpp.g:524:2: ( lvalue ( ( WS )* modify_expr_op ( WS )* where_expr -> ^( modify_expr_op lvalue where_expr ) | ( WS )* '?=' ( WS )* where_expr -> ^( '?=' lvalue where_expr ) | ( WS )* '<<' ( WS )* where_expr -> ^( Expr_Bin '<<' lvalue where_expr ) | ( WS )* '>>' ( WS )* where_expr -> ^( Expr_Bin '>>' lvalue where_expr ) | -> lvalue ) )
			DebugEnterAlt(1);
			// SugarCpp.g:524:4: lvalue ( ( WS )* modify_expr_op ( WS )* where_expr -> ^( modify_expr_op lvalue where_expr ) | ( WS )* '?=' ( WS )* where_expr -> ^( '?=' lvalue where_expr ) | ( WS )* '<<' ( WS )* where_expr -> ^( Expr_Bin '<<' lvalue where_expr ) | ( WS )* '>>' ( WS )* where_expr -> ^( Expr_Bin '>>' lvalue where_expr ) | -> lvalue )
			{
			DebugLocation(524, 4);
			PushFollow(Follow._lvalue_in_stmt_modify5162);
			lvalue553=lvalue();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_lvalue.Add(lvalue553.Tree);
			DebugLocation(524, 11);
			// SugarCpp.g:524:11: ( ( WS )* modify_expr_op ( WS )* where_expr -> ^( modify_expr_op lvalue where_expr ) | ( WS )* '?=' ( WS )* where_expr -> ^( '?=' lvalue where_expr ) | ( WS )* '<<' ( WS )* where_expr -> ^( Expr_Bin '<<' lvalue where_expr ) | ( WS )* '>>' ( WS )* where_expr -> ^( Expr_Bin '>>' lvalue where_expr ) | -> lvalue )
			int alt365=5;
			try { DebugEnterSubRule(365);
			try { DebugEnterDecision(365, false);
			try
			{
				alt365 = dfa365.Predict(input);
			}
			catch (NoViableAltException nvae)
			{
				DebugRecognitionException(nvae);
				throw;
			}
			} finally { DebugExitDecision(365); }
			switch (alt365)
			{
			case 1:
				DebugEnterAlt(1);
				// SugarCpp.g:524:13: ( WS )* modify_expr_op ( WS )* where_expr
				{
				DebugLocation(524, 13);
				// SugarCpp.g:524:13: ( WS )*
				try { DebugEnterSubRule(357);
				while (true)
				{
					int alt357=2;
					try { DebugEnterDecision(357, false);
					int LA357_0 = input.LA(1);

					if ((LA357_0==WS))
					{
						alt357 = 1;
					}


					} finally { DebugExitDecision(357); }
					switch ( alt357 )
					{
					case 1:
						DebugEnterAlt(1);
						// SugarCpp.g:524:13: WS
						{
						DebugLocation(524, 13);
						WS554=(IToken)Match(input,WS,Follow._WS_in_stmt_modify5166); if (state.failed) return retval; 
						if (state.backtracking == 0) stream_WS.Add(WS554);


						}
						break;

					default:
						goto loop357;
					}
				}

				loop357:
					;

				} finally { DebugExitSubRule(357); }

				DebugLocation(524, 17);
				PushFollow(Follow._modify_expr_op_in_stmt_modify5169);
				modify_expr_op555=modify_expr_op();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_modify_expr_op.Add(modify_expr_op555.Tree);
				DebugLocation(524, 32);
				// SugarCpp.g:524:32: ( WS )*
				try { DebugEnterSubRule(358);
				while (true)
				{
					int alt358=2;
					try { DebugEnterDecision(358, false);
					int LA358_0 = input.LA(1);

					if ((LA358_0==WS))
					{
						alt358 = 1;
					}


					} finally { DebugExitDecision(358); }
					switch ( alt358 )
					{
					case 1:
						DebugEnterAlt(1);
						// SugarCpp.g:524:32: WS
						{
						DebugLocation(524, 32);
						WS556=(IToken)Match(input,WS,Follow._WS_in_stmt_modify5171); if (state.failed) return retval; 
						if (state.backtracking == 0) stream_WS.Add(WS556);


						}
						break;

					default:
						goto loop358;
					}
				}

				loop358:
					;

				} finally { DebugExitSubRule(358); }

				DebugLocation(524, 36);
				PushFollow(Follow._where_expr_in_stmt_modify5174);
				where_expr557=where_expr();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_where_expr.Add(where_expr557.Tree);


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

				root_0 = (CommonTree)adaptor.Nil();
				// 524:47: -> ^( modify_expr_op lvalue where_expr )
				{
					DebugLocation(524, 50);
					// SugarCpp.g:524:50: ^( modify_expr_op lvalue where_expr )
					{
					CommonTree root_1 = (CommonTree)adaptor.Nil();
					DebugLocation(524, 52);
					root_1 = (CommonTree)adaptor.BecomeRoot(stream_modify_expr_op.NextNode(), root_1);

					DebugLocation(524, 67);
					adaptor.AddChild(root_1, stream_lvalue.NextTree());
					DebugLocation(524, 74);
					adaptor.AddChild(root_1, stream_where_expr.NextTree());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}
				}

				}
				break;
			case 2:
				DebugEnterAlt(2);
				// SugarCpp.g:525:13: ( WS )* '?=' ( WS )* where_expr
				{
				DebugLocation(525, 13);
				// SugarCpp.g:525:13: ( WS )*
				try { DebugEnterSubRule(359);
				while (true)
				{
					int alt359=2;
					try { DebugEnterDecision(359, false);
					int LA359_0 = input.LA(1);

					if ((LA359_0==WS))
					{
						alt359 = 1;
					}


					} finally { DebugExitDecision(359); }
					switch ( alt359 )
					{
					case 1:
						DebugEnterAlt(1);
						// SugarCpp.g:525:13: WS
						{
						DebugLocation(525, 13);
						WS558=(IToken)Match(input,WS,Follow._WS_in_stmt_modify5198); if (state.failed) return retval; 
						if (state.backtracking == 0) stream_WS.Add(WS558);


						}
						break;

					default:
						goto loop359;
					}
				}

				loop359:
					;

				} finally { DebugExitSubRule(359); }

				DebugLocation(525, 17);
				string_literal559=(IToken)Match(input,130,Follow._130_in_stmt_modify5201); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_130.Add(string_literal559);

				DebugLocation(525, 22);
				// SugarCpp.g:525:22: ( WS )*
				try { DebugEnterSubRule(360);
				while (true)
				{
					int alt360=2;
					try { DebugEnterDecision(360, false);
					int LA360_0 = input.LA(1);

					if ((LA360_0==WS))
					{
						alt360 = 1;
					}


					} finally { DebugExitDecision(360); }
					switch ( alt360 )
					{
					case 1:
						DebugEnterAlt(1);
						// SugarCpp.g:525:22: WS
						{
						DebugLocation(525, 22);
						WS560=(IToken)Match(input,WS,Follow._WS_in_stmt_modify5203); if (state.failed) return retval; 
						if (state.backtracking == 0) stream_WS.Add(WS560);


						}
						break;

					default:
						goto loop360;
					}
				}

				loop360:
					;

				} finally { DebugExitSubRule(360); }

				DebugLocation(525, 26);
				PushFollow(Follow._where_expr_in_stmt_modify5206);
				where_expr561=where_expr();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_where_expr.Add(where_expr561.Tree);


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

				root_0 = (CommonTree)adaptor.Nil();
				// 525:37: -> ^( '?=' lvalue where_expr )
				{
					DebugLocation(525, 40);
					// SugarCpp.g:525:40: ^( '?=' lvalue where_expr )
					{
					CommonTree root_1 = (CommonTree)adaptor.Nil();
					DebugLocation(525, 42);
					root_1 = (CommonTree)adaptor.BecomeRoot(stream_130.NextNode(), root_1);

					DebugLocation(525, 47);
					adaptor.AddChild(root_1, stream_lvalue.NextTree());
					DebugLocation(525, 54);
					adaptor.AddChild(root_1, stream_where_expr.NextTree());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}
				}

				}
				break;
			case 3:
				DebugEnterAlt(3);
				// SugarCpp.g:526:16: ( WS )* '<<' ( WS )* where_expr
				{
				DebugLocation(526, 16);
				// SugarCpp.g:526:16: ( WS )*
				try { DebugEnterSubRule(361);
				while (true)
				{
					int alt361=2;
					try { DebugEnterDecision(361, false);
					int LA361_0 = input.LA(1);

					if ((LA361_0==WS))
					{
						alt361 = 1;
					}


					} finally { DebugExitDecision(361); }
					switch ( alt361 )
					{
					case 1:
						DebugEnterAlt(1);
						// SugarCpp.g:526:16: WS
						{
						DebugLocation(526, 16);
						WS562=(IToken)Match(input,WS,Follow._WS_in_stmt_modify5233); if (state.failed) return retval; 
						if (state.backtracking == 0) stream_WS.Add(WS562);


						}
						break;

					default:
						goto loop361;
					}
				}

				loop361:
					;

				} finally { DebugExitSubRule(361); }

				DebugLocation(526, 20);
				string_literal563=(IToken)Match(input,117,Follow._117_in_stmt_modify5236); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_117.Add(string_literal563);

				DebugLocation(526, 25);
				// SugarCpp.g:526:25: ( WS )*
				try { DebugEnterSubRule(362);
				while (true)
				{
					int alt362=2;
					try { DebugEnterDecision(362, false);
					int LA362_0 = input.LA(1);

					if ((LA362_0==WS))
					{
						alt362 = 1;
					}


					} finally { DebugExitDecision(362); }
					switch ( alt362 )
					{
					case 1:
						DebugEnterAlt(1);
						// SugarCpp.g:526:25: WS
						{
						DebugLocation(526, 25);
						WS564=(IToken)Match(input,WS,Follow._WS_in_stmt_modify5238); if (state.failed) return retval; 
						if (state.backtracking == 0) stream_WS.Add(WS564);


						}
						break;

					default:
						goto loop362;
					}
				}

				loop362:
					;

				} finally { DebugExitSubRule(362); }

				DebugLocation(526, 29);
				PushFollow(Follow._where_expr_in_stmt_modify5241);
				where_expr565=where_expr();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_where_expr.Add(where_expr565.Tree);


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

				root_0 = (CommonTree)adaptor.Nil();
				// 526:40: -> ^( Expr_Bin '<<' lvalue where_expr )
				{
					DebugLocation(526, 43);
					// SugarCpp.g:526:43: ^( Expr_Bin '<<' lvalue where_expr )
					{
					CommonTree root_1 = (CommonTree)adaptor.Nil();
					DebugLocation(526, 45);
					root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Expr_Bin, "Expr_Bin"), root_1);

					DebugLocation(526, 54);
					adaptor.AddChild(root_1, stream_117.NextNode());
					DebugLocation(526, 59);
					adaptor.AddChild(root_1, stream_lvalue.NextTree());
					DebugLocation(526, 66);
					adaptor.AddChild(root_1, stream_where_expr.NextTree());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}
				}

				}
				break;
			case 4:
				DebugEnterAlt(4);
				// SugarCpp.g:527:16: ( WS )* '>>' ( WS )* where_expr
				{
				DebugLocation(527, 16);
				// SugarCpp.g:527:16: ( WS )*
				try { DebugEnterSubRule(363);
				while (true)
				{
					int alt363=2;
					try { DebugEnterDecision(363, false);
					int LA363_0 = input.LA(1);

					if ((LA363_0==WS))
					{
						alt363 = 1;
					}


					} finally { DebugExitDecision(363); }
					switch ( alt363 )
					{
					case 1:
						DebugEnterAlt(1);
						// SugarCpp.g:527:16: WS
						{
						DebugLocation(527, 16);
						WS566=(IToken)Match(input,WS,Follow._WS_in_stmt_modify5270); if (state.failed) return retval; 
						if (state.backtracking == 0) stream_WS.Add(WS566);


						}
						break;

					default:
						goto loop363;
					}
				}

				loop363:
					;

				} finally { DebugExitSubRule(363); }

				DebugLocation(527, 20);
				string_literal567=(IToken)Match(input,127,Follow._127_in_stmt_modify5273); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_127.Add(string_literal567);

				DebugLocation(527, 25);
				// SugarCpp.g:527:25: ( WS )*
				try { DebugEnterSubRule(364);
				while (true)
				{
					int alt364=2;
					try { DebugEnterDecision(364, false);
					int LA364_0 = input.LA(1);

					if ((LA364_0==WS))
					{
						alt364 = 1;
					}


					} finally { DebugExitDecision(364); }
					switch ( alt364 )
					{
					case 1:
						DebugEnterAlt(1);
						// SugarCpp.g:527:25: WS
						{
						DebugLocation(527, 25);
						WS568=(IToken)Match(input,WS,Follow._WS_in_stmt_modify5275); if (state.failed) return retval; 
						if (state.backtracking == 0) stream_WS.Add(WS568);


						}
						break;

					default:
						goto loop364;
					}
				}

				loop364:
					;

				} finally { DebugExitSubRule(364); }

				DebugLocation(527, 29);
				PushFollow(Follow._where_expr_in_stmt_modify5278);
				where_expr569=where_expr();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_where_expr.Add(where_expr569.Tree);


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

				root_0 = (CommonTree)adaptor.Nil();
				// 527:40: -> ^( Expr_Bin '>>' lvalue where_expr )
				{
					DebugLocation(527, 43);
					// SugarCpp.g:527:43: ^( Expr_Bin '>>' lvalue where_expr )
					{
					CommonTree root_1 = (CommonTree)adaptor.Nil();
					DebugLocation(527, 45);
					root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(Expr_Bin, "Expr_Bin"), root_1);

					DebugLocation(527, 54);
					adaptor.AddChild(root_1, stream_127.NextNode());
					DebugLocation(527, 59);
					adaptor.AddChild(root_1, stream_lvalue.NextTree());
					DebugLocation(527, 66);
					adaptor.AddChild(root_1, stream_where_expr.NextTree());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}
				}

				}
				break;
			case 5:
				DebugEnterAlt(5);
				// SugarCpp.g:528:7: 
				{

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

				root_0 = (CommonTree)adaptor.Nil();
				// 528:7: -> lvalue
				{
					DebugLocation(528, 10);
					adaptor.AddChild(root_0, stream_lvalue.NextTree());

				}

				retval.Tree = root_0;
				}
				}

				}
				break;

			}
			} finally { DebugExitSubRule(365); }


			}

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

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

		}
		finally
		{
			TraceOut("stmt_modify", 57);
			LeaveRule("stmt_modify", 57);
			LeaveRule_stmt_modify();
		}
		DebugLocation(529, 1);
		} finally { DebugExitRule(GrammarFileName, "stmt_modify"); }
		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;
		}
Пример #3
0
    // $ANTLR start "unaryExpression"
    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:491:1: unaryExpression : (m= MINUS mu= unaryExpression -> ^( UNARY_MINUS[$m] $mu) | p= PLUS pu= unaryExpression -> ^( UNARY_PLUS[$p] $pu) | c= caseExpression -> ^( $c) | q= quantifiedExpression -> ^( $q) | a= atom -> ^( $a) );
    public HqlParser.unaryExpression_return unaryExpression() // throws RecognitionException [1]
    {   
        HqlParser.unaryExpression_return retval = new HqlParser.unaryExpression_return();
        retval.Start = input.LT(1);

        IASTNode root_0 = null;

        IToken m = null;
        IToken p = null;
        HqlParser.unaryExpression_return mu = default(HqlParser.unaryExpression_return);

        HqlParser.unaryExpression_return pu = default(HqlParser.unaryExpression_return);

        HqlParser.caseExpression_return c = default(HqlParser.caseExpression_return);

        HqlParser.quantifiedExpression_return q = default(HqlParser.quantifiedExpression_return);

        HqlParser.atom_return a = default(HqlParser.atom_return);


        IASTNode m_tree=null;
        IASTNode p_tree=null;
        RewriteRuleTokenStream stream_MINUS = new RewriteRuleTokenStream(adaptor,"token MINUS");
        RewriteRuleTokenStream stream_PLUS = new RewriteRuleTokenStream(adaptor,"token PLUS");
        RewriteRuleSubtreeStream stream_unaryExpression = new RewriteRuleSubtreeStream(adaptor,"rule unaryExpression");
        RewriteRuleSubtreeStream stream_atom = new RewriteRuleSubtreeStream(adaptor,"rule atom");
        RewriteRuleSubtreeStream stream_quantifiedExpression = new RewriteRuleSubtreeStream(adaptor,"rule quantifiedExpression");
        RewriteRuleSubtreeStream stream_caseExpression = new RewriteRuleSubtreeStream(adaptor,"rule caseExpression");
        try 
    	{
            // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:492:2: (m= MINUS mu= unaryExpression -> ^( UNARY_MINUS[$m] $mu) | p= PLUS pu= unaryExpression -> ^( UNARY_PLUS[$p] $pu) | c= caseExpression -> ^( $c) | q= quantifiedExpression -> ^( $q) | a= atom -> ^( $a) )
            int alt68 = 5;
            switch ( input.LA(1) ) 
            {
            case MINUS:
            	{
                alt68 = 1;
                }
                break;
            case PLUS:
            	{
                alt68 = 2;
                }
                break;
            case CASE:
            	{
                alt68 = 3;
                }
                break;
            case ALL:
            case ANY:
            case EXISTS:
            case SOME:
            	{
                alt68 = 4;
                }
                break;
            case AVG:
            case COUNT:
            case ELEMENTS:
            case FALSE:
            case INDICES:
            case MAX:
            case MIN:
            case NULL:
            case SUM:
            case TRUE:
            case EMPTY:
            case NUM_INT:
            case NUM_DOUBLE:
            case NUM_FLOAT:
            case NUM_LONG:
            case OPEN:
            case COLON:
            case PARAM:
            case QUOTED_String:
            case IDENT:
            	{
                alt68 = 5;
                }
                break;
            	default:
            	    NoViableAltException nvae_d68s0 =
            	        new NoViableAltException("", 68, 0, input);

            	    throw nvae_d68s0;
            }

            switch (alt68) 
            {
                case 1 :
                    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:492:4: m= MINUS mu= unaryExpression
                    {
                    	m=(IToken)Match(input,MINUS,FOLLOW_MINUS_in_unaryExpression2400);  
                    	stream_MINUS.Add(m);

                    	PushFollow(FOLLOW_unaryExpression_in_unaryExpression2404);
                    	mu = unaryExpression();
                    	state.followingStackPointer--;

                    	stream_unaryExpression.Add(mu.Tree);


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

                    	root_0 = (IASTNode)adaptor.GetNilNode();
                    	// 492:31: -> ^( UNARY_MINUS[$m] $mu)
                    	{
                    	    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:492:34: ^( UNARY_MINUS[$m] $mu)
                    	    {
                    	    IASTNode root_1 = (IASTNode)adaptor.GetNilNode();
                    	    root_1 = (IASTNode)adaptor.BecomeRoot((IASTNode)adaptor.Create(UNARY_MINUS, m), root_1);

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

                    	    adaptor.AddChild(root_0, root_1);
                    	    }

                    	}

                    	retval.Tree = root_0;retval.Tree = root_0;
                    }
                    break;
                case 2 :
                    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:493:4: p= PLUS pu= unaryExpression
                    {
                    	p=(IToken)Match(input,PLUS,FOLLOW_PLUS_in_unaryExpression2421);  
                    	stream_PLUS.Add(p);

                    	PushFollow(FOLLOW_unaryExpression_in_unaryExpression2425);
                    	pu = unaryExpression();
                    	state.followingStackPointer--;

                    	stream_unaryExpression.Add(pu.Tree);


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

                    	root_0 = (IASTNode)adaptor.GetNilNode();
                    	// 493:30: -> ^( UNARY_PLUS[$p] $pu)
                    	{
                    	    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:493:33: ^( UNARY_PLUS[$p] $pu)
                    	    {
                    	    IASTNode root_1 = (IASTNode)adaptor.GetNilNode();
                    	    root_1 = (IASTNode)adaptor.BecomeRoot((IASTNode)adaptor.Create(UNARY_PLUS, p), root_1);

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

                    	    adaptor.AddChild(root_0, root_1);
                    	    }

                    	}

                    	retval.Tree = root_0;retval.Tree = root_0;
                    }
                    break;
                case 3 :
                    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:494:4: c= caseExpression
                    {
                    	PushFollow(FOLLOW_caseExpression_in_unaryExpression2442);
                    	c = caseExpression();
                    	state.followingStackPointer--;

                    	stream_caseExpression.Add(c.Tree);


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

                    	root_0 = (IASTNode)adaptor.GetNilNode();
                    	// 494:21: -> ^( $c)
                    	{
                    	    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:494:24: ^( $c)
                    	    {
                    	    IASTNode root_1 = (IASTNode)adaptor.GetNilNode();
                    	    root_1 = (IASTNode)adaptor.BecomeRoot(stream_c.NextNode(), root_1);

                    	    adaptor.AddChild(root_0, root_1);
                    	    }

                    	}

                    	retval.Tree = root_0;retval.Tree = root_0;
                    }
                    break;
                case 4 :
                    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:495:4: q= quantifiedExpression
                    {
                    	PushFollow(FOLLOW_quantifiedExpression_in_unaryExpression2456);
                    	q = quantifiedExpression();
                    	state.followingStackPointer--;

                    	stream_quantifiedExpression.Add(q.Tree);


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

                    	root_0 = (IASTNode)adaptor.GetNilNode();
                    	// 495:27: -> ^( $q)
                    	{
                    	    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:495:30: ^( $q)
                    	    {
                    	    IASTNode root_1 = (IASTNode)adaptor.GetNilNode();
                    	    root_1 = (IASTNode)adaptor.BecomeRoot(stream_q.NextNode(), root_1);

                    	    adaptor.AddChild(root_0, root_1);
                    	    }

                    	}

                    	retval.Tree = root_0;retval.Tree = root_0;
                    }
                    break;
                case 5 :
                    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:496:4: a= atom
                    {
                    	PushFollow(FOLLOW_atom_in_unaryExpression2471);
                    	a = atom();
                    	state.followingStackPointer--;

                    	stream_atom.Add(a.Tree);


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

                    	root_0 = (IASTNode)adaptor.GetNilNode();
                    	// 496:11: -> ^( $a)
                    	{
                    	    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:496:14: ^( $a)
                    	    {
                    	    IASTNode root_1 = (IASTNode)adaptor.GetNilNode();
                    	    root_1 = (IASTNode)adaptor.BecomeRoot(stream_a.NextNode(), root_1);

                    	    adaptor.AddChild(root_0, root_1);
                    	    }

                    	}

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

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

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

        }
        finally 
    	{
        }
        return retval;
    }
Пример #4
0
    // $ANTLR start "expressionOrVector"
    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:548:1: expressionOrVector : e= expression (v= vectorExpr )? -> {v != null}? ^( VECTOR_EXPR[\"{vector}\"] $e $v) -> ^( $e) ;
    public HqlParser.expressionOrVector_return expressionOrVector() // throws RecognitionException [1]
    {   
        HqlParser.expressionOrVector_return retval = new HqlParser.expressionOrVector_return();
        retval.Start = input.LT(1);

        IASTNode root_0 = null;

        HqlParser.expression_return e = default(HqlParser.expression_return);

        HqlParser.vectorExpr_return v = default(HqlParser.vectorExpr_return);


        RewriteRuleSubtreeStream stream_vectorExpr = new RewriteRuleSubtreeStream(adaptor,"rule vectorExpr");
        RewriteRuleSubtreeStream stream_expression = new RewriteRuleSubtreeStream(adaptor,"rule expression");
        try 
    	{
            // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:549:2: (e= expression (v= vectorExpr )? -> {v != null}? ^( VECTOR_EXPR[\"{vector}\"] $e $v) -> ^( $e) )
            // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:549:4: e= expression (v= vectorExpr )?
            {
            	PushFollow(FOLLOW_expression_in_expressionOrVector2861);
            	e = expression();
            	state.followingStackPointer--;

            	stream_expression.Add(e.Tree);
            	// /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:549:17: (v= vectorExpr )?
            	int alt82 = 2;
            	int LA82_0 = input.LA(1);

            	if ( (LA82_0 == COMMA) )
            	{
            	    alt82 = 1;
            	}
            	switch (alt82) 
            	{
            	    case 1 :
            	        // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:549:19: v= vectorExpr
            	        {
            	        	PushFollow(FOLLOW_vectorExpr_in_expressionOrVector2867);
            	        	v = vectorExpr();
            	        	state.followingStackPointer--;

            	        	stream_vectorExpr.Add(v.Tree);

            	        }
            	        break;

            	}



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

            	root_0 = (IASTNode)adaptor.GetNilNode();
            	// 550:2: -> {v != null}? ^( VECTOR_EXPR[\"{vector}\"] $e $v)
            	if (v != null)
            	{
            	    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:550:18: ^( VECTOR_EXPR[\"{vector}\"] $e $v)
            	    {
            	    IASTNode root_1 = (IASTNode)adaptor.GetNilNode();
            	    root_1 = (IASTNode)adaptor.BecomeRoot((IASTNode)adaptor.Create(VECTOR_EXPR, "{vector}"), root_1);

            	    adaptor.AddChild(root_1, stream_e.NextTree());
            	    adaptor.AddChild(root_1, stream_v.NextTree());

            	    adaptor.AddChild(root_0, root_1);
            	    }

            	}
            	else // 551:2: -> ^( $e)
            	{
            	    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:551:5: ^( $e)
            	    {
            	    IASTNode root_1 = (IASTNode)adaptor.GetNilNode();
            	    root_1 = (IASTNode)adaptor.BecomeRoot(stream_e.NextNode(), root_1);

            	    adaptor.AddChild(root_0, root_1);
            	    }

            	}

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

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

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

        }
        finally 
    	{
        }
        return retval;
    }
	private AstParserRuleReturnScope<object, IToken> propertyname(bool subquery)
	{
		EnterRule_propertyname();
		EnterRule("propertyname", 22);
		TraceIn("propertyname", 22);
		AstParserRuleReturnScope<object, IToken> retval = new AstParserRuleReturnScope<object, IToken>();
		retval.Start = (IToken)input.LT(1);

		object root_0 = default(object);

		IToken char_literal90 = default(IToken);
		AstParserRuleReturnScope<object, IToken> next = default(AstParserRuleReturnScope<object, IToken>);
		AstParserRuleReturnScope<object, IToken> identifierpart89 = default(AstParserRuleReturnScope<object, IToken>);

		object char_literal90_tree = default(object);
		RewriteRuleITokenStream stream_74=new RewriteRuleITokenStream(adaptor,"token 74");
		RewriteRuleSubtreeStream stream_identifierpart=new RewriteRuleSubtreeStream(adaptor,"rule identifierpart");
		RewriteRuleSubtreeStream stream_subpropertyname=new RewriteRuleSubtreeStream(adaptor,"rule subpropertyname");
		try { DebugEnterRule(GrammarFileName, "propertyname");
		DebugLocation(110, 108);
		try
		{
			// C:\\projects\\LinqToQuerystring\\LinqToQuerystring\\LinqToQuerystring.g:111:2: ( ( identifierpart[subquery] -> identifierpart ) ( '/' next= subpropertyname[false] -> ^( $propertyname $next) )? )
			DebugEnterAlt(1);
			// C:\\projects\\LinqToQuerystring\\LinqToQuerystring\\LinqToQuerystring.g:111:4: ( identifierpart[subquery] -> identifierpart ) ( '/' next= subpropertyname[false] -> ^( $propertyname $next) )?
			{
			DebugLocation(111, 4);
			// C:\\projects\\LinqToQuerystring\\LinqToQuerystring\\LinqToQuerystring.g:111:4: ( identifierpart[subquery] -> identifierpart )
			DebugEnterAlt(1);
			// C:\\projects\\LinqToQuerystring\\LinqToQuerystring\\LinqToQuerystring.g:111:5: identifierpart[subquery]
			{
			DebugLocation(111, 5);
			PushFollow(Follow._identifierpart_in_propertyname870);
			identifierpart89=identifierpart(subquery);
			PopFollow();

			stream_identifierpart.Add(identifierpart89.Tree);


			{
			// AST REWRITE
			// elements: identifierpart
			// 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();
			// 111:30: -> identifierpart
			{
				DebugLocation(111, 33);
				adaptor.AddChild(root_0, stream_identifierpart.NextTree());

			}

			retval.Tree = root_0;
			}

			}

			DebugLocation(111, 49);
			// C:\\projects\\LinqToQuerystring\\LinqToQuerystring\\LinqToQuerystring.g:111:49: ( '/' next= subpropertyname[false] -> ^( $propertyname $next) )?
			int alt25=2;
			try { DebugEnterSubRule(25);
			try { DebugEnterDecision(25, false);
			int LA25_1 = input.LA(1);

			if ((LA25_1==74))
			{
				int LA25_2 = input.LA(2);

				if ((LA25_2==DYNAMICIDENTIFIER||LA25_2==IDENTIFIER))
				{
					alt25 = 1;
				}
			}
			} finally { DebugExitDecision(25); }
			switch (alt25)
			{
			case 1:
				DebugEnterAlt(1);
				// C:\\projects\\LinqToQuerystring\\LinqToQuerystring\\LinqToQuerystring.g:111:50: '/' next= subpropertyname[false]
				{
				DebugLocation(111, 50);
				char_literal90=(IToken)Match(input,74,Follow._74_in_propertyname879);  
				stream_74.Add(char_literal90);

				DebugLocation(111, 58);
				PushFollow(Follow._subpropertyname_in_propertyname883);
				next=subpropertyname(false);
				PopFollow();

				stream_subpropertyname.Add(next.Tree);


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

				root_0 = (object)adaptor.Nil();
				// 111:82: -> ^( $propertyname $next)
				{
					DebugLocation(111, 85);
					// C:\\projects\\LinqToQuerystring\\LinqToQuerystring\\LinqToQuerystring.g:111:85: ^( $propertyname $next)
					{
					object root_1 = (object)adaptor.Nil();
					DebugLocation(111, 88);
					root_1 = (object)adaptor.BecomeRoot(stream_retval.NextNode(), root_1);

					DebugLocation(111, 102);
					adaptor.AddChild(root_1, stream_next.NextTree());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}

				}
				break;

			}
			} finally { DebugExitSubRule(25); }


			}

			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("propertyname", 22);
			LeaveRule("propertyname", 22);
			LeaveRule_propertyname();
		}
		DebugLocation(111, 108);
		} finally { DebugExitRule(GrammarFileName, "propertyname"); }
		return retval;

	}
Пример #6
0
    // $ANTLR start "negatedExpression"
    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:373:1: negatedExpression : ( NOT x= negatedExpression -> ^() | equalityExpression -> ^( equalityExpression ) );
    public HqlParser.negatedExpression_return negatedExpression() // throws RecognitionException [1]
    {   
        HqlParser.negatedExpression_return retval = new HqlParser.negatedExpression_return();
        retval.Start = input.LT(1);

        IASTNode root_0 = null;

        IToken NOT148 = null;
        HqlParser.negatedExpression_return x = default(HqlParser.negatedExpression_return);

        HqlParser.equalityExpression_return equalityExpression149 = default(HqlParser.equalityExpression_return);


        IASTNode NOT148_tree=null;
        RewriteRuleTokenStream stream_NOT = new RewriteRuleTokenStream(adaptor,"token NOT");
        RewriteRuleSubtreeStream stream_negatedExpression = new RewriteRuleSubtreeStream(adaptor,"rule negatedExpression");
        RewriteRuleSubtreeStream stream_equalityExpression = new RewriteRuleSubtreeStream(adaptor,"rule equalityExpression");
         WeakKeywords(); 
        try 
    	{
            // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:375:2: ( NOT x= negatedExpression -> ^() | equalityExpression -> ^( equalityExpression ) )
            int alt47 = 2;
            int LA47_0 = input.LA(1);

            if ( (LA47_0 == NOT) )
            {
                alt47 = 1;
            }
            else if ( ((LA47_0 >= ALL && LA47_0 <= ANY) || LA47_0 == AVG || LA47_0 == COUNT || LA47_0 == ELEMENTS || (LA47_0 >= EXISTS && LA47_0 <= FALSE) || LA47_0 == INDICES || (LA47_0 >= MAX && LA47_0 <= MIN) || LA47_0 == NULL || (LA47_0 >= SOME && LA47_0 <= TRUE) || LA47_0 == CASE || LA47_0 == EMPTY || (LA47_0 >= NUM_INT && LA47_0 <= NUM_LONG) || LA47_0 == OPEN || LA47_0 == BNOT || (LA47_0 >= PLUS && LA47_0 <= MINUS) || (LA47_0 >= COLON && LA47_0 <= IDENT)) )
            {
                alt47 = 2;
            }
            else 
            {
                NoViableAltException nvae_d47s0 =
                    new NoViableAltException("", 47, 0, input);

                throw nvae_d47s0;
            }
            switch (alt47) 
            {
                case 1 :
                    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:375:4: NOT x= negatedExpression
                    {
                    	NOT148=(IToken)Match(input,NOT,FOLLOW_NOT_in_negatedExpression1854);  
                    	stream_NOT.Add(NOT148);

                    	PushFollow(FOLLOW_negatedExpression_in_negatedExpression1858);
                    	x = negatedExpression();
                    	state.followingStackPointer--;

                    	stream_negatedExpression.Add(x.Tree);


                    	// 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 = (IASTNode)adaptor.GetNilNode();
                    	// 376:3: -> ^()
                    	{
                    	    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:376:6: ^()
                    	    {
                    	    IASTNode root_1 = (IASTNode)adaptor.GetNilNode();
                    	    root_1 = (IASTNode)adaptor.BecomeRoot(NegateNode(((x != null) ? ((IASTNode)x.Tree) : null)), root_1);

                    	    adaptor.AddChild(root_0, root_1);
                    	    }

                    	}

                    	retval.Tree = root_0;retval.Tree = root_0;
                    }
                    break;
                case 2 :
                    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:377:4: equalityExpression
                    {
                    	PushFollow(FOLLOW_equalityExpression_in_negatedExpression1871);
                    	equalityExpression149 = equalityExpression();
                    	state.followingStackPointer--;

                    	stream_equalityExpression.Add(equalityExpression149.Tree);


                    	// AST REWRITE
                    	// elements:          equalityExpression
                    	// 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 = (IASTNode)adaptor.GetNilNode();
                    	// 378:3: -> ^( equalityExpression )
                    	{
                    	    // /Users/Steve/Projects/NHibernate/Branches/2.1.x/nhibernate/src/NHibernate/Hql/Ast/ANTLR/Hql.g:378:6: ^( equalityExpression )
                    	    {
                    	    IASTNode root_1 = (IASTNode)adaptor.GetNilNode();
                    	    root_1 = (IASTNode)adaptor.BecomeRoot(stream_equalityExpression.NextNode(), root_1);

                    	    adaptor.AddChild(root_0, root_1);
                    	    }

                    	}

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

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

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

        }
        finally 
    	{
        }
        return retval;
    }
		public void CheckRRSubtreeStreamBehaviourWhileEmpty1() {
			string description = "RewriteRuleSubtreeStream test";
			RewriteRuleSubtreeStream subtreeTest =
				new RewriteRuleSubtreeStream(CreateTreeAdaptor(), description);

			Assert.IsFalse(subtreeTest.HasNext(), "HasNext() has to give back false here.");
			Assert.AreEqual(description.ToString(), subtreeTest.Description,
				"Description strings should be equal.");
			Assert.AreEqual(0, subtreeTest.Size(), "The number of elements should be zero.");
			subtreeTest.Reset();
			Assert.IsTrue(true, "Reset() shouldn't make any problems here.");
			Assert.AreEqual(0, subtreeTest.Size(),
				"The number of elements should be still zero.");
			subtreeTest.NextNode();
		}
		public void CheckRRSubtreeStreamBehaviourWithElements() {
			RewriteRuleSubtreeStream subtreeTest =
				new RewriteRuleSubtreeStream(CreateTreeAdaptor(),
				"RewriteRuleSubtreeStream test");

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

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

			// Test NextNode()
			Assert.AreEqual(tree1, (ITree) subtreeTest.NextNode(),
				"The returned tree should be equal to the given tree (1).");
			Assert.AreEqual(1, subtreeTest.Size(), "subtreeTest should have the size 1 (2).");
			Assert.IsFalse(subtreeTest.HasNext(), "HasNext() should be false here (1).");
			subtreeTest.Reset();
			Assert.AreEqual(1, subtreeTest.Size(), "subtreeTest should have the size 1 (3).");
			Assert.IsTrue(subtreeTest.HasNext(), "HasNext() should be true here (2).");
			
			// Test NextTree()
			CommonTree returnedTree = (CommonTree) subtreeTest.NextTree();
			Assert.AreEqual(token1, returnedTree.Token,
				"The returned token should be equal to the given token (3).");
			Assert.AreEqual(1, subtreeTest.Size(), "subtreeTest should have the size 1 (4).");
			Assert.IsFalse(subtreeTest.HasNext(), "HasNext() should be false here (2).");
			subtreeTest.Reset();
			Assert.AreEqual(1, subtreeTest.Size(), "subtreeTest should have the size 1 (5).");
			Assert.IsTrue(subtreeTest.HasNext(), "HasNext() should be true here (3).");
			
			// Test, what happens with two elements
			IToken token2 = CreateToken(2, "test token without any real context");
			ITree tree2 = CreateTree(token2);

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

			// Test exception
			subtreeTest.NextTree();
		}
Пример #9
0
    // $ANTLR start "varsDecl"
    // MathExpr.g:109:1: varsDecl : ident varDecl ( ',' varDecl )* -> ^( VAR ^( ident ( varDecl )+ ) ) ;
    public MathExprParser.varsDecl_return varsDecl() // throws RecognitionException [1]
    {   
        MathExprParser.varsDecl_return retval = new MathExprParser.varsDecl_return();
        retval.Start = input.LT(1);
        int varsDecl_StartIndex = input.Index();
        AstNode root_0 = null;

        IToken char_literal41 = null;
        MathExprParser.ident_return ident39 = default(MathExprParser.ident_return);

        MathExprParser.varDecl_return varDecl40 = default(MathExprParser.varDecl_return);

        MathExprParser.varDecl_return varDecl42 = default(MathExprParser.varDecl_return);


        AstNode char_literal41_tree=null;
        RewriteRuleTokenStream stream_50 = new RewriteRuleTokenStream(adaptor,"token 50");
        RewriteRuleSubtreeStream stream_ident = new RewriteRuleSubtreeStream(adaptor,"rule ident");
        RewriteRuleSubtreeStream stream_varDecl = new RewriteRuleSubtreeStream(adaptor,"rule varDecl");
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 13) ) 
    	    {
    	    	return retval; 
    	    }
            // MathExpr.g:109:9: ( ident varDecl ( ',' varDecl )* -> ^( VAR ^( ident ( varDecl )+ ) ) )
            // MathExpr.g:109:11: ident varDecl ( ',' varDecl )*
            {
            	PushFollow(FOLLOW_ident_in_varsDecl1183);
            	ident39 = ident();
            	state.followingStackPointer--;
            	if (state.failed) return retval;
            	if ( (state.backtracking==0) ) stream_ident.Add(ident39.Tree);
            	PushFollow(FOLLOW_varDecl_in_varsDecl1185);
            	varDecl40 = varDecl();
            	state.followingStackPointer--;
            	if (state.failed) return retval;
            	if ( (state.backtracking==0) ) stream_varDecl.Add(varDecl40.Tree);
            	// MathExpr.g:109:25: ( ',' varDecl )*
            	do 
            	{
            	    int alt11 = 2;
            	    int LA11_0 = input.LA(1);

            	    if ( (LA11_0 == 50) )
            	    {
            	        int LA11_2 = input.LA(2);

            	        if ( (LA11_2 == IDENT) )
            	        {
            	            int LA11_3 = input.LA(3);

            	            if ( (synpred26_MathExpr()) )
            	            {
            	                alt11 = 1;
            	            }


            	        }


            	    }


            	    switch (alt11) 
            		{
            			case 1 :
            			    // MathExpr.g:109:27: ',' varDecl
            			    {
            			    	char_literal41=(IToken)Match(input,50,FOLLOW_50_in_varsDecl1189); if (state.failed) return retval; 
            			    	if ( (state.backtracking==0) ) stream_50.Add(char_literal41);

            			    	PushFollow(FOLLOW_varDecl_in_varsDecl1191);
            			    	varDecl42 = varDecl();
            			    	state.followingStackPointer--;
            			    	if (state.failed) return retval;
            			    	if ( (state.backtracking==0) ) stream_varDecl.Add(varDecl42.Tree);

            			    }
            			    break;

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

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



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

            	root_0 = (AstNode)adaptor.GetNilNode();
            	// 109:42: -> ^( VAR ^( ident ( varDecl )+ ) )
            	{
            	    // MathExpr.g:109:45: ^( VAR ^( ident ( varDecl )+ ) )
            	    {
            	    AstNode root_1 = (AstNode)adaptor.GetNilNode();
            	    root_1 = (AstNode)adaptor.BecomeRoot((AstNode)adaptor.Create(VAR, "VAR"), root_1);

            	    // MathExpr.g:109:51: ^( ident ( varDecl )+ )
            	    {
            	    AstNode root_2 = (AstNode)adaptor.GetNilNode();
            	    root_2 = (AstNode)adaptor.BecomeRoot(stream_ident.NextNode(), root_2);

            	    if ( !(stream_varDecl.HasNext()) ) {
            	        throw new RewriteEarlyExitException();
            	    }
            	    while ( stream_varDecl.HasNext() )
            	    {
            	        adaptor.AddChild(root_2, stream_varDecl.NextTree());

            	    }
            	    stream_varDecl.Reset();

            	    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);

            if ( (state.backtracking==0) )
            {	retval.Tree = (AstNode)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 = (AstNode)adaptor.ErrorNode(input, (IToken) retval.Start, input.LT(-1), re);

        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 13, varsDecl_StartIndex); 
            }
        }
        return retval;
    }
Пример #10
0
	private AstParserRuleReturnScope<CommonTree, IToken> qualifiedIdentExpression()
	{
		EnterRule_qualifiedIdentExpression();
		EnterRule("qualifiedIdentExpression", 106);
		TraceIn("qualifiedIdentExpression", 106);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);
		int qualifiedIdentExpression_StartIndex = input.Index;

		CommonTree root_0 = default(CommonTree);

		IToken outerDot = default(IToken);
		IToken Super = default(IToken);
		IToken innerDot = default(IToken);
		IToken DOT493 = default(IToken);
		IToken CLASS494 = default(IToken);
		IToken CLASS496 = default(IToken);
		IToken SUPER499 = default(IToken);
		IToken IDENT500 = default(IToken);
		IToken IDENT502 = default(IToken);
		IToken THIS504 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> qualifiedIdentifier491 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> arrayDeclarator492 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> arguments495 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> genericTypeArgumentListSimplified497 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> arguments498 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> arguments501 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> arguments503 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> arguments505 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> innerNewExpression506 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree outerDot_tree = default(CommonTree);
		CommonTree Super_tree = default(CommonTree);
		CommonTree innerDot_tree = default(CommonTree);
		CommonTree DOT493_tree = default(CommonTree);
		CommonTree CLASS494_tree = default(CommonTree);
		CommonTree CLASS496_tree = default(CommonTree);
		CommonTree SUPER499_tree = default(CommonTree);
		CommonTree IDENT500_tree = default(CommonTree);
		CommonTree IDENT502_tree = default(CommonTree);
		CommonTree THIS504_tree = default(CommonTree);
		RewriteRuleITokenStream stream_DOT=new RewriteRuleITokenStream(adaptor,"token DOT");
		RewriteRuleITokenStream stream_CLASS=new RewriteRuleITokenStream(adaptor,"token CLASS");
		RewriteRuleITokenStream stream_SUPER=new RewriteRuleITokenStream(adaptor,"token SUPER");
		RewriteRuleITokenStream stream_IDENT=new RewriteRuleITokenStream(adaptor,"token IDENT");
		RewriteRuleITokenStream stream_THIS=new RewriteRuleITokenStream(adaptor,"token THIS");
		RewriteRuleSubtreeStream stream_qualifiedIdentifier=new RewriteRuleSubtreeStream(adaptor,"rule qualifiedIdentifier");
		RewriteRuleSubtreeStream stream_arrayDeclarator=new RewriteRuleSubtreeStream(adaptor,"rule arrayDeclarator");
		RewriteRuleSubtreeStream stream_arguments=new RewriteRuleSubtreeStream(adaptor,"rule arguments");
		RewriteRuleSubtreeStream stream_genericTypeArgumentListSimplified=new RewriteRuleSubtreeStream(adaptor,"rule genericTypeArgumentListSimplified");
		RewriteRuleSubtreeStream stream_innerNewExpression=new RewriteRuleSubtreeStream(adaptor,"rule innerNewExpression");
		try { DebugEnterRule(GrammarFileName, "qualifiedIdentExpression");
		DebugLocation(940, 4);
		try
		{
			if (state.backtracking > 0 && AlreadyParsedRule(input, 106)) { return retval; }

			// Java.g:942:5: ( ( qualifiedIdentifier -> qualifiedIdentifier ) ( ( arrayDeclarator -> ^( arrayDeclarator $qualifiedIdentExpression) )+ ( DOT CLASS -> ^( DOT $qualifiedIdentExpression CLASS ) ) | arguments -> ^( METHOD_CALL qualifiedIdentifier arguments ) |outerDot= DOT ( CLASS -> ^( DOT qualifiedIdentifier CLASS ) | genericTypeArgumentListSimplified (Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier genericTypeArgumentListSimplified arguments ) | SUPER innerDot= DOT IDENT arguments -> ^( METHOD_CALL ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT ) genericTypeArgumentListSimplified arguments ) | IDENT arguments -> ^( METHOD_CALL ^( DOT qualifiedIdentifier IDENT ) genericTypeArgumentListSimplified arguments ) ) | THIS -> ^( DOT qualifiedIdentifier THIS ) |Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier arguments ) | innerNewExpression -> ^( DOT qualifiedIdentifier innerNewExpression ) ) )? )
			DebugEnterAlt(1);
			// Java.g:942:9: ( qualifiedIdentifier -> qualifiedIdentifier ) ( ( arrayDeclarator -> ^( arrayDeclarator $qualifiedIdentExpression) )+ ( DOT CLASS -> ^( DOT $qualifiedIdentExpression CLASS ) ) | arguments -> ^( METHOD_CALL qualifiedIdentifier arguments ) |outerDot= DOT ( CLASS -> ^( DOT qualifiedIdentifier CLASS ) | genericTypeArgumentListSimplified (Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier genericTypeArgumentListSimplified arguments ) | SUPER innerDot= DOT IDENT arguments -> ^( METHOD_CALL ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT ) genericTypeArgumentListSimplified arguments ) | IDENT arguments -> ^( METHOD_CALL ^( DOT qualifiedIdentifier IDENT ) genericTypeArgumentListSimplified arguments ) ) | THIS -> ^( DOT qualifiedIdentifier THIS ) |Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier arguments ) | innerNewExpression -> ^( DOT qualifiedIdentifier innerNewExpression ) ) )?
			{
			DebugLocation(942, 9);
			// Java.g:942:9: ( qualifiedIdentifier -> qualifiedIdentifier )
			DebugEnterAlt(1);
			// Java.g:942:13: qualifiedIdentifier
			{
			DebugLocation(942, 13);
			PushFollow(Follow._qualifiedIdentifier_in_qualifiedIdentExpression13626);
			qualifiedIdentifier491=qualifiedIdentifier();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_qualifiedIdentifier.Add(qualifiedIdentifier491.Tree);


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

			root_0 = (CommonTree)adaptor.Nil();
			// 942:61: -> qualifiedIdentifier
			{
				DebugLocation(942, 65);
				adaptor.AddChild(root_0, stream_qualifiedIdentifier.NextTree());

			}

			retval.Tree = root_0;
			}
			}

			}

			DebugLocation(945, 9);
			// Java.g:945:9: ( ( arrayDeclarator -> ^( arrayDeclarator $qualifiedIdentExpression) )+ ( DOT CLASS -> ^( DOT $qualifiedIdentExpression CLASS ) ) | arguments -> ^( METHOD_CALL qualifiedIdentifier arguments ) |outerDot= DOT ( CLASS -> ^( DOT qualifiedIdentifier CLASS ) | genericTypeArgumentListSimplified (Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier genericTypeArgumentListSimplified arguments ) | SUPER innerDot= DOT IDENT arguments -> ^( METHOD_CALL ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT ) genericTypeArgumentListSimplified arguments ) | IDENT arguments -> ^( METHOD_CALL ^( DOT qualifiedIdentifier IDENT ) genericTypeArgumentListSimplified arguments ) ) | THIS -> ^( DOT qualifiedIdentifier THIS ) |Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier arguments ) | innerNewExpression -> ^( DOT qualifiedIdentifier innerNewExpression ) ) )?
			int alt143=4;
			try { DebugEnterSubRule(143);
			try { DebugEnterDecision(143, false);
			switch (input.LA(1))
			{
			case LBRACK:
				{
				int LA143_2 = input.LA(2);

				if ((EvaluatePredicate(synpred218_Java_fragment)))
				{
					alt143 = 1;
				}
				}
				break;
			case LPAREN:
				{
				alt143 = 2;
				}
				break;
			case DOT:
				{
				int LA143_2 = input.LA(2);

				if ((EvaluatePredicate(synpred226_Java_fragment)))
				{
					alt143 = 3;
				}
				}
				break;
			}

			} finally { DebugExitDecision(143); }
			switch (alt143)
			{
			case 1:
				DebugEnterAlt(1);
				// Java.g:945:13: ( arrayDeclarator -> ^( arrayDeclarator $qualifiedIdentExpression) )+ ( DOT CLASS -> ^( DOT $qualifiedIdentExpression CLASS ) )
				{
				DebugLocation(945, 13);
				// Java.g:945:13: ( arrayDeclarator -> ^( arrayDeclarator $qualifiedIdentExpression) )+
				int cnt140=0;
				try { DebugEnterSubRule(140);
				while (true)
				{
					int alt140=2;
					try { DebugEnterDecision(140, false);
					int LA140_1 = input.LA(1);

					if ((LA140_1==LBRACK))
					{
						alt140 = 1;
					}


					} finally { DebugExitDecision(140); }
					switch (alt140)
					{
					case 1:
						DebugEnterAlt(1);
						// Java.g:945:17: arrayDeclarator
						{
						DebugLocation(945, 17);
						PushFollow(Follow._arrayDeclarator_in_qualifiedIdentExpression13696);
						arrayDeclarator492=arrayDeclarator();
						PopFollow();
						if (state.failed) return retval;
						if (state.backtracking == 0) stream_arrayDeclarator.Add(arrayDeclarator492.Tree);


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

						root_0 = (CommonTree)adaptor.Nil();
						// 945:57: -> ^( arrayDeclarator $qualifiedIdentExpression)
						{
							DebugLocation(945, 61);
							// Java.g:945:61: ^( arrayDeclarator $qualifiedIdentExpression)
							{
							CommonTree root_1 = (CommonTree)adaptor.Nil();
							DebugLocation(945, 63);
							root_1 = (CommonTree)adaptor.BecomeRoot(stream_arrayDeclarator.NextNode(), root_1);

							DebugLocation(945, 80);
							adaptor.AddChild(root_1, stream_retval.NextTree());

							adaptor.AddChild(root_0, root_1);
							}

						}

						retval.Tree = root_0;
						}
						}

						}
						break;

					default:
						if (cnt140 >= 1)
							goto loop140;

						if (state.backtracking>0) {state.failed=true; return retval;}
						EarlyExitException eee140 = new EarlyExitException( 140, input );
						DebugRecognitionException(eee140);
						throw eee140;
					}
					cnt140++;
				}
				loop140:
					;

				} finally { DebugExitSubRule(140); }

				DebugLocation(947, 13);
				// Java.g:947:13: ( DOT CLASS -> ^( DOT $qualifiedIdentExpression CLASS ) )
				DebugEnterAlt(1);
				// Java.g:947:17: DOT CLASS
				{
				DebugLocation(947, 17);
				DOT493=(IToken)Match(input,DOT,Follow._DOT_in_qualifiedIdentExpression13764); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_DOT.Add(DOT493);

				DebugLocation(947, 21);
				CLASS494=(IToken)Match(input,CLASS,Follow._CLASS_in_qualifiedIdentExpression13766); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_CLASS.Add(CLASS494);



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

				root_0 = (CommonTree)adaptor.Nil();
				// 947:57: -> ^( DOT $qualifiedIdentExpression CLASS )
				{
					DebugLocation(947, 61);
					// Java.g:947:61: ^( DOT $qualifiedIdentExpression CLASS )
					{
					CommonTree root_1 = (CommonTree)adaptor.Nil();
					DebugLocation(947, 63);
					root_1 = (CommonTree)adaptor.BecomeRoot(stream_DOT.NextNode(), root_1);

					DebugLocation(947, 68);
					adaptor.AddChild(root_1, stream_retval.NextTree());
					DebugLocation(947, 93);
					adaptor.AddChild(root_1, stream_CLASS.NextNode());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}
				}

				}


				}
				break;
			case 2:
				DebugEnterAlt(2);
				// Java.g:949:13: arguments
				{
				DebugLocation(949, 13);
				PushFollow(Follow._arguments_in_qualifiedIdentExpression13836);
				arguments495=arguments();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_arguments.Add(arguments495.Tree);


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

				root_0 = (CommonTree)adaptor.Nil();
				// 949:57: -> ^( METHOD_CALL qualifiedIdentifier arguments )
				{
					DebugLocation(949, 61);
					// Java.g:949:61: ^( METHOD_CALL qualifiedIdentifier arguments )
					{
					CommonTree root_1 = (CommonTree)adaptor.Nil();
					DebugLocation(949, 63);
					root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(METHOD_CALL, "METHOD_CALL"), root_1);

					DebugLocation(949, 75);
					adaptor.AddChild(root_1, stream_qualifiedIdentifier.NextTree());
					DebugLocation(949, 95);
					adaptor.AddChild(root_1, stream_arguments.NextTree());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}
				}

				}
				break;
			case 3:
				DebugEnterAlt(3);
				// Java.g:950:13: outerDot= DOT ( CLASS -> ^( DOT qualifiedIdentifier CLASS ) | genericTypeArgumentListSimplified (Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier genericTypeArgumentListSimplified arguments ) | SUPER innerDot= DOT IDENT arguments -> ^( METHOD_CALL ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT ) genericTypeArgumentListSimplified arguments ) | IDENT arguments -> ^( METHOD_CALL ^( DOT qualifiedIdentifier IDENT ) genericTypeArgumentListSimplified arguments ) ) | THIS -> ^( DOT qualifiedIdentifier THIS ) |Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier arguments ) | innerNewExpression -> ^( DOT qualifiedIdentifier innerNewExpression ) )
				{
				DebugLocation(950, 21);
				outerDot=(IToken)Match(input,DOT,Follow._DOT_in_qualifiedIdentExpression13897); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_DOT.Add(outerDot);

				DebugLocation(951, 13);
				// Java.g:951:13: ( CLASS -> ^( DOT qualifiedIdentifier CLASS ) | genericTypeArgumentListSimplified (Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier genericTypeArgumentListSimplified arguments ) | SUPER innerDot= DOT IDENT arguments -> ^( METHOD_CALL ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT ) genericTypeArgumentListSimplified arguments ) | IDENT arguments -> ^( METHOD_CALL ^( DOT qualifiedIdentifier IDENT ) genericTypeArgumentListSimplified arguments ) ) | THIS -> ^( DOT qualifiedIdentifier THIS ) |Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier arguments ) | innerNewExpression -> ^( DOT qualifiedIdentifier innerNewExpression ) )
				int alt142=5;
				try { DebugEnterSubRule(142);
				try { DebugEnterDecision(142, false);
				switch (input.LA(1))
				{
				case CLASS:
					{
					alt142 = 1;
					}
					break;
				case LESS_THAN:
					{
					alt142 = 2;
					}
					break;
				case THIS:
					{
					alt142 = 3;
					}
					break;
				case SUPER:
					{
					alt142 = 4;
					}
					break;
				case NEW:
					{
					alt142 = 5;
					}
					break;
				default:
					{
						if (state.backtracking>0) {state.failed=true; return retval;}
						NoViableAltException nvae = new NoViableAltException("", 142, 0, input, 1);
						DebugRecognitionException(nvae);
						throw nvae;
					}
				}

				} finally { DebugExitDecision(142); }
				switch (alt142)
				{
				case 1:
					DebugEnterAlt(1);
					// Java.g:951:17: CLASS
					{
					DebugLocation(951, 17);
					CLASS496=(IToken)Match(input,CLASS,Follow._CLASS_in_qualifiedIdentExpression13915); if (state.failed) return retval; 
					if (state.backtracking == 0) stream_CLASS.Add(CLASS496);



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

					root_0 = (CommonTree)adaptor.Nil();
					// 951:57: -> ^( DOT qualifiedIdentifier CLASS )
					{
						DebugLocation(951, 61);
						// Java.g:951:61: ^( DOT qualifiedIdentifier CLASS )
						{
						CommonTree root_1 = (CommonTree)adaptor.Nil();
						DebugLocation(951, 63);
						root_1 = (CommonTree)adaptor.BecomeRoot(stream_DOT.NextNode(), root_1);

						DebugLocation(951, 67);
						adaptor.AddChild(root_1, stream_qualifiedIdentifier.NextTree());
						DebugLocation(951, 87);
						adaptor.AddChild(root_1, stream_CLASS.NextNode());

						adaptor.AddChild(root_0, root_1);
						}

					}

					retval.Tree = root_0;
					}
					}

					}
					break;
				case 2:
					DebugEnterAlt(2);
					// Java.g:952:17: genericTypeArgumentListSimplified (Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier genericTypeArgumentListSimplified arguments ) | SUPER innerDot= DOT IDENT arguments -> ^( METHOD_CALL ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT ) genericTypeArgumentListSimplified arguments ) | IDENT arguments -> ^( METHOD_CALL ^( DOT qualifiedIdentifier IDENT ) genericTypeArgumentListSimplified arguments ) )
					{
					DebugLocation(952, 17);
					PushFollow(Follow._genericTypeArgumentListSimplified_in_qualifiedIdentExpression13978);
					genericTypeArgumentListSimplified497=genericTypeArgumentListSimplified();
					PopFollow();
					if (state.failed) return retval;
					if (state.backtracking == 0) stream_genericTypeArgumentListSimplified.Add(genericTypeArgumentListSimplified497.Tree);
					DebugLocation(953, 17);
					// Java.g:953:17: (Super= SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier genericTypeArgumentListSimplified arguments ) | SUPER innerDot= DOT IDENT arguments -> ^( METHOD_CALL ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT ) genericTypeArgumentListSimplified arguments ) | IDENT arguments -> ^( METHOD_CALL ^( DOT qualifiedIdentifier IDENT ) genericTypeArgumentListSimplified arguments ) )
					int alt141=3;
					try { DebugEnterSubRule(141);
					try { DebugEnterDecision(141, false);
					int LA141_1 = input.LA(1);

					if ((LA141_1==SUPER))
					{
						int LA141_2 = input.LA(2);

						if ((LA141_2==DOT))
						{
							alt141 = 2;
						}
						else if ((LA141_2==LPAREN))
						{
							alt141 = 1;
						}
						else
						{
							if (state.backtracking>0) {state.failed=true; return retval;}
							NoViableAltException nvae = new NoViableAltException("", 141, 1, input, 2);
							DebugRecognitionException(nvae);
							throw nvae;
						}
					}
					else if ((LA141_1==IDENT))
					{
						alt141 = 3;
					}
					else
					{
						if (state.backtracking>0) {state.failed=true; return retval;}
						NoViableAltException nvae = new NoViableAltException("", 141, 0, input, 1);
						DebugRecognitionException(nvae);
						throw nvae;
					}
					} finally { DebugExitDecision(141); }
					switch (alt141)
					{
					case 1:
						DebugEnterAlt(1);
						// Java.g:953:21: Super= SUPER arguments
						{
						DebugLocation(953, 26);
						Super=(IToken)Match(input,SUPER,Follow._SUPER_in_qualifiedIdentExpression14003); if (state.failed) return retval; 
						if (state.backtracking == 0) stream_SUPER.Add(Super);

						DebugLocation(953, 33);
						PushFollow(Follow._arguments_in_qualifiedIdentExpression14005);
						arguments498=arguments();
						PopFollow();
						if (state.failed) return retval;
						if (state.backtracking == 0) stream_arguments.Add(arguments498.Tree);


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

						root_0 = (CommonTree)adaptor.Nil();
						// 953:57: -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier genericTypeArgumentListSimplified arguments )
						{
							DebugLocation(953, 61);
							// Java.g:953:61: ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier genericTypeArgumentListSimplified arguments )
							{
							CommonTree root_1 = (CommonTree)adaptor.Nil();
							DebugLocation(953, 63);
							root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(SUPER_CONSTRUCTOR_CALL, Super, "SUPER_CONSTRUCTOR_CALL"), root_1);

							DebugLocation(953, 120);
							adaptor.AddChild(root_1, stream_qualifiedIdentifier.NextTree());
							DebugLocation(953, 140);
							adaptor.AddChild(root_1, stream_genericTypeArgumentListSimplified.NextTree());
							DebugLocation(953, 174);
							adaptor.AddChild(root_1, stream_arguments.NextTree());

							adaptor.AddChild(root_0, root_1);
							}

						}

						retval.Tree = root_0;
						}
						}

						}
						break;
					case 2:
						DebugEnterAlt(2);
						// Java.g:954:21: SUPER innerDot= DOT IDENT arguments
						{
						DebugLocation(954, 21);
						SUPER499=(IToken)Match(input,SUPER,Follow._SUPER_in_qualifiedIdentExpression14055); if (state.failed) return retval; 
						if (state.backtracking == 0) stream_SUPER.Add(SUPER499);

						DebugLocation(954, 35);
						innerDot=(IToken)Match(input,DOT,Follow._DOT_in_qualifiedIdentExpression14059); if (state.failed) return retval; 
						if (state.backtracking == 0) stream_DOT.Add(innerDot);

						DebugLocation(954, 40);
						IDENT500=(IToken)Match(input,IDENT,Follow._IDENT_in_qualifiedIdentExpression14061); if (state.failed) return retval; 
						if (state.backtracking == 0) stream_IDENT.Add(IDENT500);

						DebugLocation(954, 46);
						PushFollow(Follow._arguments_in_qualifiedIdentExpression14063);
						arguments501=arguments();
						PopFollow();
						if (state.failed) return retval;
						if (state.backtracking == 0) stream_arguments.Add(arguments501.Tree);


						{
						// AST REWRITE
						// elements: innerDot, outerDot, qualifiedIdentifier, SUPER, IDENT, genericTypeArgumentListSimplified, arguments
						// token labels: innerDot, outerDot
						// rule labels: retval
						// token list labels: 
						// rule list labels: 
						// wildcard labels: 
						if (state.backtracking == 0) {
						retval.Tree = root_0;
						RewriteRuleITokenStream stream_innerDot=new RewriteRuleITokenStream(adaptor,"token innerDot",innerDot);
						RewriteRuleITokenStream stream_outerDot=new RewriteRuleITokenStream(adaptor,"token outerDot",outerDot);
						RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

						root_0 = (CommonTree)adaptor.Nil();
						// 954:57: -> ^( METHOD_CALL ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT ) genericTypeArgumentListSimplified arguments )
						{
							DebugLocation(954, 61);
							// Java.g:954:61: ^( METHOD_CALL ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT ) genericTypeArgumentListSimplified arguments )
							{
							CommonTree root_1 = (CommonTree)adaptor.Nil();
							DebugLocation(954, 63);
							root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(METHOD_CALL, "METHOD_CALL"), root_1);

							DebugLocation(954, 75);
							// Java.g:954:75: ^( $innerDot ^( $outerDot qualifiedIdentifier SUPER ) IDENT )
							{
							CommonTree root_2 = (CommonTree)adaptor.Nil();
							DebugLocation(954, 78);
							root_2 = (CommonTree)adaptor.BecomeRoot(stream_innerDot.NextNode(), root_2);

							DebugLocation(954, 87);
							// Java.g:954:87: ^( $outerDot qualifiedIdentifier SUPER )
							{
							CommonTree root_3 = (CommonTree)adaptor.Nil();
							DebugLocation(954, 90);
							root_3 = (CommonTree)adaptor.BecomeRoot(stream_outerDot.NextNode(), root_3);

							DebugLocation(954, 99);
							adaptor.AddChild(root_3, stream_qualifiedIdentifier.NextTree());
							DebugLocation(954, 119);
							adaptor.AddChild(root_3, stream_SUPER.NextNode());

							adaptor.AddChild(root_2, root_3);
							}
							DebugLocation(954, 126);
							adaptor.AddChild(root_2, stream_IDENT.NextNode());

							adaptor.AddChild(root_1, root_2);
							}
							DebugLocation(954, 133);
							adaptor.AddChild(root_1, stream_genericTypeArgumentListSimplified.NextTree());
							DebugLocation(954, 167);
							adaptor.AddChild(root_1, stream_arguments.NextTree());

							adaptor.AddChild(root_0, root_1);
							}

						}

						retval.Tree = root_0;
						}
						}

						}
						break;
					case 3:
						DebugEnterAlt(3);
						// Java.g:955:21: IDENT arguments
						{
						DebugLocation(955, 21);
						IDENT502=(IToken)Match(input,IDENT,Follow._IDENT_in_qualifiedIdentExpression14113); if (state.failed) return retval; 
						if (state.backtracking == 0) stream_IDENT.Add(IDENT502);

						DebugLocation(955, 27);
						PushFollow(Follow._arguments_in_qualifiedIdentExpression14115);
						arguments503=arguments();
						PopFollow();
						if (state.failed) return retval;
						if (state.backtracking == 0) stream_arguments.Add(arguments503.Tree);


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

						root_0 = (CommonTree)adaptor.Nil();
						// 955:57: -> ^( METHOD_CALL ^( DOT qualifiedIdentifier IDENT ) genericTypeArgumentListSimplified arguments )
						{
							DebugLocation(955, 61);
							// Java.g:955:61: ^( METHOD_CALL ^( DOT qualifiedIdentifier IDENT ) genericTypeArgumentListSimplified arguments )
							{
							CommonTree root_1 = (CommonTree)adaptor.Nil();
							DebugLocation(955, 63);
							root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(METHOD_CALL, "METHOD_CALL"), root_1);

							DebugLocation(955, 75);
							// Java.g:955:75: ^( DOT qualifiedIdentifier IDENT )
							{
							CommonTree root_2 = (CommonTree)adaptor.Nil();
							DebugLocation(955, 77);
							root_2 = (CommonTree)adaptor.BecomeRoot(stream_DOT.NextNode(), root_2);

							DebugLocation(955, 81);
							adaptor.AddChild(root_2, stream_qualifiedIdentifier.NextTree());
							DebugLocation(955, 101);
							adaptor.AddChild(root_2, stream_IDENT.NextNode());

							adaptor.AddChild(root_1, root_2);
							}
							DebugLocation(955, 108);
							adaptor.AddChild(root_1, stream_genericTypeArgumentListSimplified.NextTree());
							DebugLocation(955, 142);
							adaptor.AddChild(root_1, stream_arguments.NextTree());

							adaptor.AddChild(root_0, root_1);
							}

						}

						retval.Tree = root_0;
						}
						}

						}
						break;

					}
					} finally { DebugExitSubRule(141); }


					}
					break;
				case 3:
					DebugEnterAlt(3);
					// Java.g:957:17: THIS
					{
					DebugLocation(957, 17);
					THIS504=(IToken)Match(input,THIS,Follow._THIS_in_qualifiedIdentExpression14190); if (state.failed) return retval; 
					if (state.backtracking == 0) stream_THIS.Add(THIS504);



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

					root_0 = (CommonTree)adaptor.Nil();
					// 957:57: -> ^( DOT qualifiedIdentifier THIS )
					{
						DebugLocation(957, 61);
						// Java.g:957:61: ^( DOT qualifiedIdentifier THIS )
						{
						CommonTree root_1 = (CommonTree)adaptor.Nil();
						DebugLocation(957, 63);
						root_1 = (CommonTree)adaptor.BecomeRoot(stream_DOT.NextNode(), root_1);

						DebugLocation(957, 67);
						adaptor.AddChild(root_1, stream_qualifiedIdentifier.NextTree());
						DebugLocation(957, 87);
						adaptor.AddChild(root_1, stream_THIS.NextNode());

						adaptor.AddChild(root_0, root_1);
						}

					}

					retval.Tree = root_0;
					}
					}

					}
					break;
				case 4:
					DebugEnterAlt(4);
					// Java.g:958:17: Super= SUPER arguments
					{
					DebugLocation(958, 22);
					Super=(IToken)Match(input,SUPER,Follow._SUPER_in_qualifiedIdentExpression14256); if (state.failed) return retval; 
					if (state.backtracking == 0) stream_SUPER.Add(Super);

					DebugLocation(958, 29);
					PushFollow(Follow._arguments_in_qualifiedIdentExpression14258);
					arguments505=arguments();
					PopFollow();
					if (state.failed) return retval;
					if (state.backtracking == 0) stream_arguments.Add(arguments505.Tree);


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

					root_0 = (CommonTree)adaptor.Nil();
					// 958:57: -> ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier arguments )
					{
						DebugLocation(958, 61);
						// Java.g:958:61: ^( SUPER_CONSTRUCTOR_CALL[$Super, \"SUPER_CONSTRUCTOR_CALL\"] qualifiedIdentifier arguments )
						{
						CommonTree root_1 = (CommonTree)adaptor.Nil();
						DebugLocation(958, 63);
						root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(SUPER_CONSTRUCTOR_CALL, Super, "SUPER_CONSTRUCTOR_CALL"), root_1);

						DebugLocation(958, 120);
						adaptor.AddChild(root_1, stream_qualifiedIdentifier.NextTree());
						DebugLocation(958, 140);
						adaptor.AddChild(root_1, stream_arguments.NextTree());

						adaptor.AddChild(root_0, root_1);
						}

					}

					retval.Tree = root_0;
					}
					}

					}
					break;
				case 5:
					DebugEnterAlt(5);
					// Java.g:959:17: innerNewExpression
					{
					DebugLocation(959, 17);
					PushFollow(Follow._innerNewExpression_in_qualifiedIdentExpression14306);
					innerNewExpression506=innerNewExpression();
					PopFollow();
					if (state.failed) return retval;
					if (state.backtracking == 0) stream_innerNewExpression.Add(innerNewExpression506.Tree);


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

					root_0 = (CommonTree)adaptor.Nil();
					// 959:57: -> ^( DOT qualifiedIdentifier innerNewExpression )
					{
						DebugLocation(959, 61);
						// Java.g:959:61: ^( DOT qualifiedIdentifier innerNewExpression )
						{
						CommonTree root_1 = (CommonTree)adaptor.Nil();
						DebugLocation(959, 63);
						root_1 = (CommonTree)adaptor.BecomeRoot(stream_DOT.NextNode(), root_1);

						DebugLocation(959, 67);
						adaptor.AddChild(root_1, stream_qualifiedIdentifier.NextTree());
						DebugLocation(959, 87);
						adaptor.AddChild(root_1, stream_innerNewExpression.NextTree());

						adaptor.AddChild(root_0, root_1);
						}

					}

					retval.Tree = root_0;
					}
					}

					}
					break;

				}
				} finally { DebugExitSubRule(142); }


				}
				break;

			}
			} finally { DebugExitSubRule(143); }


			}

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

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

		}
		finally
		{
			TraceOut("qualifiedIdentExpression", 106);
			LeaveRule("qualifiedIdentExpression", 106);
			LeaveRule_qualifiedIdentExpression();
			if (state.backtracking > 0) { Memoize(input, 106, qualifiedIdentExpression_StartIndex); }

		}
		DebugLocation(962, 4);
		} finally { DebugExitRule(GrammarFileName, "qualifiedIdentExpression"); }
		return retval;

	}
Пример #11
0
	private AstParserRuleReturnScope<CommonTree, IToken> primaryExpression()
	{
		EnterRule_primaryExpression();
		EnterRule("primaryExpression", 105);
		TraceIn("primaryExpression", 105);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);
		int primaryExpression_StartIndex = input.Index;

		CommonTree root_0 = default(CommonTree);

		IToken SUPER467 = default(IToken);
		IToken DOT469 = default(IToken);
		IToken IDENT470 = default(IToken);
		IToken IDENT472 = default(IToken);
		IToken THIS474 = default(IToken);
		IToken THIS476 = default(IToken);
		IToken SUPER478 = default(IToken);
		IToken SUPER480 = default(IToken);
		IToken DOT481 = default(IToken);
		IToken IDENT482 = default(IToken);
		IToken DOT486 = default(IToken);
		IToken CLASS487 = default(IToken);
		IToken VOID488 = default(IToken);
		IToken DOT489 = default(IToken);
		IToken CLASS490 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> parenthesizedExpression462 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> literal463 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> newExpression464 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> qualifiedIdentExpression465 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> genericTypeArgumentListSimplified466 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> arguments468 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> arguments471 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> arguments473 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> arguments475 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> arguments477 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> arguments479 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> arguments483 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> primitiveType484 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> arrayDeclarator485 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree SUPER467_tree = default(CommonTree);
		CommonTree DOT469_tree = default(CommonTree);
		CommonTree IDENT470_tree = default(CommonTree);
		CommonTree IDENT472_tree = default(CommonTree);
		CommonTree THIS474_tree = default(CommonTree);
		CommonTree THIS476_tree = default(CommonTree);
		CommonTree SUPER478_tree = default(CommonTree);
		CommonTree SUPER480_tree = default(CommonTree);
		CommonTree DOT481_tree = default(CommonTree);
		CommonTree IDENT482_tree = default(CommonTree);
		CommonTree DOT486_tree = default(CommonTree);
		CommonTree CLASS487_tree = default(CommonTree);
		CommonTree VOID488_tree = default(CommonTree);
		CommonTree DOT489_tree = default(CommonTree);
		CommonTree CLASS490_tree = default(CommonTree);
		RewriteRuleITokenStream stream_SUPER=new RewriteRuleITokenStream(adaptor,"token SUPER");
		RewriteRuleITokenStream stream_DOT=new RewriteRuleITokenStream(adaptor,"token DOT");
		RewriteRuleITokenStream stream_IDENT=new RewriteRuleITokenStream(adaptor,"token IDENT");
		RewriteRuleITokenStream stream_THIS=new RewriteRuleITokenStream(adaptor,"token THIS");
		RewriteRuleITokenStream stream_CLASS=new RewriteRuleITokenStream(adaptor,"token CLASS");
		RewriteRuleITokenStream stream_VOID=new RewriteRuleITokenStream(adaptor,"token VOID");
		RewriteRuleSubtreeStream stream_genericTypeArgumentListSimplified=new RewriteRuleSubtreeStream(adaptor,"rule genericTypeArgumentListSimplified");
		RewriteRuleSubtreeStream stream_arguments=new RewriteRuleSubtreeStream(adaptor,"rule arguments");
		RewriteRuleSubtreeStream stream_primitiveType=new RewriteRuleSubtreeStream(adaptor,"rule primitiveType");
		RewriteRuleSubtreeStream stream_arrayDeclarator=new RewriteRuleSubtreeStream(adaptor,"rule arrayDeclarator");
		try { DebugEnterRule(GrammarFileName, "primaryExpression");
		DebugLocation(909, 4);
		try
		{
			if (state.backtracking > 0 && AlreadyParsedRule(input, 105)) { return retval; }

			// Java.g:910:5: ( parenthesizedExpression | literal | newExpression | qualifiedIdentExpression | genericTypeArgumentListSimplified ( SUPER ( arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) | DOT IDENT arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments ) ) | IDENT arguments -> ^( METHOD_CALL IDENT genericTypeArgumentListSimplified arguments ) | THIS arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) ) | ( THIS -> THIS ) ( arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] arguments ) )? | SUPER arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] arguments ) | ( SUPER DOT IDENT ) ( arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) arguments ) | -> ^( DOT SUPER IDENT ) ) | ( primitiveType -> primitiveType ) ( arrayDeclarator -> ^( arrayDeclarator $primaryExpression) )* DOT CLASS -> ^( DOT $primaryExpression CLASS ) | VOID DOT CLASS -> ^( DOT VOID CLASS ) )
			int alt139=10;
			try { DebugEnterDecision(139, false);
			switch (input.LA(1))
			{
			case LPAREN:
				{
				alt139 = 1;
				}
				break;
			case CHARACTER_LITERAL:
			case DECIMAL_LITERAL:
			case FALSE:
			case FLOATING_POINT_LITERAL:
			case HEX_LITERAL:
			case NULL:
			case OCTAL_LITERAL:
			case STRING_LITERAL:
			case TRUE:
				{
				alt139 = 2;
				}
				break;
			case NEW:
				{
				alt139 = 3;
				}
				break;
			case IDENT:
				{
				alt139 = 4;
				}
				break;
			case LESS_THAN:
				{
				alt139 = 5;
				}
				break;
			case THIS:
				{
				alt139 = 6;
				}
				break;
			case SUPER:
				{
				int LA139_2 = input.LA(2);

				if ((LA139_2==DOT))
				{
					alt139 = 8;
				}
				else if ((LA139_2==LPAREN))
				{
					alt139 = 7;
				}
				else
				{
					if (state.backtracking>0) {state.failed=true; return retval;}
					NoViableAltException nvae = new NoViableAltException("", 139, 7, input, 2);
					DebugRecognitionException(nvae);
					throw nvae;
				}
				}
				break;
			case BOOLEAN:
			case BYTE:
			case CHAR:
			case DOUBLE:
			case FLOAT:
			case INT:
			case LONG:
			case SHORT:
				{
				alt139 = 9;
				}
				break;
			case VOID:
				{
				alt139 = 10;
				}
				break;
			default:
				{
					if (state.backtracking>0) {state.failed=true; return retval;}
					NoViableAltException nvae = new NoViableAltException("", 139, 0, input, 1);
					DebugRecognitionException(nvae);
					throw nvae;
				}
			}

			} finally { DebugExitDecision(139); }
			switch (alt139)
			{
			case 1:
				DebugEnterAlt(1);
				// Java.g:910:9: parenthesizedExpression
				{
				root_0 = (CommonTree)adaptor.Nil();

				DebugLocation(910, 9);
				PushFollow(Follow._parenthesizedExpression_in_primaryExpression12669);
				parenthesizedExpression462=parenthesizedExpression();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) adaptor.AddChild(root_0, parenthesizedExpression462.Tree);

				}
				break;
			case 2:
				DebugEnterAlt(2);
				// Java.g:911:9: literal
				{
				root_0 = (CommonTree)adaptor.Nil();

				DebugLocation(911, 9);
				PushFollow(Follow._literal_in_primaryExpression12679);
				literal463=literal();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) adaptor.AddChild(root_0, literal463.Tree);

				}
				break;
			case 3:
				DebugEnterAlt(3);
				// Java.g:912:9: newExpression
				{
				root_0 = (CommonTree)adaptor.Nil();

				DebugLocation(912, 9);
				PushFollow(Follow._newExpression_in_primaryExpression12689);
				newExpression464=newExpression();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) adaptor.AddChild(root_0, newExpression464.Tree);

				}
				break;
			case 4:
				DebugEnterAlt(4);
				// Java.g:913:9: qualifiedIdentExpression
				{
				root_0 = (CommonTree)adaptor.Nil();

				DebugLocation(913, 9);
				PushFollow(Follow._qualifiedIdentExpression_in_primaryExpression12699);
				qualifiedIdentExpression465=qualifiedIdentExpression();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) adaptor.AddChild(root_0, qualifiedIdentExpression465.Tree);

				}
				break;
			case 5:
				DebugEnterAlt(5);
				// Java.g:914:9: genericTypeArgumentListSimplified ( SUPER ( arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) | DOT IDENT arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments ) ) | IDENT arguments -> ^( METHOD_CALL IDENT genericTypeArgumentListSimplified arguments ) | THIS arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) )
				{
				DebugLocation(914, 9);
				PushFollow(Follow._genericTypeArgumentListSimplified_in_primaryExpression12709);
				genericTypeArgumentListSimplified466=genericTypeArgumentListSimplified();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_genericTypeArgumentListSimplified.Add(genericTypeArgumentListSimplified466.Tree);
				DebugLocation(915, 9);
				// Java.g:915:9: ( SUPER ( arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) | DOT IDENT arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments ) ) | IDENT arguments -> ^( METHOD_CALL IDENT genericTypeArgumentListSimplified arguments ) | THIS arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) )
				int alt135=3;
				try { DebugEnterSubRule(135);
				try { DebugEnterDecision(135, false);
				switch (input.LA(1))
				{
				case SUPER:
					{
					alt135 = 1;
					}
					break;
				case IDENT:
					{
					alt135 = 2;
					}
					break;
				case THIS:
					{
					alt135 = 3;
					}
					break;
				default:
					{
						if (state.backtracking>0) {state.failed=true; return retval;}
						NoViableAltException nvae = new NoViableAltException("", 135, 0, input, 1);
						DebugRecognitionException(nvae);
						throw nvae;
					}
				}

				} finally { DebugExitDecision(135); }
				switch (alt135)
				{
				case 1:
					DebugEnterAlt(1);
					// Java.g:915:13: SUPER ( arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) | DOT IDENT arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments ) )
					{
					DebugLocation(915, 13);
					SUPER467=(IToken)Match(input,SUPER,Follow._SUPER_in_primaryExpression12724); if (state.failed) return retval; 
					if (state.backtracking == 0) stream_SUPER.Add(SUPER467);

					DebugLocation(916, 13);
					// Java.g:916:13: ( arguments -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments ) | DOT IDENT arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments ) )
					int alt134=2;
					try { DebugEnterSubRule(134);
					try { DebugEnterDecision(134, false);
					int LA134_1 = input.LA(1);

					if ((LA134_1==LPAREN))
					{
						alt134 = 1;
					}
					else if ((LA134_1==DOT))
					{
						alt134 = 2;
					}
					else
					{
						if (state.backtracking>0) {state.failed=true; return retval;}
						NoViableAltException nvae = new NoViableAltException("", 134, 0, input, 1);
						DebugRecognitionException(nvae);
						throw nvae;
					}
					} finally { DebugExitDecision(134); }
					switch (alt134)
					{
					case 1:
						DebugEnterAlt(1);
						// Java.g:916:17: arguments
						{
						DebugLocation(916, 17);
						PushFollow(Follow._arguments_in_primaryExpression12742);
						arguments468=arguments();
						PopFollow();
						if (state.failed) return retval;
						if (state.backtracking == 0) stream_arguments.Add(arguments468.Tree);


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

						root_0 = (CommonTree)adaptor.Nil();
						// 916:57: -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments )
						{
							DebugLocation(916, 61);
							// Java.g:916:61: ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments )
							{
							CommonTree root_1 = (CommonTree)adaptor.Nil();
							DebugLocation(916, 63);
							root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(SUPER_CONSTRUCTOR_CALL, SUPER467, "SUPER_CONSTRUCTOR_CALL"), root_1);

							DebugLocation(916, 120);
							adaptor.AddChild(root_1, stream_genericTypeArgumentListSimplified.NextTree());
							DebugLocation(916, 154);
							adaptor.AddChild(root_1, stream_arguments.NextTree());

							adaptor.AddChild(root_0, root_1);
							}

						}

						retval.Tree = root_0;
						}
						}

						}
						break;
					case 2:
						DebugEnterAlt(2);
						// Java.g:917:17: DOT IDENT arguments
						{
						DebugLocation(917, 17);
						DOT469=(IToken)Match(input,DOT,Follow._DOT_in_primaryExpression12802); if (state.failed) return retval; 
						if (state.backtracking == 0) stream_DOT.Add(DOT469);

						DebugLocation(917, 21);
						IDENT470=(IToken)Match(input,IDENT,Follow._IDENT_in_primaryExpression12804); if (state.failed) return retval; 
						if (state.backtracking == 0) stream_IDENT.Add(IDENT470);

						DebugLocation(917, 27);
						PushFollow(Follow._arguments_in_primaryExpression12806);
						arguments471=arguments();
						PopFollow();
						if (state.failed) return retval;
						if (state.backtracking == 0) stream_arguments.Add(arguments471.Tree);


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

						root_0 = (CommonTree)adaptor.Nil();
						// 917:57: -> ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments )
						{
							DebugLocation(917, 61);
							// Java.g:917:61: ^( METHOD_CALL ^( DOT SUPER IDENT ) genericTypeArgumentListSimplified arguments )
							{
							CommonTree root_1 = (CommonTree)adaptor.Nil();
							DebugLocation(917, 63);
							root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(METHOD_CALL, "METHOD_CALL"), root_1);

							DebugLocation(917, 75);
							// Java.g:917:75: ^( DOT SUPER IDENT )
							{
							CommonTree root_2 = (CommonTree)adaptor.Nil();
							DebugLocation(917, 77);
							root_2 = (CommonTree)adaptor.BecomeRoot(stream_DOT.NextNode(), root_2);

							DebugLocation(917, 81);
							adaptor.AddChild(root_2, stream_SUPER.NextNode());
							DebugLocation(917, 87);
							adaptor.AddChild(root_2, stream_IDENT.NextNode());

							adaptor.AddChild(root_1, root_2);
							}
							DebugLocation(917, 94);
							adaptor.AddChild(root_1, stream_genericTypeArgumentListSimplified.NextTree());
							DebugLocation(917, 128);
							adaptor.AddChild(root_1, stream_arguments.NextTree());

							adaptor.AddChild(root_0, root_1);
							}

						}

						retval.Tree = root_0;
						}
						}

						}
						break;

					}
					} finally { DebugExitSubRule(134); }


					}
					break;
				case 2:
					DebugEnterAlt(2);
					// Java.g:919:13: IDENT arguments
					{
					DebugLocation(919, 13);
					IDENT472=(IToken)Match(input,IDENT,Follow._IDENT_in_primaryExpression12873); if (state.failed) return retval; 
					if (state.backtracking == 0) stream_IDENT.Add(IDENT472);

					DebugLocation(919, 19);
					PushFollow(Follow._arguments_in_primaryExpression12875);
					arguments473=arguments();
					PopFollow();
					if (state.failed) return retval;
					if (state.backtracking == 0) stream_arguments.Add(arguments473.Tree);


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

					root_0 = (CommonTree)adaptor.Nil();
					// 919:57: -> ^( METHOD_CALL IDENT genericTypeArgumentListSimplified arguments )
					{
						DebugLocation(919, 61);
						// Java.g:919:61: ^( METHOD_CALL IDENT genericTypeArgumentListSimplified arguments )
						{
						CommonTree root_1 = (CommonTree)adaptor.Nil();
						DebugLocation(919, 63);
						root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(METHOD_CALL, "METHOD_CALL"), root_1);

						DebugLocation(919, 75);
						adaptor.AddChild(root_1, stream_IDENT.NextNode());
						DebugLocation(919, 81);
						adaptor.AddChild(root_1, stream_genericTypeArgumentListSimplified.NextTree());
						DebugLocation(919, 115);
						adaptor.AddChild(root_1, stream_arguments.NextTree());

						adaptor.AddChild(root_0, root_1);
						}

					}

					retval.Tree = root_0;
					}
					}

					}
					break;
				case 3:
					DebugEnterAlt(3);
					// Java.g:920:13: THIS arguments
					{
					DebugLocation(920, 13);
					THIS474=(IToken)Match(input,THIS,Follow._THIS_in_primaryExpression12930); if (state.failed) return retval; 
					if (state.backtracking == 0) stream_THIS.Add(THIS474);

					DebugLocation(920, 18);
					PushFollow(Follow._arguments_in_primaryExpression12932);
					arguments475=arguments();
					PopFollow();
					if (state.failed) return retval;
					if (state.backtracking == 0) stream_arguments.Add(arguments475.Tree);


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

					root_0 = (CommonTree)adaptor.Nil();
					// 920:57: -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments )
					{
						DebugLocation(920, 61);
						// Java.g:920:61: ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] genericTypeArgumentListSimplified arguments )
						{
						CommonTree root_1 = (CommonTree)adaptor.Nil();
						DebugLocation(920, 63);
						root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(THIS_CONSTRUCTOR_CALL, THIS474, "THIS_CONSTRUCTOR_CALL"), root_1);

						DebugLocation(920, 117);
						adaptor.AddChild(root_1, stream_genericTypeArgumentListSimplified.NextTree());
						DebugLocation(920, 151);
						adaptor.AddChild(root_1, stream_arguments.NextTree());

						adaptor.AddChild(root_0, root_1);
						}

					}

					retval.Tree = root_0;
					}
					}

					}
					break;

				}
				} finally { DebugExitSubRule(135); }


				}
				break;
			case 6:
				DebugEnterAlt(6);
				// Java.g:922:9: ( THIS -> THIS ) ( arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] arguments ) )?
				{
				DebugLocation(922, 9);
				// Java.g:922:9: ( THIS -> THIS )
				DebugEnterAlt(1);
				// Java.g:922:13: THIS
				{
				DebugLocation(922, 13);
				THIS476=(IToken)Match(input,THIS,Follow._THIS_in_primaryExpression12997); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_THIS.Add(THIS476);



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

				root_0 = (CommonTree)adaptor.Nil();
				// 922:57: -> THIS
				{
					DebugLocation(922, 61);
					adaptor.AddChild(root_0, stream_THIS.NextNode());

				}

				retval.Tree = root_0;
				}
				}

				}

				DebugLocation(924, 9);
				// Java.g:924:9: ( arguments -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] arguments ) )?
				int alt136=2;
				try { DebugEnterSubRule(136);
				try { DebugEnterDecision(136, false);
				int LA136_1 = input.LA(1);

				if ((LA136_1==LPAREN))
				{
					alt136 = 1;
				}
				} finally { DebugExitDecision(136); }
				switch (alt136)
				{
				case 1:
					DebugEnterAlt(1);
					// Java.g:924:13: arguments
					{
					DebugLocation(924, 13);
					PushFollow(Follow._arguments_in_primaryExpression13065);
					arguments477=arguments();
					PopFollow();
					if (state.failed) return retval;
					if (state.backtracking == 0) stream_arguments.Add(arguments477.Tree);


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

					root_0 = (CommonTree)adaptor.Nil();
					// 924:57: -> ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] arguments )
					{
						DebugLocation(924, 61);
						// Java.g:924:61: ^( THIS_CONSTRUCTOR_CALL[$THIS, \"THIS_CONSTRUCTOR_CALL\"] arguments )
						{
						CommonTree root_1 = (CommonTree)adaptor.Nil();
						DebugLocation(924, 63);
						root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(THIS_CONSTRUCTOR_CALL, THIS476, "THIS_CONSTRUCTOR_CALL"), root_1);

						DebugLocation(924, 117);
						adaptor.AddChild(root_1, stream_arguments.NextTree());

						adaptor.AddChild(root_0, root_1);
						}

					}

					retval.Tree = root_0;
					}
					}

					}
					break;

				}
				} finally { DebugExitSubRule(136); }


				}
				break;
			case 7:
				DebugEnterAlt(7);
				// Java.g:926:9: SUPER arguments
				{
				DebugLocation(926, 9);
				SUPER478=(IToken)Match(input,SUPER,Follow._SUPER_in_primaryExpression13130); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_SUPER.Add(SUPER478);

				DebugLocation(926, 15);
				PushFollow(Follow._arguments_in_primaryExpression13132);
				arguments479=arguments();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_arguments.Add(arguments479.Tree);


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

				root_0 = (CommonTree)adaptor.Nil();
				// 926:57: -> ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] arguments )
				{
					DebugLocation(926, 61);
					// Java.g:926:61: ^( SUPER_CONSTRUCTOR_CALL[$SUPER, \"SUPER_CONSTRUCTOR_CALL\"] arguments )
					{
					CommonTree root_1 = (CommonTree)adaptor.Nil();
					DebugLocation(926, 63);
					root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(SUPER_CONSTRUCTOR_CALL, SUPER478, "SUPER_CONSTRUCTOR_CALL"), root_1);

					DebugLocation(926, 120);
					adaptor.AddChild(root_1, stream_arguments.NextTree());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}
				}

				}
				break;
			case 8:
				DebugEnterAlt(8);
				// Java.g:927:9: ( SUPER DOT IDENT ) ( arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) arguments ) | -> ^( DOT SUPER IDENT ) )
				{
				DebugLocation(927, 9);
				// Java.g:927:9: ( SUPER DOT IDENT )
				DebugEnterAlt(1);
				// Java.g:927:13: SUPER DOT IDENT
				{
				DebugLocation(927, 13);
				SUPER480=(IToken)Match(input,SUPER,Follow._SUPER_in_primaryExpression13188); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_SUPER.Add(SUPER480);

				DebugLocation(927, 19);
				DOT481=(IToken)Match(input,DOT,Follow._DOT_in_primaryExpression13190); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_DOT.Add(DOT481);

				DebugLocation(927, 23);
				IDENT482=(IToken)Match(input,IDENT,Follow._IDENT_in_primaryExpression13192); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_IDENT.Add(IDENT482);


				}

				DebugLocation(929, 9);
				// Java.g:929:9: ( arguments -> ^( METHOD_CALL ^( DOT SUPER IDENT ) arguments ) | -> ^( DOT SUPER IDENT ) )
				int alt137=2;
				try { DebugEnterSubRule(137);
				try { DebugEnterDecision(137, false);
				int LA137_1 = input.LA(1);

				if ((LA137_1==LPAREN))
				{
					alt137 = 1;
				}
				else if ((LA137_1==EOF||(LA137_1>=AND && LA137_1<=AND_ASSIGN)||LA137_1==ASSIGN||(LA137_1>=BIT_SHIFT_RIGHT && LA137_1<=BIT_SHIFT_RIGHT_ASSIGN)||(LA137_1>=COLON && LA137_1<=COMMA)||LA137_1==DEC||(LA137_1>=DIV && LA137_1<=DIV_ASSIGN)||LA137_1==DOT||LA137_1==EQUAL||(LA137_1>=GREATER_OR_EQUAL && LA137_1<=GREATER_THAN)||(LA137_1>=INC && LA137_1<=INSTANCEOF)||LA137_1==LBRACK||(LA137_1>=LESS_OR_EQUAL && LA137_1<=LESS_THAN)||LA137_1==LOGICAL_AND||LA137_1==LOGICAL_OR||(LA137_1>=MINUS && LA137_1<=MOD)||LA137_1==MOD_ASSIGN||LA137_1==NOT_EQUAL||(LA137_1>=OR && LA137_1<=OR_ASSIGN)||(LA137_1>=PLUS && LA137_1<=PLUS_ASSIGN)||(LA137_1>=QUESTION && LA137_1<=RCURLY)||(LA137_1>=RPAREN && LA137_1<=SHIFT_RIGHT_ASSIGN)||(LA137_1>=STAR && LA137_1<=STAR_ASSIGN)||(LA137_1>=XOR && LA137_1<=XOR_ASSIGN)))
				{
					alt137 = 2;
				}
				else
				{
					if (state.backtracking>0) {state.failed=true; return retval;}
					NoViableAltException nvae = new NoViableAltException("", 137, 0, input, 1);
					DebugRecognitionException(nvae);
					throw nvae;
				}
				} finally { DebugExitDecision(137); }
				switch (alt137)
				{
				case 1:
					DebugEnterAlt(1);
					// Java.g:929:13: arguments
					{
					DebugLocation(929, 13);
					PushFollow(Follow._arguments_in_primaryExpression13216);
					arguments483=arguments();
					PopFollow();
					if (state.failed) return retval;
					if (state.backtracking == 0) stream_arguments.Add(arguments483.Tree);


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

					root_0 = (CommonTree)adaptor.Nil();
					// 929:57: -> ^( METHOD_CALL ^( DOT SUPER IDENT ) arguments )
					{
						DebugLocation(929, 61);
						// Java.g:929:61: ^( METHOD_CALL ^( DOT SUPER IDENT ) arguments )
						{
						CommonTree root_1 = (CommonTree)adaptor.Nil();
						DebugLocation(929, 63);
						root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(METHOD_CALL, "METHOD_CALL"), root_1);

						DebugLocation(929, 75);
						// Java.g:929:75: ^( DOT SUPER IDENT )
						{
						CommonTree root_2 = (CommonTree)adaptor.Nil();
						DebugLocation(929, 77);
						root_2 = (CommonTree)adaptor.BecomeRoot(stream_DOT.NextNode(), root_2);

						DebugLocation(929, 81);
						adaptor.AddChild(root_2, stream_SUPER.NextNode());
						DebugLocation(929, 87);
						adaptor.AddChild(root_2, stream_IDENT.NextNode());

						adaptor.AddChild(root_1, root_2);
						}
						DebugLocation(929, 94);
						adaptor.AddChild(root_1, stream_arguments.NextTree());

						adaptor.AddChild(root_0, root_1);
						}

					}

					retval.Tree = root_0;
					}
					}

					}
					break;
				case 2:
					DebugEnterAlt(2);
					// Java.g:930:57: 
					{

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

					root_0 = (CommonTree)adaptor.Nil();
					// 930:57: -> ^( DOT SUPER IDENT )
					{
						DebugLocation(930, 61);
						// Java.g:930:61: ^( DOT SUPER IDENT )
						{
						CommonTree root_1 = (CommonTree)adaptor.Nil();
						DebugLocation(930, 63);
						root_1 = (CommonTree)adaptor.BecomeRoot(stream_DOT.NextNode(), root_1);

						DebugLocation(930, 67);
						adaptor.AddChild(root_1, stream_SUPER.NextNode());
						DebugLocation(930, 73);
						adaptor.AddChild(root_1, stream_IDENT.NextNode());

						adaptor.AddChild(root_0, root_1);
						}

					}

					retval.Tree = root_0;
					}
					}

					}
					break;

				}
				} finally { DebugExitSubRule(137); }


				}
				break;
			case 9:
				DebugEnterAlt(9);
				// Java.g:932:9: ( primitiveType -> primitiveType ) ( arrayDeclarator -> ^( arrayDeclarator $primaryExpression) )* DOT CLASS
				{
				DebugLocation(932, 9);
				// Java.g:932:9: ( primitiveType -> primitiveType )
				DebugEnterAlt(1);
				// Java.g:932:13: primitiveType
				{
				DebugLocation(932, 13);
				PushFollow(Follow._primitiveType_in_primaryExpression13358);
				primitiveType484=primitiveType();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_primitiveType.Add(primitiveType484.Tree);


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

				root_0 = (CommonTree)adaptor.Nil();
				// 932:57: -> primitiveType
				{
					DebugLocation(932, 61);
					adaptor.AddChild(root_0, stream_primitiveType.NextTree());

				}

				retval.Tree = root_0;
				}
				}

				}

				DebugLocation(934, 9);
				// Java.g:934:9: ( arrayDeclarator -> ^( arrayDeclarator $primaryExpression) )*
				try { DebugEnterSubRule(138);
				while (true)
				{
					int alt138=2;
					try { DebugEnterDecision(138, false);
					int LA138_1 = input.LA(1);

					if ((LA138_1==LBRACK))
					{
						alt138 = 1;
					}


					} finally { DebugExitDecision(138); }
					switch ( alt138 )
					{
					case 1:
						DebugEnterAlt(1);
						// Java.g:934:13: arrayDeclarator
						{
						DebugLocation(934, 13);
						PushFollow(Follow._arrayDeclarator_in_primaryExpression13417);
						arrayDeclarator485=arrayDeclarator();
						PopFollow();
						if (state.failed) return retval;
						if (state.backtracking == 0) stream_arrayDeclarator.Add(arrayDeclarator485.Tree);


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

						root_0 = (CommonTree)adaptor.Nil();
						// 934:57: -> ^( arrayDeclarator $primaryExpression)
						{
							DebugLocation(934, 61);
							// Java.g:934:61: ^( arrayDeclarator $primaryExpression)
							{
							CommonTree root_1 = (CommonTree)adaptor.Nil();
							DebugLocation(934, 63);
							root_1 = (CommonTree)adaptor.BecomeRoot(stream_arrayDeclarator.NextNode(), root_1);

							DebugLocation(934, 80);
							adaptor.AddChild(root_1, stream_retval.NextTree());

							adaptor.AddChild(root_0, root_1);
							}

						}

						retval.Tree = root_0;
						}
						}

						}
						break;

					default:
						goto loop138;
					}
				}

				loop138:
					;

				} finally { DebugExitSubRule(138); }

				DebugLocation(936, 9);
				DOT486=(IToken)Match(input,DOT,Follow._DOT_in_primaryExpression13480); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_DOT.Add(DOT486);

				DebugLocation(936, 13);
				CLASS487=(IToken)Match(input,CLASS,Follow._CLASS_in_primaryExpression13482); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_CLASS.Add(CLASS487);



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

				root_0 = (CommonTree)adaptor.Nil();
				// 936:57: -> ^( DOT $primaryExpression CLASS )
				{
					DebugLocation(936, 61);
					// Java.g:936:61: ^( DOT $primaryExpression CLASS )
					{
					CommonTree root_1 = (CommonTree)adaptor.Nil();
					DebugLocation(936, 63);
					root_1 = (CommonTree)adaptor.BecomeRoot(stream_DOT.NextNode(), root_1);

					DebugLocation(936, 68);
					adaptor.AddChild(root_1, stream_retval.NextTree());
					DebugLocation(936, 86);
					adaptor.AddChild(root_1, stream_CLASS.NextNode());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}
				}

				}
				break;
			case 10:
				DebugEnterAlt(10);
				// Java.g:937:9: VOID DOT CLASS
				{
				DebugLocation(937, 9);
				VOID488=(IToken)Match(input,VOID,Follow._VOID_in_primaryExpression13542); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_VOID.Add(VOID488);

				DebugLocation(937, 14);
				DOT489=(IToken)Match(input,DOT,Follow._DOT_in_primaryExpression13544); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_DOT.Add(DOT489);

				DebugLocation(937, 18);
				CLASS490=(IToken)Match(input,CLASS,Follow._CLASS_in_primaryExpression13546); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_CLASS.Add(CLASS490);



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

				root_0 = (CommonTree)adaptor.Nil();
				// 937:57: -> ^( DOT VOID CLASS )
				{
					DebugLocation(937, 61);
					// Java.g:937:61: ^( DOT VOID CLASS )
					{
					CommonTree root_1 = (CommonTree)adaptor.Nil();
					DebugLocation(937, 63);
					root_1 = (CommonTree)adaptor.BecomeRoot(stream_DOT.NextNode(), root_1);

					DebugLocation(937, 67);
					adaptor.AddChild(root_1, stream_VOID.NextNode());
					DebugLocation(937, 72);
					adaptor.AddChild(root_1, stream_CLASS.NextNode());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}
				}

				}
				break;

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

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

		}
		finally
		{
			TraceOut("primaryExpression", 105);
			LeaveRule("primaryExpression", 105);
			LeaveRule_primaryExpression();
			if (state.backtracking > 0) { Memoize(input, 105, primaryExpression_StartIndex); }

		}
		DebugLocation(938, 4);
		} finally { DebugExitRule(GrammarFileName, "primaryExpression"); }
		return retval;

	}
Пример #12
0
    // $ANTLR start "expr"
    // MathExpr.g:188:1: expr : ( BEGIN exprList END -> ^( BLOCK ( exprList )? ) | idar allassign term | IF term expr ( ELSE expr )? | WHILE term expr | FOR ( VAR IDENT ASSIGN term )? ';' ( compare )? ';' ( groupExpr )? expr -> ^( FOR ( ^( VAR ^( IDENT TYPE ^( ASSIGN term ) ) ) )? ( compare )? ( groupExpr )? expr ) | LET idar ( ':' type )? ( ASSIGN returnValue )? ( ',' idar ( ':' type )? ( ASSIGN returnValue )? )* -> ^( LET ( ^( idar ^( TYPE ( type )? ) ( ^( ASSIGN returnValue ) )? ) )* ) | VAR var_element ( ',' var_element )* -> ^( VAR ( var_element )* ) | FOR ( VAR )? IDENT IN term '...' term expr | PRINT '(' ( STRINGVAL | idar ) ')' | groupExpr | REPEATE expr WHILE term -> ^( REPEATE term expr ) | FUNC IDENT '(' ( func_params )? ')' ( '->' type )? expr -> ^( FUNC IDENT ^( FUNC_PARAM ( func_params )? ) ^( TYPE ( type )? ) expr ) | RETURN ( returnValue | arrayValue ) -> ^( RETURN ( returnValue )? ( ^( ARRAY arrayValue ) )? ) | SWITCH IDENT '{' ( swcase )* ( DEFAULT ':' expr )? '}' -> ^( SWITCH IDENT ( swcase )* ( DEFAULT expr )? ) );
    public MathExprParser.expr_return expr() // throws RecognitionException [1]
    {   
        MathExprParser.expr_return retval = new MathExprParser.expr_return();
        retval.Start = input.LT(1);
        int expr_StartIndex = input.Index();
        AstNode root_0 = null;

        IToken BEGIN97 = null;
        IToken END99 = null;
        IToken IF103 = null;
        IToken ELSE106 = null;
        IToken WHILE108 = null;
        IToken FOR111 = null;
        IToken VAR112 = null;
        IToken IDENT113 = null;
        IToken ASSIGN114 = null;
        IToken char_literal116 = null;
        IToken char_literal118 = null;
        IToken LET121 = null;
        IToken char_literal123 = null;
        IToken ASSIGN125 = null;
        IToken char_literal127 = null;
        IToken char_literal129 = null;
        IToken ASSIGN131 = null;
        IToken VAR133 = null;
        IToken char_literal135 = null;
        IToken FOR137 = null;
        IToken VAR138 = null;
        IToken IDENT139 = null;
        IToken IN140 = null;
        IToken string_literal142 = null;
        IToken PRINT145 = null;
        IToken char_literal146 = null;
        IToken STRINGVAL147 = null;
        IToken char_literal149 = null;
        IToken REPEATE151 = null;
        IToken WHILE153 = null;
        IToken FUNC155 = null;
        IToken IDENT156 = null;
        IToken char_literal157 = null;
        IToken char_literal159 = null;
        IToken string_literal160 = null;
        IToken RETURN163 = null;
        IToken SWITCH166 = null;
        IToken IDENT167 = null;
        IToken char_literal168 = null;
        IToken DEFAULT170 = null;
        IToken char_literal171 = null;
        IToken char_literal173 = null;
        MathExprParser.exprList_return exprList98 = default(MathExprParser.exprList_return);

        MathExprParser.idar_return idar100 = default(MathExprParser.idar_return);

        MathExprParser.allassign_return allassign101 = default(MathExprParser.allassign_return);

        MathExprParser.term_return term102 = default(MathExprParser.term_return);

        MathExprParser.term_return term104 = default(MathExprParser.term_return);

        MathExprParser.expr_return expr105 = default(MathExprParser.expr_return);

        MathExprParser.expr_return expr107 = default(MathExprParser.expr_return);

        MathExprParser.term_return term109 = default(MathExprParser.term_return);

        MathExprParser.expr_return expr110 = default(MathExprParser.expr_return);

        MathExprParser.term_return term115 = default(MathExprParser.term_return);

        MathExprParser.compare_return compare117 = default(MathExprParser.compare_return);

        MathExprParser.groupExpr_return groupExpr119 = default(MathExprParser.groupExpr_return);

        MathExprParser.expr_return expr120 = default(MathExprParser.expr_return);

        MathExprParser.idar_return idar122 = default(MathExprParser.idar_return);

        MathExprParser.type_return type124 = default(MathExprParser.type_return);

        MathExprParser.returnValue_return returnValue126 = default(MathExprParser.returnValue_return);

        MathExprParser.idar_return idar128 = default(MathExprParser.idar_return);

        MathExprParser.type_return type130 = default(MathExprParser.type_return);

        MathExprParser.returnValue_return returnValue132 = default(MathExprParser.returnValue_return);

        MathExprParser.var_element_return var_element134 = default(MathExprParser.var_element_return);

        MathExprParser.var_element_return var_element136 = default(MathExprParser.var_element_return);

        MathExprParser.term_return term141 = default(MathExprParser.term_return);

        MathExprParser.term_return term143 = default(MathExprParser.term_return);

        MathExprParser.expr_return expr144 = default(MathExprParser.expr_return);

        MathExprParser.idar_return idar148 = default(MathExprParser.idar_return);

        MathExprParser.groupExpr_return groupExpr150 = default(MathExprParser.groupExpr_return);

        MathExprParser.expr_return expr152 = default(MathExprParser.expr_return);

        MathExprParser.term_return term154 = default(MathExprParser.term_return);

        MathExprParser.func_params_return func_params158 = default(MathExprParser.func_params_return);

        MathExprParser.type_return type161 = default(MathExprParser.type_return);

        MathExprParser.expr_return expr162 = default(MathExprParser.expr_return);

        MathExprParser.returnValue_return returnValue164 = default(MathExprParser.returnValue_return);

        MathExprParser.arrayValue_return arrayValue165 = default(MathExprParser.arrayValue_return);

        MathExprParser.swcase_return swcase169 = default(MathExprParser.swcase_return);

        MathExprParser.expr_return expr172 = default(MathExprParser.expr_return);


        AstNode BEGIN97_tree=null;
        AstNode END99_tree=null;
        AstNode IF103_tree=null;
        AstNode ELSE106_tree=null;
        AstNode WHILE108_tree=null;
        AstNode FOR111_tree=null;
        AstNode VAR112_tree=null;
        AstNode IDENT113_tree=null;
        AstNode ASSIGN114_tree=null;
        AstNode char_literal116_tree=null;
        AstNode char_literal118_tree=null;
        AstNode LET121_tree=null;
        AstNode char_literal123_tree=null;
        AstNode ASSIGN125_tree=null;
        AstNode char_literal127_tree=null;
        AstNode char_literal129_tree=null;
        AstNode ASSIGN131_tree=null;
        AstNode VAR133_tree=null;
        AstNode char_literal135_tree=null;
        AstNode FOR137_tree=null;
        AstNode VAR138_tree=null;
        AstNode IDENT139_tree=null;
        AstNode IN140_tree=null;
        AstNode string_literal142_tree=null;
        AstNode PRINT145_tree=null;
        AstNode char_literal146_tree=null;
        AstNode STRINGVAL147_tree=null;
        AstNode char_literal149_tree=null;
        AstNode REPEATE151_tree=null;
        AstNode WHILE153_tree=null;
        AstNode FUNC155_tree=null;
        AstNode IDENT156_tree=null;
        AstNode char_literal157_tree=null;
        AstNode char_literal159_tree=null;
        AstNode string_literal160_tree=null;
        AstNode RETURN163_tree=null;
        AstNode SWITCH166_tree=null;
        AstNode IDENT167_tree=null;
        AstNode char_literal168_tree=null;
        AstNode DEFAULT170_tree=null;
        AstNode char_literal171_tree=null;
        AstNode char_literal173_tree=null;
        RewriteRuleTokenStream stream_77 = new RewriteRuleTokenStream(adaptor,"token 77");
        RewriteRuleTokenStream stream_79 = new RewriteRuleTokenStream(adaptor,"token 79");
        RewriteRuleTokenStream stream_FUNC = new RewriteRuleTokenStream(adaptor,"token FUNC");
        RewriteRuleTokenStream stream_VAR = new RewriteRuleTokenStream(adaptor,"token VAR");
        RewriteRuleTokenStream stream_FOR = new RewriteRuleTokenStream(adaptor,"token FOR");
        RewriteRuleTokenStream stream_BEGIN = new RewriteRuleTokenStream(adaptor,"token BEGIN");
        RewriteRuleTokenStream stream_ASSIGN = new RewriteRuleTokenStream(adaptor,"token ASSIGN");
        RewriteRuleTokenStream stream_REPEATE = new RewriteRuleTokenStream(adaptor,"token REPEATE");
        RewriteRuleTokenStream stream_RETURN = new RewriteRuleTokenStream(adaptor,"token RETURN");
        RewriteRuleTokenStream stream_IDENT = new RewriteRuleTokenStream(adaptor,"token IDENT");
        RewriteRuleTokenStream stream_END = new RewriteRuleTokenStream(adaptor,"token END");
        RewriteRuleTokenStream stream_LET = new RewriteRuleTokenStream(adaptor,"token LET");
        RewriteRuleTokenStream stream_WHILE = new RewriteRuleTokenStream(adaptor,"token WHILE");
        RewriteRuleTokenStream stream_SWITCH = new RewriteRuleTokenStream(adaptor,"token SWITCH");
        RewriteRuleTokenStream stream_72 = new RewriteRuleTokenStream(adaptor,"token 72");
        RewriteRuleTokenStream stream_73 = new RewriteRuleTokenStream(adaptor,"token 73");
        RewriteRuleTokenStream stream_74 = new RewriteRuleTokenStream(adaptor,"token 74");
        RewriteRuleTokenStream stream_75 = new RewriteRuleTokenStream(adaptor,"token 75");
        RewriteRuleTokenStream stream_DEFAULT = new RewriteRuleTokenStream(adaptor,"token DEFAULT");
        RewriteRuleSubtreeStream stream_groupExpr = new RewriteRuleSubtreeStream(adaptor,"rule groupExpr");
        RewriteRuleSubtreeStream stream_compare = new RewriteRuleSubtreeStream(adaptor,"rule compare");
        RewriteRuleSubtreeStream stream_returnValue = new RewriteRuleSubtreeStream(adaptor,"rule returnValue");
        RewriteRuleSubtreeStream stream_func_params = new RewriteRuleSubtreeStream(adaptor,"rule func_params");
        RewriteRuleSubtreeStream stream_exprList = new RewriteRuleSubtreeStream(adaptor,"rule exprList");
        RewriteRuleSubtreeStream stream_term = new RewriteRuleSubtreeStream(adaptor,"rule term");
        RewriteRuleSubtreeStream stream_expr = new RewriteRuleSubtreeStream(adaptor,"rule expr");
        RewriteRuleSubtreeStream stream_arrayValue = new RewriteRuleSubtreeStream(adaptor,"rule arrayValue");
        RewriteRuleSubtreeStream stream_type = new RewriteRuleSubtreeStream(adaptor,"rule type");
        RewriteRuleSubtreeStream stream_swcase = new RewriteRuleSubtreeStream(adaptor,"rule swcase");
        RewriteRuleSubtreeStream stream_idar = new RewriteRuleSubtreeStream(adaptor,"rule idar");
        RewriteRuleSubtreeStream stream_var_element = new RewriteRuleSubtreeStream(adaptor,"rule var_element");
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 24) ) 
    	    {
    	    	return retval; 
    	    }
            // MathExpr.g:188:5: ( BEGIN exprList END -> ^( BLOCK ( exprList )? ) | idar allassign term | IF term expr ( ELSE expr )? | WHILE term expr | FOR ( VAR IDENT ASSIGN term )? ';' ( compare )? ';' ( groupExpr )? expr -> ^( FOR ( ^( VAR ^( IDENT TYPE ^( ASSIGN term ) ) ) )? ( compare )? ( groupExpr )? expr ) | LET idar ( ':' type )? ( ASSIGN returnValue )? ( ',' idar ( ':' type )? ( ASSIGN returnValue )? )* -> ^( LET ( ^( idar ^( TYPE ( type )? ) ( ^( ASSIGN returnValue ) )? ) )* ) | VAR var_element ( ',' var_element )* -> ^( VAR ( var_element )* ) | FOR ( VAR )? IDENT IN term '...' term expr | PRINT '(' ( STRINGVAL | idar ) ')' | groupExpr | REPEATE expr WHILE term -> ^( REPEATE term expr ) | FUNC IDENT '(' ( func_params )? ')' ( '->' type )? expr -> ^( FUNC IDENT ^( FUNC_PARAM ( func_params )? ) ^( TYPE ( type )? ) expr ) | RETURN ( returnValue | arrayValue ) -> ^( RETURN ( returnValue )? ( ^( ARRAY arrayValue ) )? ) | SWITCH IDENT '{' ( swcase )* ( DEFAULT ':' expr )? '}' -> ^( SWITCH IDENT ( swcase )* ( DEFAULT expr )? ) )
            int alt42 = 14;
            alt42 = dfa42.Predict(input);
            switch (alt42) 
            {
                case 1 :
                    // MathExpr.g:189:3: BEGIN exprList END
                    {
                    	BEGIN97=(IToken)Match(input,BEGIN,FOLLOW_BEGIN_in_expr1663); if (state.failed) return retval; 
                    	if ( (state.backtracking==0) ) stream_BEGIN.Add(BEGIN97);

                    	PushFollow(FOLLOW_exprList_in_expr1665);
                    	exprList98 = exprList();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( (state.backtracking==0) ) stream_exprList.Add(exprList98.Tree);
                    	END99=(IToken)Match(input,END,FOLLOW_END_in_expr1667); if (state.failed) return retval; 
                    	if ( (state.backtracking==0) ) stream_END.Add(END99);



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

                    	root_0 = (AstNode)adaptor.GetNilNode();
                    	// 189:22: -> ^( BLOCK ( exprList )? )
                    	{
                    	    // MathExpr.g:189:25: ^( BLOCK ( exprList )? )
                    	    {
                    	    AstNode root_1 = (AstNode)adaptor.GetNilNode();
                    	    root_1 = (AstNode)adaptor.BecomeRoot((AstNode)adaptor.Create(BLOCK, "BLOCK"), root_1);

                    	    // MathExpr.g:189:33: ( exprList )?
                    	    if ( stream_exprList.HasNext() )
                    	    {
                    	        adaptor.AddChild(root_1, stream_exprList.NextTree());

                    	    }
                    	    stream_exprList.Reset();

                    	    adaptor.AddChild(root_0, root_1);
                    	    }

                    	}

                    	retval.Tree = root_0;retval.Tree = root_0;}
                    }
                    break;
                case 2 :
                    // MathExpr.g:190:3: idar allassign term
                    {
                    	root_0 = (AstNode)adaptor.GetNilNode();

                    	PushFollow(FOLLOW_idar_in_expr1680);
                    	idar100 = idar();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, idar100.Tree);
                    	PushFollow(FOLLOW_allassign_in_expr1682);
                    	allassign101 = allassign();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( state.backtracking == 0 ) root_0 = (AstNode)adaptor.BecomeRoot(allassign101.Tree, root_0);
                    	PushFollow(FOLLOW_term_in_expr1685);
                    	term102 = term();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, term102.Tree);

                    }
                    break;
                case 3 :
                    // MathExpr.g:191:3: IF term expr ( ELSE expr )?
                    {
                    	root_0 = (AstNode)adaptor.GetNilNode();

                    	IF103=(IToken)Match(input,IF,FOLLOW_IF_in_expr1689); if (state.failed) return retval;
                    	if ( state.backtracking == 0 )
                    	{IF103_tree = (AstNode)adaptor.Create(IF103);
                    		root_0 = (AstNode)adaptor.BecomeRoot(IF103_tree, root_0);
                    	}
                    	PushFollow(FOLLOW_term_in_expr1692);
                    	term104 = term();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, term104.Tree);
                    	PushFollow(FOLLOW_expr_in_expr1694);
                    	expr105 = expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, expr105.Tree);
                    	// MathExpr.g:191:17: ( ELSE expr )?
                    	int alt25 = 2;
                    	int LA25_0 = input.LA(1);

                    	if ( (LA25_0 == ELSE) )
                    	{
                    	    int LA25_1 = input.LA(2);

                    	    if ( (synpred50_MathExpr()) )
                    	    {
                    	        alt25 = 1;
                    	    }
                    	}
                    	switch (alt25) 
                    	{
                    	    case 1 :
                    	        // MathExpr.g:191:18: ELSE expr
                    	        {
                    	        	ELSE106=(IToken)Match(input,ELSE,FOLLOW_ELSE_in_expr1697); if (state.failed) return retval;
                    	        	PushFollow(FOLLOW_expr_in_expr1700);
                    	        	expr107 = expr();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return retval;
                    	        	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, expr107.Tree);

                    	        }
                    	        break;

                    	}


                    }
                    break;
                case 4 :
                    // MathExpr.g:192:3: WHILE term expr
                    {
                    	root_0 = (AstNode)adaptor.GetNilNode();

                    	WHILE108=(IToken)Match(input,WHILE,FOLLOW_WHILE_in_expr1706); if (state.failed) return retval;
                    	if ( state.backtracking == 0 )
                    	{WHILE108_tree = (AstNode)adaptor.Create(WHILE108);
                    		root_0 = (AstNode)adaptor.BecomeRoot(WHILE108_tree, root_0);
                    	}
                    	PushFollow(FOLLOW_term_in_expr1709);
                    	term109 = term();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, term109.Tree);
                    	PushFollow(FOLLOW_expr_in_expr1712);
                    	expr110 = expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, expr110.Tree);

                    }
                    break;
                case 5 :
                    // MathExpr.g:193:3: FOR ( VAR IDENT ASSIGN term )? ';' ( compare )? ';' ( groupExpr )? expr
                    {
                    	FOR111=(IToken)Match(input,FOR,FOLLOW_FOR_in_expr1716); if (state.failed) return retval; 
                    	if ( (state.backtracking==0) ) stream_FOR.Add(FOR111);

                    	// MathExpr.g:193:7: ( VAR IDENT ASSIGN term )?
                    	int alt26 = 2;
                    	int LA26_0 = input.LA(1);

                    	if ( (LA26_0 == VAR) )
                    	{
                    	    alt26 = 1;
                    	}
                    	switch (alt26) 
                    	{
                    	    case 1 :
                    	        // MathExpr.g:193:8: VAR IDENT ASSIGN term
                    	        {
                    	        	VAR112=(IToken)Match(input,VAR,FOLLOW_VAR_in_expr1719); if (state.failed) return retval; 
                    	        	if ( (state.backtracking==0) ) stream_VAR.Add(VAR112);

                    	        	IDENT113=(IToken)Match(input,IDENT,FOLLOW_IDENT_in_expr1721); if (state.failed) return retval; 
                    	        	if ( (state.backtracking==0) ) stream_IDENT.Add(IDENT113);

                    	        	ASSIGN114=(IToken)Match(input,ASSIGN,FOLLOW_ASSIGN_in_expr1723); if (state.failed) return retval; 
                    	        	if ( (state.backtracking==0) ) stream_ASSIGN.Add(ASSIGN114);

                    	        	PushFollow(FOLLOW_term_in_expr1725);
                    	        	term115 = term();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return retval;
                    	        	if ( (state.backtracking==0) ) stream_term.Add(term115.Tree);

                    	        }
                    	        break;

                    	}

                    	char_literal116=(IToken)Match(input,77,FOLLOW_77_in_expr1730); if (state.failed) return retval; 
                    	if ( (state.backtracking==0) ) stream_77.Add(char_literal116);

                    	// MathExpr.g:193:37: ( compare )?
                    	int alt27 = 2;
                    	int LA27_0 = input.LA(1);

                    	if ( (LA27_0 == NOT || (LA27_0 >= TRUE && LA27_0 <= FALSE) || (LA27_0 >= NUMBER && LA27_0 <= IDENT) || (LA27_0 >= INCR && LA27_0 <= DECR) || LA27_0 == 74) )
                    	{
                    	    alt27 = 1;
                    	}
                    	switch (alt27) 
                    	{
                    	    case 1 :
                    	        // MathExpr.g:0:0: compare
                    	        {
                    	        	PushFollow(FOLLOW_compare_in_expr1732);
                    	        	compare117 = compare();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return retval;
                    	        	if ( (state.backtracking==0) ) stream_compare.Add(compare117.Tree);

                    	        }
                    	        break;

                    	}

                    	char_literal118=(IToken)Match(input,77,FOLLOW_77_in_expr1735); if (state.failed) return retval; 
                    	if ( (state.backtracking==0) ) stream_77.Add(char_literal118);

                    	// MathExpr.g:193:50: ( groupExpr )?
                    	int alt28 = 2;
                    	alt28 = dfa28.Predict(input);
                    	switch (alt28) 
                    	{
                    	    case 1 :
                    	        // MathExpr.g:193:52: groupExpr
                    	        {
                    	        	PushFollow(FOLLOW_groupExpr_in_expr1739);
                    	        	groupExpr119 = groupExpr();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return retval;
                    	        	if ( (state.backtracking==0) ) stream_groupExpr.Add(groupExpr119.Tree);

                    	        }
                    	        break;

                    	}

                    	PushFollow(FOLLOW_expr_in_expr1743);
                    	expr120 = expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( (state.backtracking==0) ) stream_expr.Add(expr120.Tree);


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

                    	root_0 = (AstNode)adaptor.GetNilNode();
                    	// 193:69: -> ^( FOR ( ^( VAR ^( IDENT TYPE ^( ASSIGN term ) ) ) )? ( compare )? ( groupExpr )? expr )
                    	{
                    	    // MathExpr.g:193:72: ^( FOR ( ^( VAR ^( IDENT TYPE ^( ASSIGN term ) ) ) )? ( compare )? ( groupExpr )? expr )
                    	    {
                    	    AstNode root_1 = (AstNode)adaptor.GetNilNode();
                    	    root_1 = (AstNode)adaptor.BecomeRoot(stream_FOR.NextNode(), root_1);

                    	    // MathExpr.g:193:78: ( ^( VAR ^( IDENT TYPE ^( ASSIGN term ) ) ) )?
                    	    if ( stream_term.HasNext() || stream_IDENT.HasNext() || stream_ASSIGN.HasNext() || stream_VAR.HasNext() )
                    	    {
                    	        // MathExpr.g:193:78: ^( VAR ^( IDENT TYPE ^( ASSIGN term ) ) )
                    	        {
                    	        AstNode root_2 = (AstNode)adaptor.GetNilNode();
                    	        root_2 = (AstNode)adaptor.BecomeRoot(stream_VAR.NextNode(), root_2);

                    	        // MathExpr.g:193:84: ^( IDENT TYPE ^( ASSIGN term ) )
                    	        {
                    	        AstNode root_3 = (AstNode)adaptor.GetNilNode();
                    	        root_3 = (AstNode)adaptor.BecomeRoot(stream_IDENT.NextNode(), root_3);

                    	        adaptor.AddChild(root_3, (AstNode)adaptor.Create(TYPE, "TYPE"));
                    	        // MathExpr.g:193:97: ^( ASSIGN term )
                    	        {
                    	        AstNode root_4 = (AstNode)adaptor.GetNilNode();
                    	        root_4 = (AstNode)adaptor.BecomeRoot(stream_ASSIGN.NextNode(), root_4);

                    	        adaptor.AddChild(root_4, stream_term.NextTree());

                    	        adaptor.AddChild(root_3, root_4);
                    	        }

                    	        adaptor.AddChild(root_2, root_3);
                    	        }

                    	        adaptor.AddChild(root_1, root_2);
                    	        }

                    	    }
                    	    stream_term.Reset();
                    	    stream_IDENT.Reset();
                    	    stream_ASSIGN.Reset();
                    	    stream_VAR.Reset();
                    	    // MathExpr.g:193:115: ( compare )?
                    	    if ( stream_compare.HasNext() )
                    	    {
                    	        adaptor.AddChild(root_1, stream_compare.NextTree());

                    	    }
                    	    stream_compare.Reset();
                    	    // MathExpr.g:193:124: ( groupExpr )?
                    	    if ( stream_groupExpr.HasNext() )
                    	    {
                    	        adaptor.AddChild(root_1, stream_groupExpr.NextTree());

                    	    }
                    	    stream_groupExpr.Reset();
                    	    adaptor.AddChild(root_1, stream_expr.NextTree());

                    	    adaptor.AddChild(root_0, root_1);
                    	    }

                    	}

                    	retval.Tree = root_0;retval.Tree = root_0;}
                    }
                    break;
                case 6 :
                    // MathExpr.g:194:3: LET idar ( ':' type )? ( ASSIGN returnValue )? ( ',' idar ( ':' type )? ( ASSIGN returnValue )? )*
                    {
                    	LET121=(IToken)Match(input,LET,FOLLOW_LET_in_expr1778); if (state.failed) return retval; 
                    	if ( (state.backtracking==0) ) stream_LET.Add(LET121);

                    	PushFollow(FOLLOW_idar_in_expr1780);
                    	idar122 = idar();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( (state.backtracking==0) ) stream_idar.Add(idar122.Tree);
                    	// MathExpr.g:194:12: ( ':' type )?
                    	int alt29 = 2;
                    	int LA29_0 = input.LA(1);

                    	if ( (LA29_0 == 73) )
                    	{
                    	    alt29 = 1;
                    	}
                    	switch (alt29) 
                    	{
                    	    case 1 :
                    	        // MathExpr.g:194:13: ':' type
                    	        {
                    	        	char_literal123=(IToken)Match(input,73,FOLLOW_73_in_expr1783); if (state.failed) return retval; 
                    	        	if ( (state.backtracking==0) ) stream_73.Add(char_literal123);

                    	        	PushFollow(FOLLOW_type_in_expr1785);
                    	        	type124 = type();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return retval;
                    	        	if ( (state.backtracking==0) ) stream_type.Add(type124.Tree);

                    	        }
                    	        break;

                    	}

                    	// MathExpr.g:194:24: ( ASSIGN returnValue )?
                    	int alt30 = 2;
                    	int LA30_0 = input.LA(1);

                    	if ( (LA30_0 == ASSIGN) )
                    	{
                    	    alt30 = 1;
                    	}
                    	switch (alt30) 
                    	{
                    	    case 1 :
                    	        // MathExpr.g:194:25: ASSIGN returnValue
                    	        {
                    	        	ASSIGN125=(IToken)Match(input,ASSIGN,FOLLOW_ASSIGN_in_expr1790); if (state.failed) return retval; 
                    	        	if ( (state.backtracking==0) ) stream_ASSIGN.Add(ASSIGN125);

                    	        	PushFollow(FOLLOW_returnValue_in_expr1792);
                    	        	returnValue126 = returnValue();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return retval;
                    	        	if ( (state.backtracking==0) ) stream_returnValue.Add(returnValue126.Tree);

                    	        }
                    	        break;

                    	}

                    	// MathExpr.g:194:46: ( ',' idar ( ':' type )? ( ASSIGN returnValue )? )*
                    	do 
                    	{
                    	    int alt33 = 2;
                    	    int LA33_0 = input.LA(1);

                    	    if ( (LA33_0 == 72) )
                    	    {
                    	        alt33 = 1;
                    	    }


                    	    switch (alt33) 
                    		{
                    			case 1 :
                    			    // MathExpr.g:194:47: ',' idar ( ':' type )? ( ASSIGN returnValue )?
                    			    {
                    			    	char_literal127=(IToken)Match(input,72,FOLLOW_72_in_expr1797); if (state.failed) return retval; 
                    			    	if ( (state.backtracking==0) ) stream_72.Add(char_literal127);

                    			    	PushFollow(FOLLOW_idar_in_expr1799);
                    			    	idar128 = idar();
                    			    	state.followingStackPointer--;
                    			    	if (state.failed) return retval;
                    			    	if ( (state.backtracking==0) ) stream_idar.Add(idar128.Tree);
                    			    	// MathExpr.g:194:56: ( ':' type )?
                    			    	int alt31 = 2;
                    			    	int LA31_0 = input.LA(1);

                    			    	if ( (LA31_0 == 73) )
                    			    	{
                    			    	    alt31 = 1;
                    			    	}
                    			    	switch (alt31) 
                    			    	{
                    			    	    case 1 :
                    			    	        // MathExpr.g:194:57: ':' type
                    			    	        {
                    			    	        	char_literal129=(IToken)Match(input,73,FOLLOW_73_in_expr1802); if (state.failed) return retval; 
                    			    	        	if ( (state.backtracking==0) ) stream_73.Add(char_literal129);

                    			    	        	PushFollow(FOLLOW_type_in_expr1804);
                    			    	        	type130 = type();
                    			    	        	state.followingStackPointer--;
                    			    	        	if (state.failed) return retval;
                    			    	        	if ( (state.backtracking==0) ) stream_type.Add(type130.Tree);

                    			    	        }
                    			    	        break;

                    			    	}

                    			    	// MathExpr.g:194:68: ( ASSIGN returnValue )?
                    			    	int alt32 = 2;
                    			    	int LA32_0 = input.LA(1);

                    			    	if ( (LA32_0 == ASSIGN) )
                    			    	{
                    			    	    alt32 = 1;
                    			    	}
                    			    	switch (alt32) 
                    			    	{
                    			    	    case 1 :
                    			    	        // MathExpr.g:194:69: ASSIGN returnValue
                    			    	        {
                    			    	        	ASSIGN131=(IToken)Match(input,ASSIGN,FOLLOW_ASSIGN_in_expr1809); if (state.failed) return retval; 
                    			    	        	if ( (state.backtracking==0) ) stream_ASSIGN.Add(ASSIGN131);

                    			    	        	PushFollow(FOLLOW_returnValue_in_expr1811);
                    			    	        	returnValue132 = returnValue();
                    			    	        	state.followingStackPointer--;
                    			    	        	if (state.failed) return retval;
                    			    	        	if ( (state.backtracking==0) ) stream_returnValue.Add(returnValue132.Tree);

                    			    	        }
                    			    	        break;

                    			    	}


                    			    }
                    			    break;

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

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



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

                    	root_0 = (AstNode)adaptor.GetNilNode();
                    	// 194:93: -> ^( LET ( ^( idar ^( TYPE ( type )? ) ( ^( ASSIGN returnValue ) )? ) )* )
                    	{
                    	    // MathExpr.g:194:96: ^( LET ( ^( idar ^( TYPE ( type )? ) ( ^( ASSIGN returnValue ) )? ) )* )
                    	    {
                    	    AstNode root_1 = (AstNode)adaptor.GetNilNode();
                    	    root_1 = (AstNode)adaptor.BecomeRoot(stream_LET.NextNode(), root_1);

                    	    // MathExpr.g:194:102: ( ^( idar ^( TYPE ( type )? ) ( ^( ASSIGN returnValue ) )? ) )*
                    	    while ( stream_idar.HasNext() )
                    	    {
                    	        // MathExpr.g:194:102: ^( idar ^( TYPE ( type )? ) ( ^( ASSIGN returnValue ) )? )
                    	        {
                    	        AstNode root_2 = (AstNode)adaptor.GetNilNode();
                    	        root_2 = (AstNode)adaptor.BecomeRoot(stream_idar.NextNode(), root_2);

                    	        // MathExpr.g:194:109: ^( TYPE ( type )? )
                    	        {
                    	        AstNode root_3 = (AstNode)adaptor.GetNilNode();
                    	        root_3 = (AstNode)adaptor.BecomeRoot((AstNode)adaptor.Create(TYPE, "TYPE"), root_3);

                    	        // MathExpr.g:194:116: ( type )?
                    	        if ( stream_type.HasNext() )
                    	        {
                    	            adaptor.AddChild(root_3, stream_type.NextTree());

                    	        }
                    	        stream_type.Reset();

                    	        adaptor.AddChild(root_2, root_3);
                    	        }
                    	        // MathExpr.g:194:123: ( ^( ASSIGN returnValue ) )?
                    	        if ( stream_returnValue.HasNext() || stream_ASSIGN.HasNext() )
                    	        {
                    	            // MathExpr.g:194:123: ^( ASSIGN returnValue )
                    	            {
                    	            AstNode root_3 = (AstNode)adaptor.GetNilNode();
                    	            root_3 = (AstNode)adaptor.BecomeRoot(stream_ASSIGN.NextNode(), root_3);

                    	            adaptor.AddChild(root_3, stream_returnValue.NextTree());

                    	            adaptor.AddChild(root_2, root_3);
                    	            }

                    	        }
                    	        stream_returnValue.Reset();
                    	        stream_ASSIGN.Reset();

                    	        adaptor.AddChild(root_1, root_2);
                    	        }

                    	    }
                    	    stream_idar.Reset();

                    	    adaptor.AddChild(root_0, root_1);
                    	    }

                    	}

                    	retval.Tree = root_0;retval.Tree = root_0;}
                    }
                    break;
                case 7 :
                    // MathExpr.g:195:3: VAR var_element ( ',' var_element )*
                    {
                    	VAR133=(IToken)Match(input,VAR,FOLLOW_VAR_in_expr1846); if (state.failed) return retval; 
                    	if ( (state.backtracking==0) ) stream_VAR.Add(VAR133);

                    	PushFollow(FOLLOW_var_element_in_expr1848);
                    	var_element134 = var_element();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( (state.backtracking==0) ) stream_var_element.Add(var_element134.Tree);
                    	// MathExpr.g:195:19: ( ',' var_element )*
                    	do 
                    	{
                    	    int alt34 = 2;
                    	    int LA34_0 = input.LA(1);

                    	    if ( (LA34_0 == 72) )
                    	    {
                    	        alt34 = 1;
                    	    }


                    	    switch (alt34) 
                    		{
                    			case 1 :
                    			    // MathExpr.g:195:20: ',' var_element
                    			    {
                    			    	char_literal135=(IToken)Match(input,72,FOLLOW_72_in_expr1851); if (state.failed) return retval; 
                    			    	if ( (state.backtracking==0) ) stream_72.Add(char_literal135);

                    			    	PushFollow(FOLLOW_var_element_in_expr1853);
                    			    	var_element136 = var_element();
                    			    	state.followingStackPointer--;
                    			    	if (state.failed) return retval;
                    			    	if ( (state.backtracking==0) ) stream_var_element.Add(var_element136.Tree);

                    			    }
                    			    break;

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

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



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

                    	root_0 = (AstNode)adaptor.GetNilNode();
                    	// 195:38: -> ^( VAR ( var_element )* )
                    	{
                    	    // MathExpr.g:195:41: ^( VAR ( var_element )* )
                    	    {
                    	    AstNode root_1 = (AstNode)adaptor.GetNilNode();
                    	    root_1 = (AstNode)adaptor.BecomeRoot(stream_VAR.NextNode(), root_1);

                    	    // MathExpr.g:195:47: ( var_element )*
                    	    while ( stream_var_element.HasNext() )
                    	    {
                    	        adaptor.AddChild(root_1, stream_var_element.NextTree());

                    	    }
                    	    stream_var_element.Reset();

                    	    adaptor.AddChild(root_0, root_1);
                    	    }

                    	}

                    	retval.Tree = root_0;retval.Tree = root_0;}
                    }
                    break;
                case 8 :
                    // MathExpr.g:196:3: FOR ( VAR )? IDENT IN term '...' term expr
                    {
                    	root_0 = (AstNode)adaptor.GetNilNode();

                    	FOR137=(IToken)Match(input,FOR,FOLLOW_FOR_in_expr1868); if (state.failed) return retval;
                    	if ( state.backtracking == 0 )
                    	{FOR137_tree = (AstNode)adaptor.Create(FOR137);
                    		root_0 = (AstNode)adaptor.BecomeRoot(FOR137_tree, root_0);
                    	}
                    	// MathExpr.g:196:11: ( VAR )?
                    	int alt35 = 2;
                    	int LA35_0 = input.LA(1);

                    	if ( (LA35_0 == VAR) )
                    	{
                    	    alt35 = 1;
                    	}
                    	switch (alt35) 
                    	{
                    	    case 1 :
                    	        // MathExpr.g:0:0: VAR
                    	        {
                    	        	VAR138=(IToken)Match(input,VAR,FOLLOW_VAR_in_expr1871); if (state.failed) return retval;

                    	        }
                    	        break;

                    	}

                    	IDENT139=(IToken)Match(input,IDENT,FOLLOW_IDENT_in_expr1875); if (state.failed) return retval;
                    	if ( state.backtracking == 0 )
                    	{IDENT139_tree = (AstNode)adaptor.Create(IDENT139);
                    		adaptor.AddChild(root_0, IDENT139_tree);
                    	}
                    	IN140=(IToken)Match(input,IN,FOLLOW_IN_in_expr1877); if (state.failed) return retval;
                    	PushFollow(FOLLOW_term_in_expr1880);
                    	term141 = term();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, term141.Tree);
                    	string_literal142=(IToken)Match(input,78,FOLLOW_78_in_expr1882); if (state.failed) return retval;
                    	PushFollow(FOLLOW_term_in_expr1885);
                    	term143 = term();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, term143.Tree);
                    	PushFollow(FOLLOW_expr_in_expr1887);
                    	expr144 = expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, expr144.Tree);

                    }
                    break;
                case 9 :
                    // MathExpr.g:197:3: PRINT '(' ( STRINGVAL | idar ) ')'
                    {
                    	root_0 = (AstNode)adaptor.GetNilNode();

                    	PRINT145=(IToken)Match(input,PRINT,FOLLOW_PRINT_in_expr1891); if (state.failed) return retval;
                    	if ( state.backtracking == 0 )
                    	{PRINT145_tree = (AstNode)adaptor.Create(PRINT145);
                    		root_0 = (AstNode)adaptor.BecomeRoot(PRINT145_tree, root_0);
                    	}
                    	char_literal146=(IToken)Match(input,74,FOLLOW_74_in_expr1894); if (state.failed) return retval;
                    	// MathExpr.g:197:15: ( STRINGVAL | idar )
                    	int alt36 = 2;
                    	int LA36_0 = input.LA(1);

                    	if ( (LA36_0 == STRINGVAL) )
                    	{
                    	    alt36 = 1;
                    	}
                    	else if ( (LA36_0 == IDENT) )
                    	{
                    	    alt36 = 2;
                    	}
                    	else 
                    	{
                    	    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                    	    NoViableAltException nvae_d36s0 =
                    	        new NoViableAltException("", 36, 0, input);

                    	    throw nvae_d36s0;
                    	}
                    	switch (alt36) 
                    	{
                    	    case 1 :
                    	        // MathExpr.g:197:17: STRINGVAL
                    	        {
                    	        	STRINGVAL147=(IToken)Match(input,STRINGVAL,FOLLOW_STRINGVAL_in_expr1899); if (state.failed) return retval;
                    	        	if ( state.backtracking == 0 )
                    	        	{STRINGVAL147_tree = (AstNode)adaptor.Create(STRINGVAL147);
                    	        		adaptor.AddChild(root_0, STRINGVAL147_tree);
                    	        	}

                    	        }
                    	        break;
                    	    case 2 :
                    	        // MathExpr.g:197:29: idar
                    	        {
                    	        	PushFollow(FOLLOW_idar_in_expr1903);
                    	        	idar148 = idar();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return retval;
                    	        	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, idar148.Tree);

                    	        }
                    	        break;

                    	}

                    	char_literal149=(IToken)Match(input,75,FOLLOW_75_in_expr1907); if (state.failed) return retval;

                    }
                    break;
                case 10 :
                    // MathExpr.g:198:3: groupExpr
                    {
                    	root_0 = (AstNode)adaptor.GetNilNode();

                    	PushFollow(FOLLOW_groupExpr_in_expr1912);
                    	groupExpr150 = groupExpr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( state.backtracking == 0 ) adaptor.AddChild(root_0, groupExpr150.Tree);

                    }
                    break;
                case 11 :
                    // MathExpr.g:199:3: REPEATE expr WHILE term
                    {
                    	REPEATE151=(IToken)Match(input,REPEATE,FOLLOW_REPEATE_in_expr1916); if (state.failed) return retval; 
                    	if ( (state.backtracking==0) ) stream_REPEATE.Add(REPEATE151);

                    	PushFollow(FOLLOW_expr_in_expr1918);
                    	expr152 = expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( (state.backtracking==0) ) stream_expr.Add(expr152.Tree);
                    	WHILE153=(IToken)Match(input,WHILE,FOLLOW_WHILE_in_expr1920); if (state.failed) return retval; 
                    	if ( (state.backtracking==0) ) stream_WHILE.Add(WHILE153);

                    	PushFollow(FOLLOW_term_in_expr1922);
                    	term154 = term();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( (state.backtracking==0) ) stream_term.Add(term154.Tree);


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

                    	root_0 = (AstNode)adaptor.GetNilNode();
                    	// 199:27: -> ^( REPEATE term expr )
                    	{
                    	    // MathExpr.g:199:30: ^( REPEATE term expr )
                    	    {
                    	    AstNode root_1 = (AstNode)adaptor.GetNilNode();
                    	    root_1 = (AstNode)adaptor.BecomeRoot(stream_REPEATE.NextNode(), root_1);

                    	    adaptor.AddChild(root_1, stream_term.NextTree());
                    	    adaptor.AddChild(root_1, stream_expr.NextTree());

                    	    adaptor.AddChild(root_0, root_1);
                    	    }

                    	}

                    	retval.Tree = root_0;retval.Tree = root_0;}
                    }
                    break;
                case 12 :
                    // MathExpr.g:200:3: FUNC IDENT '(' ( func_params )? ')' ( '->' type )? expr
                    {
                    	FUNC155=(IToken)Match(input,FUNC,FOLLOW_FUNC_in_expr1936); if (state.failed) return retval; 
                    	if ( (state.backtracking==0) ) stream_FUNC.Add(FUNC155);

                    	IDENT156=(IToken)Match(input,IDENT,FOLLOW_IDENT_in_expr1938); if (state.failed) return retval; 
                    	if ( (state.backtracking==0) ) stream_IDENT.Add(IDENT156);

                    	char_literal157=(IToken)Match(input,74,FOLLOW_74_in_expr1940); if (state.failed) return retval; 
                    	if ( (state.backtracking==0) ) stream_74.Add(char_literal157);

                    	// MathExpr.g:200:18: ( func_params )?
                    	int alt37 = 2;
                    	int LA37_0 = input.LA(1);

                    	if ( (LA37_0 == IDENT) )
                    	{
                    	    alt37 = 1;
                    	}
                    	switch (alt37) 
                    	{
                    	    case 1 :
                    	        // MathExpr.g:0:0: func_params
                    	        {
                    	        	PushFollow(FOLLOW_func_params_in_expr1942);
                    	        	func_params158 = func_params();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return retval;
                    	        	if ( (state.backtracking==0) ) stream_func_params.Add(func_params158.Tree);

                    	        }
                    	        break;

                    	}

                    	char_literal159=(IToken)Match(input,75,FOLLOW_75_in_expr1945); if (state.failed) return retval; 
                    	if ( (state.backtracking==0) ) stream_75.Add(char_literal159);

                    	// MathExpr.g:200:35: ( '->' type )?
                    	int alt38 = 2;
                    	int LA38_0 = input.LA(1);

                    	if ( (LA38_0 == 79) )
                    	{
                    	    alt38 = 1;
                    	}
                    	switch (alt38) 
                    	{
                    	    case 1 :
                    	        // MathExpr.g:200:36: '->' type
                    	        {
                    	        	string_literal160=(IToken)Match(input,79,FOLLOW_79_in_expr1948); if (state.failed) return retval; 
                    	        	if ( (state.backtracking==0) ) stream_79.Add(string_literal160);

                    	        	PushFollow(FOLLOW_type_in_expr1950);
                    	        	type161 = type();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return retval;
                    	        	if ( (state.backtracking==0) ) stream_type.Add(type161.Tree);

                    	        }
                    	        break;

                    	}

                    	PushFollow(FOLLOW_expr_in_expr1954);
                    	expr162 = expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( (state.backtracking==0) ) stream_expr.Add(expr162.Tree);


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

                    	root_0 = (AstNode)adaptor.GetNilNode();
                    	// 200:53: -> ^( FUNC IDENT ^( FUNC_PARAM ( func_params )? ) ^( TYPE ( type )? ) expr )
                    	{
                    	    // MathExpr.g:200:56: ^( FUNC IDENT ^( FUNC_PARAM ( func_params )? ) ^( TYPE ( type )? ) expr )
                    	    {
                    	    AstNode root_1 = (AstNode)adaptor.GetNilNode();
                    	    root_1 = (AstNode)adaptor.BecomeRoot(stream_FUNC.NextNode(), root_1);

                    	    adaptor.AddChild(root_1, stream_IDENT.NextNode());
                    	    // MathExpr.g:200:69: ^( FUNC_PARAM ( func_params )? )
                    	    {
                    	    AstNode root_2 = (AstNode)adaptor.GetNilNode();
                    	    root_2 = (AstNode)adaptor.BecomeRoot((AstNode)adaptor.Create(FUNC_PARAM, "FUNC_PARAM"), root_2);

                    	    // MathExpr.g:200:83: ( func_params )?
                    	    if ( stream_func_params.HasNext() )
                    	    {
                    	        adaptor.AddChild(root_2, stream_func_params.NextTree());

                    	    }
                    	    stream_func_params.Reset();

                    	    adaptor.AddChild(root_1, root_2);
                    	    }
                    	    // MathExpr.g:200:97: ^( TYPE ( type )? )
                    	    {
                    	    AstNode root_2 = (AstNode)adaptor.GetNilNode();
                    	    root_2 = (AstNode)adaptor.BecomeRoot((AstNode)adaptor.Create(TYPE, "TYPE"), root_2);

                    	    // MathExpr.g:200:104: ( type )?
                    	    if ( stream_type.HasNext() )
                    	    {
                    	        adaptor.AddChild(root_2, stream_type.NextTree());

                    	    }
                    	    stream_type.Reset();

                    	    adaptor.AddChild(root_1, root_2);
                    	    }
                    	    adaptor.AddChild(root_1, stream_expr.NextTree());

                    	    adaptor.AddChild(root_0, root_1);
                    	    }

                    	}

                    	retval.Tree = root_0;retval.Tree = root_0;}
                    }
                    break;
                case 13 :
                    // MathExpr.g:201:3: RETURN ( returnValue | arrayValue )
                    {
                    	RETURN163=(IToken)Match(input,RETURN,FOLLOW_RETURN_in_expr1983); if (state.failed) return retval; 
                    	if ( (state.backtracking==0) ) stream_RETURN.Add(RETURN163);

                    	// MathExpr.g:201:10: ( returnValue | arrayValue )
                    	int alt39 = 2;
                    	int LA39_0 = input.LA(1);

                    	if ( (LA39_0 == NOT || (LA39_0 >= TRUE && LA39_0 <= FALSE) || (LA39_0 >= NUMBER && LA39_0 <= IDENT) || (LA39_0 >= INCR && LA39_0 <= DECR) || LA39_0 == 74) )
                    	{
                    	    alt39 = 1;
                    	}
                    	else if ( (LA39_0 == 70) )
                    	{
                    	    alt39 = 2;
                    	}
                    	else 
                    	{
                    	    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                    	    NoViableAltException nvae_d39s0 =
                    	        new NoViableAltException("", 39, 0, input);

                    	    throw nvae_d39s0;
                    	}
                    	switch (alt39) 
                    	{
                    	    case 1 :
                    	        // MathExpr.g:201:11: returnValue
                    	        {
                    	        	PushFollow(FOLLOW_returnValue_in_expr1986);
                    	        	returnValue164 = returnValue();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return retval;
                    	        	if ( (state.backtracking==0) ) stream_returnValue.Add(returnValue164.Tree);

                    	        }
                    	        break;
                    	    case 2 :
                    	        // MathExpr.g:201:26: arrayValue
                    	        {
                    	        	PushFollow(FOLLOW_arrayValue_in_expr1991);
                    	        	arrayValue165 = arrayValue();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return retval;
                    	        	if ( (state.backtracking==0) ) stream_arrayValue.Add(arrayValue165.Tree);

                    	        }
                    	        break;

                    	}



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

                    	root_0 = (AstNode)adaptor.GetNilNode();
                    	// 201:38: -> ^( RETURN ( returnValue )? ( ^( ARRAY arrayValue ) )? )
                    	{
                    	    // MathExpr.g:201:41: ^( RETURN ( returnValue )? ( ^( ARRAY arrayValue ) )? )
                    	    {
                    	    AstNode root_1 = (AstNode)adaptor.GetNilNode();
                    	    root_1 = (AstNode)adaptor.BecomeRoot(stream_RETURN.NextNode(), root_1);

                    	    // MathExpr.g:201:50: ( returnValue )?
                    	    if ( stream_returnValue.HasNext() )
                    	    {
                    	        adaptor.AddChild(root_1, stream_returnValue.NextTree());

                    	    }
                    	    stream_returnValue.Reset();
                    	    // MathExpr.g:201:63: ( ^( ARRAY arrayValue ) )?
                    	    if ( stream_arrayValue.HasNext() )
                    	    {
                    	        // MathExpr.g:201:63: ^( ARRAY arrayValue )
                    	        {
                    	        AstNode root_2 = (AstNode)adaptor.GetNilNode();
                    	        root_2 = (AstNode)adaptor.BecomeRoot((AstNode)adaptor.Create(ARRAY, "ARRAY"), root_2);

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

                    	        adaptor.AddChild(root_1, root_2);
                    	        }

                    	    }
                    	    stream_arrayValue.Reset();

                    	    adaptor.AddChild(root_0, root_1);
                    	    }

                    	}

                    	retval.Tree = root_0;retval.Tree = root_0;}
                    }
                    break;
                case 14 :
                    // MathExpr.g:202:3: SWITCH IDENT '{' ( swcase )* ( DEFAULT ':' expr )? '}'
                    {
                    	SWITCH166=(IToken)Match(input,SWITCH,FOLLOW_SWITCH_in_expr2012); if (state.failed) return retval; 
                    	if ( (state.backtracking==0) ) stream_SWITCH.Add(SWITCH166);

                    	IDENT167=(IToken)Match(input,IDENT,FOLLOW_IDENT_in_expr2014); if (state.failed) return retval; 
                    	if ( (state.backtracking==0) ) stream_IDENT.Add(IDENT167);

                    	char_literal168=(IToken)Match(input,BEGIN,FOLLOW_BEGIN_in_expr2016); if (state.failed) return retval; 
                    	if ( (state.backtracking==0) ) stream_BEGIN.Add(char_literal168);

                    	// MathExpr.g:202:20: ( swcase )*
                    	do 
                    	{
                    	    int alt40 = 2;
                    	    int LA40_0 = input.LA(1);

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


                    	    switch (alt40) 
                    		{
                    			case 1 :
                    			    // MathExpr.g:202:21: swcase
                    			    {
                    			    	PushFollow(FOLLOW_swcase_in_expr2019);
                    			    	swcase169 = swcase();
                    			    	state.followingStackPointer--;
                    			    	if (state.failed) return retval;
                    			    	if ( (state.backtracking==0) ) stream_swcase.Add(swcase169.Tree);

                    			    }
                    			    break;

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

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

                    	// MathExpr.g:202:30: ( DEFAULT ':' expr )?
                    	int alt41 = 2;
                    	int LA41_0 = input.LA(1);

                    	if ( (LA41_0 == DEFAULT) )
                    	{
                    	    alt41 = 1;
                    	}
                    	switch (alt41) 
                    	{
                    	    case 1 :
                    	        // MathExpr.g:202:31: DEFAULT ':' expr
                    	        {
                    	        	DEFAULT170=(IToken)Match(input,DEFAULT,FOLLOW_DEFAULT_in_expr2024); if (state.failed) return retval; 
                    	        	if ( (state.backtracking==0) ) stream_DEFAULT.Add(DEFAULT170);

                    	        	char_literal171=(IToken)Match(input,73,FOLLOW_73_in_expr2026); if (state.failed) return retval; 
                    	        	if ( (state.backtracking==0) ) stream_73.Add(char_literal171);

                    	        	PushFollow(FOLLOW_expr_in_expr2028);
                    	        	expr172 = expr();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return retval;
                    	        	if ( (state.backtracking==0) ) stream_expr.Add(expr172.Tree);

                    	        }
                    	        break;

                    	}

                    	char_literal173=(IToken)Match(input,END,FOLLOW_END_in_expr2032); if (state.failed) return retval; 
                    	if ( (state.backtracking==0) ) stream_END.Add(char_literal173);



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

                    	root_0 = (AstNode)adaptor.GetNilNode();
                    	// 202:54: -> ^( SWITCH IDENT ( swcase )* ( DEFAULT expr )? )
                    	{
                    	    // MathExpr.g:202:57: ^( SWITCH IDENT ( swcase )* ( DEFAULT expr )? )
                    	    {
                    	    AstNode root_1 = (AstNode)adaptor.GetNilNode();
                    	    root_1 = (AstNode)adaptor.BecomeRoot(stream_SWITCH.NextNode(), root_1);

                    	    adaptor.AddChild(root_1, stream_IDENT.NextNode());
                    	    // MathExpr.g:202:73: ( swcase )*
                    	    while ( stream_swcase.HasNext() )
                    	    {
                    	        adaptor.AddChild(root_1, stream_swcase.NextTree());

                    	    }
                    	    stream_swcase.Reset();
                    	    // MathExpr.g:202:83: ( DEFAULT expr )?
                    	    if ( stream_expr.HasNext() || stream_DEFAULT.HasNext() )
                    	    {
                    	        adaptor.AddChild(root_1, stream_DEFAULT.NextNode());
                    	        adaptor.AddChild(root_1, stream_expr.NextTree());

                    	    }
                    	    stream_expr.Reset();
                    	    stream_DEFAULT.Reset();

                    	    adaptor.AddChild(root_0, root_1);
                    	    }

                    	}

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

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

            if ( (state.backtracking==0) )
            {	retval.Tree = (AstNode)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 = (AstNode)adaptor.ErrorNode(input, (IToken) retval.Start, input.LT(-1), re);

        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 24, expr_StartIndex); 
            }
        }
        return retval;
    }
Пример #13
0
    // $ANTLR start "var_element"
    // MathExpr.g:148:1: var_element : idar ( ':' type ( '(count' ':' add ')' ) )? ( ASSIGN ( returnValue | arrayValue ) )? -> ^( idar ( ^( TYPE type add ) )? ( ^( ASSIGN ( returnValue )? ( ^( ARRAY arrayValue ) )? ) )? ) ;
    public MathExprParser.var_element_return var_element() // throws RecognitionException [1]
    {   
        MathExprParser.var_element_return retval = new MathExprParser.var_element_return();
        retval.Start = input.LT(1);
        int var_element_StartIndex = input.Index();
        AstNode root_0 = null;

        IToken char_literal59 = null;
        IToken string_literal61 = null;
        IToken char_literal62 = null;
        IToken char_literal64 = null;
        IToken ASSIGN65 = null;
        MathExprParser.idar_return idar58 = default(MathExprParser.idar_return);

        MathExprParser.type_return type60 = default(MathExprParser.type_return);

        MathExprParser.add_return add63 = default(MathExprParser.add_return);

        MathExprParser.returnValue_return returnValue66 = default(MathExprParser.returnValue_return);

        MathExprParser.arrayValue_return arrayValue67 = default(MathExprParser.arrayValue_return);


        AstNode char_literal59_tree=null;
        AstNode string_literal61_tree=null;
        AstNode char_literal62_tree=null;
        AstNode char_literal64_tree=null;
        AstNode ASSIGN65_tree=null;
        RewriteRuleTokenStream stream_73 = new RewriteRuleTokenStream(adaptor,"token 73");
        RewriteRuleTokenStream stream_ASSIGN = new RewriteRuleTokenStream(adaptor,"token ASSIGN");
        RewriteRuleTokenStream stream_75 = new RewriteRuleTokenStream(adaptor,"token 75");
        RewriteRuleTokenStream stream_76 = new RewriteRuleTokenStream(adaptor,"token 76");
        RewriteRuleSubtreeStream stream_add = new RewriteRuleSubtreeStream(adaptor,"rule add");
        RewriteRuleSubtreeStream stream_returnValue = new RewriteRuleSubtreeStream(adaptor,"rule returnValue");
        RewriteRuleSubtreeStream stream_arrayValue = new RewriteRuleSubtreeStream(adaptor,"rule arrayValue");
        RewriteRuleSubtreeStream stream_type = new RewriteRuleSubtreeStream(adaptor,"rule type");
        RewriteRuleSubtreeStream stream_idar = new RewriteRuleSubtreeStream(adaptor,"rule idar");
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 13) ) 
    	    {
    	    	return retval; 
    	    }
            // MathExpr.g:148:12: ( idar ( ':' type ( '(count' ':' add ')' ) )? ( ASSIGN ( returnValue | arrayValue ) )? -> ^( idar ( ^( TYPE type add ) )? ( ^( ASSIGN ( returnValue )? ( ^( ARRAY arrayValue ) )? ) )? ) )
            // MathExpr.g:148:14: idar ( ':' type ( '(count' ':' add ')' ) )? ( ASSIGN ( returnValue | arrayValue ) )?
            {
            	PushFollow(FOLLOW_idar_in_var_element1384);
            	idar58 = idar();
            	state.followingStackPointer--;
            	if (state.failed) return retval;
            	if ( (state.backtracking==0) ) stream_idar.Add(idar58.Tree);
            	// MathExpr.g:148:19: ( ':' type ( '(count' ':' add ')' ) )?
            	int alt13 = 2;
            	int LA13_0 = input.LA(1);

            	if ( (LA13_0 == 73) )
            	{
            	    alt13 = 1;
            	}
            	switch (alt13) 
            	{
            	    case 1 :
            	        // MathExpr.g:148:20: ':' type ( '(count' ':' add ')' )
            	        {
            	        	char_literal59=(IToken)Match(input,73,FOLLOW_73_in_var_element1387); if (state.failed) return retval; 
            	        	if ( (state.backtracking==0) ) stream_73.Add(char_literal59);

            	        	PushFollow(FOLLOW_type_in_var_element1389);
            	        	type60 = type();
            	        	state.followingStackPointer--;
            	        	if (state.failed) return retval;
            	        	if ( (state.backtracking==0) ) stream_type.Add(type60.Tree);
            	        	// MathExpr.g:148:29: ( '(count' ':' add ')' )
            	        	// MathExpr.g:148:30: '(count' ':' add ')'
            	        	{
            	        		string_literal61=(IToken)Match(input,76,FOLLOW_76_in_var_element1392); if (state.failed) return retval; 
            	        		if ( (state.backtracking==0) ) stream_76.Add(string_literal61);

            	        		char_literal62=(IToken)Match(input,73,FOLLOW_73_in_var_element1394); if (state.failed) return retval; 
            	        		if ( (state.backtracking==0) ) stream_73.Add(char_literal62);

            	        		PushFollow(FOLLOW_add_in_var_element1396);
            	        		add63 = add();
            	        		state.followingStackPointer--;
            	        		if (state.failed) return retval;
            	        		if ( (state.backtracking==0) ) stream_add.Add(add63.Tree);
            	        		char_literal64=(IToken)Match(input,75,FOLLOW_75_in_var_element1398); if (state.failed) return retval; 
            	        		if ( (state.backtracking==0) ) stream_75.Add(char_literal64);


            	        	}


            	        }
            	        break;

            	}

            	// MathExpr.g:148:56: ( ASSIGN ( returnValue | arrayValue ) )?
            	int alt15 = 2;
            	int LA15_0 = input.LA(1);

            	if ( (LA15_0 == ASSIGN) )
            	{
            	    alt15 = 1;
            	}
            	switch (alt15) 
            	{
            	    case 1 :
            	        // MathExpr.g:148:57: ASSIGN ( returnValue | arrayValue )
            	        {
            	        	ASSIGN65=(IToken)Match(input,ASSIGN,FOLLOW_ASSIGN_in_var_element1406); if (state.failed) return retval; 
            	        	if ( (state.backtracking==0) ) stream_ASSIGN.Add(ASSIGN65);

            	        	// MathExpr.g:148:64: ( returnValue | arrayValue )
            	        	int alt14 = 2;
            	        	int LA14_0 = input.LA(1);

            	        	if ( (LA14_0 == NOT || (LA14_0 >= TRUE && LA14_0 <= FALSE) || (LA14_0 >= NUMBER && LA14_0 <= IDENT) || (LA14_0 >= INCR && LA14_0 <= DECR) || LA14_0 == 74) )
            	        	{
            	        	    alt14 = 1;
            	        	}
            	        	else if ( (LA14_0 == 70) )
            	        	{
            	        	    alt14 = 2;
            	        	}
            	        	else 
            	        	{
            	        	    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
            	        	    NoViableAltException nvae_d14s0 =
            	        	        new NoViableAltException("", 14, 0, input);

            	        	    throw nvae_d14s0;
            	        	}
            	        	switch (alt14) 
            	        	{
            	        	    case 1 :
            	        	        // MathExpr.g:148:66: returnValue
            	        	        {
            	        	        	PushFollow(FOLLOW_returnValue_in_var_element1410);
            	        	        	returnValue66 = returnValue();
            	        	        	state.followingStackPointer--;
            	        	        	if (state.failed) return retval;
            	        	        	if ( (state.backtracking==0) ) stream_returnValue.Add(returnValue66.Tree);

            	        	        }
            	        	        break;
            	        	    case 2 :
            	        	        // MathExpr.g:148:80: arrayValue
            	        	        {
            	        	        	PushFollow(FOLLOW_arrayValue_in_var_element1414);
            	        	        	arrayValue67 = arrayValue();
            	        	        	state.followingStackPointer--;
            	        	        	if (state.failed) return retval;
            	        	        	if ( (state.backtracking==0) ) stream_arrayValue.Add(arrayValue67.Tree);

            	        	        }
            	        	        break;

            	        	}


            	        }
            	        break;

            	}



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

            	root_0 = (AstNode)adaptor.GetNilNode();
            	// 148:94: -> ^( idar ( ^( TYPE type add ) )? ( ^( ASSIGN ( returnValue )? ( ^( ARRAY arrayValue ) )? ) )? )
            	{
            	    // MathExpr.g:148:97: ^( idar ( ^( TYPE type add ) )? ( ^( ASSIGN ( returnValue )? ( ^( ARRAY arrayValue ) )? ) )? )
            	    {
            	    AstNode root_1 = (AstNode)adaptor.GetNilNode();
            	    root_1 = (AstNode)adaptor.BecomeRoot(stream_idar.NextNode(), root_1);

            	    // MathExpr.g:148:104: ( ^( TYPE type add ) )?
            	    if ( stream_type.HasNext() || stream_add.HasNext() )
            	    {
            	        // MathExpr.g:148:104: ^( TYPE type add )
            	        {
            	        AstNode root_2 = (AstNode)adaptor.GetNilNode();
            	        root_2 = (AstNode)adaptor.BecomeRoot((AstNode)adaptor.Create(TYPE, "TYPE"), root_2);

            	        adaptor.AddChild(root_2, stream_type.NextTree());
            	        adaptor.AddChild(root_2, stream_add.NextTree());

            	        adaptor.AddChild(root_1, root_2);
            	        }

            	    }
            	    stream_type.Reset();
            	    stream_add.Reset();
            	    // MathExpr.g:148:122: ( ^( ASSIGN ( returnValue )? ( ^( ARRAY arrayValue ) )? ) )?
            	    if ( stream_returnValue.HasNext() || stream_arrayValue.HasNext() || stream_ASSIGN.HasNext() )
            	    {
            	        // MathExpr.g:148:122: ^( ASSIGN ( returnValue )? ( ^( ARRAY arrayValue ) )? )
            	        {
            	        AstNode root_2 = (AstNode)adaptor.GetNilNode();
            	        root_2 = (AstNode)adaptor.BecomeRoot(stream_ASSIGN.NextNode(), root_2);

            	        // MathExpr.g:148:131: ( returnValue )?
            	        if ( stream_returnValue.HasNext() )
            	        {
            	            adaptor.AddChild(root_2, stream_returnValue.NextTree());

            	        }
            	        stream_returnValue.Reset();
            	        // MathExpr.g:148:144: ( ^( ARRAY arrayValue ) )?
            	        if ( stream_arrayValue.HasNext() )
            	        {
            	            // MathExpr.g:148:144: ^( ARRAY arrayValue )
            	            {
            	            AstNode root_3 = (AstNode)adaptor.GetNilNode();
            	            root_3 = (AstNode)adaptor.BecomeRoot((AstNode)adaptor.Create(ARRAY, "ARRAY"), root_3);

            	            adaptor.AddChild(root_3, stream_arrayValue.NextTree());

            	            adaptor.AddChild(root_2, root_3);
            	            }

            	        }
            	        stream_arrayValue.Reset();

            	        adaptor.AddChild(root_1, root_2);
            	        }

            	    }
            	    stream_returnValue.Reset();
            	    stream_arrayValue.Reset();
            	    stream_ASSIGN.Reset();

            	    adaptor.AddChild(root_0, root_1);
            	    }

            	}

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

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

            if ( (state.backtracking==0) )
            {	retval.Tree = (AstNode)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 = (AstNode)adaptor.ErrorNode(input, (IToken) retval.Start, input.LT(-1), re);

        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 13, var_element_StartIndex); 
            }
        }
        return retval;
    }