eric7.EricGui.EricGenericDiffHighlighter

Module implementing a syntax highlighter for diff outputs.

Global Attributes

_REGEX_CACHE

Classes

EricGenericDiffHighlighter Class implementing a generic diff highlighter.

Functions

TERMINAL Function to mark a pattern as the final one to search for.


EricGenericDiffHighlighter

Class implementing a generic diff highlighter.

Derived from

QSyntaxHighlighter

Class Attributes

None

Class Methods

None

Methods

EricGenericDiffHighlighter Constructor
__initColours Private method to initialize the highlighter colours.
createRules Public method to create the highlighting rules.
formats Public method to determine the highlighting formats for a line of text.
generateRules Public method to generate the rule set.
highlightBlock Public method to highlight a block of text.
makeFormat Public method to generate a format definition.
regenerateRules Public method to initialize or regenerate the syntax highlighter rules.

Static Methods

None

EricGenericDiffHighlighter (Constructor)

EricGenericDiffHighlighter(doc)

Constructor

doc (QTextDocument)
reference to the text document

EricGenericDiffHighlighter.__initColours

__initColours()

Private method to initialize the highlighter colours.

EricGenericDiffHighlighter.createRules

createRules(*rules)

Public method to create the highlighting rules.

rules (set of tuple of (str, QTextCharFormat))
set of highlighting rules (list of tuples of rule pattern and highlighting format)

EricGenericDiffHighlighter.formats

formats(line)

Public method to determine the highlighting formats for a line of text.

line (str)
text line to be highlighted
Return:
list of matched highlighting rules (list of tuples of match object and format)
Return Type:
list of tuple of (re.Match, QTextCharFormat)

EricGenericDiffHighlighter.generateRules

generateRules()

Public method to generate the rule set.

Note: This method must me implemented by derived syntax highlighters.

EricGenericDiffHighlighter.highlightBlock

highlightBlock(text)

Public method to highlight a block of text.

text (str)
text to be highlighted

EricGenericDiffHighlighter.makeFormat

makeFormat(fg=None, bg=None, bold=False)

Public method to generate a format definition.

fg (QColor)
foreground color
bg (QColor)
background color
bold (bool)
flag indicating bold text
Return:
format definiton
Return Type:
QTextCharFormat

EricGenericDiffHighlighter.regenerateRules

regenerateRules()

Public method to initialize or regenerate the syntax highlighter rules.

Up


TERMINAL

TERMINAL(pattern)

Function to mark a pattern as the final one to search for.

pattern (str)
pattern to be marked
Return:
marked pattern
Return Type:
str
Up