/// <summary> /// 读取基类列表。 /// </summary> /// <param name="reader">当前读取器。</param> /// <returns>返回基类列表。</returns> public static List <string> ReadBaseTypes(this SourceReader reader) { reader.EscapeWhiteSpace(); var baseTypes = new List <string>(); if (reader.Current == ':') { reader.Offset(); reader.EscapeWhiteSpace(); var baseType = reader.ReadDeclaration('{', ','); while (reader.Current == ',') { baseTypes.Add(baseType); reader.Offset();//移除, baseType = reader.ReadDeclaration('{', ','); } baseTypes.Add(baseType); } return(baseTypes); }
/// <summary> /// 读取成员声明。 /// </summary> /// <param name="reader">源代码读取器。</param> /// <returns>返回当前声明字符串。</returns> public static string ReadMemberDeclaration(this SourceReader reader) => reader.ReadDeclaration('{', '=', '(');
/// <summary> /// 读取参数声明。 /// </summary> /// <param name="reader">源代码读取器。</param> /// <param name="end">结束字符。</param> /// <returns>返回当前声明字符串。</returns> public static string ReadParameterDeclaration(this SourceReader reader, char end) => reader.ReadDeclaration('=', ',', end);
/// <summary> /// 读取类型名称。 /// </summary> /// <param name="reader">当前读取器。</param> /// <returns>返回类型名称。</returns> public static string ReadTypeName(this SourceReader reader) => reader.ReadDeclaration('{', ':');