diff options
| author | mryouse | 2022-06-11 22:16:22 +0000 |
|---|---|---|
| committer | mryouse | 2022-06-11 22:16:22 +0000 |
| commit | fd0be36c64c7e7e6be927f701ff2bf08c0ffe974 (patch) | |
| tree | aa975ff83653db4f1426f6238324a172e6814b47 /lexer.py | |
| parent | 885bef21990ac0a5bc500f7c8af8a956f457c37b (diff) | |
add string escapes
Diffstat (limited to 'lexer.py')
| -rw-r--r-- | lexer.py | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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": |
