diff options
Homework 1 - C# Lexer and Syntax Highlighter for Javascript (#34)
* Initial lexer structure
* Added IInputStream interface for the Lexer and its base implementation in FileInputStream not implemented yet.
* Extend InputStream interface
* Implement FileInputStream not tested
* Lexer almost ready - comments need to be parsed.
InputStream ready
* Added some TODOs
* Add error token type and almost parse comments
* Parse multiline comments and fix string parsing to not include the quotes.
* Added Syntax Highlighter, added support for more js reserved words, removed error tokens to not break the actual word tokens, fixed comments and string token representation to include its special characters
* Initial lexer structure
* Added IInputStream interface for the Lexer and its base implementation in FileInputStream not implemented yet.
* Extend InputStream interface
* Implement FileInputStream not tested
* Lexer almost ready - comments need to be parsed.
InputStream ready
* Added some TODOs
* Add error token type and almost parse comments
* Parse multiline comments and fix string parsing to not include the quotes.
* Added Syntax Highlighter, added support for more js reserved words, removed error tokens to not break the actual word tokens, fixed comments and string token representation to include its special characters
* Improve project structure and add tests
* Fix physical path structure of the projects
* Write tests, fix tokenizer bugs
* Fix README format, fix AssemblyInfo name
* Escape slashes in readme
1 files changed, 48 insertions, 0 deletions
| -rw-r--r-- | homework/81709/JSCompiler.Core/Token.cs | 48 |
diff --git a/homework/81709/JSCompiler.Core/Token.cs b/homework/81709/JSCompiler.Core/Token.cs new file mode 100644 index 0000000..efa2dd8 --- /dev/null +++ b/homework/81709/JSCompiler.Core/Token.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace JSCompiler.Core +{ + public class Token : IEquatable<Token> + { + public Token(TokenType type) + { + Type = type; + } + + public TokenType Type { get; private set; } + + public override bool Equals(object obj) + { + var item = obj as Token; + + if(item == null) + { + return false; + } + + return Equals(item); + } + + public bool Equals(Token other) + { + return Type == other.Type; + } + + public override int GetHashCode() + { + return this.Type.GetHashCode(); + } + + public override string ToString() + { + return ((char)Type).ToString(); + } + } + + + +} |
