src/eric7/QScintilla/Lexers/LexerRuby.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
17 17
18 class LexerRuby(Lexer, QsciLexerRuby): 18 class LexerRuby(Lexer, QsciLexerRuby):
19 """ 19 """
20 Subclass to implement some additional lexer dependant methods. 20 Subclass to implement some additional lexer dependant methods.
21 """ 21 """
22
22 def __init__(self, parent=None): 23 def __init__(self, parent=None):
23 """ 24 """
24 Constructor 25 Constructor
25 26
26 @param parent parent widget of this lexer 27 @param parent parent widget of this lexer
27 """ 28 """
28 QsciLexerRuby.__init__(self, parent) 29 QsciLexerRuby.__init__(self, parent)
29 Lexer.__init__(self) 30 Lexer.__init__(self)
30 31
31 self.commentString = "#" 32 self.commentString = "#"
32 33
33 self.keywordSetDescriptions = [ 34 self.keywordSetDescriptions = [
34 self.tr("Keywords"), 35 self.tr("Keywords"),
35 ] 36 ]
36 37
37 def initProperties(self): 38 def initProperties(self):
38 """ 39 """
39 Public slot to initialize the properties. 40 Public slot to initialize the properties.
40 """ 41 """
41 with contextlib.suppress(AttributeError): 42 with contextlib.suppress(AttributeError):
42 self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) 43 self.setFoldCompact(Preferences.getEditor("AllFoldCompact"))
43 self.setFoldComments(Preferences.getEditor("RubyFoldComment")) 44 self.setFoldComments(Preferences.getEditor("RubyFoldComment"))
44 45
45 def autoCompletionWordSeparators(self): 46 def autoCompletionWordSeparators(self):
46 """ 47 """
47 Public method to return the list of separators for autocompletion. 48 Public method to return the list of separators for autocompletion.
48 49
49 @return list of separators (list of strings) 50 @return list of separators (list of strings)
50 """ 51 """
51 return ['.'] 52 return ["."]
52 53
53 def isCommentStyle(self, style): 54 def isCommentStyle(self, style):
54 """ 55 """
55 Public method to check, if a style is a comment style. 56 Public method to check, if a style is a comment style.
56 57
57 @param style style to check (integer) 58 @param style style to check (integer)
58 @return flag indicating a comment style (boolean) 59 @return flag indicating a comment style (boolean)
59 """ 60 """
60 return style in [QsciLexerRuby.Comment] 61 return style in [QsciLexerRuby.Comment]
61 62
62 def isStringStyle(self, style): 63 def isStringStyle(self, style):
63 """ 64 """
64 Public method to check, if a style is a string style. 65 Public method to check, if a style is a string style.
65 66
66 @param style style to check (integer) 67 @param style style to check (integer)
67 @return flag indicating a string style (boolean) 68 @return flag indicating a string style (boolean)
68 """ 69 """
69 return style in [QsciLexerRuby.DoubleQuotedString, 70 return style in [
70 QsciLexerRuby.HereDocument, 71 QsciLexerRuby.DoubleQuotedString,
71 QsciLexerRuby.PercentStringQ, 72 QsciLexerRuby.HereDocument,
72 QsciLexerRuby.PercentStringq, 73 QsciLexerRuby.PercentStringQ,
73 QsciLexerRuby.PercentStringr, 74 QsciLexerRuby.PercentStringq,
74 QsciLexerRuby.PercentStringw, 75 QsciLexerRuby.PercentStringr,
75 QsciLexerRuby.PercentStringx, 76 QsciLexerRuby.PercentStringw,
76 QsciLexerRuby.SingleQuotedString] 77 QsciLexerRuby.PercentStringx,
77 78 QsciLexerRuby.SingleQuotedString,
79 ]
80
78 def defaultKeywords(self, kwSet): 81 def defaultKeywords(self, kwSet):
79 """ 82 """
80 Public method to get the default keywords. 83 Public method to get the default keywords.
81 84
82 @param kwSet number of the keyword set (integer) 85 @param kwSet number of the keyword set (integer)
83 @return string giving the keywords (string) or None 86 @return string giving the keywords (string) or None
84 """ 87 """
85 return QsciLexerRuby.keywords(self, kwSet) 88 return QsciLexerRuby.keywords(self, kwSet)

eric ide

mercurial