source: trunk/src/xmlpatterns/parser/qtokenlookup.cpp@ 243

Last change on this file since 243 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 14.1 KB
Line 
1/* C++ code produced by gperf version 3.0.2 */
2/* Command-line: gperf TokenLookup.gperf */
3/* Computed positions: -k'1,3,$' */
4
5#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
6 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
7 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
8 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
9 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
10 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
11 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
12 && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
13 && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
14 && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
15 && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
16 && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
17 && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
18 && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
19 && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
20 && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
21 && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
22 && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
23 && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
24 && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
25 && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
26 && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
27 && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
28/* The character set is not based on ISO-646. */
29#error "gperf generated tables don't work with this execution character set. Please report a bug to <[email protected]>."
30#endif
31
32#line 80 "TokenLookup.gperf"
33
34
35QT_BEGIN_NAMESPACE
36
37namespace QPatternist
38{
39
40#line 74 "TokenLookup.gperf"
41struct TokenMap
42{
43 const char *name;
44 const Tokenizer::TokenType token;
45}
46
47
48/* The strings below are in UTF-16 encoding. Subsequently, each ASCII
49 * character is stored as the ASCII character, followed by a null byte.
50 * Sorted alphabetically. */;
51/* maximum key range = 228, duplicates = 0 */
52
53class TokenLookup
54{
55private:
56 static inline unsigned int hash (const char *str, unsigned int len);
57public:
58 static const struct TokenMap *value (const char *str, unsigned int len);
59};
60
61inline unsigned int
62TokenLookup::hash (register const char *str, register unsigned int len)
63{
64 static const unsigned char asso_values[] =
65 {
66 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
67 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
68 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
69 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
70 230, 230, 230, 230, 230, 25, 230, 230, 230, 230,
71 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
72 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
73 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
74 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
75 230, 230, 230, 230, 230, 230, 230, 0, 2, 5,
76 25, 0, 20, 20, 35, 85, 230, 230, 40, 110,
77 25, 65, 80, 0, 60, 5, 10, 0, 55, 5,
78 20, 0, 230, 230, 230, 230, 230, 230, 230, 230,
79 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
80 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
81 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
82 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
83 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
84 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
85 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
86 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
87 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
88 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
89 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
90 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
91 230, 230, 230, 230, 230, 230
92 };
93 register int hval = len;
94
95 switch (hval)
96 {
97 default:
98 hval += asso_values[(unsigned char)str[2]];
99 /*FALLTHROUGH*/
100 case 2:
101 case 1:
102 hval += asso_values[(unsigned char)str[0]];
103 break;
104 }
105 return hval + asso_values[(unsigned char)str[len - 1]];
106}
107
108const struct TokenMap *
109TokenLookup::value (register const char *str, register unsigned int len)
110{
111 enum
112 {
113 TOTAL_KEYWORDS = 99,
114 MIN_WORD_LENGTH = 2,
115 MAX_WORD_LENGTH = 22,
116 MIN_HASH_VALUE = 2,
117 MAX_HASH_VALUE = 229
118 };
119
120 static const struct TokenMap wordlist[] =
121 {
122 {"",ERROR}, {"",ERROR},
123#line 125 "TokenLookup.gperf"
124 {"eq", EQ},
125 {"",ERROR},
126#line 103 "TokenLookup.gperf"
127 {"by", BY},
128#line 126 "TokenLookup.gperf"
129 {"every", EVERY},
130 {"",ERROR},
131#line 96 "TokenLookup.gperf"
132 {"as", AS},
133 {"",ERROR},
134#line 121 "TokenLookup.gperf"
135 {"else", ELSE},
136#line 190 "TokenLookup.gperf"
137 {"where", WHERE},
138#line 177 "TokenLookup.gperf"
139 {"stable", STABLE},
140#line 99 "TokenLookup.gperf"
141 {"at", AT},
142 {"",ERROR},
143#line 104 "TokenLookup.gperf"
144 {"case", CASE},
145 {"",ERROR},
146#line 102 "TokenLookup.gperf"
147 {"boundary-space", BOUNDARY_SPACE},
148#line 120 "TokenLookup.gperf"
149 {"element", ELEMENT},
150#line 105 "TokenLookup.gperf"
151 {"castable", CASTABLE},
152#line 100 "TokenLookup.gperf"
153 {"attribute", ATTRIBUTE},
154 {"",ERROR},
155#line 127 "TokenLookup.gperf"
156 {"except", EXCEPT},
157#line 134 "TokenLookup.gperf"
158 {"ge", GE},
159 {"",ERROR},
160#line 106 "TokenLookup.gperf"
161 {"cast", CAST},
162#line 183 "TokenLookup.gperf"
163 {"treat", TREAT},
164#line 191 "TokenLookup.gperf"
165 {"xquery", XQUERY},
166#line 154 "TokenLookup.gperf"
167 {"ne", NE},
168 {"",ERROR},
169#line 171 "TokenLookup.gperf"
170 {"satisfies", SATISFIES},
171 {"",ERROR}, {"",ERROR},
172#line 136 "TokenLookup.gperf"
173 {"gt", GT},
174#line 124 "TokenLookup.gperf"
175 {"encoding", ENCODING},
176#line 97 "TokenLookup.gperf"
177 {"ascending", ASCENDING},
178 {"",ERROR},
179#line 98 "TokenLookup.gperf"
180 {"assign", ASSIGN},
181#line 112 "TokenLookup.gperf"
182 {"declare", DECLARE},
183#line 135 "TokenLookup.gperf"
184 {"greatest", GREATEST},
185#line 181 "TokenLookup.gperf"
186 {"then", THEN},
187 {"",ERROR},
188#line 94 "TokenLookup.gperf"
189 {"ancestor-or-self", ANCESTOR_OR_SELF},
190#line 148 "TokenLookup.gperf"
191 {"le", LE},
192#line 119 "TokenLookup.gperf"
193 {"document-node", DOCUMENT_NODE},
194#line 180 "TokenLookup.gperf"
195 {"text", TEXT},
196 {"",ERROR},
197#line 174 "TokenLookup.gperf"
198 {"schema", SCHEMA},
199 {"",ERROR},
200#line 118 "TokenLookup.gperf"
201 {"document", DOCUMENT},
202 {"",ERROR},
203#line 114 "TokenLookup.gperf"
204 {"descendant", DESCENDANT},
205 {"",ERROR},
206#line 150 "TokenLookup.gperf"
207 {"lt", LT},
208#line 95 "TokenLookup.gperf"
209 {"and", AND},
210#line 155 "TokenLookup.gperf"
211 {"node", NODE},
212#line 147 "TokenLookup.gperf"
213 {"least", LEAST},
214#line 172 "TokenLookup.gperf"
215 {"schema-attribute", SCHEMA_ATTRIBUTE},
216 {"",ERROR},
217#line 128 "TokenLookup.gperf"
218 {"external", EXTERNAL},
219 {"",ERROR},
220#line 116 "TokenLookup.gperf"
221 {"descending", DESCENDING},
222#line 157 "TokenLookup.gperf"
223 {"no-preserve", NO_PRESERVE},
224#line 113 "TokenLookup.gperf"
225 {"default", DEFAULT},
226#line 149 "TokenLookup.gperf"
227 {"let", LET},
228#line 173 "TokenLookup.gperf"
229 {"schema-element", SCHEMA_ELEMENT},
230 {"",ERROR}, {"",ERROR},
231#line 110 "TokenLookup.gperf"
232 {"construction", CONSTRUCTION},
233#line 115 "TokenLookup.gperf"
234 {"descendant-or-self", DESCENDANT_OR_SELF},
235#line 175 "TokenLookup.gperf"
236 {"self", SELF},
237#line 156 "TokenLookup.gperf"
238 {"no-inherit", NO_INHERIT},
239 {"",ERROR},
240#line 131 "TokenLookup.gperf"
241 {"follows", FOLLOWS},
242#line 93 "TokenLookup.gperf"
243 {"ancestor", ANCESTOR},
244 {"",ERROR}, {"",ERROR}, {"",ERROR},
245#line 182 "TokenLookup.gperf"
246 {"to", TO},
247#line 133 "TokenLookup.gperf"
248 {"function", FUNCTION},
249#line 108 "TokenLookup.gperf"
250 {"collation", COLLATION},
251 {"",ERROR},
252#line 178 "TokenLookup.gperf"
253 {"strict", STRICT},
254 {"",ERROR},
255#line 146 "TokenLookup.gperf"
256 {"lax", LAX},
257 {"",ERROR},
258#line 122 "TokenLookup.gperf"
259 {"empty", EMPTY},
260 {"",ERROR},
261#line 158 "TokenLookup.gperf"
262 {"of", OF},
263#line 168 "TokenLookup.gperf"
264 {"preserve", PRESERVE},
265#line 129 "TokenLookup.gperf"
266 {"following", FOLLOWING},
267 {"",ERROR}, {"",ERROR},
268#line 144 "TokenLookup.gperf"
269 {"is", IS},
270#line 165 "TokenLookup.gperf"
271 {"precedes", PRECEDES},
272#line 123 "TokenLookup.gperf"
273 {"empty-sequence", EMPTY_SEQUENCE},
274 {"",ERROR}, {"",ERROR},
275#line 130 "TokenLookup.gperf"
276 {"following-sibling", FOLLOWING_SIBLING},
277#line 142 "TokenLookup.gperf"
278 {"instance", INSTANCE},
279#line 186 "TokenLookup.gperf"
280 {"unordered", UNORDERED},
281#line 101 "TokenLookup.gperf"
282 {"base-uri", BASEURI},
283#line 170 "TokenLookup.gperf"
284 {"return", RETURN},
285 {"",ERROR},
286#line 187 "TokenLookup.gperf"
287 {"validate", VALIDATE},
288 {"",ERROR},
289#line 111 "TokenLookup.gperf"
290 {"copy-namespaces", COPY_NAMESPACES},
291#line 159 "TokenLookup.gperf"
292 {"option", OPTION},
293#line 138 "TokenLookup.gperf"
294 {"if", IF},
295 {"",ERROR},
296#line 166 "TokenLookup.gperf"
297 {"preceding", PRECEDING},
298 {"",ERROR}, {"",ERROR},
299#line 141 "TokenLookup.gperf"
300 {"in", IN},
301 {"",ERROR},
302#line 143 "TokenLookup.gperf"
303 {"intersect", INTERSECT},
304#line 185 "TokenLookup.gperf"
305 {"union", UNION},
306 {"",ERROR},
307#line 167 "TokenLookup.gperf"
308 {"preceding-sibling", PRECEDING_SIBLING},
309#line 161 "TokenLookup.gperf"
310 {"ordering", ORDERING},
311#line 176 "TokenLookup.gperf"
312 {"some", SOME},
313#line 107 "TokenLookup.gperf"
314 {"child", CHILD},
315 {"",ERROR},
316#line 160 "TokenLookup.gperf"
317 {"ordered", ORDERED},
318#line 188 "TokenLookup.gperf"
319 {"variable", VARIABLE},
320 {"",ERROR}, {"",ERROR}, {"",ERROR},
321#line 163 "TokenLookup.gperf"
322 {"or", OR},
323 {"",ERROR}, {"",ERROR}, {"",ERROR}, {"",ERROR},
324#line 109 "TokenLookup.gperf"
325 {"comment", COMMENT},
326 {"",ERROR}, {"",ERROR},
327#line 184 "TokenLookup.gperf"
328 {"typeswitch", TYPESWITCH},
329 {"",ERROR},
330#line 140 "TokenLookup.gperf"
331 {"inherit", INHERIT},
332#line 117 "TokenLookup.gperf"
333 {"div", DIV},
334 {"",ERROR}, {"",ERROR},
335#line 152 "TokenLookup.gperf"
336 {"module", MODULE},
337 {"",ERROR},
338#line 132 "TokenLookup.gperf"
339 {"for", FOR},
340#line 153 "TokenLookup.gperf"
341 {"namespace", NAMESPACE},
342 {"",ERROR}, {"",ERROR},
343#line 189 "TokenLookup.gperf"
344 {"version", VERSION},
345 {"",ERROR}, {"",ERROR},
346#line 179 "TokenLookup.gperf"
347 {"strip", STRIP},
348 {"",ERROR}, {"",ERROR}, {"",ERROR}, {"",ERROR},
349#line 162 "TokenLookup.gperf"
350 {"order", ORDER},
351#line 164 "TokenLookup.gperf"
352 {"parent", PARENT},
353 {"",ERROR}, {"",ERROR}, {"",ERROR}, {"",ERROR},
354 {"",ERROR}, {"",ERROR},
355#line 151 "TokenLookup.gperf"
356 {"mod", MOD},
357 {"",ERROR}, {"",ERROR}, {"",ERROR}, {"",ERROR},
358 {"",ERROR}, {"",ERROR}, {"",ERROR}, {"",ERROR},
359 {"",ERROR}, {"",ERROR}, {"",ERROR}, {"",ERROR},
360 {"",ERROR}, {"",ERROR}, {"",ERROR}, {"",ERROR},
361 {"",ERROR},
362#line 139 "TokenLookup.gperf"
363 {"import", IMPORT},
364 {"",ERROR}, {"",ERROR}, {"",ERROR}, {"",ERROR},
365 {"",ERROR}, {"",ERROR}, {"",ERROR}, {"",ERROR},
366 {"",ERROR}, {"",ERROR},
367#line 169 "TokenLookup.gperf"
368 {"processing-instruction", PROCESSING_INSTRUCTION},
369 {"",ERROR}, {"",ERROR}, {"",ERROR}, {"",ERROR},
370 {"",ERROR}, {"",ERROR},
371#line 145 "TokenLookup.gperf"
372 {"item", ITEM},
373 {"",ERROR}, {"",ERROR}, {"",ERROR}, {"",ERROR},
374 {"",ERROR}, {"",ERROR}, {"",ERROR}, {"",ERROR},
375 {"",ERROR}, {"",ERROR}, {"",ERROR}, {"",ERROR},
376 {"",ERROR}, {"",ERROR}, {"",ERROR}, {"",ERROR},
377 {"",ERROR}, {"",ERROR}, {"",ERROR}, {"",ERROR},
378 {"",ERROR}, {"",ERROR}, {"",ERROR}, {"",ERROR},
379 {"",ERROR}, {"",ERROR}, {"",ERROR}, {"",ERROR},
380 {"",ERROR},
381#line 137 "TokenLookup.gperf"
382 {"idiv", IDIV}
383 };
384
385 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
386 {
387 register int key = hash (str, len);
388
389 if (key <= MAX_HASH_VALUE && key >= 0)
390 {
391 register const char *s = wordlist[key].name;
392
393 if (*str == *s && !strcmp (str + 1, s + 1))
394 return &wordlist[key];
395 }
396 }
397 return 0;
398}
399#line 192 "TokenLookup.gperf"
400
401
402} /* Close the QPatternist namespace. */
403
404QT_END_NAMESPACE
Note: See TracBrowser for help on using the repository browser.