internal static void SplitParameterName(string t, out string paramName, out string typeName) { int index = t.IndexOf(':'); if (index < 0) { LAReader lar = new LAReader(t); lar.MoveNext(); typeName = lar.EatUntilWithBracketCounting(' ').Trim(); paramName = lar.Rest.Trim(); } else { // param:type paramName = t.Substring(0, index).Trim(); typeName = t.Substring(index + 1).Trim(); } }
internal static IEnumerable <string> SplitParametersInternal(string parameters) { LAReader lar = new LAReader(parameters); int depth = 0; if (lar.MoveNext()) { do { // TODO Throw on unbalanced brackets switch (lar.Current) { case '[': case '(': case '{': case '<': depth++; break; case ']': case ')': case '}': case '>': depth--; break; } while (lar.Current == ',' && depth == 0) { yield return(lar.StopEating().Trim()); if (!lar.MoveNext()) { goto exit; } } } while (lar.Eat()); } exit: yield return(lar.StopEating().Trim()); }