Mercurial > octave
comparison libgui/languages/build_ts/octave-qsci/Qsci/qscilexerruby.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 QsciLexerRuby 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 QSCILEXERRUBY_H | |
22 #define QSCILEXERRUBY_H | |
23 | |
24 #include <QObject> | |
25 | |
26 #include <Qsci/qsciglobal.h> | |
27 #include <Qsci/qscilexer.h> | |
28 | |
29 | |
30 //! \brief The QsciLexerRuby class encapsulates the Scintilla Ruby lexer. | |
31 class QSCINTILLA_EXPORT QsciLexerRuby : public QsciLexer | |
32 { | |
33 Q_OBJECT | |
34 | |
35 public: | |
36 //! This enum defines the meanings of the different styles used by the | |
37 //! Ruby lexer. | |
38 enum { | |
39 //! The default. | |
40 Default = 0, | |
41 | |
42 //! An error. | |
43 Error = 1, | |
44 | |
45 //! A comment. | |
46 Comment = 2, | |
47 | |
48 //! A POD. | |
49 POD = 3, | |
50 | |
51 //! A number. | |
52 Number = 4, | |
53 | |
54 //! A keyword. | |
55 Keyword = 5, | |
56 | |
57 //! A double-quoted string. | |
58 DoubleQuotedString = 6, | |
59 | |
60 //! A single-quoted string. | |
61 SingleQuotedString = 7, | |
62 | |
63 //! The name of a class. | |
64 ClassName = 8, | |
65 | |
66 //! The name of a function or method. | |
67 FunctionMethodName = 9, | |
68 | |
69 //! An operator. | |
70 Operator = 10, | |
71 | |
72 //! An identifier | |
73 Identifier = 11, | |
74 | |
75 //! A regular expression. | |
76 Regex = 12, | |
77 | |
78 //! A global. | |
79 Global = 13, | |
80 | |
81 //! A symbol. | |
82 Symbol = 14, | |
83 | |
84 //! The name of a module. | |
85 ModuleName = 15, | |
86 | |
87 //! An instance variable. | |
88 InstanceVariable = 16, | |
89 | |
90 //! A class variable. | |
91 ClassVariable = 17, | |
92 | |
93 //! Backticks. | |
94 Backticks = 18, | |
95 | |
96 //! A data section. | |
97 DataSection = 19, | |
98 | |
99 //! A here document delimiter. | |
100 HereDocumentDelimiter = 20, | |
101 | |
102 //! A here document. | |
103 HereDocument = 21, | |
104 | |
105 //! A %q string. | |
106 PercentStringq = 24, | |
107 | |
108 //! A %Q string. | |
109 PercentStringQ = 25, | |
110 | |
111 //! A %x string. | |
112 PercentStringx = 26, | |
113 | |
114 //! A %r string. | |
115 PercentStringr = 27, | |
116 | |
117 //! A %w string. | |
118 PercentStringw = 28, | |
119 | |
120 //! A demoted keyword. | |
121 DemotedKeyword = 29, | |
122 | |
123 //! stdin. | |
124 Stdin = 30, | |
125 | |
126 //! stdout. | |
127 Stdout = 31, | |
128 | |
129 //! stderr. | |
130 Stderr = 40 | |
131 }; | |
132 | |
133 //! Construct a QsciLexerRuby with parent \a parent. \a parent is | |
134 //! typically the QsciScintilla instance. | |
135 QsciLexerRuby(QObject *parent = 0); | |
136 | |
137 //! Destroys the QsciLexerRuby instance. | |
138 virtual ~QsciLexerRuby(); | |
139 | |
140 //! Returns the name of the language. | |
141 const char *language() const; | |
142 | |
143 //! Returns the name of the lexer. Some lexers support a number of | |
144 //! languages. | |
145 const char *lexer() const; | |
146 | |
147 //! \internal Returns a space separated list of words or characters in | |
148 //! a particular style that define the end of a block for | |
149 //! auto-indentation. The style is returned via \a style. | |
150 const char *blockEnd(int *style = 0) const; | |
151 | |
152 //! \internal Returns a space separated list of words or characters in | |
153 //! a particular style that define the start of a block for | |
154 //! auto-indentation. The styles is returned via \a style. | |
155 const char *blockStart(int *style = 0) const; | |
156 | |
157 //! \internal Returns a space separated list of keywords in a | |
158 //! particular style that define the start of a block for | |
159 //! auto-indentation. The style is returned via \a style. | |
160 const char *blockStartKeyword(int *style = 0) const; | |
161 | |
162 //! \internal Returns the style used for braces for brace matching. | |
163 int braceStyle() const; | |
164 | |
165 //! Returns the foreground colour of the text for style number \a style. | |
166 //! | |
167 //! \sa defaultpaper() | |
168 QColor defaultColor(int style) const; | |
169 | |
170 //! Returns the end-of-line fill for style number \a style. | |
171 bool defaultEolFill(int style) const; | |
172 | |
173 //! Returns the font for style number \a style. | |
174 QFont defaultFont(int style) const; | |
175 | |
176 //! Returns the background colour of the text for style number \a style. | |
177 //! | |
178 //! \sa defaultColor() | |
179 QColor defaultPaper(int style) const; | |
180 | |
181 //! Returns the set of keywords for the keyword set \a set recognised | |
182 //! by the lexer as a space separated string. | |
183 const char *keywords(int set) const; | |
184 | |
185 //! Returns the descriptive name for style number \a style. If the style | |
186 //! is invalid for this language then an empty QString is returned. This | |
187 //! is intended to be used in user preference dialogs. | |
188 QString description(int style) const; | |
189 | |
190 //! Causes all properties to be refreshed by emitting the | |
191 //! propertyChanged() signal as required. | |
192 void refreshProperties(); | |
193 | |
194 //! If \a fold is true then multi-line comment blocks can be folded. | |
195 //! The default is false. | |
196 //! | |
197 //! \sa foldComments() | |
198 void setFoldComments(bool fold); | |
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 trailing blank lines are included in a fold | |
206 //! block. The default is true. | |
207 //! | |
208 //! \sa foldCompact() | |
209 void setFoldCompact(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 protected: | |
217 //! The lexer's properties are read from the settings \a qs. \a prefix | |
218 //! (which has a trailing '/') should be used as a prefix to the key of | |
219 //! each setting. true is returned if there is no error. | |
220 //! | |
221 bool readProperties(QSettings &qs, const QString &prefix); | |
222 | |
223 //! The lexer's properties are written to the settings \a qs. | |
224 //! \a prefix (which has a trailing '/') should be used as a prefix to | |
225 //! the key of each setting. true is returned if there is no error. | |
226 //! | |
227 bool writeProperties(QSettings &qs, const QString &prefix) const; | |
228 | |
229 private: | |
230 void setCommentProp(); | |
231 void setCompactProp(); | |
232 | |
233 bool fold_comments; | |
234 bool fold_compact; | |
235 | |
236 QsciLexerRuby(const QsciLexerRuby &); | |
237 QsciLexerRuby &operator=(const QsciLexerRuby &); | |
238 }; | |
239 | |
240 #endif |