Esempio n. 1
0
 private static void SetupTempTables()
 {
     LRConfigSetLookup.Clear();
     BuilderApp.Mode = BuilderApp.ProgramMode.BuildingFirstSets;
     SetupFirstTable();
     BuilderApp.Mode = BuilderApp.ProgramMode.BuildingLALRClosure;
     ComputePartialClosures();
     GotoList = new LRConfigSet[BuilderApp.BuildTables.Symbol.Count() + 1];
 }
Esempio n. 2
0
        private static short CreateLRState(LRStateBuild State)
        {
            LRConfigCompare unEqual;
            short           tableIndex = (short)LRConfigSetLookup.get_TableIndex(State.ConfigSet);

            if (tableIndex != -1)
            {
                unEqual = State.ConfigSet.CompareCore(BuilderApp.BuildTables.LALR[tableIndex].ConfigSet);
            }
            else
            {
                unEqual = LRConfigCompare.UnEqual;
            }
            switch (((int)unEqual))
            {
            case 0:
            case 1:
                return(tableIndex);

            case 2:
            {
                LRStateBuild build2 = BuilderApp.BuildTables.LALR[tableIndex];
                build2.ConfigSet.UnionWith(State.ConfigSet);
                build2.Modified = true;
                build2          = null;
                return(tableIndex);
            }

            case 3:
            {
                LRStateBuild build = State;
                build.Expanded = false;
                build.Modified = true;
                build          = null;
                tableIndex     = (short)BuilderApp.BuildTables.LALR.Add(State);
                LRConfigSetLookup.Add(State.ConfigSet, tableIndex);
                Notify.Counter++;
                return(tableIndex);
            }
            }
            return(tableIndex);
        }