auto merge of #3751 : fabricedesre/servo/update-toml, r=metajack

This commit is contained in:
bors-servo 2014-10-21 20:36:33 -06:00
commit cf789e40c5

View file

@ -1,4 +1,4 @@
import datetime, decimal import datetime, decimal, re
try: try:
_range = xrange _range = xrange
@ -42,7 +42,7 @@ def loads(s):
sl = list(s) sl = list(s)
openarr = 0 openarr = 0
openstring = False openstring = False
arrayoftables = True arrayoftables = False
beginline = True beginline = True
keygroup = False keygroup = False
delnum = 1 delnum = 1
@ -79,7 +79,7 @@ def loads(s):
keygroup = True keygroup = True
else: else:
openarr += 1 openarr += 1
if sl[i] == ']' and not openstring and not keygroup and not arrayoftables: if sl[i] == ']' and not openstring:
if keygroup: if keygroup:
keygroup = False keygroup = False
elif arrayoftables: elif arrayoftables:
@ -251,10 +251,10 @@ def load_value(v):
newv += unicode(hx[len(hxb):]) newv += unicode(hx[len(hxb):])
v = newv v = newv
for i in range(len(escapes)): for i in range(len(escapes)):
v = v.replace("\\"+escapes[i], escapedchars[i]) if escapes[i] == '\\':
# (where (n) signifies a member of escapes: v = v.replace("\\"+escapes[i], escapedchars[i])
# undo (\\)(\\)(n) -> (\\)(\n) else:
v = v.replace("\\"+escapedchars[i], "\\\\"+escapes[i]) v = re.sub("([^\\\\](\\\\\\\\)*)\\\\"+escapes[i], "\\1"+escapedchars[i], v)
return (v[1:-1], "str") return (v[1:-1], "str")
elif v[0] == '[': elif v[0] == '[':
return (load_array(v), "array") return (load_array(v), "array")