aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormryouse2022-06-11 22:16:22 +0000
committermryouse2022-06-11 22:16:22 +0000
commitfd0be36c64c7e7e6be927f701ff2bf08c0ffe974 (patch)
treeaa975ff83653db4f1426f6238324a172e6814b47
parent885bef21990ac0a5bc500f7c8af8a956f457c37b (diff)
add string escapes
-rw-r--r--lexer.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lexer.py b/lexer.py
index c4f52d3..eaeccec 100644
--- a/lexer.py
+++ b/lexer.py
@@ -10,6 +10,7 @@ types = {
":int": TokenType.INT_TYPE,
":float": TokenType.FLOAT_TYPE,
":string": TokenType.STRING_TYPE,
+ ":list": TokenType.LIST_TYPE,
":any": TokenType.ANY_TYPE }
keywords = {
@@ -129,7 +130,8 @@ def get_string(data, line):
counter += 1
if counter >= len(data):
raise Exception("couldn't parse string")
- return Token(TokenType.STRING, string, string, line), counter + 1, offset
+ string = string.encode().decode("unicode_escape")
+ return Token(TokenType.STRING, str(string), str(string), line), counter + 1, offset
def get_bool(data, line):
if len(data) >= 4 and data[:4] == "true":