コード例 #1
0
 public abstract Template Visit(IdentType type);
コード例 #2
0
ファイル: TargetCpp.cs プロジェクト: Connect2Begin/SugarCpp
 public override Template Visit(IdentType type)
 {
     return new Template(type.Type);
 }
コード例 #3
0
ファイル: SugarWalker.cs プロジェクト: Connect2Begin/SugarCpp
	private SugarType type_ident()
	{
		EnterRule_type_ident();
		EnterRule("type_ident", 14);
		TraceIn("type_ident", 14);
		SugarType value = default(SugarType);


		string a = default(string);


			string type = "";

		try { DebugEnterRule(GrammarFileName, "type_ident");
		DebugLocation(193, 1);
		try
		{
			// SugarWalker.g:198:2: ( ^( Type_Ident ( 'const' | 'static' | 'long' | 'struct' | 'thread_local' |a= ident )* ) )
			DebugEnterAlt(1);
			// SugarWalker.g:198:4: ^( Type_Ident ( 'const' | 'static' | 'long' | 'struct' | 'thread_local' |a= ident )* )
			{
			DebugLocation(198, 4);
			DebugLocation(198, 6);
			Match(input,Type_Ident,Follow._Type_Ident_in_type_ident775); 

			if (input.LA(1) == TokenTypes.Down)
			{
				Match(input, TokenTypes.Down, null); 
				DebugLocation(198, 17);
				// SugarWalker.g:198:17: ( 'const' | 'static' | 'long' | 'struct' | 'thread_local' |a= ident )*
				try { DebugEnterSubRule(28);
				while (true)
				{
					int alt28=7;
					try { DebugEnterDecision(28, false);
					switch (input.LA(1))
					{
					case 142:
						{
						alt28 = 1;
						}
						break;
					case 166:
						{
						alt28 = 2;
						}
						break;
					case 156:
						{
						alt28 = 3;
						}
						break;
					case 167:
						{
						alt28 = 4;
						}
						break;
					case 170:
						{
						alt28 = 5;
						}
						break;
					case IDENT:
						{
						alt28 = 6;
						}
						break;
					}

					} finally { DebugExitDecision(28); }
					switch ( alt28 )
					{
					case 1:
						DebugEnterAlt(1);
						// SugarWalker.g:198:19: 'const'
						{
						DebugLocation(198, 19);
						Match(input,142,Follow._142_in_type_ident779); 
						DebugLocation(198, 27);
						 type+="const "; 

						}
						break;
					case 2:
						DebugEnterAlt(2);
						// SugarWalker.g:199:10: 'static'
						{
						DebugLocation(199, 10);
						Match(input,166,Follow._166_in_type_ident792); 
						DebugLocation(199, 19);
						 type+="static "; 

						}
						break;
					case 3:
						DebugEnterAlt(3);
						// SugarWalker.g:200:10: 'long'
						{
						DebugLocation(200, 10);
						Match(input,156,Follow._156_in_type_ident805); 
						DebugLocation(200, 18);
						 type+="long "; 

						}
						break;
					case 4:
						DebugEnterAlt(4);
						// SugarWalker.g:201:10: 'struct'
						{
						DebugLocation(201, 10);
						Match(input,167,Follow._167_in_type_ident819); 
						DebugLocation(201, 19);
						 type+="struct "; 

						}
						break;
					case 5:
						DebugEnterAlt(5);
						// SugarWalker.g:202:10: 'thread_local'
						{
						DebugLocation(202, 10);
						Match(input,170,Follow._170_in_type_ident832); 
						DebugLocation(202, 25);
						 type+="thread_local "; 

						}
						break;
					case 6:
						DebugEnterAlt(6);
						// SugarWalker.g:203:10: a= ident
						{
						DebugLocation(203, 11);
						PushFollow(Follow._ident_in_type_ident847);
						a=ident();
						PopFollow();

						DebugLocation(203, 18);
						 type+=Alias(a); 

						}
						break;

					default:
						goto loop28;
					}
				}

				loop28:
					;

				} finally { DebugExitSubRule(28); }


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

			DebugLocation(205, 2);

					value = new IdentType(type.Trim());
				

			}

		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		}
		finally
		{
			TraceOut("type_ident", 14);
			LeaveRule("type_ident", 14);
			LeaveRule_type_ident();
		}
		DebugLocation(208, 1);
		} finally { DebugExitRule(GrammarFileName, "type_ident"); }
		return value;

	}