Esempio n. 1
0
        /// <summary>
        /// tuple ==> "{}" | "{" result ( "," result )* "}"
        /// </summary>
        /// <returns>if one tuple found a TupleValue, otherwise a ValueListValue of TupleValues</returns>
        private static ResultValue ParseResultTuple(string input, out string rest)
        {
            var list = ParseResultList('{', '}', input, out rest);

            if (list == null)
            {
                return(null);
            }
            var        tlist = new List <ResultValue>();
            TupleValue v;

            while (rest.StartsWith(",{", StringComparison.Ordinal))
            {
                // a tuple list
                v = new TupleValue(list);
                tlist.Add(v);
                list = ParseResultList('{', '}', rest.Substring(1), out rest);
            }
            v = new TupleValue(list);
            if (tlist.Count != 0)
            {
                tlist.Add(v);
                return(new ValueListValue(tlist));
            }
            return(v);
        }
Esempio n. 2
0
        /// <summary>
        /// tuple ==> "{}" | "{" result ( "," result )* "}"
        /// </summary>
        /// <returns>if one tuple found a TupleValue, otherwise a ValueListValue of TupleValues</returns>
        private ResultValue ParseResultTuple(Span input, out Span rest)
        {
            var list = ParseResultList('{', '}', input, out rest);

            if (list == null)
            {
                return(null);
            }
            var        tlist = new List <ResultValue>();
            TupleValue v;

            while (rest.StartsWith(_resultString, ",{"))
            {
                // a tuple list
                v = new TupleValue(list);
                tlist.Add(v);
                list = ParseResultList('{', '}', rest.Advance(1), out rest);
            }
            v = new TupleValue(list);
            if (tlist.Count != 0)
            {
                tlist.Add(v);
                return(new ValueListValue(tlist));
            }
            return(v);
        }