Skip to content

Commit

Permalink
Merge pull request #39 from grycap/devel
Browse files Browse the repository at this point in the history
Fix scaped strings
  • Loading branch information
micafer authored Feb 21, 2022
2 parents 585ae31 + 7b343fb commit 03edb9c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions radl/radl_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ def t_NUMBER(t):
@staticmethod
def t_STRING(t):
r"'([^\\']|\\.)*'"
# t.value = t.value[1:-1].replace("\\'", "'")
t.value = t.value[1:-1]
t.value = t.value[1:-1].replace("\\'", "'")
#t.value = t.value[1:-1]
return t

reserved = {
Expand Down
17 changes: 17 additions & 0 deletions test/TestRADL.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,5 +412,22 @@ def test_empty_configure(self):
r.check()
self.assertEqual(r.configures[0].recipes, None)

def test_escape_quote(self):
radl = """
system test (
some_value = 'some \\\' some'
)
"""
r = parse_radl(radl)
r.check()
self.assertEqual(r.systems[0].getValue("some_value"), "some ' some")

radl_json = dump_radl_json(r)
print(radl_json)
r = parse_radl_json(radl_json)
r.check()
self.assertEqual(r.systems[0].getValue("some_value"), "some ' some")


if __name__ == "__main__":
unittest.main()

0 comments on commit 03edb9c

Please sign in to comment.