15 |
15 |
16 class LexerVHDL(Lexer, QsciLexerVHDL): |
16 class LexerVHDL(Lexer, QsciLexerVHDL): |
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 QsciLexerVHDL.__init__(self, parent) |
27 QsciLexerVHDL.__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 self.tr("Operators"), |
34 self.tr("Operators"), |
34 self.tr("Attributes"), |
35 self.tr("Attributes"), |
35 self.tr("Standard Functions"), |
36 self.tr("Standard Functions"), |
36 self.tr("Standard Packages"), |
37 self.tr("Standard Packages"), |
37 self.tr("Standard Types"), |
38 self.tr("Standard Types"), |
38 self.tr("User defined"), |
39 self.tr("User defined"), |
39 ] |
40 ] |
40 |
41 |
41 def initProperties(self): |
42 def initProperties(self): |
42 """ |
43 """ |
43 Public slot to initialize the properties. |
44 Public slot to initialize the properties. |
44 """ |
45 """ |
45 self.setFoldComments(Preferences.getEditor("VHDLFoldComment")) |
46 self.setFoldComments(Preferences.getEditor("VHDLFoldComment")) |
46 self.setFoldAtElse(Preferences.getEditor("VHDLFoldAtElse")) |
47 self.setFoldAtElse(Preferences.getEditor("VHDLFoldAtElse")) |
47 self.setFoldAtBegin(Preferences.getEditor("VHDLFoldAtBegin")) |
48 self.setFoldAtBegin(Preferences.getEditor("VHDLFoldAtBegin")) |
48 self.setFoldAtParenthesis( |
49 self.setFoldAtParenthesis(Preferences.getEditor("VHDLFoldAtParenthesis")) |
49 Preferences.getEditor("VHDLFoldAtParenthesis")) |
|
50 self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) |
50 self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) |
51 |
51 |
52 def isCommentStyle(self, style): |
52 def isCommentStyle(self, style): |
53 """ |
53 """ |
54 Public method to check, if a style is a comment style. |
54 Public method to check, if a style is a comment style. |
55 |
55 |
56 @param style style to check (integer) |
56 @param style style to check (integer) |
57 @return flag indicating a comment style (boolean) |
57 @return flag indicating a comment style (boolean) |
58 """ |
58 """ |
59 return style in [QsciLexerVHDL.Comment, |
59 return style in [QsciLexerVHDL.Comment, QsciLexerVHDL.CommentLine] |
60 QsciLexerVHDL.CommentLine] |
60 |
61 |
|
62 def isStringStyle(self, style): |
61 def isStringStyle(self, style): |
63 """ |
62 """ |
64 Public method to check, if a style is a string style. |
63 Public method to check, if a style is a string style. |
65 |
64 |
66 @param style style to check (integer) |
65 @param style style to check (integer) |
67 @return flag indicating a string style (boolean) |
66 @return flag indicating a string style (boolean) |
68 """ |
67 """ |
69 return style in [QsciLexerVHDL.String, |
68 return style in [QsciLexerVHDL.String, QsciLexerVHDL.UnclosedString] |
70 QsciLexerVHDL.UnclosedString] |
69 |
71 |
|
72 def defaultKeywords(self, kwSet): |
70 def defaultKeywords(self, kwSet): |
73 """ |
71 """ |
74 Public method to get the default keywords. |
72 Public method to get the default keywords. |
75 |
73 |
76 @param kwSet number of the keyword set (integer) |
74 @param kwSet number of the keyword set (integer) |
77 @return string giving the keywords (string) or None |
75 @return string giving the keywords (string) or None |
78 """ |
76 """ |
79 return QsciLexerVHDL.keywords(self, kwSet) |
77 return QsciLexerVHDL.keywords(self, kwSet) |
80 |
78 |
81 def maximumKeywordSet(self): |
79 def maximumKeywordSet(self): |
82 """ |
80 """ |
83 Public method to get the maximum keyword set. |
81 Public method to get the maximum keyword set. |
84 |
82 |
85 @return maximum keyword set (integer) |
83 @return maximum keyword set (integer) |
86 """ |
84 """ |
87 return 7 |
85 return 7 |