Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(744)

Side by Side Diff: third_party/sqlite/preprocessed/keywordhash.h

Issue 3108030: Move bundled copy of sqlite one level deeper to better separate it... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/sqlite/preprocessed/README ('k') | third_party/sqlite/preprocessed/opcodes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /***** This file contains automatically generated code ******
2 **
3 ** The code in this file has been automatically generated by
4 **
5 ** $Header: /home/drh/sqlite/trans/cvs/sqlite/sqlite/tool/mkkeywordhash.c,v 1.38 2009/06/09 14:27:41 drh Exp $
6 **
7 ** The code in this file implements a function that determines whether
8 ** or not a given identifier is really an SQL keyword. The same thing
9 ** might be implemented more directly using a hand-written hash table.
10 ** But by using this automatically generated code, the size of the code
11 ** is substantially reduced. This is important for embedded applications
12 ** on platforms with limited memory.
13 */
14 /* Hash score: 171 */
15 static int keywordCode(const char *z, int n){
16 /* zText[] encodes 801 bytes of keywords in 541 bytes */
17 /* REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT */
18 /* ABLEFTHENDEFERRABLELSEXCEPTRANSACTIONATURALTERAISEXCLUSIVE */
19 /* XISTSAVEPOINTERSECTRIGGEREFERENCESCONSTRAINTOFFSETEMPORARY */
20 /* UNIQUERYATTACHAVINGROUPDATEBEGINNERELEASEBETWEENOTNULLIKE */
21 /* CASCADELETECASECOLLATECREATECURRENT_DATEDETACHIMMEDIATEJOIN */
22 /* SERTMATCHPLANALYZEPRAGMABORTVALUESVIRTUALIMITWHENWHERENAME */
23 /* AFTEREPLACEANDEFAULTAUTOINCREMENTCASTCOLUMNCOMMITCONFLICTCROSS */
24 /* CURRENT_TIMESTAMPRIMARYDEFERREDISTINCTDROPFAILFROMFULLGLOBYIF */
25 /* ISNULLORDERESTRICTOUTERIGHTROLLBACKROWUNIONUSINGVACUUMVIEW */
26 /* INITIALLY */
27 static const char zText[540] = {
28 'R','E','I','N','D','E','X','E','D','E','S','C','A','P','E','A','C','H',
29 'E','C','K','E','Y','B','E','F','O','R','E','I','G','N','O','R','E','G',
30 'E','X','P','L','A','I','N','S','T','E','A','D','D','A','T','A','B','A',
31 'S','E','L','E','C','T','A','B','L','E','F','T','H','E','N','D','E','F',
32 'E','R','R','A','B','L','E','L','S','E','X','C','E','P','T','R','A','N',
33 'S','A','C','T','I','O','N','A','T','U','R','A','L','T','E','R','A','I',
34 'S','E','X','C','L','U','S','I','V','E','X','I','S','T','S','A','V','E',
35 'P','O','I','N','T','E','R','S','E','C','T','R','I','G','G','E','R','E',
36 'F','E','R','E','N','C','E','S','C','O','N','S','T','R','A','I','N','T',
37 'O','F','F','S','E','T','E','M','P','O','R','A','R','Y','U','N','I','Q',
38 'U','E','R','Y','A','T','T','A','C','H','A','V','I','N','G','R','O','U',
39 'P','D','A','T','E','B','E','G','I','N','N','E','R','E','L','E','A','S',
40 'E','B','E','T','W','E','E','N','O','T','N','U','L','L','I','K','E','C',
41 'A','S','C','A','D','E','L','E','T','E','C','A','S','E','C','O','L','L',
42 'A','T','E','C','R','E','A','T','E','C','U','R','R','E','N','T','_','D',
43 'A','T','E','D','E','T','A','C','H','I','M','M','E','D','I','A','T','E',
44 'J','O','I','N','S','E','R','T','M','A','T','C','H','P','L','A','N','A',
45 'L','Y','Z','E','P','R','A','G','M','A','B','O','R','T','V','A','L','U',
46 'E','S','V','I','R','T','U','A','L','I','M','I','T','W','H','E','N','W',
47 'H','E','R','E','N','A','M','E','A','F','T','E','R','E','P','L','A','C',
48 'E','A','N','D','E','F','A','U','L','T','A','U','T','O','I','N','C','R',
49 'E','M','E','N','T','C','A','S','T','C','O','L','U','M','N','C','O','M',
50 'M','I','T','C','O','N','F','L','I','C','T','C','R','O','S','S','C','U',
51 'R','R','E','N','T','_','T','I','M','E','S','T','A','M','P','R','I','M',
52 'A','R','Y','D','E','F','E','R','R','E','D','I','S','T','I','N','C','T',
53 'D','R','O','P','F','A','I','L','F','R','O','M','F','U','L','L','G','L',
54 'O','B','Y','I','F','I','S','N','U','L','L','O','R','D','E','R','E','S',
55 'T','R','I','C','T','O','U','T','E','R','I','G','H','T','R','O','L','L',
56 'B','A','C','K','R','O','W','U','N','I','O','N','U','S','I','N','G','V',
57 'A','C','U','U','M','V','I','E','W','I','N','I','T','I','A','L','L','Y',
58 };
59 static const unsigned char aHash[127] = {
60 70, 99, 112, 68, 0, 43, 0, 0, 76, 0, 71, 0, 0,
61 41, 12, 72, 15, 0, 111, 79, 49, 106, 0, 19, 0, 0,
62 116, 0, 114, 109, 0, 22, 87, 0, 9, 0, 0, 64, 65,
63 0, 63, 6, 0, 47, 84, 96, 0, 113, 95, 0, 0, 44,
64 0, 97, 24, 0, 17, 0, 117, 48, 23, 0, 5, 104, 25,
65 90, 0, 0, 119, 100, 55, 118, 52, 7, 50, 0, 85, 0,
66 94, 26, 0, 93, 0, 0, 0, 89, 86, 91, 82, 103, 14,
67 38, 102, 0, 75, 0, 18, 83, 105, 31, 0, 115, 74, 107,
68 57, 45, 78, 0, 0, 88, 39, 0, 110, 0, 35, 0, 0,
69 28, 0, 80, 53, 58, 0, 20, 56, 0, 51,
70 };
71 static const unsigned char aNext[119] = {
72 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
73 0, 2, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0,
74 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
75 0, 0, 0, 0, 32, 21, 0, 0, 0, 42, 3, 46, 0,
76 0, 0, 0, 29, 0, 0, 37, 0, 0, 0, 1, 60, 0,
77 0, 61, 0, 40, 0, 0, 0, 0, 0, 0, 0, 59, 0,
78 0, 0, 0, 30, 54, 16, 33, 10, 0, 0, 0, 0, 0,
79 0, 0, 11, 66, 73, 0, 8, 0, 98, 92, 0, 101, 0,
80 81, 0, 69, 0, 0, 108, 27, 36, 67, 77, 0, 34, 62,
81 0, 0,
82 };
83 static const unsigned char aLen[119] = {
84 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6,
85 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 6,
86 11, 2, 7, 5, 5, 9, 6, 9, 9, 7, 10, 10, 4,
87 6, 2, 3, 4, 9, 2, 6, 5, 6, 6, 5, 6, 5,
88 5, 7, 7, 7, 3, 4, 4, 7, 3, 6, 4, 7, 6,
89 12, 6, 9, 4, 6, 5, 4, 7, 6, 5, 6, 7, 5,
90 4, 5, 6, 5, 7, 3, 7, 13, 2, 2, 4, 6, 6,
91 8, 5, 17, 12, 7, 8, 8, 2, 4, 4, 4, 4, 4,
92 2, 2, 6, 5, 8, 5, 5, 8, 3, 5, 5, 6, 4,
93 9, 3,
94 };
95 static const unsigned short int aOffset[119] = {
96 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33,
97 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81,
98 86, 95, 96, 101, 105, 109, 117, 122, 128, 136, 142, 152, 159,
99 162, 162, 165, 167, 167, 171, 176, 179, 184, 189, 194, 197, 203,
100 206, 210, 217, 223, 223, 226, 229, 233, 234, 238, 244, 248, 255,
101 261, 273, 279, 288, 290, 296, 301, 303, 310, 315, 320, 326, 332,
102 337, 341, 344, 350, 354, 361, 363, 370, 372, 374, 383, 387, 393,
103 399, 407, 412, 412, 428, 435, 442, 443, 450, 454, 458, 462, 466,
104 469, 471, 473, 479, 483, 491, 495, 500, 508, 511, 516, 521, 527,
105 531, 536,
106 };
107 static const unsigned char aCode[119] = {
108 TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE,
109 TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN,
110 TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD,
111 TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
112 TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
113 TK_EXCEPT, TK_TRANSACTION,TK_ON, TK_JOIN_KW, TK_ALTER,
114 TK_RAISE, TK_EXCLUSIVE, TK_EXISTS, TK_SAVEPOINT, TK_INTERSECT,
115 TK_TRIGGER, TK_REFERENCES, TK_CONSTRAINT, TK_INTO, TK_OFFSET,
116 TK_OF, TK_SET, TK_TEMP, TK_TEMP, TK_OR,
117 TK_UNIQUE, TK_QUERY, TK_ATTACH, TK_HAVING, TK_GROUP,
118 TK_UPDATE, TK_BEGIN, TK_JOIN_KW, TK_RELEASE, TK_BETWEEN,
119 TK_NOTNULL, TK_NOT, TK_NULL, TK_LIKE_KW, TK_CASCADE,
120 TK_ASC, TK_DELETE, TK_CASE, TK_COLLATE, TK_CREATE,
121 TK_CTIME_KW, TK_DETACH, TK_IMMEDIATE, TK_JOIN, TK_INSERT,
122 TK_MATCH, TK_PLAN, TK_ANALYZE, TK_PRAGMA, TK_ABORT,
123 TK_VALUES, TK_VIRTUAL, TK_LIMIT, TK_WHEN, TK_WHERE,
124 TK_RENAME, TK_AFTER, TK_REPLACE, TK_AND, TK_DEFAULT,
125 TK_AUTOINCR, TK_TO, TK_IN, TK_CAST, TK_COLUMNKW,
126 TK_COMMIT, TK_CONFLICT, TK_JOIN_KW, TK_CTIME_KW, TK_CTIME_KW,
127 TK_PRIMARY, TK_DEFERRED, TK_DISTINCT, TK_IS, TK_DROP,
128 TK_FAIL, TK_FROM, TK_JOIN_KW, TK_LIKE_KW, TK_BY,
129 TK_IF, TK_ISNULL, TK_ORDER, TK_RESTRICT, TK_JOIN_KW,
130 TK_JOIN_KW, TK_ROLLBACK, TK_ROW, TK_UNION, TK_USING,
131 TK_VACUUM, TK_VIEW, TK_INITIALLY, TK_ALL,
132 };
133 int h, i;
134 if( n<2 ) return TK_ID;
135 h = ((charMap(z[0])*4) ^
136 (charMap(z[n-1])*3) ^
137 n) % 127;
138 for(i=((int)aHash[h])-1; i>=0; i=((int)aNext[i])-1){
139 if( aLen[i]==n && sqlite3StrNICmp(&zText[aOffset[i]],z,n)==0 ){
140 testcase( i==0 ); /* REINDEX */
141 testcase( i==1 ); /* INDEXED */
142 testcase( i==2 ); /* INDEX */
143 testcase( i==3 ); /* DESC */
144 testcase( i==4 ); /* ESCAPE */
145 testcase( i==5 ); /* EACH */
146 testcase( i==6 ); /* CHECK */
147 testcase( i==7 ); /* KEY */
148 testcase( i==8 ); /* BEFORE */
149 testcase( i==9 ); /* FOREIGN */
150 testcase( i==10 ); /* FOR */
151 testcase( i==11 ); /* IGNORE */
152 testcase( i==12 ); /* REGEXP */
153 testcase( i==13 ); /* EXPLAIN */
154 testcase( i==14 ); /* INSTEAD */
155 testcase( i==15 ); /* ADD */
156 testcase( i==16 ); /* DATABASE */
157 testcase( i==17 ); /* AS */
158 testcase( i==18 ); /* SELECT */
159 testcase( i==19 ); /* TABLE */
160 testcase( i==20 ); /* LEFT */
161 testcase( i==21 ); /* THEN */
162 testcase( i==22 ); /* END */
163 testcase( i==23 ); /* DEFERRABLE */
164 testcase( i==24 ); /* ELSE */
165 testcase( i==25 ); /* EXCEPT */
166 testcase( i==26 ); /* TRANSACTION */
167 testcase( i==27 ); /* ON */
168 testcase( i==28 ); /* NATURAL */
169 testcase( i==29 ); /* ALTER */
170 testcase( i==30 ); /* RAISE */
171 testcase( i==31 ); /* EXCLUSIVE */
172 testcase( i==32 ); /* EXISTS */
173 testcase( i==33 ); /* SAVEPOINT */
174 testcase( i==34 ); /* INTERSECT */
175 testcase( i==35 ); /* TRIGGER */
176 testcase( i==36 ); /* REFERENCES */
177 testcase( i==37 ); /* CONSTRAINT */
178 testcase( i==38 ); /* INTO */
179 testcase( i==39 ); /* OFFSET */
180 testcase( i==40 ); /* OF */
181 testcase( i==41 ); /* SET */
182 testcase( i==42 ); /* TEMP */
183 testcase( i==43 ); /* TEMPORARY */
184 testcase( i==44 ); /* OR */
185 testcase( i==45 ); /* UNIQUE */
186 testcase( i==46 ); /* QUERY */
187 testcase( i==47 ); /* ATTACH */
188 testcase( i==48 ); /* HAVING */
189 testcase( i==49 ); /* GROUP */
190 testcase( i==50 ); /* UPDATE */
191 testcase( i==51 ); /* BEGIN */
192 testcase( i==52 ); /* INNER */
193 testcase( i==53 ); /* RELEASE */
194 testcase( i==54 ); /* BETWEEN */
195 testcase( i==55 ); /* NOTNULL */
196 testcase( i==56 ); /* NOT */
197 testcase( i==57 ); /* NULL */
198 testcase( i==58 ); /* LIKE */
199 testcase( i==59 ); /* CASCADE */
200 testcase( i==60 ); /* ASC */
201 testcase( i==61 ); /* DELETE */
202 testcase( i==62 ); /* CASE */
203 testcase( i==63 ); /* COLLATE */
204 testcase( i==64 ); /* CREATE */
205 testcase( i==65 ); /* CURRENT_DATE */
206 testcase( i==66 ); /* DETACH */
207 testcase( i==67 ); /* IMMEDIATE */
208 testcase( i==68 ); /* JOIN */
209 testcase( i==69 ); /* INSERT */
210 testcase( i==70 ); /* MATCH */
211 testcase( i==71 ); /* PLAN */
212 testcase( i==72 ); /* ANALYZE */
213 testcase( i==73 ); /* PRAGMA */
214 testcase( i==74 ); /* ABORT */
215 testcase( i==75 ); /* VALUES */
216 testcase( i==76 ); /* VIRTUAL */
217 testcase( i==77 ); /* LIMIT */
218 testcase( i==78 ); /* WHEN */
219 testcase( i==79 ); /* WHERE */
220 testcase( i==80 ); /* RENAME */
221 testcase( i==81 ); /* AFTER */
222 testcase( i==82 ); /* REPLACE */
223 testcase( i==83 ); /* AND */
224 testcase( i==84 ); /* DEFAULT */
225 testcase( i==85 ); /* AUTOINCREMENT */
226 testcase( i==86 ); /* TO */
227 testcase( i==87 ); /* IN */
228 testcase( i==88 ); /* CAST */
229 testcase( i==89 ); /* COLUMN */
230 testcase( i==90 ); /* COMMIT */
231 testcase( i==91 ); /* CONFLICT */
232 testcase( i==92 ); /* CROSS */
233 testcase( i==93 ); /* CURRENT_TIMESTAMP */
234 testcase( i==94 ); /* CURRENT_TIME */
235 testcase( i==95 ); /* PRIMARY */
236 testcase( i==96 ); /* DEFERRED */
237 testcase( i==97 ); /* DISTINCT */
238 testcase( i==98 ); /* IS */
239 testcase( i==99 ); /* DROP */
240 testcase( i==100 ); /* FAIL */
241 testcase( i==101 ); /* FROM */
242 testcase( i==102 ); /* FULL */
243 testcase( i==103 ); /* GLOB */
244 testcase( i==104 ); /* BY */
245 testcase( i==105 ); /* IF */
246 testcase( i==106 ); /* ISNULL */
247 testcase( i==107 ); /* ORDER */
248 testcase( i==108 ); /* RESTRICT */
249 testcase( i==109 ); /* OUTER */
250 testcase( i==110 ); /* RIGHT */
251 testcase( i==111 ); /* ROLLBACK */
252 testcase( i==112 ); /* ROW */
253 testcase( i==113 ); /* UNION */
254 testcase( i==114 ); /* USING */
255 testcase( i==115 ); /* VACUUM */
256 testcase( i==116 ); /* VIEW */
257 testcase( i==117 ); /* INITIALLY */
258 testcase( i==118 ); /* ALL */
259 return aCode[i];
260 }
261 }
262 return TK_ID;
263 }
264 int sqlite3KeywordCode(const unsigned char *z, int n){
265 return keywordCode((char*)z, n);
266 }
OLDNEW
« no previous file with comments | « third_party/sqlite/preprocessed/README ('k') | third_party/sqlite/preprocessed/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698