|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2008 - 2009 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a TCL/Tk lexer with some additional methods. |
|
8 """ |
|
9 |
|
10 from PyQt4.Qsci import QsciLexerTCL |
|
11 |
|
12 from Lexer import Lexer |
|
13 |
|
14 import Preferences |
|
15 |
|
16 class LexerTCL(QsciLexerTCL, Lexer): |
|
17 """ |
|
18 Subclass to implement some additional lexer dependant methods. |
|
19 """ |
|
20 def __init__(self, parent=None): |
|
21 """ |
|
22 Constructor |
|
23 |
|
24 @param parent parent widget of this lexer |
|
25 """ |
|
26 QsciLexerTCL.__init__(self, parent) |
|
27 Lexer.__init__(self) |
|
28 |
|
29 self.commentString = "#" |
|
30 |
|
31 def initProperties(self): |
|
32 """ |
|
33 Public slot to initialize the properties. |
|
34 """ |
|
35 self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) |
|
36 |
|
37 def isCommentStyle(self, style): |
|
38 """ |
|
39 Public method to check, if a style is a comment style. |
|
40 |
|
41 @return flag indicating a comment style (boolean) |
|
42 """ |
|
43 return style in [QsciLexerTCL.Comment, |
|
44 QsciLexerTCL.CommentBlock, |
|
45 QsciLexerTCL.CommentBox, |
|
46 QsciLexerTCL.CommentLine] |
|
47 |
|
48 def isStringStyle(self, style): |
|
49 """ |
|
50 Public method to check, if a style is a string style. |
|
51 |
|
52 @return flag indicating a string style (boolean) |
|
53 """ |
|
54 return style in [QsciLexerTCL.QuotedString] |