src/eric7/QScintilla/Lexers/LexerTCL.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
18 18
19 class LexerTCL(Lexer, QsciLexerTCL): 19 class LexerTCL(Lexer, QsciLexerTCL):
20 """ 20 """
21 Subclass to implement some additional lexer dependant methods. 21 Subclass to implement some additional lexer dependant methods.
22 """ 22 """
23
23 def __init__(self, parent=None): 24 def __init__(self, parent=None):
24 """ 25 """
25 Constructor 26 Constructor
26 27
27 @param parent parent widget of this lexer 28 @param parent parent widget of this lexer
28 """ 29 """
29 QsciLexerTCL.__init__(self, parent) 30 QsciLexerTCL.__init__(self, parent)
30 Lexer.__init__(self) 31 Lexer.__init__(self)
31 32
32 self.commentString = "#" 33 self.commentString = "#"
33 34
34 self.keywordSetDescriptions = [ 35 self.keywordSetDescriptions = [
35 self.tr("TCL Keywords"), 36 self.tr("TCL Keywords"),
36 self.tr("TK Keywords"), 37 self.tr("TK Keywords"),
37 self.tr("iTCL Keywords"), 38 self.tr("iTCL Keywords"),
38 self.tr("TK Commands"), 39 self.tr("TK Commands"),
40 self.tr("User defined 1"), 41 self.tr("User defined 1"),
41 self.tr("User defined 2"), 42 self.tr("User defined 2"),
42 self.tr("User defined 3"), 43 self.tr("User defined 3"),
43 self.tr("User defined 4"), 44 self.tr("User defined 4"),
44 ] 45 ]
45 46
46 def initProperties(self): 47 def initProperties(self):
47 """ 48 """
48 Public slot to initialize the properties. 49 Public slot to initialize the properties.
49 """ 50 """
50 with contextlib.suppress(AttributeError): 51 with contextlib.suppress(AttributeError):
51 self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) 52 self.setFoldCompact(Preferences.getEditor("AllFoldCompact"))
52 with contextlib.suppress(AttributeError): 53 with contextlib.suppress(AttributeError):
53 self.setFoldComments(Preferences.getEditor("TclFoldComment")) 54 self.setFoldComments(Preferences.getEditor("TclFoldComment"))
54 55
55 def isCommentStyle(self, style): 56 def isCommentStyle(self, style):
56 """ 57 """
57 Public method to check, if a style is a comment style. 58 Public method to check, if a style is a comment style.
58 59
59 @param style style to check (integer) 60 @param style style to check (integer)
60 @return flag indicating a comment style (boolean) 61 @return flag indicating a comment style (boolean)
61 """ 62 """
62 return style in [QsciLexerTCL.Comment, 63 return style in [
63 QsciLexerTCL.CommentBlock, 64 QsciLexerTCL.Comment,
64 QsciLexerTCL.CommentBox, 65 QsciLexerTCL.CommentBlock,
65 QsciLexerTCL.CommentLine] 66 QsciLexerTCL.CommentBox,
66 67 QsciLexerTCL.CommentLine,
68 ]
69
67 def isStringStyle(self, style): 70 def isStringStyle(self, style):
68 """ 71 """
69 Public method to check, if a style is a string style. 72 Public method to check, if a style is a string style.
70 73
71 @param style style to check (integer) 74 @param style style to check (integer)
72 @return flag indicating a string style (boolean) 75 @return flag indicating a string style (boolean)
73 """ 76 """
74 return style in [QsciLexerTCL.QuotedString] 77 return style in [QsciLexerTCL.QuotedString]
75 78
76 def defaultKeywords(self, kwSet): 79 def defaultKeywords(self, kwSet):
77 """ 80 """
78 Public method to get the default keywords. 81 Public method to get the default keywords.
79 82
80 @param kwSet number of the keyword set (integer) 83 @param kwSet number of the keyword set (integer)
81 @return string giving the keywords (string) or None 84 @return string giving the keywords (string) or None
82 """ 85 """
83 return QsciLexerTCL.keywords(self, kwSet) 86 return QsciLexerTCL.keywords(self, kwSet)
84 87
85 def maximumKeywordSet(self): 88 def maximumKeywordSet(self):
86 """ 89 """
87 Public method to get the maximum keyword set. 90 Public method to get the maximum keyword set.
88 91
89 @return maximum keyword set (integer) 92 @return maximum keyword set (integer)
90 """ 93 """
91 return 9 94 return 9

eric ide

mercurial