10 from PyQt4.Qsci import QsciLexerLua |
10 from PyQt4.Qsci import QsciLexerLua |
11 |
11 |
12 from .Lexer import Lexer |
12 from .Lexer import Lexer |
13 import Preferences |
13 import Preferences |
14 |
14 |
|
15 |
15 class LexerLua(QsciLexerLua, Lexer): |
16 class LexerLua(QsciLexerLua, 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 QsciLexerLua.__init__(self, parent) |
26 QsciLexerLua.__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 |
34 |
34 def initProperties(self): |
35 def initProperties(self): |
35 """ |
36 """ |
36 Public slot to initialize the properties. |
37 Public slot to initialize the properties. |
49 """ |
50 """ |
50 Public method to check, if a style is a comment style. |
51 Public method to check, if a style is a comment style. |
51 |
52 |
52 @return flag indicating a comment style (boolean) |
53 @return flag indicating a comment style (boolean) |
53 """ |
54 """ |
54 return style in [QsciLexerLua.Comment, |
55 return style in [QsciLexerLua.Comment, |
55 QsciLexerLua.LineComment] |
56 QsciLexerLua.LineComment] |
56 |
57 |
57 def isStringStyle(self, style): |
58 def isStringStyle(self, style): |
58 """ |
59 """ |
59 Public method to check, if a style is a string style. |
60 Public method to check, if a style is a string style. |
60 |
61 |
61 @return flag indicating a string style (boolean) |
62 @return flag indicating a string style (boolean) |
62 """ |
63 """ |
63 return style in [QsciLexerLua.String, |
64 return style in [QsciLexerLua.String, |
64 QsciLexerLua.LiteralString, |
65 QsciLexerLua.LiteralString, |
65 QsciLexerLua.UnclosedString] |
66 QsciLexerLua.UnclosedString] |
66 |
67 |
67 def defaultKeywords(self, kwSet): |
68 def defaultKeywords(self, kwSet): |
68 """ |
69 """ |
69 Public method to get the default keywords. |
70 Public method to get the default keywords. |
70 |
71 |
71 @param kwSet number of the keyword set (integer) |
72 @param kwSet number of the keyword set (integer) |
72 @return string giving the keywords (string) or None |
73 @return string giving the keywords (string) or None |
73 """ |
74 """ |
74 return QsciLexerLua.keywords(self, kwSet) |
75 return QsciLexerLua.keywords(self, kwSet) |