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, 33 insertions, 0 deletions
| -rw-r--r-- | homework/81498/Project/Wizard/Tokenizing/Token.cs | 33 |
diff --git a/homework/81498/Project/Wizard/Tokenizing/Token.cs b/homework/81498/Project/Wizard/Tokenizing/Token.cs new file mode 100644 index 0000000..1d68e8e --- /dev/null +++ b/homework/81498/Project/Wizard/Tokenizing/Token.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Wizard +{ + public class Token + { + public Token(TokenType type, int line, string lexeme, string location, decimal? number) + { + Type = type; + Line = line; + Lexeme = lexeme; + Location = location; + Number = number; + + } + + public TokenType Type { get; private set; } + public int Line { get; private set; } + public string Lexeme { get; private set; } + public decimal? Number { get; private set; } + public string Location { get; private set; } + + public override string ToString() + { + return Type.ToString() + " " + Lexeme + " " + Number; + } + + } +} |
