10 from PyQt4.Qsci import QsciLexerD, QsciScintilla |
10 from PyQt4.Qsci import QsciLexerD, QsciScintilla |
11 |
11 |
12 from .Lexer import Lexer |
12 from .Lexer import Lexer |
13 import Preferences |
13 import Preferences |
14 |
14 |
|
15 |
15 class LexerD(QsciLexerD, Lexer): |
16 class LexerD(QsciLexerD, Lexer): |
16 """ |
17 """ |
17 Subclass to implement some additional lexer dependant methods. |
18 Subclass to implement some additional lexer dependant methods. |
18 """ |
19 """ |
19 def __init__(self, parent=None): |
20 def __init__(self, parent=None): |
20 """ |
21 """ |
21 Constructor |
22 Constructor |
25 QsciLexerD.__init__(self, parent) |
26 QsciLexerD.__init__(self, parent) |
26 Lexer.__init__(self) |
27 Lexer.__init__(self) |
27 |
28 |
28 self.commentString = "//" |
29 self.commentString = "//" |
29 self.streamCommentString = { |
30 self.streamCommentString = { |
30 'start' : '/+ ', |
31 'start': '/+ ', |
31 'end' : ' +/' |
32 'end': ' +/' |
32 } |
33 } |
33 self.boxCommentString = { |
34 self.boxCommentString = { |
34 'start' : '/* ', |
35 'start': '/* ', |
35 'middle' : ' * ', |
36 'middle': ' * ', |
36 'end' : ' */' |
37 'end': ' */' |
37 } |
38 } |
38 |
39 |
39 def initProperties(self): |
40 def initProperties(self): |
40 """ |
41 """ |
41 Public slot to initialize the properties. |
42 Public slot to initialize the properties. |
62 """ |
63 """ |
63 Public method to check, if a style is a comment style. |
64 Public method to check, if a style is a comment style. |
64 |
65 |
65 @return flag indicating a comment style (boolean) |
66 @return flag indicating a comment style (boolean) |
66 """ |
67 """ |
67 return style in [QsciLexerD.Comment, |
68 return style in [QsciLexerD.Comment, |
68 QsciLexerD.CommentDoc, |
69 QsciLexerD.CommentDoc, |
69 QsciLexerD.CommentLine, |
70 QsciLexerD.CommentLine, |
70 QsciLexerD.CommentLineDoc, |
71 QsciLexerD.CommentLineDoc, |
71 QsciLexerD.CommentNested] |
72 QsciLexerD.CommentNested] |
72 |
73 |
73 def isStringStyle(self, style): |
74 def isStringStyle(self, style): |
74 """ |
75 """ |
75 Public method to check, if a style is a string style. |
76 Public method to check, if a style is a string style. |
76 |
77 |
77 @return flag indicating a string style (boolean) |
78 @return flag indicating a string style (boolean) |
78 """ |
79 """ |
79 return style in [QsciLexerD.String, |
80 return style in [QsciLexerD.String, |
80 QsciLexerD.UnclosedString] |
81 QsciLexerD.UnclosedString] |
81 |
82 |
82 def defaultKeywords(self, kwSet): |
83 def defaultKeywords(self, kwSet): |
83 """ |
84 """ |
84 Public method to get the default keywords. |
85 Public method to get the default keywords. |
85 |
86 |
86 @param kwSet number of the keyword set (integer) |
87 @param kwSet number of the keyword set (integer) |
87 @return string giving the keywords (string) or None |
88 @return string giving the keywords (string) or None |
88 """ |
89 """ |
89 return QsciLexerD.keywords(self, kwSet) |
90 return QsciLexerD.keywords(self, kwSet) |