Commit f6fa97f1 authored by Igor Dejanovic's avatar Igor Dejanovic

Fix in NoMatch error reporting from comments parsing.

parent 9360398a
......@@ -1047,13 +1047,16 @@ class Parser(object):
Args:
args: A NoMatch instance or (value, position, parser)
"""
# Do not report NoMatch for comments matching.
# Use last exception instead.
if not self._in_parse_comment or self.nm is None:
if len(args) == 1 and isinstance(args[0], NoMatch):
if self.nm is None or args[0].position > self.nm.position:
self.nm = args[0]
else:
value, position, parser = args
rule, position, parser = args
if self.nm is None or position > self.nm.position:
self.nm = NoMatch(value, position, parser)
self.nm = NoMatch(rule, position, parser)
raise self.nm
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment