(self, *args, **kwargs)
| 33 | |
| 34 | class JsonHighlighter(QSyntaxHighlighter): |
| 35 | def __init__(self, *args, **kwargs): |
| 36 | super().__init__(*args, **kwargs) |
| 37 | self._rules = [ |
| 38 | # numbers |
| 39 | HighlightingRule(QRegExp('([-0-9.]+)(?!([^"]*"[\\s]*\\:))'), Qt.darkRed), |
| 40 | # key |
| 41 | HighlightingRule(QRegExp('("[^"]*")\\s*\\:'), Qt.darkBlue), |
| 42 | # value |
| 43 | HighlightingRule(QRegExp(':+(?:[: []*)("[^"]*")'), Qt.darkGreen), |
| 44 | ] |
| 45 | |
| 46 | def highlightBlock(self, text: str) -> None: |
| 47 | for rule in self._rules: |
nothing calls this directly
no test coverage detected