15 |
15 |
16 class LexerCMake(Lexer, QsciLexerCMake): |
16 class LexerCMake(Lexer, QsciLexerCMake): |
17 """ |
17 """ |
18 Subclass to implement some additional lexer dependant methods. |
18 Subclass to implement some additional lexer dependant methods. |
19 """ |
19 """ |
|
20 |
20 def __init__(self, parent=None): |
21 def __init__(self, parent=None): |
21 """ |
22 """ |
22 Constructor |
23 Constructor |
23 |
24 |
24 @param parent parent widget of this lexer |
25 @param parent parent widget of this lexer |
25 """ |
26 """ |
26 QsciLexerCMake.__init__(self, parent) |
27 QsciLexerCMake.__init__(self, parent) |
27 Lexer.__init__(self) |
28 Lexer.__init__(self) |
28 |
29 |
29 self.commentString = "#" |
30 self.commentString = "#" |
30 |
31 |
31 self.keywordSetDescriptions = [ |
32 self.keywordSetDescriptions = [ |
32 self.tr("Commands"), |
33 self.tr("Commands"), |
33 self.tr("Parameters"), |
34 self.tr("Parameters"), |
34 self.tr("User defined"), |
35 self.tr("User defined"), |
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 self.setFoldAtElse(Preferences.getEditor("CMakeFoldAtElse")) |
42 self.setFoldAtElse(Preferences.getEditor("CMakeFoldAtElse")) |
42 |
43 |
43 def isCommentStyle(self, style): |
44 def isCommentStyle(self, style): |
44 """ |
45 """ |
45 Public method to check, if a style is a comment style. |
46 Public method to check, if a style is a comment style. |
46 |
47 |
47 @param style style to check (integer) |
48 @param style style to check (integer) |
48 @return flag indicating a comment style (boolean) |
49 @return flag indicating a comment style (boolean) |
49 """ |
50 """ |
50 return style in [QsciLexerCMake.Comment] |
51 return style in [QsciLexerCMake.Comment] |
51 |
52 |
52 def isStringStyle(self, style): |
53 def isStringStyle(self, style): |
53 """ |
54 """ |
54 Public method to check, if a style is a string style. |
55 Public method to check, if a style is a string style. |
55 |
56 |
56 @param style style to check (integer) |
57 @param style style to check (integer) |
57 @return flag indicating a string style (boolean) |
58 @return flag indicating a string style (boolean) |
58 """ |
59 """ |
59 return style in [QsciLexerCMake.String] |
60 return style in [QsciLexerCMake.String] |
60 |
61 |
61 def defaultKeywords(self, kwSet): |
62 def defaultKeywords(self, kwSet): |
62 """ |
63 """ |
63 Public method to get the default keywords. |
64 Public method to get the default keywords. |
64 |
65 |
65 @param kwSet number of the keyword set (integer) |
66 @param kwSet number of the keyword set (integer) |
66 @return string giving the keywords (string) or None |
67 @return string giving the keywords (string) or None |
67 """ |
68 """ |
68 return QsciLexerCMake.keywords(self, kwSet) |
69 return QsciLexerCMake.keywords(self, kwSet) |