1 using System.Collections.Generic;
4 namespace Tizen.NUI.Xaml
6 static class TypeArgumentsParser
8 public static IList<XmlType> ParseExpression(string expression, IXmlNamespaceResolver resolver, IXmlLineInfo lineInfo)
10 var typeList = new List<XmlType>();
11 while (!string.IsNullOrWhiteSpace(expression))
13 var match = expression;
14 typeList.Add(Parse(match, ref expression, resolver, lineInfo));
19 static XmlType Parse(string match, ref string remaining, IXmlNamespaceResolver resolver, IXmlLineInfo lineinfo)
24 bool isGeneric = false;
26 for (pos = 0; pos < match.Length; pos++)
28 if (match[pos] == '(')
33 else if (match[pos] == ')')
35 else if (match[pos] == ',' && parensCount == 0)
37 remaining = match.Substring(pos + 1);
41 var type = match.Substring(0, pos).Trim();
43 IList<XmlType> typeArguments = null;
46 typeArguments = ParseExpression(
47 type.Substring(type.IndexOf('(') + 1, type.LastIndexOf(')') - type.IndexOf('(') - 1), resolver, lineinfo);
48 type = type.Substring(0, type.IndexOf('('));
51 var split = type.Split(':');
56 if (split.Length == 2) {
64 var namespaceuri = resolver.LookupNamespace(prefix);
65 if (namespaceuri == null)
66 throw new XamlParseException($"No xmlns declaration for prefix '{prefix}'.", lineinfo, null);
67 return new XmlType(namespaceuri, name, typeArguments);