Mercurial > octave
comparison libgui/languages/build_ts/octave-qsci/Qsci/qscilexerjson.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 QsciLexerJSON 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 QSCILEXERJSON_H | |
22 #define QSCILEXERJSON_H | |
23 | |
24 #include <QObject> | |
25 | |
26 #include <Qsci/qsciglobal.h> | |
27 #include <Qsci/qscilexer.h> | |
28 | |
29 | |
30 //! \brief The QsciLexerJSON class encapsulates the Scintilla JSON lexer. | |
31 class QSCINTILLA_EXPORT QsciLexerJSON : public QsciLexer | |
32 { | |
33 Q_OBJECT | |
34 | |
35 public: | |
36 //! This enum defines the meanings of the different styles used by the | |
37 //! JSON lexer. | |
38 enum { | |
39 //! The default. | |
40 Default = 0, | |
41 | |
42 //! A number. | |
43 Number = 1, | |
44 | |
45 //! A string. | |
46 String = 2, | |
47 | |
48 //! An unclosed string. | |
49 UnclosedString = 3, | |
50 | |
51 //! A property. | |
52 Property = 4, | |
53 | |
54 //! An escape sequence. | |
55 EscapeSequence = 5, | |
56 | |
57 //! A line comment. | |
58 CommentLine = 6, | |
59 | |
60 //! A block comment. | |
61 CommentBlock = 7, | |
62 | |
63 //! An operator. | |
64 Operator = 8, | |
65 | |
66 //! An Internationalised Resource Identifier (IRI). | |
67 IRI = 9, | |
68 | |
69 //! A JSON-LD compact IRI. | |
70 IRICompact = 10, | |
71 | |
72 //! A JSON keyword. | |
73 Keyword = 11, | |
74 | |
75 //! A JSON-LD keyword. | |
76 KeywordLD = 12, | |
77 | |
78 //! A parsing error. | |
79 Error = 13, | |
80 }; | |
81 | |
82 //! Construct a QsciLexerJSON with parent \a parent. \a parent is | |
83 //! typically the QsciScintilla instance. | |
84 QsciLexerJSON(QObject *parent = 0); | |
85 | |
86 //! Destroys the QsciLexerJSON instance. | |
87 virtual ~QsciLexerJSON(); | |
88 | |
89 //! Returns the name of the language. | |
90 const char *language() const; | |
91 | |
92 //! Returns the name of the lexer. Some lexers support a number of | |
93 //! languages. | |
94 const char *lexer() const; | |
95 | |
96 //! Returns the foreground colour of the text for style number \a style. | |
97 //! | |
98 //! \sa defaultPaper() | |
99 QColor defaultColor(int style) const; | |
100 | |
101 //! Returns the end-of-line fill for style number \a style. | |
102 bool defaultEolFill(int style) const; | |
103 | |
104 //! Returns the font for style number \a style. | |
105 QFont defaultFont(int style) const; | |
106 | |
107 //! Returns the background colour of the text for style number \a style. | |
108 //! | |
109 //! \sa defaultColor() | |
110 QColor defaultPaper(int style) const; | |
111 | |
112 //! Returns the set of keywords for the keyword set \a set recognised | |
113 //! by the lexer as a space separated string. | |
114 const char *keywords(int set) const; | |
115 | |
116 //! Returns the descriptive name for style number \a style. If the | |
117 //! style is invalid for this language then an empty QString is returned. | |
118 //! This is intended to be used in user preference dialogs. | |
119 QString description(int style) const; | |
120 | |
121 //! Causes all properties to be refreshed by emitting the | |
122 //! propertyChanged() signal as required. | |
123 void refreshProperties(); | |
124 | |
125 //! If \a highlight is true then line and block comments will be | |
126 //! highlighted. The default is true. | |
127 //! | |
128 //! \sa hightlightComments() | |
129 void setHighlightComments(bool highlight); | |
130 | |
131 //! Returns true if line and block comments are highlighted | |
132 //! | |
133 //! \sa setHightlightComments() | |
134 bool highlightComments() const {return allow_comments;} | |
135 | |
136 //! If \a highlight is true then escape sequences in strings are | |
137 //! highlighted. The default is true. | |
138 //! | |
139 //! \sa highlightEscapeSequences() | |
140 void setHighlightEscapeSequences(bool highlight); | |
141 | |
142 //! Returns true if escape sequences in strings are highlighted. | |
143 //! | |
144 //! \sa setHighlightEscapeSequences() | |
145 bool highlightEscapeSequences() const {return escape_sequence;} | |
146 | |
147 //! If \a fold is true then trailing blank lines are included in a fold | |
148 //! block. The default is true. | |
149 //! | |
150 //! \sa foldCompact() | |
151 void setFoldCompact(bool fold); | |
152 | |
153 //! Returns true if trailing blank lines are included in a fold block. | |
154 //! | |
155 //! \sa setFoldCompact() | |
156 bool foldCompact() const {return fold_compact;} | |
157 | |
158 protected: | |
159 //! The lexer's properties are read from the settings \a qs. \a prefix | |
160 //! (which has a trailing '/') should be used as a prefix to the key of | |
161 //! each setting. true is returned if there is no error. | |
162 //! | |
163 bool readProperties(QSettings &qs,const QString &prefix); | |
164 | |
165 //! The lexer's properties are written to the settings \a qs. | |
166 //! \a prefix (which has a trailing '/') should be used as a prefix to | |
167 //! the key of each setting. true is returned if there is no error. | |
168 //! | |
169 bool writeProperties(QSettings &qs,const QString &prefix) const; | |
170 | |
171 private: | |
172 void setAllowCommentsProp(); | |
173 void setEscapeSequenceProp(); | |
174 void setCompactProp(); | |
175 | |
176 bool allow_comments; | |
177 bool escape_sequence; | |
178 bool fold_compact; | |
179 | |
180 QsciLexerJSON(const QsciLexerJSON &); | |
181 QsciLexerJSON &operator=(const QsciLexerJSON &); | |
182 }; | |
183 | |
184 #endif |