Mercurial > octave
comparison libgui/languages/build_ts/octave-qsci/Qsci/qscilexercoffeescript.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 QsciLexerCoffeeScript 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 QSCILEXERCOFFEESCRIPT_H | |
22 #define QSCILEXERCOFFEESCRIPT_H | |
23 | |
24 #include <QObject> | |
25 | |
26 #include <Qsci/qsciglobal.h> | |
27 #include <Qsci/qscilexer.h> | |
28 | |
29 | |
30 //! \brief The QsciLexerCoffeeScript class encapsulates the Scintilla | |
31 //! CoffeeScript lexer. | |
32 class QSCINTILLA_EXPORT QsciLexerCoffeeScript : public QsciLexer | |
33 { | |
34 Q_OBJECT | |
35 | |
36 public: | |
37 //! This enum defines the meanings of the different styles used by the | |
38 //! C++ lexer. | |
39 enum { | |
40 //! The default. | |
41 Default = 0, | |
42 | |
43 //! A C-style comment. | |
44 Comment = 1, | |
45 | |
46 //! A C++-style comment line. | |
47 CommentLine = 2, | |
48 | |
49 //! A JavaDoc/Doxygen C-style comment. | |
50 CommentDoc = 3, | |
51 | |
52 //! A number. | |
53 Number = 4, | |
54 | |
55 //! A keyword. | |
56 Keyword = 5, | |
57 | |
58 //! A double-quoted string. | |
59 DoubleQuotedString = 6, | |
60 | |
61 //! A single-quoted string. | |
62 SingleQuotedString = 7, | |
63 | |
64 //! An IDL UUID. | |
65 UUID = 8, | |
66 | |
67 //! A pre-processor block. | |
68 PreProcessor = 9, | |
69 | |
70 //! An operator. | |
71 Operator = 10, | |
72 | |
73 //! An identifier | |
74 Identifier = 11, | |
75 | |
76 //! The end of a line where a string is not closed. | |
77 UnclosedString = 12, | |
78 | |
79 //! A C# verbatim string. | |
80 VerbatimString = 13, | |
81 | |
82 //! A regular expression. | |
83 Regex = 14, | |
84 | |
85 //! A JavaDoc/Doxygen C++-style comment line. | |
86 CommentLineDoc = 15, | |
87 | |
88 //! A keyword defined in keyword set number 2. The class must be | |
89 //! sub-classed and re-implement keywords() to make use of this style. | |
90 KeywordSet2 = 16, | |
91 | |
92 //! A JavaDoc/Doxygen keyword. | |
93 CommentDocKeyword = 17, | |
94 | |
95 //! A JavaDoc/Doxygen keyword error defined in keyword set number 3. | |
96 //! The class must be sub-classed and re-implement keywords() to make | |
97 //! use of this style. | |
98 CommentDocKeywordError = 18, | |
99 | |
100 //! A global class defined in keyword set number 4. The class must be | |
101 //! sub-classed and re-implement keywords() to make use of this style. | |
102 GlobalClass = 19, | |
103 | |
104 //! A block comment. | |
105 CommentBlock = 22, | |
106 | |
107 //! A block regular expression. | |
108 BlockRegex = 23, | |
109 | |
110 //! A block regular expression comment. | |
111 BlockRegexComment = 24, | |
112 | |
113 //! An instance property. | |
114 InstanceProperty = 25, | |
115 }; | |
116 | |
117 //! Construct a QsciLexerCoffeeScript with parent \a parent. \a parent is | |
118 //! typically the QsciScintilla instance. | |
119 QsciLexerCoffeeScript(QObject *parent = 0); | |
120 | |
121 //! Destroys the QsciLexerCoffeeScript instance. | |
122 virtual ~QsciLexerCoffeeScript(); | |
123 | |
124 //! Returns the name of the language. | |
125 const char *language() const; | |
126 | |
127 //! Returns the name of the lexer. Some lexers support a number of | |
128 //! languages. | |
129 const char *lexer() const; | |
130 | |
131 //! \internal Returns the character sequences that can separate | |
132 //! auto-completion words. | |
133 QStringList autoCompletionWordSeparators() const; | |
134 | |
135 //! \internal Returns a space separated list of words or characters in | |
136 //! a particular style that define the end of a block for | |
137 //! auto-indentation. The styles is returned via \a style. | |
138 const char *blockEnd(int *style = 0) const; | |
139 | |
140 //! \internal Returns a space separated list of words or characters in | |
141 //! a particular style that define the start of a block for | |
142 //! auto-indentation. The styles is returned via \a style. | |
143 const char *blockStart(int *style = 0) const; | |
144 | |
145 //! \internal Returns a space separated list of keywords in a | |
146 //! particular style that define the start of a block for | |
147 //! auto-indentation. The styles is returned via \a style. | |
148 const char *blockStartKeyword(int *style = 0) const; | |
149 | |
150 //! \internal Returns the style used for braces for brace matching. | |
151 int braceStyle() const; | |
152 | |
153 //! Returns the string of characters that comprise a word. | |
154 const char *wordCharacters() const; | |
155 | |
156 //! Returns the foreground colour of the text for style number \a style. | |
157 //! | |
158 //! \sa defaultPaper() | |
159 QColor defaultColor(int style) const; | |
160 | |
161 //! Returns the end-of-line fill for style number \a style. | |
162 bool defaultEolFill(int style) const; | |
163 | |
164 //! Returns the font for style number \a style. | |
165 QFont defaultFont(int style) const; | |
166 | |
167 //! Returns the background colour of the text for style number \a style. | |
168 //! | |
169 //! \sa defaultColor() | |
170 QColor defaultPaper(int style) const; | |
171 | |
172 //! Returns the set of keywords for the keyword set \a set recognised | |
173 //! by the lexer as a space separated string. Set 1 is normally used for | |
174 //! primary keywords and identifiers. Set 2 is normally used for secondary | |
175 //! keywords and identifiers. Set 3 is normally used for documentation | |
176 //! comment keywords. Set 4 is normally used for global classes and | |
177 //! typedefs. | |
178 const char *keywords(int set) const; | |
179 | |
180 //! Returns the descriptive name for style number \a style. If the | |
181 //! style is invalid for this language then an empty QString is returned. | |
182 //! This is intended to be used in user preference dialogs. | |
183 QString description(int style) const; | |
184 | |
185 //! Causes all properties to be refreshed by emitting the | |
186 //! propertyChanged() signal as required. | |
187 void refreshProperties(); | |
188 | |
189 //! Returns true if '$' characters are allowed in identifier names. | |
190 //! | |
191 //! \sa setDollarsAllowed() | |
192 bool dollarsAllowed() const {return dollars;} | |
193 | |
194 //! If \a allowed is true then '$' characters are allowed in identifier | |
195 //! names. The default is true. | |
196 //! | |
197 //! \sa dollarsAllowed() | |
198 void setDollarsAllowed(bool allowed); | |
199 | |
200 //! Returns true if multi-line comment blocks can be folded. | |
201 //! | |
202 //! \sa setFoldComments() | |
203 bool foldComments() const {return fold_comments;} | |
204 | |
205 //! If \a fold is true then multi-line comment blocks can be folded. | |
206 //! The default is false. | |
207 //! | |
208 //! \sa foldComments() | |
209 void setFoldComments(bool fold); | |
210 | |
211 //! Returns true if trailing blank lines are included in a fold block. | |
212 //! | |
213 //! \sa setFoldCompact() | |
214 bool foldCompact() const {return fold_compact;} | |
215 | |
216 //! If \a fold is true then trailing blank lines are included in a fold | |
217 //! block. The default is true. | |
218 //! | |
219 //! \sa foldCompact() | |
220 void setFoldCompact(bool fold); | |
221 | |
222 //! Returns true if preprocessor lines (after the preprocessor | |
223 //! directive) are styled. | |
224 //! | |
225 //! \sa setStylePreprocessor() | |
226 bool stylePreprocessor() const {return style_preproc;} | |
227 | |
228 //! If \a style is true then preprocessor lines (after the preprocessor | |
229 //! directive) are styled. The default is false. | |
230 //! | |
231 //! \sa stylePreprocessor() | |
232 void setStylePreprocessor(bool style); | |
233 | |
234 protected: | |
235 //! The lexer's properties are read from the settings \a qs. \a prefix | |
236 //! (which has a trailing '/') should be used as a prefix to the key of | |
237 //! each setting. true is returned if there is no error. | |
238 //! | |
239 //! \sa writeProperties() | |
240 bool readProperties(QSettings &qs,const QString &prefix); | |
241 | |
242 //! The lexer's properties are written to the settings \a qs. | |
243 //! \a prefix (which has a trailing '/') should be used as a prefix to | |
244 //! the key of each setting. true is returned if there is no error. | |
245 //! | |
246 //! \sa readProperties() | |
247 bool writeProperties(QSettings &qs,const QString &prefix) const; | |
248 | |
249 private: | |
250 void setCommentProp(); | |
251 void setCompactProp(); | |
252 void setStylePreprocProp(); | |
253 void setDollarsProp(); | |
254 | |
255 bool fold_comments; | |
256 bool fold_compact; | |
257 bool style_preproc; | |
258 bool dollars; | |
259 | |
260 QsciLexerCoffeeScript(const QsciLexerCoffeeScript &); | |
261 QsciLexerCoffeeScript &operator=(const QsciLexerCoffeeScript &); | |
262 }; | |
263 | |
264 #endif |