Пример #1
0
 public override Template Visit(FuncType type)
 {
     Template template = new Template("std::function\\<<return_type> (<list_type; separator=\", \">)>");
     if (type.Type != null)
     {
         template.Add("return_type", type.Type.Accept(this));
     }
     else
     {
         template.Add("return_type", "void");
     }
     template.Add("list_type", type.Args.Select(x => x.Accept(this)));
     return template;
 }
Пример #2
0
 public abstract Template Visit(FuncType type);
Пример #3
0
	private SugarType type_func()
	{
		EnterRule_type_func();
		EnterRule("type_func", 19);
		TraceIn("type_func", 19);
		SugarType value = default(SugarType);


		List<SugarType> a = default(List<SugarType>);
		SugarType b = default(SugarType);

		try { DebugEnterRule(GrammarFileName, "type_func");
		DebugLocation(244, 1);
		try
		{
			// SugarWalker.g:245:2: ( ^( Type_Func (a= type_list )? (b= type_name )? ) )
			DebugEnterAlt(1);
			// SugarWalker.g:245:4: ^( Type_Func (a= type_list )? (b= type_name )? )
			{
			DebugLocation(245, 4);
			DebugLocation(245, 6);
			Match(input,Type_Func,Follow._Type_Func_in_type_func1012); 

			if (input.LA(1) == TokenTypes.Down)
			{
				Match(input, TokenTypes.Down, null); 
				DebugLocation(245, 16);
				// SugarWalker.g:245:16: (a= type_list )?
				int alt32=2;
				try { DebugEnterSubRule(32);
				try { DebugEnterDecision(32, false);
				int LA32_0 = input.LA(1);

				if ((LA32_0==Type_List))
				{
					alt32 = 1;
				}
				} finally { DebugExitDecision(32); }
				switch (alt32)
				{
				case 1:
					DebugEnterAlt(1);
					// SugarWalker.g:245:17: a= type_list
					{
					DebugLocation(245, 18);
					PushFollow(Follow._type_list_in_type_func1017);
					a=type_list();
					PopFollow();


					}
					break;

				}
				} finally { DebugExitSubRule(32); }

				DebugLocation(245, 31);
				// SugarWalker.g:245:31: (b= type_name )?
				int alt33=2;
				try { DebugEnterSubRule(33);
				try { DebugEnterDecision(33, false);
				int LA33_0 = input.LA(1);

				if (((LA33_0>=Type_Array && LA33_0<=Type_Ident)||(LA33_0>=Type_Ref && LA33_0<=Type_Template)))
				{
					alt33 = 1;
				}
				} finally { DebugExitDecision(33); }
				switch (alt33)
				{
				case 1:
					DebugEnterAlt(1);
					// SugarWalker.g:245:32: b= type_name
					{
					DebugLocation(245, 33);
					PushFollow(Follow._type_name_in_type_func1024);
					b=type_name();
					PopFollow();


					}
					break;

				}
				} finally { DebugExitSubRule(33); }


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

			DebugLocation(246, 2);

					value = new FuncType(a, b);
				

			}

		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		}
		finally
		{
			TraceOut("type_func", 19);
			LeaveRule("type_func", 19);
			LeaveRule_type_func();
		}
		DebugLocation(249, 1);
		} finally { DebugExitRule(GrammarFileName, "type_func"); }
		return value;

	}