diff --git a/common/python/nomadcore/annotator.py b/common/python/nomadcore/annotator.py index 3daaa0e83e82b6789395dc7aaba1a07b9447627b..c63a8be95fc2ca5227a312703ff7b8b37bc1bccb 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 d92274456013ec574e3ecbcd70f4eb9d464f0b6b..cee04c3226ea50582dbff2e0400a8baf7a4a3eb1 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 c9eb7e34416f378685f936fa773d2a0d22400c54..e2271fe307648def046a0a599b52cc915894ba22 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