Exemple #1
0
        static void GetNextcTest()
        {
            FileStream fs     = new FileStream("D:\\workspace\\c\\my-lib\\test\\TestMain\\LispParserTest\\IO\\lisp.txt", FileMode.Open);
            FileStream output = new FileStream("D:\\workspace\\c\\my-lib\\test\\TestMain\\LispParserTest\\IO\\out.txt", FileMode.Create);

            StreamWriter sw = new StreamWriter(output);

            TokenParserTwo tokenParser = new TokenParserTwo(fs);
            char           c           = tokenParser.nextc();

            //while (c != '\0')
            //{
            //    sw.WriteLine(c);
            //    c = tokenParser.nextc();
            //}
            fs.Close();
            sw.Close();
        }
Exemple #2
0
        static void GetNextTokenTest()
        {
            FileStream fs     = new FileStream("D:\\workspace\\c\\my-lib\\test\\TestMain\\LispParserTest\\IO\\lisp.txt", FileMode.Open);
            FileStream output = new FileStream("D:\\workspace\\c\\my-lib\\test\\TestMain\\LispParserTest\\IO\\out-token.txt", FileMode.Create);

            StreamWriter   sw          = new StreamWriter(output);
            TokenParserTwo tokenParser = new TokenParserTwo(fs);

            using (tokenParser)
            {
                Token t = tokenParser.nextToken();
                while (t != null)
                {
                    sw.WriteLine(t.TokenValue + "," + t.Type);
                    t = tokenParser.nextToken();
                }
                Console.WriteLine(tokenParser.LineNumber);
            }
            fs.Close();
            sw.Close();
        }