Beispiel #1
0
        /// <summary>
        /// Builds the specified source.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <returns>The Build result.</returns>
        public static SymbolParseResult Build(string source)
        {
            var item = new SymbolParser(source);
            List <KeyValuePair <int, string> > data = new List <KeyValuePair <int, string> >();

            while (true)
            {
                var index  = item.CurrentPosition;
                var symbol = item.NextToken();
                if (string.IsNullOrWhiteSpace(symbol))
                {
                    break;
                }
                data.Add(new KeyValuePair <int, string>(index, symbol));
            }
            return(new SymbolParseResult(data));
        }
Beispiel #2
0
 /// <summary>
 /// Resolves the specified json.
 /// </summary>
 /// <param name="json">The json.</param>
 /// <returns></returns>
 public static object Resolve(string json)
 {
     return(new TypeParser(SymbolParser.Build(json)).GetValue());
 }