QScintilla/Lexers/LexerPython.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 3011
18292228c724
child 3145
a9de05d4a22f
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
35 self.commentString = "#" 35 self.commentString = "#"
36 36
37 def language(self): 37 def language(self):
38 """ 38 """
39 Public method to get the lexer language. 39 Public method to get the lexer language.
40
41 @return lexer language (string)
40 """ 42 """
41 if not self.variant: 43 if not self.variant:
42 return QsciLexerPython.language(self) 44 return QsciLexerPython.language(self)
43 else: 45 else:
44 return self.variant 46 return self.variant
54 self.setFoldComments(Preferences.getEditor("PythonFoldComment")) 56 self.setFoldComments(Preferences.getEditor("PythonFoldComment"))
55 self.setFoldQuotes(Preferences.getEditor("PythonFoldString")) 57 self.setFoldQuotes(Preferences.getEditor("PythonFoldString"))
56 if not Preferences.getEditor("PythonAutoIndent"): 58 if not Preferences.getEditor("PythonAutoIndent"):
57 self.setAutoIndentStyle(QsciScintilla.AiMaintain) 59 self.setAutoIndentStyle(QsciScintilla.AiMaintain)
58 try: 60 try:
59 self.setV2UnicodeAllowed(Preferences.getEditor("PythonAllowV2Unicode")) 61 self.setV2UnicodeAllowed(
60 self.setV3BinaryOctalAllowed(Preferences.getEditor("PythonAllowV3Binary")) 62 Preferences.getEditor("PythonAllowV2Unicode"))
63 self.setV3BinaryOctalAllowed(
64 Preferences.getEditor("PythonAllowV3Binary"))
61 self.setV3BytesAllowed(Preferences.getEditor("PythonAllowV3Bytes")) 65 self.setV3BytesAllowed(Preferences.getEditor("PythonAllowV3Bytes"))
62 except AttributeError: 66 except AttributeError:
63 pass 67 pass
64 try: 68 try:
65 self.setFoldQuotes(Preferences.getEditor("PythonFoldQuotes")) 69 self.setFoldQuotes(Preferences.getEditor("PythonFoldQuotes"))
123 127
124 def isCommentStyle(self, style): 128 def isCommentStyle(self, style):
125 """ 129 """
126 Public method to check, if a style is a comment style. 130 Public method to check, if a style is a comment style.
127 131
132 @param style style to check (integer)
128 @return flag indicating a comment style (boolean) 133 @return flag indicating a comment style (boolean)
129 """ 134 """
130 return style in [QsciLexerPython.Comment, 135 return style in [QsciLexerPython.Comment,
131 QsciLexerPython.CommentBlock] 136 QsciLexerPython.CommentBlock]
132 137
133 def isStringStyle(self, style): 138 def isStringStyle(self, style):
134 """ 139 """
135 Public method to check, if a style is a string style. 140 Public method to check, if a style is a string style.
136 141
142 @param style style to check (integer)
137 @return flag indicating a string style (boolean) 143 @return flag indicating a string style (boolean)
138 """ 144 """
139 return style in [QsciLexerPython.DoubleQuotedString, 145 return style in [QsciLexerPython.DoubleQuotedString,
140 QsciLexerPython.SingleQuotedString, 146 QsciLexerPython.SingleQuotedString,
141 QsciLexerPython.TripleDoubleQuotedString, 147 QsciLexerPython.TripleDoubleQuotedString,

eric ide

mercurial