Skip to content

Commit

Permalink
Fix #205: Bug in array of nested inline tables
Browse files Browse the repository at this point in the history
  • Loading branch information
uiri committed Nov 27, 2018
1 parent 3a694e9 commit 7bafb6e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions toml/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,7 @@ def load_array(self, a):
new_a = []
start_group_index = 1
end_group_index = 2
open_bracket_count = 1 if a[start_group_index] == '{' else 0
in_str = False
while end_group_index < len(a[1:]):
if a[end_group_index] == '"' or a[end_group_index] == "'":
Expand All @@ -890,9 +891,15 @@ def load_array(self, a):
in_str = not in_str
backslash_index -= 1
in_str = not in_str
if not in_str and a[end_group_index] == '{':
open_bracket_count += 1
if in_str or a[end_group_index] != '}':
end_group_index += 1
continue
elif a[end_group_index] == '}' and open_bracket_count > 1:
open_bracket_count -= 1
end_group_index += 1
continue

# Increase end_group_index by 1 to get the closing bracket
end_group_index += 1
Expand Down

0 comments on commit 7bafb6e

Please sign in to comment.