Skip to content

Commit

Permalink
Fix #113: Bug with string inside multiline string
Browse files Browse the repository at this point in the history
  • Loading branch information
uiri committed Mar 25, 2018
1 parent e8ec718 commit 07aaa4d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,12 +597,18 @@ def _load_value(v, _dict, strictly_valid=True):
return (False, "bool")
elif v[0] == '"':
testv = v[1:].split('"')
triplequote = False
triplequotecount = 0
if testv[0] == '' and testv[1] == '':
testv = testv[2:-2]
testv = testv[2:]
triplequote = True
closed = False
for tv in testv:
if tv == '':
closed = True
if triplequote:
triplequotecount += 1
else:
closed = True
else:
oddbackslash = False
try:
Expand All @@ -618,7 +624,10 @@ def _load_value(v, _dict, strictly_valid=True):
if closed:
raise ValueError("Stuff after closed string. WTF?")
else:
closed = True
if not triplequote or triplequotecount > 1:
closed = True
else:
triplequotecount = 0
escapeseqs = v.split('\\')[1:]
backslash = False
for i in escapeseqs:
Expand Down

0 comments on commit 07aaa4d

Please sign in to comment.