1
|
1 /****************************************************************************
|
|
2 **
|
|
3 ** Copyright (C) 1992-2008 Nokia. All rights reserved.
|
|
4 ** Copyright (C) 2002-2005 Roberto Raggi <roberto@kdevelop.org>
|
|
5 **
|
|
6 ** This file is part of Qt Jambi.
|
|
7 **
|
|
8 ** * Commercial Usage
|
|
9 * Licensees holding valid Qt Commercial licenses may use this file in
|
|
10 * accordance with the Qt Commercial License Agreement provided with the
|
|
11 * Software or, alternatively, in accordance with the terms contained in
|
|
12 * a written agreement between you and Nokia.
|
|
13 *
|
|
14 *
|
|
15 * GNU General Public License Usage
|
|
16 * Alternatively, this file may be used under the terms of the GNU
|
|
17 * General Public License versions 2.0 or 3.0 as published by the Free
|
|
18 * Software Foundation and appearing in the file LICENSE.GPL included in
|
|
19 * the packaging of this file. Please review the following information
|
|
20 * to ensure GNU General Public Licensing requirements will be met:
|
|
21 * http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
|
22 * http://www.gnu.org/copyleft/gpl.html. In addition, as a special
|
|
23 * exception, Nokia gives you certain additional rights. These rights
|
|
24 * are described in the Nokia Qt GPL Exception version 1.2, included in
|
|
25 * the file GPL_EXCEPTION.txt in this package.
|
|
26 *
|
|
27 * Qt for Windows(R) Licensees
|
|
28 * As a special exception, Nokia, as the sole copyright holder for Qt
|
|
29 * Designer, grants users of the Qt/Eclipse Integration plug-in the
|
|
30 * right for the Qt/Eclipse Integration to link to functionality
|
|
31 * provided by Qt Designer and its related libraries.
|
|
32 *
|
|
33 *
|
|
34 * If you are unsure which license is appropriate for your use, please
|
|
35 * contact the sales department at qt-sales@nokia.com.
|
|
36
|
|
37 **
|
|
38 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
|
39 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
40 **
|
|
41 ****************************************************************************/
|
|
42
|
|
43
|
|
44 #include <QtCore/qglobal.h>
|
|
45
|
|
46 #include "tokens.h"
|
|
47
|
|
48 static char const * const _S_token_names[] = {
|
|
49 "K_DCOP",
|
|
50 "Q_OBJECT",
|
|
51 "Q_PROPERTY",
|
|
52 "__attribute__",
|
|
53 "__typeof",
|
|
54 "and",
|
|
55 "and_eq",
|
|
56 "arrow",
|
|
57 "asm",
|
|
58 "assign",
|
|
59 "auto",
|
|
60 "bitand",
|
|
61 "bitor",
|
|
62 "bool",
|
|
63 "break",
|
|
64 "case",
|
|
65 "catch",
|
|
66 "char",
|
|
67 "char_literal",
|
|
68 "class",
|
|
69 "comment",
|
|
70 "compl",
|
|
71 "concat",
|
|
72 "const",
|
|
73 "const_cast",
|
|
74 "continue",
|
|
75 "decr",
|
|
76 "default",
|
|
77 "delete",
|
|
78 "do",
|
|
79 "double",
|
|
80 "dynamic_cast",
|
|
81 "ellipsis",
|
|
82 "else",
|
|
83 "emit",
|
|
84 "enum",
|
|
85 "eq",
|
|
86 "explicit",
|
|
87 "export",
|
|
88 "extern",
|
|
89 "false",
|
|
90 "float",
|
|
91 "for",
|
|
92 "friend",
|
|
93 "geq",
|
|
94 "goto",
|
|
95 "identifier",
|
|
96 "if",
|
|
97 "incr",
|
|
98 "inline",
|
|
99 "int",
|
|
100 "k_dcop",
|
|
101 "k_dcop_signals",
|
|
102 "leq",
|
|
103 "long",
|
|
104 "mutable",
|
|
105 "namespace",
|
|
106 "new",
|
|
107 "not",
|
|
108 "not_eq",
|
|
109 "number_literal",
|
|
110 "operator",
|
|
111 "or",
|
|
112 "or_eq",
|
|
113 "preproc",
|
|
114 "private",
|
|
115 "protected",
|
|
116 "ptrmem",
|
|
117 "public",
|
|
118 "register",
|
|
119 "reinterpret_cast",
|
|
120 "return",
|
|
121 "scope",
|
|
122 "shift",
|
|
123 "short",
|
|
124 "signals",
|
|
125 "signed",
|
|
126 "sizeof",
|
|
127 "slots",
|
|
128 "static",
|
|
129 "static_cast",
|
|
130 "string_literal",
|
|
131 "struct",
|
|
132 "switch",
|
|
133 "template",
|
|
134 "this",
|
|
135 "throw",
|
|
136 "true",
|
|
137 "try",
|
|
138 "typedef",
|
|
139 "typeid",
|
|
140 "typename",
|
|
141 "union",
|
|
142 "unsigned",
|
|
143 "using",
|
|
144 "virtual",
|
|
145 "void",
|
|
146 "volatile",
|
|
147 "wchar_t",
|
|
148 "while",
|
|
149 "whitespaces",
|
|
150 "xor",
|
|
151 "xor_eq",
|
|
152 "Q_ENUMS"
|
|
153 };
|
|
154
|
|
155 static char _S_printable[][2] = {
|
|
156 { char(32), '\0' },
|
|
157 { char(33), '\0' },
|
|
158 { char(34), '\0' },
|
|
159 { char(35), '\0' },
|
|
160 { char(36), '\0' },
|
|
161 { char(37), '\0' },
|
|
162 { char(38), '\0' },
|
|
163 { char(39), '\0' },
|
|
164 { char(40), '\0' },
|
|
165 { char(41), '\0' },
|
|
166 { char(42), '\0' },
|
|
167 { char(43), '\0' },
|
|
168 { char(44), '\0' },
|
|
169 { char(45), '\0' },
|
|
170 { char(46), '\0' },
|
|
171 { char(47), '\0' },
|
|
172 { char(48), '\0' },
|
|
173 { char(49), '\0' },
|
|
174 { char(50), '\0' },
|
|
175 { char(51), '\0' },
|
|
176 { char(52), '\0' },
|
|
177 { char(53), '\0' },
|
|
178 { char(54), '\0' },
|
|
179 { char(55), '\0' },
|
|
180 { char(56), '\0' },
|
|
181 { char(57), '\0' },
|
|
182 { char(58), '\0' },
|
|
183 { char(59), '\0' },
|
|
184 { char(60), '\0' },
|
|
185 { char(61), '\0' },
|
|
186 { char(62), '\0' },
|
|
187 { char(63), '\0' },
|
|
188 { char(64), '\0' },
|
|
189 { char(65), '\0' },
|
|
190 { char(66), '\0' },
|
|
191 { char(67), '\0' },
|
|
192 { char(68), '\0' },
|
|
193 { char(69), '\0' },
|
|
194 { char(70), '\0' },
|
|
195 { char(71), '\0' },
|
|
196 { char(72), '\0' },
|
|
197 { char(73), '\0' },
|
|
198 { char(74), '\0' },
|
|
199 { char(75), '\0' },
|
|
200 { char(76), '\0' },
|
|
201 { char(77), '\0' },
|
|
202 { char(78), '\0' },
|
|
203 { char(79), '\0' },
|
|
204 { char(80), '\0' },
|
|
205 { char(81), '\0' },
|
|
206 { char(82), '\0' },
|
|
207 { char(83), '\0' },
|
|
208 { char(84), '\0' },
|
|
209 { char(85), '\0' },
|
|
210 { char(86), '\0' },
|
|
211 { char(87), '\0' },
|
|
212 { char(88), '\0' },
|
|
213 { char(89), '\0' },
|
|
214 { char(90), '\0' },
|
|
215 { char(91), '\0' },
|
|
216 { char(92), '\0' },
|
|
217 { char(93), '\0' },
|
|
218 { char(94), '\0' },
|
|
219 { char(95), '\0' },
|
|
220 { char(96), '\0' },
|
|
221 { char(97), '\0' },
|
|
222 { char(98), '\0' },
|
|
223 { char(99), '\0' },
|
|
224 { char(100), '\0' },
|
|
225 { char(101), '\0' },
|
|
226 { char(102), '\0' },
|
|
227 { char(103), '\0' },
|
|
228 { char(104), '\0' },
|
|
229 { char(105), '\0' },
|
|
230 { char(106), '\0' },
|
|
231 { char(107), '\0' },
|
|
232 { char(108), '\0' },
|
|
233 { char(109), '\0' },
|
|
234 { char(110), '\0' },
|
|
235 { char(111), '\0' },
|
|
236 { char(112), '\0' },
|
|
237 { char(113), '\0' },
|
|
238 { char(114), '\0' },
|
|
239 { char(115), '\0' },
|
|
240 { char(116), '\0' },
|
|
241 { char(117), '\0' },
|
|
242 { char(118), '\0' },
|
|
243 { char(119), '\0' },
|
|
244 { char(120), '\0' },
|
|
245 { char(121), '\0' },
|
|
246 { char(122), '\0' },
|
|
247 { char(123), '\0' },
|
|
248 { char(124), '\0' },
|
|
249 { char(125), '\0' },
|
|
250 { char(126), '\0' },
|
|
251 { char(127), '\0' },
|
|
252 };
|
|
253
|
|
254 char const *token_name(int token)
|
|
255 {
|
|
256 if (token == 0)
|
|
257 {
|
|
258 return "eof";
|
|
259 }
|
|
260 else if (token >= 32 && token <= 127)
|
|
261 {
|
|
262 return _S_printable[token - 32];
|
|
263 }
|
|
264 else if (token >= 1000)
|
|
265 {
|
|
266 return _S_token_names[token - 1000];
|
|
267 }
|
|
268
|
|
269 Q_ASSERT(0);
|
|
270 return 0;
|
|
271 }
|
|
272
|
|
273 // kate: space-indent on; indent-width 2; replace-tabs on;
|