25 |
25 |
26 def __init__(self, variant="", parent=None): |
26 def __init__(self, variant="", parent=None): |
27 """ |
27 """ |
28 Constructor |
28 Constructor |
29 |
29 |
30 @param variant name of the language variant (string) |
30 @param variant name of the language variant |
|
31 @type str |
31 @param parent parent widget of this lexer |
32 @param parent parent widget of this lexer |
|
33 @type QWidget |
32 """ |
34 """ |
33 QsciLexerPython.__init__(self, parent) |
35 QsciLexerPython.__init__(self, parent) |
34 SubstyledLexer.__init__(self) |
36 SubstyledLexer.__init__(self) |
35 |
37 |
36 self.variant = variant |
38 self.variant = variant |
152 |
155 |
153 def getIndentationDifference(self, line, editor): |
156 def getIndentationDifference(self, line, editor): |
154 """ |
157 """ |
155 Public method to determine the difference for the new indentation. |
158 Public method to determine the difference for the new indentation. |
156 |
159 |
157 @param line line to perform the calculation for (integer) |
160 @param line line to perform the calculation for |
|
161 @type int |
158 @param editor QScintilla editor |
162 @param editor QScintilla editor |
159 @return amount of difference in indentation (integer) |
163 @type Editor |
|
164 @return amount of difference in indentation |
|
165 @rtype int |
160 """ |
166 """ |
161 indent_width = editor.getEditorConfig("IndentWidth") |
167 indent_width = editor.getEditorConfig("IndentWidth") |
162 |
168 |
163 lead_spaces = editor.indentation(line) |
169 lead_spaces = editor.indentation(line) |
164 |
170 |
195 |
201 |
196 def autoCompletionWordSeparators(self): |
202 def autoCompletionWordSeparators(self): |
197 """ |
203 """ |
198 Public method to return the list of separators for autocompletion. |
204 Public method to return the list of separators for autocompletion. |
199 |
205 |
200 @return list of separators (list of strings) |
206 @return list of separators |
|
207 @rtype list of str |
201 """ |
208 """ |
202 return ["."] |
209 return ["."] |
203 |
210 |
204 def isCommentStyle(self, style): |
211 def isCommentStyle(self, style): |
205 """ |
212 """ |
206 Public method to check, if a style is a comment style. |
213 Public method to check, if a style is a comment style. |
207 |
214 |
208 @param style style to check (integer) |
215 @param style style to check |
209 @return flag indicating a comment style (boolean) |
216 @type int |
|
217 @return flag indicating a comment style |
|
218 @rtype bool |
210 """ |
219 """ |
211 return style in [QsciLexerPython.Comment, QsciLexerPython.CommentBlock] |
220 return style in [QsciLexerPython.Comment, QsciLexerPython.CommentBlock] |
212 |
221 |
213 def isStringStyle(self, style): |
222 def isStringStyle(self, style): |
214 """ |
223 """ |
215 Public method to check, if a style is a string style. |
224 Public method to check, if a style is a string style. |
216 |
225 |
217 @param style style to check (integer) |
226 @param style style to check |
218 @return flag indicating a string style (boolean) |
227 @type int |
|
228 @return flag indicating a string style |
|
229 @rtype bool |
219 """ |
230 """ |
220 return style in [ |
231 return style in [ |
221 QsciLexerPython.DoubleQuotedString, |
232 QsciLexerPython.DoubleQuotedString, |
222 QsciLexerPython.SingleQuotedString, |
233 QsciLexerPython.SingleQuotedString, |
223 QsciLexerPython.TripleDoubleQuotedString, |
234 QsciLexerPython.TripleDoubleQuotedString, |
227 |
238 |
228 def defaultKeywords(self, kwSet): |
239 def defaultKeywords(self, kwSet): |
229 """ |
240 """ |
230 Public method to get the default keywords. |
241 Public method to get the default keywords. |
231 |
242 |
232 @param kwSet number of the keyword set (integer) |
243 @param kwSet number of the keyword set |
233 @return string giving the keywords (string) or None |
244 @type int |
|
245 @return string giving the keywords or None |
|
246 @rtype str |
234 """ |
247 """ |
235 if kwSet == 1: |
248 if kwSet == 1: |
236 if self.language() == "Python3": |
249 if self.language() == "Python3": |
237 keywords = " ".join(keyword.kwlist) |
250 keywords = " ".join(keyword.kwlist) |
238 elif self.language() == "MicroPython": |
251 elif self.language() == "MicroPython": |