Skip to content
Snippets Groups Projects
Commit 5d5bafb1 authored by Lauri Himanen's avatar Lauri Himanen
Browse files

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
No related branches found
No related tags found
No related merge requests found
......@@ -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())
else:
for k,v in sorted(m.groupdict().items()):
if v is None:
# a group may be optional (subexpression of ? or | in regex)
continue
k_converted, v_converted = self.addStrValue(parser.backend, k, v)
result_dict[k_converted] = v_converted
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
# 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)
parser.fIn.pushbackLine(line)
return result_dict
def handleEndMatch(self, parser):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment