Ejemplo n.º 1
0
 public FuncDefNode Get(FuncDeclNode funcDecl)
 {
     foreach (FuncDefNode def in definitions_)
         if (def.Equatable.Equals(funcDecl.Equatable))
             return def;
     return null;
 }
Ejemplo n.º 2
0
 public bool Contains(FuncDeclNode funcDecl)
 {
     foreach (FuncDefNode def in definitions_)
         if (def.Equatable.Equals(funcDecl.Equatable))
             return true;
     return false;
 }
Ejemplo n.º 3
0
		public static bool Contains(FuncDeclNode funcDeclEquatable)
		{
			foreach (FuncDeclNode decl in declarations_)
				if (decl.Equatable.Equals(funcDeclEquatable))
					return true;
			return false;
		}
Ejemplo n.º 4
0
		public static void Add(FuncDeclNode funcDecl)
		{
			Debug.Assert(funcDecl != null);
			FuncDeclNode previousDecl = Get(funcDecl.Equatable);
			if (previousDecl != null)
				declarations_.Remove(previousDecl);
			declarations_.Add(funcDecl);
		}
Ejemplo n.º 5
0
	private FuncDeclNode funcDecl()
	{
		EnterRule_funcDecl();
		EnterRule("funcDecl", 4);
		TraceIn("funcDecl", 4);
		FuncDeclNode node = default(FuncDeclNode);


		CommonTree IDENT7 = default(CommonTree);
		TypeSpecNode typeSpec6 = default(TypeSpecNode);
		VarSpecNode varSpec8 = default(VarSpecNode);


			node = new FuncDeclNode();

		try { DebugEnterRule(GrammarFileName, "funcDecl");
		DebugLocation(43, 0);
		try
		{
			// Grammar\\SimpleCTreeWalker.g:46:3: ( ^( FUNC_DECL typeSpec IDENT ^( PARAM_SPEC_LIST ( varSpec )* ) ) )
			DebugEnterAlt(1);
			// Grammar\\SimpleCTreeWalker.g:47:2: ^( FUNC_DECL typeSpec IDENT ^( PARAM_SPEC_LIST ( varSpec )* ) )
			{
			DebugLocation(47, 2);
			DebugLocation(47, 4);
			Match(input,FUNC_DECL,Follow._FUNC_DECL_in_funcDecl138); 

			Match(input, TokenTypes.Down, null); 
			DebugLocation(48, 3);
			PushFollow(Follow._typeSpec_in_funcDecl143);
			typeSpec6=typeSpec();
			PopFollow();

			DebugLocation(48, 12);
			 node.ReturnTypeSpec = typeSpec6; 
			DebugLocation(49, 3);
			IDENT7=(CommonTree)Match(input,IDENT,Follow._IDENT_in_funcDecl150); 
			DebugLocation(49, 9);
			 node.Name = IDENT7.Text; 
			DebugLocation(50, 3);
			DebugLocation(50, 5);
			Match(input,PARAM_SPEC_LIST,Follow._PARAM_SPEC_LIST_in_funcDecl157); 

			if (input.LA(1) == TokenTypes.Down)
			{
				Match(input, TokenTypes.Down, null); 
				DebugLocation(50, 21);
				// Grammar\\SimpleCTreeWalker.g:50:21: ( varSpec )*
				try { DebugEnterSubRule(3);
				while (true)
				{
					int alt3=2;
					try { DebugEnterDecision(3, false);
					int LA3_0 = input.LA(1);

					if ((LA3_0==VAR_SPEC))
					{
						alt3 = 1;
					}


					} finally { DebugExitDecision(3); }
					switch ( alt3 )
					{
					case 1:
						DebugEnterAlt(1);
						// Grammar\\SimpleCTreeWalker.g:50:22: varSpec
						{
						DebugLocation(50, 22);
						PushFollow(Follow._varSpec_in_funcDecl160);
						varSpec8=varSpec();
						PopFollow();

						DebugLocation(50, 30);
						 node.Parameters.Add(varSpec8); 

						}
						break;

					default:
						goto loop3;
					}
				}

				loop3:
					;

				} finally { DebugExitSubRule(3); }


				Match(input, TokenTypes.Up, null); 
			}


			Match(input, TokenTypes.Up, null); 


			}

		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		}
		finally
		{
			TraceOut("funcDecl", 4);
			LeaveRule("funcDecl", 4);
			LeaveRule_funcDecl();
		}
		DebugLocation(52, 0);
		} finally { DebugExitRule(GrammarFileName, "funcDecl"); }
		return node;

	}
