Website Summary Files Commits Branches @commit @diff @stats
path: root / homework / 81498 / Project / Wizard / Misc / ExactMatchSymbolsToTokensMap.cs
diff options
context:
space:
mode:
Commit68964c78790c0eaf847fa0491f85d73566e4985d (patch)
Author
 Yasen Bonev <yabonev@gmail.com>
2018-10-25 12:52:15 +0300
Committer
 dtrendafilov <trendafilov.dn@gmail.com>
2018-10-25 12:52:15 +0300
Files6410e06a3f99cbe76626c75f843c636fcff3a7ce /homework/81498/Project/Wizard/Misc/ExactMatchSymbolsToTokensMap.cs
IPL-68964c78790c0eaf847fa0491f85d73566e4985d.tar
IPL-68964c78790c0eaf847fa0491f85d73566e4985d.tar.gz
IPL-68964c78790c0eaf847fa0491f85d73566e4985d.zip
Parent087fc8804bc0d26f19cdcb2111877f2da90bf471 (diff)
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, 32 insertions, 0 deletions
-rw-r--r--homework/81498/Project/Wizard/Misc/ExactMatchSymbolsToTokensMap.cs32
diff --git a/homework/81498/Project/Wizard/Misc/ExactMatchSymbolsToTokensMap.cs b/homework/81498/Project/Wizard/Misc/ExactMatchSymbolsToTokensMap.cs
new file mode 100644
index 0000000..ecfeb92
--- /dev/null
+++ b/homework/81498/Project/Wizard/Misc/ExactMatchSymbolsToTokensMap.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Wizard.Misc
+{ // is this a good idea?
+ public static class ExactMatchSymbolsToTokens
+ {
+ public static Dictionary<char, TokenType> AsMap()
+ {
+ return new Dictionary<char, TokenType>()
+ {
+ {' ', TokenType.Whitespace },
+ {'\t', TokenType.Tab },
+ {':', TokenType.Colon },
+ {',', TokenType.Comma },
+ {'(', TokenType.LeftParenthesis },
+ {'{', TokenType.LeftBrace },
+ {'[', TokenType.LeftSquareBracket },
+ {']', TokenType.RightSquareBracket },
+ {'}', TokenType.RightBrace },
+ {')', TokenType.RightParenthesis },
+ {';', TokenType.Semicolon },
+ {'\'', TokenType.SingleQuote },
+ {'?', TokenType.SingleQuote },
+ {'.', TokenType.SingleQuote },
+ };
+ }
+ }
+}