Website Summary Files Commits Branches @commit @diff @stats
path: root / homework / 81498 / Project / Wizard / Program.cs
blob: a2722f5e7d33aa9d0acf366c3ff311408d1090d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using Wizard.Homeworks;

namespace Wizard
{
    class Program
    {
        static void Main(string[] args)
        {
            string programAsText = "";
            string fileName = "";

            Console.WriteLine("Please Enter absolute path for the text file(sorry): \n");
            fileName = Console.ReadLine();

            Console.WriteLine("The html will be generated with name semi_pretty.html");

            using (var reader = new StreamReader(fileName))
            {
                while (!reader.EndOfStream)
                {
                    programAsText += reader.ReadLine();
                    programAsText += "\n";
                }
            }

            var tokenizer = new Lexer(programAsText, fileName);
            var tokens = tokenizer.GenerateTokens();

            var printToPath = "semi_pretty.html";
            var tokenHandler = new TokenHandler(tokens, printToPath);
            //tokenHandler.PrintTokens();
            tokenHandler.PrettyPrint(printToPath);

        }
    }
}