public TdfaSimulationLexer(TextReader textSource, ScannerDescriptor descriptor)
        {
            this.text       = textSource.ReadToEnd();
            this.descriptor = descriptor;

            Dictionary <string, int> literalToAction = new Dictionary <string, int>();
            var root      = descriptor.MakeAst(literalToAction);
            var regTree   = new RegularTree(root);
            var algorithm = new RegularToTdfaAlgorithm(regTree, literalToAction);

            DescribeTdfa(algorithm.Data);
            this.tdfa = new TdfaSimulation(algorithm.Data);

            int count = descriptor.Matchers.Count;

            this.tokenFactories = new TokenFactoryDelegate[count];

            for (int i = 0; i != count; ++i)
            {
                if (descriptor.Matchers[i].Outcome != null)
                {
                    tokenFactories[i] = BuildTokenFactory(descriptor.Matchers[i]);
                }
            }
        }
        public DfaSimulationLexer(TextReader textSource, ScannerDescriptor descriptor)
        {
            this.text       = textSource.ReadToEnd();
            this.descriptor = descriptor;

            var root      = descriptor.MakeAst();
            var regTree   = new RegularTree(root);
            var algorithm = new RegularToDfaAlgorithm(regTree);

            this.dfa = new DfaSimulation(algorithm.Data);

            int count = descriptor.Matchers.Count;

            this.tokenFactories = new TokenFactoryDelegate[count];

            for (int i = 0; i != count; ++i)
            {
                if (descriptor.Matchers[i].Outcome != null)
                {
                    tokenFactories[i] = BuildTokenFactory(descriptor.Matchers[i]);
                }
            }
        }