Deal with string escaping
This commit is contained in:
parent
ed41277614
commit
8d58aebb4a
2 changed files with 4 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
||||||
%import common.WORD
|
%import common.WORD
|
||||||
%import common.INT
|
%import common.INT
|
||||||
%import common.FLOAT
|
%import common.FLOAT
|
||||||
|
%import common.ESCAPED_STRING
|
||||||
%import common.WS
|
%import common.WS
|
||||||
%ignore WS
|
%ignore WS
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,9 @@ class Block(t.NamedTuple):
|
||||||
|
|
||||||
|
|
||||||
class TreeToTuples(lark.Transformer):
|
class TreeToTuples(lark.Transformer):
|
||||||
def string(self, args):
|
@lark.v_args(inline=True)
|
||||||
# FIXME (arrdem 2021-08-21):
|
def string(self, s):
|
||||||
# Gonna have to do escape sequences here
|
return s[1:-1].replace('\\"', '"')
|
||||||
return args[0].value
|
|
||||||
|
|
||||||
def int(self, args):
|
def int(self, args):
|
||||||
return int(args[0])
|
return int(args[0])
|
||||||
|
|
Loading…
Reference in a new issue