Esempio n. 1
0
        private HashSet <LookaheadSymbol> TotalLookahead(LRConfig config)
        {
            bool flag = false;
            var  set  = new HashSet <LookaheadSymbol>();

            for (int offset = 0; (offset < config.CheckaheadCount()) && !flag; offset++)
            {
                var build = config.Checkahead(offset);
                ConfigTrackSource source = (build.Symbol.Type == ESymbolType.NonTerminal ? ConfigTrackSource.First : ConfigTrackSource.Config);

                foreach (var j in build.First)
                {
                    LookaheadSymbol item = new LookaheadSymbol(j);
                    if (item.Parent.Symbol.Type != ESymbolType.NonTerminal)
                    {
                        item.Configs.Add(new ConfigTrack(config, source));
                        set.Add(item);
                    }
                }
                flag = !build.Nullable;
            }

            if (!flag)
            {
                set.UnionWith(config.LookaheadSet);
            }
            return(set);
        }
Esempio n. 2
0
 private bool PopulateLookahead(LRConfig config)
 {
     if (config.InheritLookahead)
     {
         bool flag = false;
         for (var i = 0; (i < config.CheckaheadCount()) & !flag; ++i)
         {
             var build = config.Checkahead(i);
             flag = !build.Nullable;
         }
         return(!flag);
     }
     return(false);
 }
Esempio n. 3
0
 public ConfigTrack(LRConfig config, ConfigTrackSource source)
 {
     m_parent     = config;
     m_fromConfig = source == ConfigTrackSource.Config;
     m_fromFirst  = source == ConfigTrackSource.First;
 }
Esempio n. 4
0
 public ConfigTrack(ConfigTrack track)
 {
     m_parent     = track.m_parent;
     m_fromConfig = track.FromConfig;
     m_fromFirst  = track.m_fromFirst;
 }