Esempio n. 1
0
	public Procedure procDef()
	{
		EnterRule_procDef();
		EnterRule("procDef", 11);
		TraceIn("procDef", 11);
		Procedure procDecl = default(Procedure);


		IToken identifier20 = default(IToken);
		List<Variable> parameterList21 = default(List<Variable>);
		List<Variable> variableDef22 = default(List<Variable>);
		Body body23 = default(Body);


				procDecl = new Procedure();
			
		try { DebugEnterRule(GrammarFileName, "procDef");
		DebugLocation(222, 5);
		try
		{
			// D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:227:6: ( PROCEDURE identifier ( LPAREN parameterList RPAREN )? SEMI ( variableDef )? body SEMI )
			DebugEnterAlt(1);
			// D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:227:8: PROCEDURE identifier ( LPAREN parameterList RPAREN )? SEMI ( variableDef )? body SEMI
			{
			DebugLocation(227, 8);
			Match(input,PROCEDURE,Follow._PROCEDURE_in_procDef727); 
			DebugLocation(228, 7);
			PushFollow(Follow._identifier_in_procDef735);
			identifier20=identifier();
			PopFollow();

			DebugLocation(229, 7);

			    			procDecl.SetName(identifier20);
			    		
			DebugLocation(232, 7);
			// D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:232:7: ( LPAREN parameterList RPAREN )?
			int alt10=2;
			try { DebugEnterSubRule(10);
			try { DebugEnterDecision(10, false);
			int LA10_0 = input.LA(1);

			if ((LA10_0==LPAREN))
			{
				alt10 = 1;
			}
			} finally { DebugExitDecision(10); }
			switch (alt10)
			{
			case 1:
				DebugEnterAlt(1);
				// D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:232:9: LPAREN parameterList RPAREN
				{
				DebugLocation(232, 9);
				Match(input,LPAREN,Follow._LPAREN_in_procDef753); 
				DebugLocation(233, 7);
				PushFollow(Follow._parameterList_in_procDef762);
				parameterList21=parameterList();
				PopFollow();

				DebugLocation(234, 7);

				    			foreach(var pr in parameterList21)
				    			{
				    				procDecl.AddChild(pr);
				    			}
				    		
				DebugLocation(240, 7);
				Match(input,RPAREN,Follow._RPAREN_in_procDef778); 

				}
				break;

			}
			} finally { DebugExitSubRule(10); }

			DebugLocation(240, 17);
			Match(input,SEMI,Follow._SEMI_in_procDef783); 
			DebugLocation(241, 7);
			// D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:241:7: ( variableDef )?
			int alt11=2;
			try { DebugEnterSubRule(11);
			try { DebugEnterDecision(11, false);
			int LA11_0 = input.LA(1);

			if ((LA11_0==VAR))
			{
				alt11 = 1;
			}
			} finally { DebugExitDecision(11); }
			switch (alt11)
			{
			case 1:
				DebugEnterAlt(1);
				// D:\\projects\\repository\\ifmo\\Компиляторы\\PascalCompiler\\PascalCompiler\\Grammar\\Pascal.g:241:9: variableDef
				{
				DebugLocation(241, 9);
				PushFollow(Follow._variableDef_in_procDef794);
				variableDef22=variableDef();
				PopFollow();

				DebugLocation(242, 7);

				    			foreach(var child in variableDef22)
							{
								procDecl.AddChild(child);
							}
				    		

				}
				break;

			}
			} finally { DebugExitSubRule(11); }

			DebugLocation(249, 7);
			PushFollow(Follow._body_in_procDef819);
			body23=body();
			PopFollow();

			DebugLocation(250, 7);

						procDecl.AddChild(body23);
			    		
			DebugLocation(253, 7);
			Match(input,SEMI,Follow._SEMI_in_procDef835); 

			}

		}

			catch (RecognitionException e)
			{
		        	throw e;
		    	}

		finally
		{
			TraceOut("procDef", 11);
			LeaveRule("procDef", 11);
			LeaveRule_procDef();
		}
		DebugLocation(254, 5);
		} finally { DebugExitRule(GrammarFileName, "procDef"); }
		return procDecl;

	}