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