15 |
15 |
16 class LexerPO(Lexer, QsciLexerPO): |
16 class LexerPO(Lexer, QsciLexerPO): |
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 QsciLexerPO.__init__(self, parent) |
27 QsciLexerPO.__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 |
33 |
33 def initProperties(self): |
34 def initProperties(self): |
34 """ |
35 """ |
35 Public slot to initialize the properties. |
36 Public slot to initialize the properties. |
36 """ |
37 """ |
37 self.setFoldComments(Preferences.getEditor("PoFoldComment")) |
38 self.setFoldComments(Preferences.getEditor("PoFoldComment")) |
38 self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) |
39 self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) |
39 |
40 |
40 def isCommentStyle(self, style): |
41 def isCommentStyle(self, style): |
41 """ |
42 """ |
42 Public method to check, if a style is a comment style. |
43 Public method to check, if a style is a comment style. |
43 |
44 |
44 @param style style to check (integer) |
45 @param style style to check (integer) |
45 @return flag indicating a comment style (boolean) |
46 @return flag indicating a comment style (boolean) |
46 """ |
47 """ |
47 return style in [QsciLexerPO.Comment, QsciLexerPO.ProgrammerComment] |
48 return style in [QsciLexerPO.Comment, QsciLexerPO.ProgrammerComment] |
48 |
49 |
49 def isStringStyle(self, style): |
50 def isStringStyle(self, style): |
50 """ |
51 """ |
51 Public method to check, if a style is a string style. |
52 Public method to check, if a style is a string style. |
52 |
53 |
53 @param style style to check (integer) |
54 @param style style to check (integer) |
54 @return flag indicating a string style (boolean) |
55 @return flag indicating a string style (boolean) |
55 """ |
56 """ |
56 return style in [QsciLexerPO.MessageIdText, |
57 return style in [ |
57 QsciLexerPO.MessageStringText, |
58 QsciLexerPO.MessageIdText, |
58 QsciLexerPO.MessageContextText] |
59 QsciLexerPO.MessageStringText, |
59 |
60 QsciLexerPO.MessageContextText, |
|
61 ] |
|
62 |
60 def defaultKeywords(self, kwSet): |
63 def defaultKeywords(self, kwSet): |
61 """ |
64 """ |
62 Public method to get the default keywords. |
65 Public method to get the default keywords. |
63 |
66 |
64 @param kwSet number of the keyword set (integer) |
67 @param kwSet number of the keyword set (integer) |
65 @return string giving the keywords (string) or None |
68 @return string giving the keywords (string) or None |
66 """ |
69 """ |
67 return QsciLexerPO.keywords(self, kwSet) |
70 return QsciLexerPO.keywords(self, kwSet) |