Add rpp files
[rpp.git] / src / tokens.cpp
blob834eecdc76de34065ff5df6a34814b96845b1dc1
1 /****************************************************************************
2 **
3 ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
4 **
5 ** This file is part of Qt Jambi.
6 **
7 ** ** This file may be used under the terms of the GNU General Public
8 ** License version 2.0 as published by the Free Software Foundation
9 ** and appearing in the file LICENSE.GPL included in the packaging of
10 ** this file. Please review the following information to ensure GNU
11 ** General Public Licensing requirements will be met:
12 ** http://www.trolltech.com/products/qt/opensource.html
14 ** If you are unsure which license is appropriate for your use, please
15 ** review the following information:
16 ** http://www.trolltech.com/products/qt/licensing.html or contact the
17 ** sales department at sales@trolltech.com.
20 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
21 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23 ****************************************************************************/
25 /* This file is part of KDevelop
26 Copyright (C) 2002-2005 Roberto Raggi <roberto@kdevelop.org>
28 This library is free software; you can redistribute it and/or
29 modify it under the terms of the GNU Library General Public
30 License version 2 as published by the Free Software Foundation.
32 This library is distributed in the hope that it will be useful,
33 but WITHOUT ANY WARRANTY; without even the implied warranty of
34 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
35 Library General Public License for more details.
37 You should have received a copy of the GNU Library General Public License
38 along with this library; see the file COPYING.LIB. If not, write to
39 the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
40 Boston, MA 02110-1301, USA.
43 #include <QtCore/qglobal.h>
45 #include "tokens.h"
47 static char const * const _S_token_names[] = {
48 "K_DCOP",
49 "Q_OBJECT",
50 "Q_PROPERTY",
51 "__attribute__",
52 "__typeof",
53 "and",
54 "and_eq",
55 "arrow",
56 "asm",
57 "assign",
58 "auto",
59 "bitand",
60 "bitor",
61 "bool",
62 "break",
63 "case",
64 "catch",
65 "char",
66 "char_literal",
67 "class",
68 "comment",
69 "compl",
70 "concat",
71 "const",
72 "const_cast",
73 "continue",
74 "decr",
75 "default",
76 "delete",
77 "do",
78 "double",
79 "dynamic_cast",
80 "ellipsis",
81 "else",
82 "emit",
83 "enum",
84 "eq",
85 "explicit",
86 "export",
87 "extern",
88 "false",
89 "float",
90 "for",
91 "friend",
92 "geq",
93 "goto",
94 "identifier",
95 "if",
96 "incr",
97 "inline",
98 "int",
99 "k_dcop",
100 "k_dcop_signals",
101 "leq",
102 "long",
103 "mutable",
104 "namespace",
105 "new",
106 "not",
107 "not_eq",
108 "number_literal",
109 "operator",
110 "or",
111 "or_eq",
112 "preproc",
113 "private",
114 "protected",
115 "ptrmem",
116 "public",
117 "register",
118 "reinterpret_cast",
119 "return",
120 "scope",
121 "shift",
122 "short",
123 "signals",
124 "signed",
125 "sizeof",
126 "slots",
127 "static",
128 "static_cast",
129 "string_literal",
130 "struct",
131 "switch",
132 "template",
133 "this",
134 "throw",
135 "true",
136 "try",
137 "typedef",
138 "typeid",
139 "typename",
140 "union",
141 "unsigned",
142 "using",
143 "virtual",
144 "void",
145 "volatile",
146 "wchar_t",
147 "while",
148 "whitespaces",
149 "xor",
150 "xor_eq"
153 static char _S_printable[][2] = {
154 { char(32), '\0' },
155 { char(33), '\0' },
156 { char(34), '\0' },
157 { char(35), '\0' },
158 { char(36), '\0' },
159 { char(37), '\0' },
160 { char(38), '\0' },
161 { char(39), '\0' },
162 { char(40), '\0' },
163 { char(41), '\0' },
164 { char(42), '\0' },
165 { char(43), '\0' },
166 { char(44), '\0' },
167 { char(45), '\0' },
168 { char(46), '\0' },
169 { char(47), '\0' },
170 { char(48), '\0' },
171 { char(49), '\0' },
172 { char(50), '\0' },
173 { char(51), '\0' },
174 { char(52), '\0' },
175 { char(53), '\0' },
176 { char(54), '\0' },
177 { char(55), '\0' },
178 { char(56), '\0' },
179 { char(57), '\0' },
180 { char(58), '\0' },
181 { char(59), '\0' },
182 { char(60), '\0' },
183 { char(61), '\0' },
184 { char(62), '\0' },
185 { char(63), '\0' },
186 { char(64), '\0' },
187 { char(65), '\0' },
188 { char(66), '\0' },
189 { char(67), '\0' },
190 { char(68), '\0' },
191 { char(69), '\0' },
192 { char(70), '\0' },
193 { char(71), '\0' },
194 { char(72), '\0' },
195 { char(73), '\0' },
196 { char(74), '\0' },
197 { char(75), '\0' },
198 { char(76), '\0' },
199 { char(77), '\0' },
200 { char(78), '\0' },
201 { char(79), '\0' },
202 { char(80), '\0' },
203 { char(81), '\0' },
204 { char(82), '\0' },
205 { char(83), '\0' },
206 { char(84), '\0' },
207 { char(85), '\0' },
208 { char(86), '\0' },
209 { char(87), '\0' },
210 { char(88), '\0' },
211 { char(89), '\0' },
212 { char(90), '\0' },
213 { char(91), '\0' },
214 { char(92), '\0' },
215 { char(93), '\0' },
216 { char(94), '\0' },
217 { char(95), '\0' },
218 { char(96), '\0' },
219 { char(97), '\0' },
220 { char(98), '\0' },
221 { char(99), '\0' },
222 { char(100), '\0' },
223 { char(101), '\0' },
224 { char(102), '\0' },
225 { char(103), '\0' },
226 { char(104), '\0' },
227 { char(105), '\0' },
228 { char(106), '\0' },
229 { char(107), '\0' },
230 { char(108), '\0' },
231 { char(109), '\0' },
232 { char(110), '\0' },
233 { char(111), '\0' },
234 { char(112), '\0' },
235 { char(113), '\0' },
236 { char(114), '\0' },
237 { char(115), '\0' },
238 { char(116), '\0' },
239 { char(117), '\0' },
240 { char(118), '\0' },
241 { char(119), '\0' },
242 { char(120), '\0' },
243 { char(121), '\0' },
244 { char(122), '\0' },
245 { char(123), '\0' },
246 { char(124), '\0' },
247 { char(125), '\0' },
248 { char(126), '\0' },
249 { char(127), '\0' },
252 char const *token_name(int token)
254 if (token == 0)
256 return "eof";
258 else if (token >= 32 && token <= 127)
260 return _S_printable[token - 32];
262 else if (token >= 1000)
264 return _S_token_names[token - 1000];
267 Q_ASSERT(0);
268 return 0;
271 // kate: space-indent on; indent-width 2; replace-tabs on;