|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the QtXmlPatterns module of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 /** |
|
43 * @file qtokenlookup.cpp |
|
44 * @short This file is generated from TokenLookup.gperf and contains |
|
45 * TokenLookup, a class housing a perfect hash function class for XQuery's keywords. |
|
46 * @author Frans Englich <frans.englich@nokia.com> |
|
47 */ |
|
48 |
|
49 /** |
|
50 * @class QPatternist::TokenLookup |
|
51 * @short Contains a perfect hash function for XQuery's keywords. |
|
52 */ |
|
53 |
|
54 /** |
|
55 * @fn QPatternist::TokenLookup::value(const QString &keyword) |
|
56 * Looks up @p keyword and returns a pointer to the corresponding value. |
|
57 * |
|
58 * If @p keyword is not contained in the hash, a null pointer is returned. |
|
59 */ |
|
60 |
|
61 /** |
|
62 * @file |
|
63 * @short This file is the @c gperf declaration for generating TokenLookup.cpp. |
|
64 * |
|
65 * You generate TokenLookup.cpp by running: |
|
66 * |
|
67 * @code |
|
68 * gperf TokenLookup.gperf --output-file=../src/parser/TokenLookup.cpp |
|
69 * @endcode |
|
70 * |
|
71 * @c gperf generates a perfect hash function, which the tokenizer, src/parser/qxquerytokenizer.cpp, |
|
72 * uses for looking up XQuery keywords. |
|
73 * |
|
74 * @see <a href="http://en.wikipedia.org/wiki/Perfect_hash_function">Perfect hash function, Wikipedia</a> |
|
75 * @see <a href="http://www.gnu.org/software/gperf/manual/gperf.html">Perfect Hash Function Generator</a> |
|
76 */ |
|
77 |
|
78 %language=C++ |
|
79 |
|
80 /* Declare data const such that the compiler can put them |
|
81 * in the read-only section. */ |
|
82 %readonly-tables |
|
83 |
|
84 /* Yes, for crisps sake, we want enums instead of macros. */ |
|
85 %enum |
|
86 |
|
87 /* Rename in_word_set to value, such that it's more |
|
88 * like QHash::value(). */ |
|
89 %define lookup-function-name value |
|
90 |
|
91 /* Rename Perfect_Hash to TokenLookup. More Qt/Patternist'ish. */ |
|
92 %define class-name TokenLookup |
|
93 |
|
94 /* Output initializers for the TokenMap struct. Note the lack |
|
95 * of a space between the comma and ERROR. Anything else is |
|
96 * a syntax error to gperf. Rocket science. */ |
|
97 %define initializer-suffix ,ERROR |
|
98 |
|
99 %struct-type |
|
100 |
|
101 struct TokenMap |
|
102 { |
|
103 const char *name; |
|
104 const Tokenizer::TokenType token; |
|
105 } |
|
106 |
|
107 %{ |
|
108 |
|
109 QT_BEGIN_NAMESPACE |
|
110 |
|
111 namespace QPatternist |
|
112 { |
|
113 |
|
114 %} |
|
115 |
|
116 /* The strings below are in UTF-16 encoding. Subsequently, each ASCII |
|
117 * character is stored as the ASCII character, followed by a null byte. |
|
118 * Sorted alphabetically. */ |
|
119 %% |
|
120 "ancestor", ANCESTOR |
|
121 "ancestor-or-self", ANCESTOR_OR_SELF |
|
122 "and", AND |
|
123 "as", AS |
|
124 "ascending", ASCENDING |
|
125 "assign", ASSIGN |
|
126 "at", AT |
|
127 "attribute", ATTRIBUTE |
|
128 "base-uri", BASEURI |
|
129 "boundary-space", BOUNDARY_SPACE |
|
130 "by", BY |
|
131 "case", CASE |
|
132 "castable", CASTABLE |
|
133 "cast", CAST |
|
134 "child", CHILD |
|
135 "collation", COLLATION |
|
136 "comment", COMMENT |
|
137 "construction", CONSTRUCTION |
|
138 "copy-namespaces", COPY_NAMESPACES |
|
139 "declare", DECLARE |
|
140 "default", DEFAULT |
|
141 "descendant", DESCENDANT |
|
142 "descendant-or-self", DESCENDANT_OR_SELF |
|
143 "descending", DESCENDING |
|
144 "div", DIV |
|
145 "document", DOCUMENT |
|
146 "document-node", DOCUMENT_NODE |
|
147 "element", ELEMENT |
|
148 "else", ELSE |
|
149 "empty", EMPTY |
|
150 "empty-sequence", EMPTY_SEQUENCE |
|
151 "encoding", ENCODING |
|
152 "eq", EQ |
|
153 "every", EVERY |
|
154 "except", EXCEPT |
|
155 "external", EXTERNAL |
|
156 "following", FOLLOWING |
|
157 "following-sibling", FOLLOWING_SIBLING |
|
158 "follows", FOLLOWS |
|
159 "for", FOR |
|
160 "function", FUNCTION |
|
161 "ge", GE |
|
162 "greatest", GREATEST |
|
163 "gt", GT |
|
164 "idiv", IDIV |
|
165 "if", IF |
|
166 "import", IMPORT |
|
167 "inherit", INHERIT |
|
168 "in", IN |
|
169 "instance", INSTANCE |
|
170 "intersect", INTERSECT |
|
171 "is", IS |
|
172 "item", ITEM |
|
173 "lax", LAX |
|
174 "least", LEAST |
|
175 "le", LE |
|
176 "let", LET |
|
177 "lt", LT |
|
178 "mod", MOD |
|
179 "module", MODULE |
|
180 "namespace", NAMESPACE |
|
181 "ne", NE |
|
182 "node", NODE |
|
183 "no-inherit", NO_INHERIT |
|
184 "no-preserve", NO_PRESERVE |
|
185 "of", OF |
|
186 "option", OPTION |
|
187 "ordered", ORDERED |
|
188 "ordering", ORDERING |
|
189 "order", ORDER |
|
190 "or", OR |
|
191 "parent", PARENT |
|
192 "precedes", PRECEDES |
|
193 "preceding", PRECEDING |
|
194 "preceding-sibling", PRECEDING_SIBLING |
|
195 "preserve", PRESERVE |
|
196 "processing-instruction", PROCESSING_INSTRUCTION |
|
197 "return", RETURN |
|
198 "satisfies", SATISFIES |
|
199 "schema-attribute", SCHEMA_ATTRIBUTE |
|
200 "schema-element", SCHEMA_ELEMENT |
|
201 "schema", SCHEMA |
|
202 "self", SELF |
|
203 "some", SOME |
|
204 "stable", STABLE |
|
205 "strict", STRICT |
|
206 "strip", STRIP |
|
207 "text", TEXT |
|
208 "then", THEN |
|
209 "to", TO |
|
210 "treat", TREAT |
|
211 "typeswitch", TYPESWITCH |
|
212 "union", UNION |
|
213 "unordered", UNORDERED |
|
214 "validate", VALIDATE |
|
215 "variable", VARIABLE |
|
216 "version", VERSION |
|
217 "where", WHERE |
|
218 "xquery", XQUERY |
|
219 %% |
|
220 |
|
221 } /* Close the QPatternist namespace. */ |
|
222 |
|
223 QT_END_NAMESPACE |