示例#1
0
 public LRxItem(int produce, ExpressInt express, int index, CHashSet <int> lookahead)
 {
     this.produce   = produce;
     this.express   = express;
     this.index     = index;
     this.lookahead = lookahead;
 }
示例#2
0
        // public int GetCoreHashCode()
        // {
        //     int result = 3;
        //     IntHash.Combine(ref result, produce);
        //     IntHash.Combine(ref result, express.GetHashCode());
        //
        //     return result;
        // }

#if DEBUG
        public override string ToString()
        {
            if (index == 0)
            {
                return($"{Grammar.bag[produce]} -> . {express}");
            }
            else if (IsEnd)
            {
                return($"{Grammar.bag[produce]} -> {express} .");
            }

            string st = $"{Grammar.bag[produce]} ->";

            ExpressInt e   = express;
            int        max = e.Length;

            for (int x = 0; x < max; x++)
            {
                if (x == index)
                {
                    st += " .";
                }

                int now = e[x];
                st += " " +
                      (now.IsTerminal()
                    ? ((TokenType)now).ToString()
                    : Grammar.bag[now]);
            }

            return(st);
        }
示例#3
0
 public LRxItem(GItem source, CHashSet <int> la)
 {
     produce   = source.produce;
     express   = source.express;
     lookahead = la;
 }