示例#1
0
        /// <summary>
        /// Initializes a new instance of the ParseState class.
        /// </summary>
        /// <param name="concrete">The concrete used to parse.</param>
        public ParseState(Concrete concrete)
        {
            this.concrete = concrete;
            this.startCat = concrete.GetStartCat();

            this.items = new Trie();
            this.chart = new Chart(concrete);

            ConcreteCategory tempcat = concrete.GetStartCat();
            for (int fid = tempcat.FirstFID; fid <= tempcat.LastFID; fid++)
            {
                var prods = this.chart.ExpandForest(fid);
                foreach (ProductionApply k in prods)
                {
                    k.Function.FixSymbols();
                    int lbl = 0;
                    foreach (Symbol[] sym in k.Function.Sequences)
                    {
                        var activeItem = new ActiveItem(0, 0, k.Function, sym.ToList<Symbol>(), k.Domain().ToList<int>(), fid, lbl);
                        this.items.Value.Add(activeItem);
                        lbl++;
                    }
                }
            }

            this.items.InsertChain(new List<string>(), this.items);
        }