eric6/QScintilla/Lexers/LexerVHDL.py

changeset 6942
2602857055c5
parent 6874
5a3a39442711
child 7229
53054eb5b15a
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2007 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a VHDL lexer with some additional methods.
8 """
9
10 from __future__ import unicode_literals
11
12 from PyQt5.Qsci import QsciLexerVHDL
13
14 from .Lexer import Lexer
15 import Preferences
16
17
18 class LexerVHDL(Lexer, QsciLexerVHDL):
19 """
20 Subclass to implement some additional lexer dependant methods.
21 """
22 def __init__(self, parent=None):
23 """
24 Constructor
25
26 @param parent parent widget of this lexer
27 """
28 QsciLexerVHDL.__init__(self, parent)
29 Lexer.__init__(self)
30
31 self.commentString = "--"
32
33 self.keywordSetDescriptions = [
34 self.tr("Keywords"),
35 self.tr("Operators"),
36 self.tr("Attributes"),
37 self.tr("Standard Functions"),
38 self.tr("Standard Packages"),
39 self.tr("Standard Types"),
40 self.tr("User defined"),
41 ]
42
43 def initProperties(self):
44 """
45 Public slot to initialize the properties.
46 """
47 self.setFoldComments(Preferences.getEditor("VHDLFoldComment"))
48 self.setFoldAtElse(Preferences.getEditor("VHDLFoldAtElse"))
49 self.setFoldAtBegin(Preferences.getEditor("VHDLFoldAtBegin"))
50 self.setFoldAtParenthesis(
51 Preferences.getEditor("VHDLFoldAtParenthesis"))
52 self.setFoldCompact(Preferences.getEditor("AllFoldCompact"))
53
54 def isCommentStyle(self, style):
55 """
56 Public method to check, if a style is a comment style.
57
58 @param style style to check (integer)
59 @return flag indicating a comment style (boolean)
60 """
61 return style in [QsciLexerVHDL.Comment,
62 QsciLexerVHDL.CommentLine]
63
64 def isStringStyle(self, style):
65 """
66 Public method to check, if a style is a string style.
67
68 @param style style to check (integer)
69 @return flag indicating a string style (boolean)
70 """
71 return style in [QsciLexerVHDL.String,
72 QsciLexerVHDL.UnclosedString]
73
74 def defaultKeywords(self, kwSet):
75 """
76 Public method to get the default keywords.
77
78 @param kwSet number of the keyword set (integer)
79 @return string giving the keywords (string) or None
80 """
81 return QsciLexerVHDL.keywords(self, kwSet)
82
83 def maximumKeywordSet(self):
84 """
85 Public method to get the maximum keyword set.
86
87 @return maximum keyword set (integer)
88 """
89 return 7

eric ide

mercurial