comparison libgui/languages/build_ts/octave-qsci/Qsci/qscilexervhdl.h @ 31537:5ceb4bfcdb0f stable

add tools and files for updating the gui's language files for translation * libgui/languages/build_ts/README.md: readme for updating language files * libgui/languages/build_ts/octave-qsci: QScintilla source files for languages without translation provided by QScintilla * libgui/languages/build_ts/octave-qt: Qt source files for languages without translation provided by Qt
author Torsten Lilge <ttl-octave@mailbox.org>
date Thu, 24 Nov 2022 06:48:25 +0100
parents
children dd5ece3664ed
comparison
equal deleted inserted replaced
31535:4b80982e0af8 31537:5ceb4bfcdb0f
1 // This defines the interface to the QsciLexerVHDL class.
2 //
3 // Copyright (c) 2019 Riverbank Computing Limited <info@riverbankcomputing.com>
4 //
5 // This file is part of QScintilla.
6 //
7 // This file may be used under the terms of the GNU General Public License
8 // version 3.0 as published by the Free Software Foundation and appearing in
9 // the file LICENSE included in the packaging of this file. Please review the
10 // following information to ensure the GNU General Public License version 3.0
11 // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 //
13 // If you do not wish to use this file under the terms of the GPL version 3.0
14 // then you may purchase a commercial license. For more information contact
15 // info@riverbankcomputing.com.
16 //
17 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19
20
21 #ifndef QSCILEXERVHDL_H
22 #define QSCILEXERVHDL_H
23
24 #include <QObject>
25
26 #include <Qsci/qsciglobal.h>
27 #include <Qsci/qscilexer.h>
28
29
30 //! \brief The QsciLexerVHDL class encapsulates the Scintilla VHDL lexer.
31 class QSCINTILLA_EXPORT QsciLexerVHDL : public QsciLexer
32 {
33 Q_OBJECT
34
35 public:
36 //! This enum defines the meanings of the different styles used by the
37 //! VHDL lexer.
38 enum {
39 //! The default.
40 Default = 0,
41
42 //! A comment.
43 Comment = 1,
44
45 //! A comment line.
46 CommentLine = 2,
47
48 //! A number.
49 Number = 3,
50
51 //! A string.
52 String = 4,
53
54 //! An operator.
55 Operator = 5,
56
57 //! An identifier
58 Identifier = 6,
59
60 //! The end of a line where a string is not closed.
61 UnclosedString = 7,
62
63 //! A keyword.
64 Keyword = 8,
65
66 //! A standard operator.
67 StandardOperator = 9,
68
69 //! An attribute.
70 Attribute = 10,
71
72 //! A standard function.
73 StandardFunction = 11,
74
75 //! A standard package.
76 StandardPackage = 12,
77
78 //! A standard type.
79 StandardType = 13,
80
81 //! A keyword defined in keyword set number 7. The class must be
82 //! sub-classed and re-implement keywords() to make use of this style.
83 KeywordSet7 = 14,
84
85 //! A comment block.
86 CommentBlock = 15,
87 };
88
89 //! Construct a QsciLexerVHDL with parent \a parent. \a parent is
90 //! typically the QsciScintilla instance.
91 QsciLexerVHDL(QObject *parent = 0);
92
93 //! Destroys the QsciLexerVHDL instance.
94 virtual ~QsciLexerVHDL();
95
96 //! Returns the name of the language.
97 const char *language() const;
98
99 //! Returns the name of the lexer. Some lexers support a number of
100 //! languages.
101 const char *lexer() const;
102
103 //! \internal Returns the style used for braces for brace matching.
104 int braceStyle() const;
105
106 //! Returns the foreground colour of the text for style number \a style.
107 //!
108 //! \sa defaultPaper()
109 QColor defaultColor(int style) const;
110
111 //! Returns the end-of-line fill for style number \a style.
112 bool defaultEolFill(int style) const;
113
114 //! Returns the font for style number \a style.
115 QFont defaultFont(int style) const;
116
117 //! Returns the background colour of the text for style number \a style.
118 //!
119 //! \sa defaultColor()
120 QColor defaultPaper(int style) const;
121
122 //! Returns the set of keywords for the keyword set \a set recognised
123 //! by the lexer as a space separated string.
124 const char *keywords(int set) const;
125
126 //! Returns the descriptive name for style number \a style. If the
127 //! style is invalid for this language then an empty QString is returned.
128 //! This is intended to be used in user preference dialogs.
129 QString description(int style) const;
130
131 //! Causes all properties to be refreshed by emitting the propertyChanged()
132 //! signal as required.
133 void refreshProperties();
134
135 //! Returns true if multi-line comment blocks can be folded.
136 //!
137 //! \sa setFoldComments()
138 bool foldComments() const;
139
140 //! Returns true if trailing blank lines are included in a fold block.
141 //!
142 //! \sa setFoldCompact()
143 bool foldCompact() const;
144
145 //! Returns true if else blocks can be folded.
146 //!
147 //! \sa setFoldAtElse()
148 bool foldAtElse() const;
149
150 //! Returns true if begin blocks can be folded.
151 //!
152 //! \sa setFoldAtBegin()
153 bool foldAtBegin() const;
154
155 //! Returns true if blocks can be folded at a parenthesis.
156 //!
157 //! \sa setFoldAtParenthesis()
158 bool foldAtParenthesis() const;
159
160 public slots:
161 //! If \a fold is true then multi-line comment blocks can be folded.
162 //! The default is true.
163 //!
164 //! \sa foldComments()
165 virtual void setFoldComments(bool fold);
166
167 //! If \a fold is true then trailing blank lines are included in a fold
168 //! block. The default is true.
169 //!
170 //! \sa foldCompact()
171 virtual void setFoldCompact(bool fold);
172
173 //! If \a fold is true then else blocks can be folded. The default is
174 //! true.
175 //!
176 //! \sa foldAtElse()
177 virtual void setFoldAtElse(bool fold);
178
179 //! If \a fold is true then begin blocks can be folded. The default is
180 //! true.
181 //!
182 //! \sa foldAtBegin()
183 virtual void setFoldAtBegin(bool fold);
184
185 //! If \a fold is true then blocks can be folded at a parenthesis. The
186 //! default is true.
187 //!
188 //! \sa foldAtParenthesis()
189 virtual void setFoldAtParenthesis(bool fold);
190
191 protected:
192 //! The lexer's properties are read from the settings \a qs. \a prefix
193 //! (which has a trailing '/') should be used as a prefix to the key of
194 //! each setting. true is returned if there is no error.
195 //!
196 bool readProperties(QSettings &qs,const QString &prefix);
197
198 //! The lexer's properties are written to the settings \a qs.
199 //! \a prefix (which has a trailing '/') should be used as a prefix to
200 //! the key of each setting. true is returned if there is no error.
201 //!
202 bool writeProperties(QSettings &qs,const QString &prefix) const;
203
204 private:
205 void setCommentProp();
206 void setCompactProp();
207 void setAtElseProp();
208 void setAtBeginProp();
209 void setAtParenthProp();
210
211 bool fold_comments;
212 bool fold_compact;
213 bool fold_atelse;
214 bool fold_atbegin;
215 bool fold_atparenth;
216
217 QsciLexerVHDL(const QsciLexerVHDL &);
218 QsciLexerVHDL &operator=(const QsciLexerVHDL &);
219 };
220
221 #endif