private static CppName ParseCppName(string name, ref int index) { CppName result = new CppName(); result.Name = ParseName(name, ref index); result.Parameters = new CppName[0]; if (ParseChar(name, '<', ref index)) { List <CppName> parameters = new List <CppName>(); while (true) { parameters.Add(ParseCppName(name, ref index)); if (ParseChar(name, '>', ref index)) { break; } else if (!ParseChar(name, ',', ref index)) { throw new ArgumentException(); } } result.Parameters = parameters.ToArray(); } if (ParseChar(name, ':', ref index)) { if (!ParseChar(name, ':', ref index)) { throw new ArgumentException(); } result.Member = ParseCppName(name, ref index); } return(result); }
public IEnumerable <CppName> Cascade() { CppName current = this; while (current != null) { yield return(current); current = current.Member; } }
public static CppName Parse(string name) { int index = 0; CppName result = ParseCppName(name.Trim(), ref index); if (index != name.Length) { throw new ArgumentException(); } return(result); }