Commit 5d5bafb1 authored by Lauri Himanen's avatar Lauri Himanen

Fixed bug with caused clash in handling starReTransform and fixedStartValues...

Fixed bug with caused clash in handling starReTransform and fixedStartValues on the same SimpleMatcher.
parent 27dc5d91
......@@ -636,25 +636,30 @@ class CompiledMatcher(object):
result_dict = {}
# If a separate transform function was defined in the matcher, call it
# and do nothing else.
# and ignore any named groups.
if self.matcher.startReTransform is not None:
self.matcher.startReTransform(parser.backend, m.groups())
for k,v in sorted(m.groupdict().items()):
if v is None:
# a group may be optional (subexpression of ? or | in regex)
k_converted, v_converted = self.addStrValue(parser.backend, k, v)
result_dict[k_converted] = v_converted
# Emit fixed start values
if self.matcher.fixedStartValues:
for k,v in sorted(self.matcher.fixedStartValues.items()):
if k not in result_dict:
v_converted = self.addValue(parser.backend, k, v)
result_dict[k] = v_converted
# If the match needs to be forwarded, push the read line back into the
# file stream
if self.matcher.forwardMatch:
logger.debug("handleStartMatch of %s on (%s) pushing back line", self.matcher.desc(),line)
return result_dict
def handleEndMatch(self, parser):
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