From 182f9216a9cc256dc4de85b449818a01a8b6f62c Mon Sep 17 00:00:00 2001 From: Henning Glawe <glaweh@debian.org> Date: Fri, 19 Aug 2016 22:46:26 +0200 Subject: [PATCH] rename line/lineNr to fInLine/fInLineNr --- common/python/nomadcore/annotator.py | 2 +- common/python/nomadcore/match_highlighter.py | 10 +++++----- common/python/nomadcore/simple_parser.py | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/common/python/nomadcore/annotator.py b/common/python/nomadcore/annotator.py index 3daaa0e..c63a8be 100644 --- a/common/python/nomadcore/annotator.py +++ b/common/python/nomadcore/annotator.py @@ -62,7 +62,7 @@ class Annotator(object): elif minfo['match']: highlighted = self.matchHighlighter.highlight_minfo(minfo) else: - highlighted = minfo['line'] + highlighted = minfo['fInLine'] # shorted matcher- and source file names name = minfo['matcherName'][-self._formatNameWidth:] if minfo['matcherName'] else 'UNNAMED' defFile = minfo['defFile'][-self._formatSourceWidth:] diff --git a/common/python/nomadcore/match_highlighter.py b/common/python/nomadcore/match_highlighter.py index d922744..cee04c3 100644 --- a/common/python/nomadcore/match_highlighter.py +++ b/common/python/nomadcore/match_highlighter.py @@ -41,7 +41,7 @@ class MatchHighlighter(object): if multiline is None: multiline=self.multiline - line = minfo['line'] + line = minfo['fInLine'] trailing = '' if not multiline: m = RE_finalnewlines.match(line) @@ -68,8 +68,8 @@ class MatchHighlighter(object): ansiSwitch.append([e,0,ANSI.RESET_COLOR]) # sort by position, then by event ansiSwitch=sorted(ansiSwitch, key=itemgetter(0,1)) - if ansiSwitch[-1][0]>len(minfo['line']): - raise Exception('line_exceed',"match exceeds line") + if ansiSwitch[-1][0]>len(minfo['fInLine']): + raise Exception('line_exceed',"match exceeds fInLine") # line may not contain trailing newline characters for a in ansiSwitch: if a[0] > len(line): @@ -87,14 +87,14 @@ class MatchHighlighter(object): highlighted += trailing return highlighted - def highlight(self, match, lineOrig, multiline=None, linecolor=''): + def highlight(self, match, fInLine, multiline=None, linecolor=''): """ :rtype: str :returns: highlighed string containing ANSI escapes """ # subset of annotator.match_info for backwards compatibility minfo = { - 'line': lineOrig, + 'fInLine': fInLine, 'span': [[match.span()]], } ngroups=len(match.groups()) diff --git a/common/python/nomadcore/simple_parser.py b/common/python/nomadcore/simple_parser.py index c9eb7e3..e2271fe 100644 --- a/common/python/nomadcore/simple_parser.py +++ b/common/python/nomadcore/simple_parser.py @@ -688,11 +688,11 @@ class CompiledMatcher(object): def findNextMatchEnd(self, parser): return self.findNextWithRe(self.possibleNextsEndRe, self.possibleNextsEnd, parser) - def getMatchTelemetry(self, parser, match, line, targetStartEnd): + def getMatchTelemetry(self, parser, match, fInLine, targetStartEnd): result = { # raw line - 'line': line, - 'lineNr': parser.fIn.lineNr, + 'fInLine': fInLine, + 'fInLineNr': parser.fIn.lineNr, # information about SimpleMatcher 'matcherName': self.matcher.name, 'defFile': self.matcher.defFile, @@ -710,7 +710,7 @@ class CompiledMatcher(object): } if match: span = match.span() - if span[0] == 0 and span[1] == len(line): + if span[0] == 0 and span[1] == len(fInLine): result['match'] = 3 # full match else: result['match'] = 1 # partial match @@ -726,12 +726,12 @@ class CompiledMatcher(object): if match.group(groupi) is not None: result['span'][groupi].append(match.span(groupi)) else: - m_ci = parser.coverageIgnore.match(line) # check global coverageIgnore + m_ci = parser.coverageIgnore.match(fInLine) # check global coverageIgnore if m_ci: result['coverageIgnore'] = 3 span = m_ci.span() result['span'] = [[span]] - if span[0] == 0 and span[1] == len(line): + if span[0] == 0 and span[1] == len(fInLine): result['match'] = 3 # full match else: result['match'] = 1 # partial match -- GitLab