コード例 #1
0
        public Query Parse(List <Match> tokens)
        {
            Query q     = null;
            RQ    queue = new RQ(tokens);
            int   ind   = queue.Step();

            q = ParseCreate(queue);
            if (q != null)
            {
                return(q);
            }
            queue.Restore(ind);

            q = ParseDrop(queue);
            if (q != null)
            {
                return(q);
            }
            queue.Restore(ind);

            q = ParseSelect(queue);
            if (q != null)
            {
                return(q);
            }
            queue.Restore(ind);

            q = ParseInsert(queue);
            if (q != null)
            {
                return(q);
            }
            queue.Restore(ind);

            q = ParseUpdate(queue);
            if (q != null)
            {
                return(q);
            }
            queue.Restore(ind);

            q = ParseDelete(queue);
            if (q != null)
            {
                return(q);
            }
            queue.Restore(ind);

            throw new ParseException("Input string is not one of: create | drop | select | insert | update | delete");
        }