comparison libgui/languages/build_ts/octave-qsci/Qsci/qscilexerhtml.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 QsciLexerHTML 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 QSCILEXERHTML_H
22 #define QSCILEXERHTML_H
23
24 #include <QObject>
25
26 #include <Qsci/qsciglobal.h>
27 #include <Qsci/qscilexer.h>
28
29
30 //! \brief The QsciLexerHTML class encapsulates the Scintilla HTML lexer.
31 class QSCINTILLA_EXPORT QsciLexerHTML : public QsciLexer
32 {
33 Q_OBJECT
34
35 public:
36 //! This enum defines the meanings of the different styles used by the
37 //! HTML lexer.
38 enum {
39 //! The default.
40 Default = 0,
41
42 //! A tag.
43 Tag = 1,
44
45 //! An unknown tag.
46 UnknownTag = 2,
47
48 //! An attribute.
49 Attribute = 3,
50
51 //! An unknown attribute.
52 UnknownAttribute = 4,
53
54 //! An HTML number.
55 HTMLNumber = 5,
56
57 //! An HTML double-quoted string.
58 HTMLDoubleQuotedString = 6,
59
60 //! An HTML single-quoted string.
61 HTMLSingleQuotedString = 7,
62
63 //! Other text within a tag.
64 OtherInTag = 8,
65
66 //! An HTML comment.
67 HTMLComment = 9,
68
69 //! An entity.
70 Entity = 10,
71
72 //! The end of an XML style tag.
73 XMLTagEnd = 11,
74
75 //! The start of an XML fragment.
76 XMLStart = 12,
77
78 //! The end of an XML fragment.
79 XMLEnd = 13,
80
81 //! A script tag.
82 Script = 14,
83
84 //! The start of an ASP fragment with @.
85 ASPAtStart = 15,
86
87 //! The start of an ASP fragment.
88 ASPStart = 16,
89
90 //! CDATA.
91 CDATA = 17,
92
93 //! The start of a PHP fragment.
94 PHPStart = 18,
95
96 //! An unquoted HTML value.
97 HTMLValue = 19,
98
99 //! An ASP X-Code comment.
100 ASPXCComment = 20,
101
102 //! The default for SGML.
103 SGMLDefault = 21,
104
105 //! An SGML command.
106 SGMLCommand = 22,
107
108 //! The first parameter of an SGML command.
109 SGMLParameter = 23,
110
111 //! An SGML double-quoted string.
112 SGMLDoubleQuotedString = 24,
113
114 //! An SGML single-quoted string.
115 SGMLSingleQuotedString = 25,
116
117 //! An SGML error.
118 SGMLError = 26,
119
120 //! An SGML special entity.
121 SGMLSpecial = 27,
122
123 //! An SGML entity.
124 SGMLEntity = 28,
125
126 //! An SGML comment.
127 SGMLComment = 29,
128
129 //! A comment with the first parameter of an SGML command.
130 SGMLParameterComment = 30,
131
132 //! The default for an SGML block.
133 SGMLBlockDefault = 31,
134
135 //! The start of a JavaScript fragment.
136 JavaScriptStart = 40,
137
138 //! The default for JavaScript.
139 JavaScriptDefault = 41,
140
141 //! A JavaScript comment.
142 JavaScriptComment = 42,
143
144 //! A JavaScript line comment.
145 JavaScriptCommentLine = 43,
146
147 //! A JavaDoc style JavaScript comment.
148 JavaScriptCommentDoc = 44,
149
150 //! A JavaScript number.
151 JavaScriptNumber = 45,
152
153 //! A JavaScript word.
154 JavaScriptWord = 46,
155
156 //! A JavaScript keyword.
157 JavaScriptKeyword = 47,
158
159 //! A JavaScript double-quoted string.
160 JavaScriptDoubleQuotedString = 48,
161
162 //! A JavaScript single-quoted string.
163 JavaScriptSingleQuotedString = 49,
164
165 //! A JavaScript symbol.
166 JavaScriptSymbol = 50,
167
168 //! The end of a JavaScript line where a string is not closed.
169 JavaScriptUnclosedString = 51,
170
171 //! A JavaScript regular expression.
172 JavaScriptRegex = 52,
173
174 //! The start of an ASP JavaScript fragment.
175 ASPJavaScriptStart = 55,
176
177 //! The default for ASP JavaScript.
178 ASPJavaScriptDefault = 56,
179
180 //! An ASP JavaScript comment.
181 ASPJavaScriptComment = 57,
182
183 //! An ASP JavaScript line comment.
184 ASPJavaScriptCommentLine = 58,
185
186 //! An ASP JavaDoc style JavaScript comment.
187 ASPJavaScriptCommentDoc = 59,
188
189 //! An ASP JavaScript number.
190 ASPJavaScriptNumber = 60,
191
192 //! An ASP JavaScript word.
193 ASPJavaScriptWord = 61,
194
195 //! An ASP JavaScript keyword.
196 ASPJavaScriptKeyword = 62,
197
198 //! An ASP JavaScript double-quoted string.
199 ASPJavaScriptDoubleQuotedString = 63,
200
201 //! An ASP JavaScript single-quoted string.
202 ASPJavaScriptSingleQuotedString = 64,
203
204 //! An ASP JavaScript symbol.
205 ASPJavaScriptSymbol = 65,
206
207 //! The end of an ASP JavaScript line where a string is not
208 //! closed.
209 ASPJavaScriptUnclosedString = 66,
210
211 //! An ASP JavaScript regular expression.
212 ASPJavaScriptRegex = 67,
213
214 //! The start of a VBScript fragment.
215 VBScriptStart = 70,
216
217 //! The default for VBScript.
218 VBScriptDefault = 71,
219
220 //! A VBScript comment.
221 VBScriptComment = 72,
222
223 //! A VBScript number.
224 VBScriptNumber = 73,
225
226 //! A VBScript keyword.
227 VBScriptKeyword = 74,
228
229 //! A VBScript string.
230 VBScriptString = 75,
231
232 //! A VBScript identifier.
233 VBScriptIdentifier = 76,
234
235 //! The end of a VBScript line where a string is not closed.
236 VBScriptUnclosedString = 77,
237
238 //! The start of an ASP VBScript fragment.
239 ASPVBScriptStart = 80,
240
241 //! The default for ASP VBScript.
242 ASPVBScriptDefault = 81,
243
244 //! An ASP VBScript comment.
245 ASPVBScriptComment = 82,
246
247 //! An ASP VBScript number.
248 ASPVBScriptNumber = 83,
249
250 //! An ASP VBScript keyword.
251 ASPVBScriptKeyword = 84,
252
253 //! An ASP VBScript string.
254 ASPVBScriptString = 85,
255
256 //! An ASP VBScript identifier.
257 ASPVBScriptIdentifier = 86,
258
259 //! The end of an ASP VBScript line where a string is not
260 //! closed.
261 ASPVBScriptUnclosedString = 87,
262
263 //! The start of a Python fragment.
264 PythonStart = 90,
265
266 //! The default for Python.
267 PythonDefault = 91,
268
269 //! A Python comment.
270 PythonComment = 92,
271
272 //! A Python number.
273 PythonNumber = 93,
274
275 //! A Python double-quoted string.
276 PythonDoubleQuotedString = 94,
277
278 //! A Python single-quoted string.
279 PythonSingleQuotedString = 95,
280
281 //! A Python keyword.
282 PythonKeyword = 96,
283
284 //! A Python triple single-quoted string.
285 PythonTripleSingleQuotedString = 97,
286
287 //! A Python triple double-quoted string.
288 PythonTripleDoubleQuotedString = 98,
289
290 //! The name of a Python class.
291 PythonClassName = 99,
292
293 //! The name of a Python function or method.
294 PythonFunctionMethodName = 100,
295
296 //! A Python operator.
297 PythonOperator = 101,
298
299 //! A Python identifier.
300 PythonIdentifier = 102,
301
302 //! The start of an ASP Python fragment.
303 ASPPythonStart = 105,
304
305 //! The default for ASP Python.
306 ASPPythonDefault = 106,
307
308 //! An ASP Python comment.
309 ASPPythonComment = 107,
310
311 //! An ASP Python number.
312 ASPPythonNumber = 108,
313
314 //! An ASP Python double-quoted string.
315 ASPPythonDoubleQuotedString = 109,
316
317 //! An ASP Python single-quoted string.
318 ASPPythonSingleQuotedString = 110,
319
320 //! An ASP Python keyword.
321 ASPPythonKeyword = 111,
322
323 //! An ASP Python triple single-quoted string.
324 ASPPythonTripleSingleQuotedString = 112,
325
326 //! An ASP Python triple double-quoted string.
327 ASPPythonTripleDoubleQuotedString = 113,
328
329 //! The name of an ASP Python class.
330 ASPPythonClassName = 114,
331
332 //! The name of an ASP Python function or method.
333 ASPPythonFunctionMethodName = 115,
334
335 //! An ASP Python operator.
336 ASPPythonOperator = 116,
337
338 //! An ASP Python identifier
339 ASPPythonIdentifier = 117,
340
341 //! The default for PHP.
342 PHPDefault = 118,
343
344 //! A PHP double-quoted string.
345 PHPDoubleQuotedString = 119,
346
347 //! A PHP single-quoted string.
348 PHPSingleQuotedString = 120,
349
350 //! A PHP keyword.
351 PHPKeyword = 121,
352
353 //! A PHP number.
354 PHPNumber = 122,
355
356 //! A PHP variable.
357 PHPVariable = 123,
358
359 //! A PHP comment.
360 PHPComment = 124,
361
362 //! A PHP line comment.
363 PHPCommentLine = 125,
364
365 //! A PHP double-quoted variable.
366 PHPDoubleQuotedVariable = 126,
367
368 //! A PHP operator.
369 PHPOperator = 127
370 };
371
372 //! Construct a QsciLexerHTML with parent \a parent. \a parent is
373 //! typically the QsciScintilla instance.
374 QsciLexerHTML(QObject *parent = 0);
375
376 //! Destroys the QsciLexerHTML instance.
377 virtual ~QsciLexerHTML();
378
379 //! Returns the name of the language.
380 const char *language() const;
381
382 //! Returns the name of the lexer. Some lexers support a number of
383 //! languages.
384 const char *lexer() const;
385
386 //! \internal Returns the auto-completion fillup characters.
387 const char *autoCompletionFillups() const;
388
389 //! Returns the string of characters that comprise a word.
390 const char *wordCharacters() const;
391
392 //! Returns the foreground colour of the text for style number \a style.
393 //!
394 //! \sa defaultPaper()
395 QColor defaultColor(int style) const;
396
397 //! Returns the end-of-line fill for style number \a style.
398 bool defaultEolFill(int style) const;
399
400 //! Returns the font for style number \a style.
401 QFont defaultFont(int style) const;
402
403 //! Returns the background colour of the text for style number \a style.
404 //!
405 //! \sa defaultColor()
406 QColor defaultPaper(int style) const;
407
408 //! Returns the set of keywords for the keyword set \a set recognised
409 //! by the lexer as a space separated string.
410 const char *keywords(int set) const;
411
412 //! Returns the descriptive name for style number \a style. If the
413 //! style is invalid for this language then an empty QString is returned.
414 //! This is intended to be used in user preference dialogs.
415 QString description(int style) const;
416
417 //! Causes all properties to be refreshed by emitting the
418 //! propertyChanged() signal as required.
419 void refreshProperties();
420
421 //! Returns true if tags are case sensitive.
422 //!
423 //! \sa setCaseSensitiveTags()
424 bool caseSensitiveTags() const {return case_sens_tags;}
425
426 //! If \a enabled is true then Django templates are enabled. The default
427 //! is false.
428 //!
429 //! \sa djangoTemplates()
430 void setDjangoTemplates(bool enabled);
431
432 //! Returns true if support for Django templates is enabled.
433 //!
434 //! \sa setDjangoTemplates()
435 bool djangoTemplates() const {return django_templates;}
436
437 //! Returns true if trailing blank lines are included in a fold block.
438 //!
439 //! \sa setFoldCompact()
440 bool foldCompact() const {return fold_compact;}
441
442 //! Returns true if preprocessor blocks can be folded.
443 //!
444 //! \sa setFoldPreprocessor()
445 bool foldPreprocessor() const {return fold_preproc;}
446
447 //! If \a fold is true then script comments can be folded. The default is
448 //! false.
449 //!
450 //! \sa foldScriptComments()
451 void setFoldScriptComments(bool fold);
452
453 //! Returns true if script comments can be folded.
454 //!
455 //! \sa setFoldScriptComments()
456 bool foldScriptComments() const {return fold_script_comments;}
457
458 //! If \a fold is true then script heredocs can be folded. The default is
459 //! false.
460 //!
461 //! \sa foldScriptHeredocs()
462 void setFoldScriptHeredocs(bool fold);
463
464 //! Returns true if script heredocs can be folded.
465 //!
466 //! \sa setFoldScriptHeredocs()
467 bool foldScriptHeredocs() const {return fold_script_heredocs;}
468
469 //! If \a enabled is true then Mako templates are enabled. The default is
470 //! false.
471 //!
472 //! \sa makoTemplates()
473 void setMakoTemplates(bool enabled);
474
475 //! Returns true if support for Mako templates is enabled.
476 //!
477 //! \sa setMakoTemplates()
478 bool makoTemplates() const {return mako_templates;}
479
480 public slots:
481 //! If \a fold is true then trailing blank lines are included in a fold
482 //! block. The default is true.
483 //!
484 //! \sa foldCompact()
485 virtual void setFoldCompact(bool fold);
486
487 //! If \a fold is true then preprocessor blocks can be folded. The
488 //! default is false.
489 //!
490 //! \sa foldPreprocessor()
491 virtual void setFoldPreprocessor(bool fold);
492
493 //! If \a sens is true then tags are case sensitive. The default is false.
494 //!
495 //! \sa caseSensitiveTags()
496 virtual void setCaseSensitiveTags(bool sens);
497
498 protected:
499 //! The lexer's properties are read from the settings \a qs. \a prefix
500 //! (which has a trailing '/') should be used as a prefix to the key of
501 //! each setting. true is returned if there is no error.
502 //!
503 bool readProperties(QSettings &qs,const QString &prefix);
504
505 //! The lexer's properties are written to the settings \a qs.
506 //! \a prefix (which has a trailing '/') should be used as a prefix to
507 //! the key of each setting. true is returned if there is no error.
508 //!
509 bool writeProperties(QSettings &qs,const QString &prefix) const;
510
511 private:
512 void setCompactProp();
513 void setPreprocProp();
514 void setCaseSensTagsProp();
515 void setScriptCommentsProp();
516 void setScriptHeredocsProp();
517 void setDjangoProp();
518 void setMakoProp();
519
520 bool fold_compact;
521 bool fold_preproc;
522 bool case_sens_tags;
523 bool fold_script_comments;
524 bool fold_script_heredocs;
525 bool django_templates;
526 bool mako_templates;
527
528 QsciLexerHTML(const QsciLexerHTML &);
529 QsciLexerHTML &operator=(const QsciLexerHTML &);
530 };
531
532 #endif