private static void SetField <TArg, TNode>(ListParser <TArg, TNode> parser, SymbolIterator iterator, ref TNode[] field)
     where TNode : ICriteriaNode <TArg>
 {
     if (field != null)
     {
         throw new Exception("");
     }
     field = parser.Parse(iterator);
 }
Exemple #2
0
        public static ICriteriaNode <CoStarterResult> TryParse(string source)
        {
            var it     = new SymbolIterator(ConvertToTokens(source).ConvertToSymbols().GetEnumerator());
            var parser = new ListParser <CoStarterResult>(new CoStarterCriteriaParser());

            try
            {
                var node = new OrCriteriaNode <CoStarterResult>(parser.Parse(it));
                if (it.HasValue)
                {
                    throw new UnexpectedSymbolException(it.GetAndNext());
                }
                return(node);
            }
            catch (Exception e)
            {
                throw new Exception($"{e.Message}{Environment.NewLine}{it.GetUsedSymbols()}<-");
            }
        }