Deal with string escaping

This commit is contained in:
Reid 'arrdem' McKenzie 2021-08-21 14:23:39 -06:00
parent 02c5f61bb8
commit 20ed127bf7
2 changed files with 4 additions and 4 deletions

View file

@ -1,6 +1,7 @@
%import common.WORD
%import common.INT
%import common.FLOAT
%import common.ESCAPED_STRING
%import common.WS
%ignore WS

View file

@ -44,10 +44,9 @@ class Block(t.NamedTuple):
class TreeToTuples(lark.Transformer):
def string(self, args):
# FIXME (arrdem 2021-08-21):
# Gonna have to do escape sequences here
return args[0].value
@lark.v_args(inline=True)
def string(self, s):
return s[1:-1].replace('\\"', '"')
def int(self, args):
return int(args[0])