Example #1
0
        public TerminalNode <TExtension, TTransition> GetOrCreateTerminalNode(SppfNodeKey <TExtension> key, TTransition token)
        {
            var fullKey = (key, token);
            var exists  = myTerminals.TryGetValue(fullKey, out var node);

            if (!exists)
            {
                node = new TerminalNode <TExtension, TTransition>(key, token);
                myTerminals.Add(fullKey, node);
            }

            return(node);
        }
Example #2
0
 public Sppf()
 {
     myIntermediates = new Dictionary <SppfNodeKey <TExtension>, IntermediateNode <TExtension> >();
     myComplete      = new Dictionary <SppfNodeKey <TExtension>, CompleteNode <TExtension> >();
     myTerminals     = new Dictionary <(SppfNodeKey <TExtension>, TTransition), TerminalNode <TExtension, TTransition> >();
 }