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): ...@@ -1047,13 +1047,16 @@ class Parser(object):
Args: Args:
args: A NoMatch instance or (value, position, parser) args: A NoMatch instance or (value, position, parser)
""" """
if len(args) == 1 and isinstance(args[0], NoMatch): # Do not report NoMatch for comments matching.
if self.nm is None or args[0].position > self.nm.position: # Use last exception instead.
self.nm = args[0] if not self._in_parse_comment or self.nm is None:
else: if len(args) == 1 and isinstance(args[0], NoMatch):
value, position, parser = args if self.nm is None or args[0].position > self.nm.position:
if self.nm is None or position > self.nm.position: self.nm = args[0]
self.nm = NoMatch(value, position, parser) else:
rule, position, parser = args
if self.nm is None or position > self.nm.position:
self.nm = NoMatch(rule, position, parser)
raise self.nm 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