From fd0be36c64c7e7e6be927f701ff2bf08c0ffe974 Mon Sep 17 00:00:00 2001 From: mryouse Date: Sat, 11 Jun 2022 22:16:22 +0000 Subject: add string escapes --- lexer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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": -- cgit v1.2.3