Skip to content

Commit

Permalink
Addresses some issues raised in #4
Browse files Browse the repository at this point in the history
No longer chop off opening brackets for nested arrays
Ignore trailing backslashes
  • Loading branch information
uiri committed Mar 4, 2013
1 parent 37f8791 commit 3abea2f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ def load_value(v):
escapedchars = ['\0', '\n', '\r', '\t', '\"', '\\']
escapeseqs = v.split('\\')[1:]
for i in escapeseqs:
if i[0] not in escapes and i[0] != 'x':
raise Exception("Reserved escape sequence used")
if i != '':
if i[0] not in escapes and i[0] != 'x':
raise Exception("Reserved escape sequence used")
if "\\x" in v:
hexchars = ['0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f']
Expand Down Expand Up @@ -131,13 +132,14 @@ def load_value(v):

def load_array(a):
retval = []
a = a.strip()
if '[' not in a[1:-1]:
a = a[1:-1].split(',')
else:
al = list(a[1:-1])
a = []
openarr = 0
j = 1
j = 0
for i in xrange(len(al)):
if al[i] == '[':
openarr += 1
Expand Down

0 comments on commit 3abea2f

Please sign in to comment.