Skip to content

Commit

Permalink
release 8.17.21356
Browse files Browse the repository at this point in the history
  • Loading branch information
klahnakoski committed Dec 22, 2021
2 parents eb40acc + 5981ccb commit f5d2b37
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
16 changes: 14 additions & 2 deletions mo_parsing/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ def __init__(self, exprs, whitespace):
:param exprs: The expressions to be matched
:param mins: list of integers indincating any minimums
"""
super(MatchAll, self).__init__(exprs)
ParseExpression.__init__(self, exprs)
self.set_config(
whitespace=whitespace,
min_match=[
Expand All @@ -730,7 +730,16 @@ def __init__(self, exprs, whitespace):
def streamline(self):
if self.streamlined:
return self
return super(MatchAll, self).streamline()
output = ParseExpression.streamline(self)
output.set_config(
min_match=[
e.parser_config.min_match if isinstance(e, Many) else 1 for e in output.exprs
],
max_match=[
e.parser_config.max_match if isinstance(e, Many) else 1 for e in output.exprs
],
)
return output

def _min_length(self):
# TODO: MAY BE TOO CONSERVATIVE, WE MAY BE ABLE TO PROVE self CAN CONSUME A CHARACTER
Expand Down Expand Up @@ -797,6 +806,9 @@ def parse_impl(self, string, start, do_actions=True):
# add any unmatched Optionals, in case they have default values defined
match_order += [e for e in self.exprs if id(e) not in found]

if not match_order:
return ParseResults(self, start, start, [], failures)

# TODO: CAN WE AVOID THIS RE-PARSE?
results = []
end = start
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
name='mo-parsing',
packages=["mo_parsing"],
url='https://github.com/klahnakoski/mo-parsing',
version='8.14.21350'
version='8.17.21356'
)
2 changes: 1 addition & 1 deletion setuptools.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,5 @@
"name": "mo-parsing",
"packages": ["mo_parsing"],
"url": "https://github.com/klahnakoski/mo-parsing",
"version": "8.14.21350"
"version": "8.17.21356"
}

0 comments on commit f5d2b37

Please sign in to comment.