aboutsummaryrefslogtreecommitdiff
path: root/lexer.py
diff options
context:
space:
mode:
authormryouse2022-06-11 22:45:01 +0000
committermryouse2022-06-11 22:45:01 +0000
commitc8ae5a4dbb6768c524b992b539842172057e7b70 (patch)
treef885be0df4d6c84594c8f7ff340ee76d79813f5d /lexer.py
parentfd0be36c64c7e7e6be927f701ff2bf08c0ffe974 (diff)
bugfix: support escaped double quotes in strings
Diffstat (limited to 'lexer.py')
-rw-r--r--lexer.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/lexer.py b/lexer.py
index eaeccec..0a634c5 100644
--- a/lexer.py
+++ b/lexer.py
@@ -126,7 +126,15 @@ def get_string(data, line):
while data[counter] != '"':
if data[counter] == "\n":
offset += 1
- string += data[counter]
+
+ # look ahead to see if it's a double quote
+ if data[counter] == "\\" and \
+ len(data) > counter and \
+ data[counter+1] == '"':
+ string += '"'
+ counter += 1
+ else:
+ string += data[counter]
counter += 1
if counter >= len(data):
raise Exception("couldn't parse string")