Skip to content

Commit

Permalink
Fix multiselect list parsing
Browse files Browse the repository at this point in the history
Closes #86.
  • Loading branch information
jamesls committed Jul 12, 2015
1 parent 9302489 commit bdda80e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 4 additions & 3 deletions jmespath/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,12 +338,13 @@ def _parse_comparator(self, left, comparator):

def _parse_multi_select_list(self):
expressions = []
while not self._current_token() == 'rbracket':
while True:
expression = self._expression()
expressions.append(expression)
if self._current_token() == 'comma':
if self._current_token() == 'rbracket':
break
else:
self._match('comma')
self._assert_not_token('rbracket')
self._match('rbracket')
return ast.multi_select_list(expressions)

Expand Down
4 changes: 4 additions & 0 deletions tests/compliance/syntax.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@
"expression": "foo.[0]",
"error": "syntax"
},
{
"expression": "[foo bar]",
"error": "syntax"
},
{
"expression": "foo.[*]",
"result": null
Expand Down

0 comments on commit bdda80e

Please sign in to comment.