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