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

add setter methods for annotator field widths

With this, a parser can override the default field widths via
superContext.startedParsing:

def startedParsing(self, path, parser):
    # reconfigure width of SimpleMatcher name
    parser.annotator.set_formatNameWidth(42)
    # reconfigure width of source file where SimpleMatcher was defined
    parser.annotator.set_formatSourceWidth(10)
parent c20cee22
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,14 @@ class Annotator(object): ...@@ -25,6 +25,14 @@ class Annotator(object):
self._annotate_format = '%%%ds:%%04d %%%ds %%7s|%%s' % ( self._annotate_format = '%%%ds:%%04d %%%ds %%7s|%%s' % (
self._formatSourceWidth, self._formatNameWidth) self._formatSourceWidth, self._formatNameWidth)
def set_formatSourceWidth(self, formatSourceWidth):
self._formatSourceWidth = formatSourceWidth
self._update_annotate_format()
def set_formatNameWidth(self, formatNameWidth):
self._formatNameWidth = formatNameWidth
self._update_annotate_format()
def annotate(self,match,line,matcher,targetStartEnd): def annotate(self,match,line,matcher,targetStartEnd):
if not self.annotateFile: if not self.annotateFile:
return 1 return 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment