1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtXmlPatterns module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39/* C++ code produced by gperf version 3.1 */
40/* Command-line: gperf TokenLookup.gperf */
41/* Computed positions: -k'1,3,$' */
42
43#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
44 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
45 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
46 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
47 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
48 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
49 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
50 && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
51 && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
52 && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
53 && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
54 && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
55 && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
56 && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
57 && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
58 && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
59 && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
60 && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
61 && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
62 && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
63 && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
64 && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
65 && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
66/* The character set is not based on ISO-646. */
67#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
68#endif
69
70#line 105 "TokenLookup.gperf"
71
72
73QT_BEGIN_NAMESPACE
74
75namespace QPatternist
76{
77
78#line 99 "TokenLookup.gperf"
79struct TokenMap
80{
81 const char *name;
82 const Tokenizer::TokenType token;
83}
84
85
86/* The strings below are in UTF-16 encoding. Subsequently, each ASCII
87 * character is stored as the ASCII character, followed by a null byte.
88 * Sorted alphabetically. */;
89/* maximum key range = 228, duplicates = 0 */
90
91class TokenLookup
92{
93private:
94 static inline unsigned int hash (const char *str, unsigned int len);
95public:
96 static const struct TokenMap *value (const char *str, unsigned int len);
97};
98
99inline unsigned int
100TokenLookup::hash (const char *str, unsigned int len)
101{
102 static const unsigned char asso_values[] =
103 {
104 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
105 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
106 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
107 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
108 230, 230, 230, 230, 230, 25, 230, 230, 230, 230,
109 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
110 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
111 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
112 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
113 230, 230, 230, 230, 230, 230, 230, 0, 2, 5,
114 25, 0, 20, 20, 35, 85, 230, 230, 40, 110,
115 25, 65, 80, 0, 60, 5, 10, 0, 55, 5,
116 20, 0, 230, 230, 230, 230, 230, 230, 230, 230,
117 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
118 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
119 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
120 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
121 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
122 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
123 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
124 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
125 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
126 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
127 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
128 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
129 230, 230, 230, 230, 230, 230
130 };
131 unsigned int hval = len;
132
133 switch (hval)
134 {
135 default:
136 hval += asso_values[static_cast<unsigned char>(str[2])];
137 Q_FALLTHROUGH();
138 case 2:
139 case 1:
140 hval += asso_values[static_cast<unsigned char>(str[0])];
141 break;
142 }
143 return hval + asso_values[static_cast<unsigned char>(str[len - 1])];
144}
145
146const struct TokenMap *
147TokenLookup::value (const char *str, unsigned int len)
148{
149 enum
150 {
151 TOTAL_KEYWORDS = 99,
152 MIN_WORD_LENGTH = 2,
153 MAX_WORD_LENGTH = 22,
154 MIN_HASH_VALUE = 2,
155 MAX_HASH_VALUE = 229
156 };
157
158 static const struct TokenMap wordlist[] =
159 {
160 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
161#line 150 "TokenLookup.gperf"
162 {.name: "eq", .token: T_EQ},
163 {.name: "",.token: T_ERROR},
164#line 128 "TokenLookup.gperf"
165 {.name: "by", .token: T_BY},
166#line 151 "TokenLookup.gperf"
167 {.name: "every", .token: T_EVERY},
168 {.name: "",.token: T_ERROR},
169#line 121 "TokenLookup.gperf"
170 {.name: "as", .token: T_AS},
171 {.name: "",.token: T_ERROR},
172#line 146 "TokenLookup.gperf"
173 {.name: "else", .token: T_ELSE},
174#line 215 "TokenLookup.gperf"
175 {.name: "where", .token: T_WHERE},
176#line 202 "TokenLookup.gperf"
177 {.name: "stable", .token: T_STABLE},
178#line 124 "TokenLookup.gperf"
179 {.name: "at", .token: T_AT},
180 {.name: "",.token: T_ERROR},
181#line 129 "TokenLookup.gperf"
182 {.name: "case", .token: T_CASE},
183 {.name: "",.token: T_ERROR},
184#line 127 "TokenLookup.gperf"
185 {.name: "boundary-space", .token: T_BOUNDARY_SPACE},
186#line 145 "TokenLookup.gperf"
187 {.name: "element", .token: T_ELEMENT},
188#line 130 "TokenLookup.gperf"
189 {.name: "castable", .token: T_CASTABLE},
190#line 125 "TokenLookup.gperf"
191 {.name: "attribute", .token: T_ATTRIBUTE},
192 {.name: "",.token: T_ERROR},
193#line 152 "TokenLookup.gperf"
194 {.name: "except", .token: T_EXCEPT},
195#line 159 "TokenLookup.gperf"
196 {.name: "ge", .token: T_GE},
197 {.name: "",.token: T_ERROR},
198#line 131 "TokenLookup.gperf"
199 {.name: "cast", .token: T_CAST},
200#line 208 "TokenLookup.gperf"
201 {.name: "treat", .token: T_TREAT},
202#line 216 "TokenLookup.gperf"
203 {.name: "xquery", .token: T_XQUERY},
204#line 179 "TokenLookup.gperf"
205 {.name: "ne", .token: T_NE},
206 {.name: "",.token: T_ERROR},
207#line 196 "TokenLookup.gperf"
208 {.name: "satisfies", .token: T_SATISFIES},
209 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
210#line 161 "TokenLookup.gperf"
211 {.name: "gt", .token: T_GT},
212#line 149 "TokenLookup.gperf"
213 {.name: "encoding", .token: T_ENCODING},
214#line 122 "TokenLookup.gperf"
215 {.name: "ascending", .token: T_ASCENDING},
216 {.name: "",.token: T_ERROR},
217#line 123 "TokenLookup.gperf"
218 {.name: "assign", .token: T_ASSIGN},
219#line 137 "TokenLookup.gperf"
220 {.name: "declare", .token: T_DECLARE},
221#line 160 "TokenLookup.gperf"
222 {.name: "greatest", .token: T_GREATEST},
223#line 206 "TokenLookup.gperf"
224 {.name: "then", .token: T_THEN},
225 {.name: "",.token: T_ERROR},
226#line 119 "TokenLookup.gperf"
227 {.name: "ancestor-or-self", .token: T_ANCESTOR_OR_SELF},
228#line 173 "TokenLookup.gperf"
229 {.name: "le", .token: T_LE},
230#line 144 "TokenLookup.gperf"
231 {.name: "document-node", .token: T_DOCUMENT_NODE},
232#line 205 "TokenLookup.gperf"
233 {.name: "text", .token: T_TEXT},
234 {.name: "",.token: T_ERROR},
235#line 199 "TokenLookup.gperf"
236 {.name: "schema", .token: T_SCHEMA},
237 {.name: "",.token: T_ERROR},
238#line 143 "TokenLookup.gperf"
239 {.name: "document", .token: T_DOCUMENT},
240 {.name: "",.token: T_ERROR},
241#line 139 "TokenLookup.gperf"
242 {.name: "descendant", .token: T_DESCENDANT},
243 {.name: "",.token: T_ERROR},
244#line 175 "TokenLookup.gperf"
245 {.name: "lt", .token: T_LT},
246#line 120 "TokenLookup.gperf"
247 {.name: "and", .token: T_AND},
248#line 180 "TokenLookup.gperf"
249 {.name: "node", .token: T_NODE},
250#line 172 "TokenLookup.gperf"
251 {.name: "least", .token: T_LEAST},
252#line 197 "TokenLookup.gperf"
253 {.name: "schema-attribute", .token: T_SCHEMA_ATTRIBUTE},
254 {.name: "",.token: T_ERROR},
255#line 153 "TokenLookup.gperf"
256 {.name: "external", .token: T_EXTERNAL},
257 {.name: "",.token: T_ERROR},
258#line 141 "TokenLookup.gperf"
259 {.name: "descending", .token: T_DESCENDING},
260#line 182 "TokenLookup.gperf"
261 {.name: "no-preserve", .token: T_NO_PRESERVE},
262#line 138 "TokenLookup.gperf"
263 {.name: "default", .token: T_DEFAULT},
264#line 174 "TokenLookup.gperf"
265 {.name: "let", .token: T_LET},
266#line 198 "TokenLookup.gperf"
267 {.name: "schema-element", .token: T_SCHEMA_ELEMENT},
268 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
269#line 135 "TokenLookup.gperf"
270 {.name: "construction", .token: T_CONSTRUCTION},
271#line 140 "TokenLookup.gperf"
272 {.name: "descendant-or-self", .token: T_DESCENDANT_OR_SELF},
273#line 200 "TokenLookup.gperf"
274 {.name: "self", .token: T_SELF},
275#line 181 "TokenLookup.gperf"
276 {.name: "no-inherit", .token: T_NO_INHERIT},
277 {.name: "",.token: T_ERROR},
278#line 156 "TokenLookup.gperf"
279 {.name: "follows", .token: T_FOLLOWS},
280#line 118 "TokenLookup.gperf"
281 {.name: "ancestor", .token: T_ANCESTOR},
282 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
283#line 207 "TokenLookup.gperf"
284 {.name: "to", .token: T_TO},
285#line 158 "TokenLookup.gperf"
286 {.name: "function", .token: T_FUNCTION},
287#line 133 "TokenLookup.gperf"
288 {.name: "collation", .token: T_COLLATION},
289 {.name: "",.token: T_ERROR},
290#line 203 "TokenLookup.gperf"
291 {.name: "strict", .token: T_STRICT},
292 {.name: "",.token: T_ERROR},
293#line 171 "TokenLookup.gperf"
294 {.name: "lax", .token: T_LAX},
295 {.name: "",.token: T_ERROR},
296#line 147 "TokenLookup.gperf"
297 {.name: "empty", .token: T_EMPTY},
298 {.name: "",.token: T_ERROR},
299#line 183 "TokenLookup.gperf"
300 {.name: "of", .token: T_OF},
301#line 193 "TokenLookup.gperf"
302 {.name: "preserve", .token: T_PRESERVE},
303#line 154 "TokenLookup.gperf"
304 {.name: "following", .token: T_FOLLOWING},
305 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
306#line 169 "TokenLookup.gperf"
307 {.name: "is", .token: T_IS},
308#line 190 "TokenLookup.gperf"
309 {.name: "precedes", .token: T_PRECEDES},
310#line 148 "TokenLookup.gperf"
311 {.name: "empty-sequence", .token: T_EMPTY_SEQUENCE},
312 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
313#line 155 "TokenLookup.gperf"
314 {.name: "following-sibling", .token: T_FOLLOWING_SIBLING},
315#line 167 "TokenLookup.gperf"
316 {.name: "instance", .token: T_INSTANCE},
317#line 211 "TokenLookup.gperf"
318 {.name: "unordered", .token: T_UNORDERED},
319#line 126 "TokenLookup.gperf"
320 {.name: "base-uri", .token: T_BASEURI},
321#line 195 "TokenLookup.gperf"
322 {.name: "return", .token: T_RETURN},
323 {.name: "",.token: T_ERROR},
324#line 212 "TokenLookup.gperf"
325 {.name: "validate", .token: T_VALIDATE},
326 {.name: "",.token: T_ERROR},
327#line 136 "TokenLookup.gperf"
328 {.name: "copy-namespaces", .token: T_COPY_NAMESPACES},
329#line 184 "TokenLookup.gperf"
330 {.name: "option", .token: T_OPTION},
331#line 163 "TokenLookup.gperf"
332 {.name: "if", .token: T_IF},
333 {.name: "",.token: T_ERROR},
334#line 191 "TokenLookup.gperf"
335 {.name: "preceding", .token: T_PRECEDING},
336 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
337#line 166 "TokenLookup.gperf"
338 {.name: "in", .token: T_IN},
339 {.name: "",.token: T_ERROR},
340#line 168 "TokenLookup.gperf"
341 {.name: "intersect", .token: T_INTERSECT},
342#line 210 "TokenLookup.gperf"
343 {.name: "union", .token: T_UNION},
344 {.name: "",.token: T_ERROR},
345#line 192 "TokenLookup.gperf"
346 {.name: "preceding-sibling", .token: T_PRECEDING_SIBLING},
347#line 186 "TokenLookup.gperf"
348 {.name: "ordering", .token: T_ORDERING},
349#line 201 "TokenLookup.gperf"
350 {.name: "some", .token: T_SOME},
351#line 132 "TokenLookup.gperf"
352 {.name: "child", .token: T_CHILD},
353 {.name: "",.token: T_ERROR},
354#line 185 "TokenLookup.gperf"
355 {.name: "ordered", .token: T_ORDERED},
356#line 213 "TokenLookup.gperf"
357 {.name: "variable", .token: T_VARIABLE},
358 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
359#line 188 "TokenLookup.gperf"
360 {.name: "or", .token: T_OR},
361 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
362#line 134 "TokenLookup.gperf"
363 {.name: "comment", .token: T_COMMENT},
364 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
365#line 209 "TokenLookup.gperf"
366 {.name: "typeswitch", .token: T_TYPESWITCH},
367 {.name: "",.token: T_ERROR},
368#line 165 "TokenLookup.gperf"
369 {.name: "inherit", .token: T_INHERIT},
370#line 142 "TokenLookup.gperf"
371 {.name: "div", .token: T_DIV},
372 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
373#line 177 "TokenLookup.gperf"
374 {.name: "module", .token: T_MODULE},
375 {.name: "",.token: T_ERROR},
376#line 157 "TokenLookup.gperf"
377 {.name: "for", .token: T_FOR},
378#line 178 "TokenLookup.gperf"
379 {.name: "namespace", .token: T_NAMESPACE},
380 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
381#line 214 "TokenLookup.gperf"
382 {.name: "version", .token: T_VERSION},
383 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
384#line 204 "TokenLookup.gperf"
385 {.name: "strip", .token: T_STRIP},
386 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
387#line 187 "TokenLookup.gperf"
388 {.name: "order", .token: T_ORDER},
389#line 189 "TokenLookup.gperf"
390 {.name: "parent", .token: T_PARENT},
391 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
392 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
393#line 176 "TokenLookup.gperf"
394 {.name: "mod", .token: T_MOD},
395 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
396 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
397 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
398 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
399 {.name: "",.token: T_ERROR},
400#line 164 "TokenLookup.gperf"
401 {.name: "import", .token: T_IMPORT},
402 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
403 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
404 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
405#line 194 "TokenLookup.gperf"
406 {.name: "processing-instruction", .token: T_PROCESSING_INSTRUCTION},
407 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
408 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
409#line 170 "TokenLookup.gperf"
410 {.name: "item", .token: T_ITEM},
411 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
412 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
413 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
414 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
415 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
416 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
417 {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR}, {.name: "",.token: T_ERROR},
418 {.name: "",.token: T_ERROR},
419#line 162 "TokenLookup.gperf"
420 {.name: "idiv", .token: T_IDIV}
421 };
422
423 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
424 {
425 unsigned int key = hash (str, len);
426
427 if (key <= MAX_HASH_VALUE)
428 {
429 const char *s = wordlist[key].name;
430
431 if (*str == *s && !strcmp (s1: str + 1, s2: s + 1))
432 return &wordlist[key];
433 }
434 }
435 return 0;
436}
437#line 217 "TokenLookup.gperf"
438
439
440} /* Close the QPatternist namespace. */
441
442QT_END_NAMESPACE
443

source code of qtxmlpatterns/src/xmlpatterns/parser/qtokenlookup.cpp