Пример #1
0
 public override Template Visit(TemplateType type)
 {
     Template template = new Template("<type>\\<<list; separator=\", \">>");
     template.Add("type", type.Type.Accept(this));
     template.Add("list", type.Args.Select(x => x.Accept(this)));
     return template;
 }
Пример #2
0
 public abstract Template Visit(TemplateType type);
Пример #3
0
	private SugarType type_template()
	{
		EnterRule_type_template();
		EnterRule("type_template", 15);
		TraceIn("type_template", 15);
		SugarType value = default(SugarType);


		SugarType a = default(SugarType);
		SugarType b = default(SugarType);


			List<SugarType> list = new List<SugarType>();

		try { DebugEnterRule(GrammarFileName, "type_template");
		DebugLocation(210, 1);
		try
		{
			// SugarWalker.g:215:2: ( ^( Type_Template a= type_name (b= type_name )* ) )
			DebugEnterAlt(1);
			// SugarWalker.g:215:4: ^( Type_Template a= type_name (b= type_name )* )
			{
			DebugLocation(215, 4);
			DebugLocation(215, 6);
			Match(input,Type_Template,Follow._Type_Template_in_type_template884); 

			Match(input, TokenTypes.Down, null); 
			DebugLocation(215, 21);
			PushFollow(Follow._type_name_in_type_template888);
			a=type_name();
			PopFollow();

			DebugLocation(215, 32);
			// SugarWalker.g:215:32: (b= type_name )*
			try { DebugEnterSubRule(29);
			while (true)
			{
				int alt29=2;
				try { DebugEnterDecision(29, false);
				int LA29_0 = input.LA(1);

				if (((LA29_0>=Type_Array && LA29_0<=Type_Ident)||(LA29_0>=Type_Ref && LA29_0<=Type_Template)))
				{
					alt29 = 1;
				}


				} finally { DebugExitDecision(29); }
				switch ( alt29 )
				{
				case 1:
					DebugEnterAlt(1);
					// SugarWalker.g:215:33: b= type_name
					{
					DebugLocation(215, 34);
					PushFollow(Follow._type_name_in_type_template893);
					b=type_name();
					PopFollow();

					DebugLocation(215, 45);
					list.Add(b);

					}
					break;

				default:
					goto loop29;
				}
			}

			loop29:
				;

			} finally { DebugExitSubRule(29); }


			Match(input, TokenTypes.Up, null); 

			DebugLocation(216, 2);

					value = new TemplateType(a, list);
				

			}

		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		}
		finally
		{
			TraceOut("type_template", 15);
			LeaveRule("type_template", 15);
			LeaveRule_type_template();
		}
		DebugLocation(219, 1);
		} finally { DebugExitRule(GrammarFileName, "type_template"); }
		return value;

	}