Skip to content
Snippets Groups Projects
Commit 1e9bbd1f authored by Henning Glawe's avatar Henning Glawe
Browse files

add special case in annotator for SimpleMatcher.does_nothing

parent 88a25996
Branches
Tags
No related merge requests found
......@@ -42,20 +42,43 @@ class Annotator(object):
return 1
# classify match
full = match and match.start() == 0 and match.end() == len(line)
ignore = not match and (RE_EMPTY.match(line) or (
self.coverageIgnore is not None and
self.coverageIgnore.match(line)))
ignore = False
matcher_does_nothing = False
if match:
if matcher.does_nothing:
matcher_does_nothing = True
else:
m2 = RE_EMPTY.match(line)
if m2:
ignore = True
match = m2
elif self.coverageIgnore is not None:
m2 = self.coverageIgnore.match(line)
if m2:
ignore = True
match = m2
# setup match label
if match:
matchlabel = ('' if full else 'p_') + ('end' if targetStartEnd else 'start')
matchlabel = ''
if ignore:
matchlabel = 'ign'
elif match:
if matcher_does_nothing:
matchlabel='n_'
if not full:
matchlabel += 'p_'
matchlabel += 'end' if targetStartEnd else 'start'
else:
matchlabel = 'ign' if ignore else 'no'
matchlabel = 'no'
# highlight line
if match:
if ignore:
highlighted = self.matchHighlighter.highlight(
match, line, linecolor=ANSI.FG_BLUE)
elif matcher_does_nothing:
highlighted = self.matchHighlighter.highlight(
match, line, linecolor=ANSI.FG_MAGENTA)
elif match:
highlighted = self.matchHighlighter.highlight(match, line)
elif ignore:
highlighted = ANSI.FG_BLUE + self.matchHighlighter.with_ANSI_RESET(line)
else:
highlighted = line
# set matcher name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment