1 /****************************************************************************
3 ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
6 ** This file is part of the QtXmlPatterns module of the Qt Toolkit.
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 Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
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 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
40 ****************************************************************************/
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>
50 * @class QPatternist::TokenLookup
51 * @short Contains a perfect hash function for XQuery's keywords.
55 * @fn QPatternist::TokenLookup::value(const QString &keyword)
56 * Looks up @p keyword and returns a pointer to the corresponding value.
58 * If @p keyword is not contained in the hash, a null pointer is returned.
63 * @short This file is the @c gperf declaration for generating TokenLookup.cpp.
65 * You generate TokenLookup.cpp by running:
68 * gperf TokenLookup.gperf --output-file=../src/parser/TokenLookup.cpp
71 * @c gperf generates a perfect hash function, which the tokenizer, src/parser/qxquerytokenizer.cpp,
72 * uses for looking up XQuery keywords.
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>
80 /* Declare data const such that the compiler can put them
81 * in the read-only section. */
84 /* Yes, for crisps sake, we want enums instead of macros. */
87 /* Rename in_word_set to value, such that it's more
88 * like QHash::value(). */
89 %define lookup-function-name value
91 /* Rename Perfect_Hash to TokenLookup. More Qt/Patternist'ish. */
92 %define class-name TokenLookup
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
104 const Tokenizer::TokenType token;
111 namespace QPatternist
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. */
121 "ancestor-or-self", ANCESTOR_OR_SELF
124 "ascending", ASCENDING
127 "attribute", ATTRIBUTE
129 "boundary-space", BOUNDARY_SPACE
135 "collation", COLLATION
137 "construction", CONSTRUCTION
138 "copy-namespaces", COPY_NAMESPACES
141 "descendant", DESCENDANT
142 "descendant-or-self", DESCENDANT_OR_SELF
143 "descending", DESCENDING
146 "document-node", DOCUMENT_NODE
150 "empty-sequence", EMPTY_SEQUENCE
156 "following", FOLLOWING
157 "following-sibling", FOLLOWING_SIBLING
170 "intersect", INTERSECT
180 "namespace", NAMESPACE
183 "no-inherit", NO_INHERIT
184 "no-preserve", NO_PRESERVE
193 "preceding", PRECEDING
194 "preceding-sibling", PRECEDING_SIBLING
196 "processing-instruction", PROCESSING_INSTRUCTION
198 "satisfies", SATISFIES
199 "schema-attribute", SCHEMA_ATTRIBUTE
200 "schema-element", SCHEMA_ELEMENT
211 "typeswitch", TYPESWITCH
213 "unordered", UNORDERED
221 } /* Close the QPatternist namespace. */