Ejemplo n.º 6
0
 public bool IsDefined(FuncDeclNode funcDecl)
 {
     if (FuncDefs == null)
         return false;
     return FuncDefs.Contains(funcDecl);
 }
Ejemplo n.º 7
0
	private FuncDeclNode macroDecl()
	{
		EnterRule_macroDecl();
		EnterRule("macroDecl", 5);
		TraceIn("macroDecl", 5);
		FuncDeclNode node = default(FuncDeclNode);


		CommonTree IDENT10 = default(CommonTree);
		TypeSpecNode typeSpec9 = default(TypeSpecNode);
		VarSpecNode varSpec11 = default(VarSpecNode);


			node = new FuncDeclNode();

		try { DebugEnterRule(GrammarFileName, "macroDecl");
		DebugLocation(60, 0);
		try
		{
			// Grammar\\SimpleCTreeWalker.g:63:3: ( ^( FUNC_DECL typeSpec IDENT ^( PARAM_SPEC_LIST ( varSpec )* ) ) )
			DebugEnterAlt(1);
			// Grammar\\SimpleCTreeWalker.g:64:2: ^( FUNC_DECL typeSpec IDENT ^( PARAM_SPEC_LIST ( varSpec )* ) )
			{
			DebugLocation(64, 2);
			DebugLocation(64, 4);
			Match(input,FUNC_DECL,Follow._FUNC_DECL_in_macroDecl191); 

			Match(input, TokenTypes.Down, null); 
			DebugLocation(65, 3);
			PushFollow(Follow._typeSpec_in_macroDecl196);
			typeSpec9=typeSpec();
			PopFollow();

			DebugLocation(65, 12);
			 node.ReturnTypeSpec = typeSpec9; 
			DebugLocation(66, 3);
			IDENT10=(CommonTree)Match(input,IDENT,Follow._IDENT_in_macroDecl203); 
			DebugLocation(66, 9);
			 node.Name = IDENT10.Text; 
			DebugLocation(67, 3);
			DebugLocation(67, 5);
			Match(input,PARAM_SPEC_LIST,Follow._PARAM_SPEC_LIST_in_macroDecl210); 

			if (input.LA(1) == TokenTypes.Down)
			{
				Match(input, TokenTypes.Down, null); 
				DebugLocation(67, 21);
				// Grammar\\SimpleCTreeWalker.g:67:21: ( varSpec )*
				try { DebugEnterSubRule(4);
				while (true)
				{
					int alt4=2;
					try { DebugEnterDecision(4, false);
					int LA4_0 = input.LA(1);

					if ((LA4_0==VAR_SPEC))
					{
						alt4 = 1;
					}


					} finally { DebugExitDecision(4); }
					switch ( alt4 )
					{
					case 1:
						DebugEnterAlt(1);
						// Grammar\\SimpleCTreeWalker.g:67:22: varSpec
						{
						DebugLocation(67, 22);
						PushFollow(Follow._varSpec_in_macroDecl213);
						varSpec11=varSpec();
						PopFollow();

						DebugLocation(67, 30);
						 node.Parameters.Add(varSpec11); 

						}
						break;

					default:
						goto loop4;
					}
				}

				loop4:
					;

				} finally { DebugExitSubRule(4); }


				Match(input, TokenTypes.Up, null); 
			}


			Match(input, TokenTypes.Up, null); 


			}

		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		}
		finally
		{
			TraceOut("macroDecl", 5);
			LeaveRule("macroDecl", 5);
			LeaveRule_macroDecl();
		}
		DebugLocation(69, 0);
		} finally { DebugExitRule(GrammarFileName, "macroDecl"); }
		return node;

	}