pycrossword
0.4
Pure-Python implementation of a crossword puzzle generator and editor
|
Syntax highlighter class for JSON. More...
Public Member Functions | |
def | __init__ (self, QtGui.QTextDocument parent, decode_errors=False, on_decode_error=None, on_decode_success=None) |
def | highlightBlock (self, text) |
Override of QtGui.QSyntaxHighlighter::highlightBlock() method: does the syntax highlighting. More... | |
Public Attributes | |
decode_errors | |
bool whether to highlight and process JSON decode errors More... | |
decoder | |
json.JSONDecoder JSON decoder More... | |
Static Public Attributes | |
list | PATTERNS |
Regex-based patterns and their corresponding color values. More... | |
sig_parse_error = QtCore.pyqtSignal(QtGui.QSyntaxHighlighter, str, str, int, int, int) | |
Qt signal emitted on a syntax parser error. More... | |
sig_parse_success = QtCore.pyqtSignal(QtGui.QSyntaxHighlighter) | |
Qt signal emitted on a syntax parser success. More... | |
Private Attributes | |
_error_format | |
QtGui.QTextCharFormat error highlighting text format More... | |
Syntax highlighter class for JSON.
Used in pycross::forms::WordSrcDialog (DB table definition).
def pycross.utils.utils.JsonHiliter.__init__ | ( | self, | |
QtGui.QTextDocument | parent, | ||
decode_errors = False , |
|||
on_decode_error = None , |
|||
on_decode_success = None |
|||
) |
parent | QtGui.QTextDocument parent document that the highlighter binds to |
decode_errors | bool whether to highlight and process JSON decode errors |
on_decode_error | QtCore.pyQtSlot slot for the JsonHiliter::sig_parse_error signal |
on_decode_success | QtCore.pyQtSlot slot for the JsonHiliter::sig_parse_success signal |
def pycross.utils.utils.JsonHiliter.highlightBlock | ( | self, | |
text | |||
) |
Override of QtGui.QSyntaxHighlighter::highlightBlock()
method: does the syntax highlighting.
text | str the text string to be parsed and highlighted |
|
private |
QtGui.QTextCharFormat
error highlighting text format
pycross.utils.utils.JsonHiliter.decode_errors |
bool
whether to highlight and process JSON decode errors
pycross.utils.utils.JsonHiliter.decoder |
json.JSONDecoder
JSON decoder
|
static |
Regex-based patterns and their corresponding color values.
Each record has 3 elements:
Python regex object
compiled regex patternint
group number in regex match results to highlight (0 = whole match, 1 = first expression in parentheses, etc...)QtGui.QColor
color to apply to matched text
|
static |
Qt signal emitted on a syntax parser error.
Arguments:
QtGui.QSyntaxHighlighter
this instancestr
error message stringstr
error docs stringint
absolute position of the error in the source codeint
line number in the source codeint
column number in the source code
|
static |
Qt signal emitted on a syntax parser success.
Arguments:
QtGui.QSyntaxHighlighter
this instance