Esempio n. 1
0
        static void Main()
        {
            Automate        auto       = new Automate();
            string          str        = auto.ReadStr();
            List <Automate> lexClasses = new List <Automate>
            {
                new Automate("KeyW.txt"),
                new Automate("Automate.txt"),
                new Automate("WhiteSpace.txt"),
                new Automate("Operation.txt")
            };

            List <KeyValuePair <string, string> > result = LexAnalyzer.Analyzer(lexClasses, str);

            foreach (KeyValuePair <string, string> res in result)
            {
                Console.WriteLine(res);
            }
        }
Esempio n. 2
0
        static void Main()
        {
            List <string> result = new List <string>();
            StreamReader  f      = new StreamReader("input.txt", Encoding.Default);
            string        str    = f.ReadToEnd();
            Automate      auto   = new Automate();
            int           k      = 0;

            while (k < str.Length)
            {
                KeyValuePair <bool, int> resString = auto.MaxString(str, k);
                if (resString.Key == true)
                {
                    result.Add(str.Substring(k, resString.Value));
                    k += resString.Value;
                }
                else
                {
                    k++;
                }
            }
            auto.Show(result);
        }