Krita Source Code Documentation
Loading...
Searching...
No Matches
krita.sceditor.highlighter.QtQmlHighlighter Class Reference
+ Inheritance diagram for krita.sceditor.highlighter.QtQmlHighlighter:

Public Member Functions

 __init__ (self, edit)
 
 updateRules (self)
 
- Public Member Functions inherited from krita.sceditor.highlighter.PythonHighlighter
 highlightBlock (self, text)
 
 highlightRules (self, text, start, finish)
 
 updateFonts (self, font)
 
 updateHighlighter (self, font)
 

Public Attributes

 callableFormat
 
 keywordFormat
 
 keywords
 
 multiLineStringBegin
 
 multiLineStringEnd
 
 multiLineStringFormat
 
 qtFormat
 
 quotationFormat1
 
 quotationFormat2
 
 rules
 
 selfFormat
 
 singleLineCommentFormat
 
- Public Attributes inherited from krita.sceditor.highlighter.PythonHighlighter
 base_format
 
 callableFormat
 
 document
 
 empty_format
 
 keywordFormat
 
 keywords
 
 magicFormat
 
 multiLineStringBegin
 
 multiLineStringEnd
 
 multiLineStringFormat
 
 qtFormat
 
 quotationFormat1
 
 quotationFormat2
 
 rules
 
 selfFormat
 
 singleLineCommentFormat
 

Static Public Attributes

str keywords
 
- Static Public Attributes inherited from krita.sceditor.highlighter.PythonHighlighter
tuple keywords
 

Detailed Description

Definition at line 141 of file highlighter.py.

Constructor & Destructor Documentation

◆ __init__()

krita.sceditor.highlighter.QtQmlHighlighter.__init__ ( self,
edit )

Reimplemented from krita.sceditor.highlighter.PythonHighlighter.

Definition at line 157 of file highlighter.py.

157 def __init__(self, edit):
158 PythonHighlighter.__init__(self, edit)
159

Member Function Documentation

◆ updateRules()

krita.sceditor.highlighter.QtQmlHighlighter.updateRules ( self)

Reimplemented from krita.sceditor.highlighter.PythonHighlighter.

Definition at line 160 of file highlighter.py.

160 def updateRules(self):
161
162 self.rules = []
163 self.rules += map(lambda s: (QtCore.QRegularExpression(r"\b" + s + r"\b"),
164 self.keywordFormat), self.keywords)
165
166 self.rules.append((QtCore.QRegularExpression(r"\b[A-Za-z_]+\‍(.*\‍)"), self.callableFormat))
167 # self.rules.append((QtCore.QRegularExpression(r"\b__[a-z]+__\b"), self.magicFormat))
168 self.rules.append((QtCore.QRegularExpression(r"\bthis\b"), self.selfFormat))
169 self.rules.append((QtCore.QRegularExpression(r"\bQ([A-Z][a-z]*)+\b"), self.qtFormat))
170
171 self.rules.append((QtCore.QRegularExpression(r"//[^\n]*"), self.singleLineCommentFormat))
172
173 # XXX quick hack to support QtQml syntax
174 self.multiLineStringBegin = QtCore.QRegularExpression(r'/\*')
175 self.multiLineStringEnd = QtCore.QRegularExpression(r'\*/')
176 self.multiLineStringFormat = self.singleLineCommentFormat
177 self.rules.append((QtCore.QRegularExpression(r'\"[^\n]*\"'), self.quotationFormat1))
178 self.rules.append((QtCore.QRegularExpression(r"'[^\n]*'"), self.quotationFormat2))

Member Data Documentation

◆ callableFormat

krita.sceditor.highlighter.QtQmlHighlighter.callableFormat

Definition at line 166 of file highlighter.py.

◆ keywordFormat

krita.sceditor.highlighter.QtQmlHighlighter.keywordFormat

Definition at line 164 of file highlighter.py.

◆ keywords [1/2]

str krita.sceditor.highlighter.QtQmlHighlighter.keywords
static
Initial value:
= """"
break for throw case function try
catch if typeof continue in var default instanceof void
delete new undefined do return while else switch with
finally this """.split() + \
['NaN', 'Infinity', 'undefined', 'print', 'parseInt',
'parseFloat', 'isNaN', 'isFinite', 'decodeURI',
'decodeURIComponent', 'encodeURI', 'encodeURIComponent',
'escape', 'unescape', 'version', 'gc', 'Object',
'Function', 'Number', 'Boolean', 'String', 'Date', 'Array',
'RegularExpression', 'Error', 'EvalError', 'RangeError', 'ReferenceError',
'SyntaxError', 'TypeError', 'URIError', 'eval', 'Math',
'Enumeration', 'Variant', 'QObject', 'QMetaObject']

Definition at line 143 of file highlighter.py.

◆ keywords [2/2]

krita.sceditor.highlighter.QtQmlHighlighter.keywords

Definition at line 164 of file highlighter.py.

◆ multiLineStringBegin

krita.sceditor.highlighter.QtQmlHighlighter.multiLineStringBegin

Definition at line 174 of file highlighter.py.

◆ multiLineStringEnd

krita.sceditor.highlighter.QtQmlHighlighter.multiLineStringEnd

Definition at line 175 of file highlighter.py.

◆ multiLineStringFormat

krita.sceditor.highlighter.QtQmlHighlighter.multiLineStringFormat

Definition at line 176 of file highlighter.py.

◆ qtFormat

krita.sceditor.highlighter.QtQmlHighlighter.qtFormat

Definition at line 169 of file highlighter.py.

◆ quotationFormat1

krita.sceditor.highlighter.QtQmlHighlighter.quotationFormat1

Definition at line 177 of file highlighter.py.

◆ quotationFormat2

krita.sceditor.highlighter.QtQmlHighlighter.quotationFormat2

Definition at line 178 of file highlighter.py.

◆ rules

krita.sceditor.highlighter.QtQmlHighlighter.rules

Definition at line 162 of file highlighter.py.

◆ selfFormat

krita.sceditor.highlighter.QtQmlHighlighter.selfFormat

Definition at line 168 of file highlighter.py.

◆ singleLineCommentFormat

krita.sceditor.highlighter.QtQmlHighlighter.singleLineCommentFormat

Definition at line 171 of file highlighter.py.


The documentation for this class was generated from the following file: