diff options
Homework 1 (#21)
* Commiting .gitignore before real solution
* C# project implementing very basic functionality of the lexer, needs
refactoring.
* Added most javascript reserved keywords
* Added logic for most js operators in Tokenizer.cs
* added lexemes for operator tokens
also created the PrettyPrint() function
* added a coloring logic to the parsed text
* Refactored Lexer class, added TokenHandler class
PrettyPrint colors require tweaking, Lexer needs more refactoring
* created TokenHandler to pretty print text to html
* Deleted project files
* Updated Program.cs
1 files changed, 42 insertions, 0 deletions
| -rw-r--r-- | homework/81498/Project/Wizard/Program.cs | 42 |
diff --git a/homework/81498/Project/Wizard/Program.cs b/homework/81498/Project/Wizard/Program.cs new file mode 100644 index 0000000..a2722f5 --- /dev/null +++ b/homework/81498/Project/Wizard/Program.cs @@ -0,0 +1,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); + + } + } +} |
