Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | The makefile now runs mkkeywordhash.c. Keywords that are unused are omitted from the keyword hash table. (CVS 2045) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
007aec11333432e08d1091b728773011 |
User & Date: | drh 2004-11-03 03:59:57 |
Context
2004-11-03
| ||
08:44 | Auto-vacuum bug: Correctly manipulate page cache hash-table entries in sqlite3pager_movepage(). (CVS 2046) (check-in: 719c1b79 user: danielk1977 tags: trunk) | |
03:59 | The makefile now runs mkkeywordhash.c. Keywords that are unused are omitted from the keyword hash table. (CVS 2045) (check-in: 007aec11 user: drh tags: trunk) | |
03:52 | Auto-vacuum bugfix: Do not attempt to move a pointer-map page during auto-vacuum. (CVS 2044) (check-in: bd50fbb5 user: danielk1977 tags: trunk) | |
Changes
Changes to Makefile.in.
︙ | ︙ | |||
72 73 74 75 76 77 78 79 80 81 82 83 84 85 | # default to file, 2 to default to memory, and 3 to force temporary # tables to always be in memory. # TEMP_STORE = -DTEMP_STORE=@TEMP_STORE@ # You should not have to change anything below this line ############################################################################### # Object files for the SQLite library. # LIBOBJ = attach.lo auth.lo btree.lo build.lo date.lo delete.lo \ expr.lo func.lo hash.lo insert.lo \ main.lo opcodes.lo os_mac.lo os_unix.lo os_win.lo \ pager.lo parse.lo pragma.lo printf.lo random.lo \ | > > | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | # default to file, 2 to default to memory, and 3 to force temporary # tables to always be in memory. # TEMP_STORE = -DTEMP_STORE=@TEMP_STORE@ # You should not have to change anything below this line ############################################################################### BEXE = @BUILD_EXEEXT@ # Object files for the SQLite library. # LIBOBJ = attach.lo auth.lo btree.lo build.lo date.lo delete.lo \ expr.lo func.lo hash.lo insert.lo \ main.lo opcodes.lo os_mac.lo os_unix.lo os_win.lo \ pager.lo parse.lo pragma.lo printf.lo random.lo \ |
︙ | ︙ | |||
207 208 209 210 211 212 213 | # This target creates a directory named "tsrc" and fills it with # copies of all of the C source code and header files needed to # build on the target system. Some of the C source code and header # files are automatically generated. This target takes care of # all that automatic generation. # | | | | | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | # This target creates a directory named "tsrc" and fills it with # copies of all of the C source code and header files needed to # build on the target system. Some of the C source code and header # files are automatically generated. This target takes care of # all that automatic generation. # target_source: $(SRC) parse.c opcodes.c keywordhash.c $(VDBEHDR) rm -rf tsrc mkdir -p tsrc cp $(SRC) $(VDBEHDR) tsrc rm tsrc/sqlite.h.in tsrc/parse.y cp parse.c opcodes.c keywordhash.c tsrc cp $(TOP)/sqlite3.def tsrc # Rules to build the LEMON compiler generator # lemon$(BEXE): $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c $(BCC) -o lemon $(TOP)/tool/lemon.c cp $(TOP)/tool/lempar.c . # Rules to build individual files # attach.lo: $(TOP)/src/attach.c $(HDR) |
︙ | ︙ | |||
302 303 304 305 306 307 308 | $(LTCOMPILE) $(THREADSAFE) -c $(TOP)/src/os_win.c parse.lo: parse.c $(HDR) $(LTCOMPILE) -c parse.c parse.h: parse.c | | | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | $(LTCOMPILE) $(THREADSAFE) -c $(TOP)/src/os_win.c parse.lo: parse.c $(HDR) $(LTCOMPILE) -c parse.c parse.h: parse.c parse.c: $(TOP)/src/parse.y lemon$(BEXE) cp $(TOP)/src/parse.y . ./lemon $(OPTS) parse.y pragma.lo: $(TOP)/src/pragma.c $(HDR) $(LTCOMPILE) $(TCL_FLAGS) -c $(TOP)/src/pragma.c printf.lo: $(TOP)/src/printf.c $(HDR) |
︙ | ︙ | |||
328 329 330 331 332 333 334 | table.lo: $(TOP)/src/table.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/table.c tclsqlite.lo: $(TOP)/src/tclsqlite.c $(HDR) $(LTCOMPILE) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c | | > > > > | 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | table.lo: $(TOP)/src/table.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/table.c tclsqlite.lo: $(TOP)/src/tclsqlite.c $(HDR) $(LTCOMPILE) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c tokenize.lo: $(TOP)/src/tokenize.c keywordhash.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/tokenize.c keywordhash.c: $(TOP)/tool/mkkeywordhash.c $(BCC) -o mkkeywordhash$(BEXE) $(OPTS) $(TOP)/tool/mkkeywordhash.c ./mkkeywordhash$(BEXE) >keywordhash.c trigger.lo: $(TOP)/src/trigger.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/trigger.c update.lo: $(TOP)/src/update.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/update.c |
︙ | ︙ | |||
550 551 552 553 554 555 556 | $(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig; $(INSTALL) -m 0644 sqlite3.pc $(DESTDIR)$(libdir)/pkgconfig; clean: rm -f *.lo *.la *.o sqlite3@TARGET_EXEEXT@ libsqlite3.la rm -f sqlite3.h opcodes.* rm -rf .libs .deps | | > | 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | $(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig; $(INSTALL) -m 0644 sqlite3.pc $(DESTDIR)$(libdir)/pkgconfig; clean: rm -f *.lo *.la *.o sqlite3@TARGET_EXEEXT@ libsqlite3.la rm -f sqlite3.h opcodes.* rm -rf .libs .deps rm -f lemon$(BEXE) lempar.c parse.* sqlite*.tar.gz rm -f mkkeywordhash$(BEXE) keywordhash.c rm -f $(PUBLISH) rm -f *.da *.bb *.bbg gmon.out rm -f testfixture@TARGET_EXEEXT@ test.db rm -rf doc rm -f common.tcl rm -f sqlite3.dll sqlite3.lib |
︙ | ︙ |
Changes to main.mk.
︙ | ︙ | |||
177 178 179 180 181 182 183 | # This target creates a directory named "tsrc" and fills it with # copies of all of the C source code and header files needed to # build on the target system. Some of the C source code and header # files are automatically generated. This target takes care of # all that automatic generation. # | | | | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | # This target creates a directory named "tsrc" and fills it with # copies of all of the C source code and header files needed to # build on the target system. Some of the C source code and header # files are automatically generated. This target takes care of # all that automatic generation. # target_source: $(SRC) $(VDBEHDR) opcodes.c keyworkhash.c rm -rf tsrc mkdir tsrc cp $(SRC) $(VDBEHDR) tsrc rm tsrc/sqlite.h.in tsrc/parse.y cp parse.c opcodes.c keywordhash.c tsrc cp $(TOP)/sqlite3.def tsrc # Rules to build the LEMON compiler generator # lemon: $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c $(BCC) -o lemon $(TOP)/tool/lemon.c cp $(TOP)/tool/lempar.c . |
︙ | ︙ | |||
298 299 300 301 302 303 304 | table.o: $(TOP)/src/table.c $(HDR) $(TCCX) -c $(TOP)/src/table.c tclsqlite.o: $(TOP)/src/tclsqlite.c $(HDR) $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c | | > > > > | 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | table.o: $(TOP)/src/table.c $(HDR) $(TCCX) -c $(TOP)/src/table.c tclsqlite.o: $(TOP)/src/tclsqlite.c $(HDR) $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c tokenize.o: $(TOP)/src/tokenize.c keywordhash.c $(HDR) $(TCCX) -c $(TOP)/src/tokenize.c keywordhash.c: $(TOP)/tool/mkkeywordhash.c $(BCC) -o mkkeywordhash $(OPTS) $(TOP)/tool/mkkeywordhash.c ./mkkeywordhash >keywordhash.c trigger.o: $(TOP)/src/trigger.c $(HDR) $(TCCX) -c $(TOP)/src/trigger.c update.o: $(TOP)/src/update.c $(HDR) $(TCCX) -c $(TOP)/src/update.c |
︙ | ︙ | |||
523 524 525 526 527 528 529 | install: sqlite3 libsqlite3.a sqlite3.h mv sqlite3 /usr/bin mv libsqlite3.a /usr/lib mv sqlite3.h /usr/include clean: rm -f *.o sqlite3 libsqlite3.a sqlite3.h opcodes.* | | | 527 528 529 530 531 532 533 534 535 536 537 | install: sqlite3 libsqlite3.a sqlite3.h mv sqlite3 /usr/bin mv libsqlite3.a /usr/lib mv sqlite3.h /usr/include clean: rm -f *.o sqlite3 libsqlite3.a sqlite3.h opcodes.* rm -f lemon lempar.c parse.* sqlite*.tar.gz mkkeywordhash keywordhash.c rm -f $(PUBLISH) rm -f *.da *.bb *.bbg gmon.out rm -rf tsrc |
Changes to src/parse.y.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** This file contains SQLite's grammar for SQL. Process this file ** using the lemon parser generator to generate C code that runs ** the parser. Lemon will also generate a header file containing ** numeric codes for all of the tokens. ** | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** ************************************************************************* ** This file contains SQLite's grammar for SQL. Process this file ** using the lemon parser generator to generate C code that runs ** the parser. Lemon will also generate a header file containing ** numeric codes for all of the tokens. ** ** @(#) $Id: parse.y,v 1.146 2004/11/03 03:59:57 drh Exp $ */ %token_prefix TK_ %token_type {Token} %default_type {Token} %extra_argument {Parse *pParse} %syntax_error { if( pParse->zErrMsg==0 ){ |
︙ | ︙ | |||
146 147 148 149 150 151 152 153 154 155 156 157 158 159 | DATABASE DEFERRED DESC DETACH EACH END EXCLUSIVE EXPLAIN FAIL FOR GLOB IGNORE IMMEDIATE INITIALLY INSTEAD LIKE MATCH KEY OF OFFSET PRAGMA RAISE REPLACE RESTRICT ROW STATEMENT TEMP TRIGGER VACUUM VIEW %ifdef SQLITE_OMIT_COMPOUND_SELECT EXCEPT INTERSECT UNION %endif . // Define operator precedence early so that this is the first occurance // of the operator tokens in the grammer. Keeping the operators together // causes them to be assigned integer values that are close together, // which keeps parser tables smaller. // | > | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | DATABASE DEFERRED DESC DETACH EACH END EXCLUSIVE EXPLAIN FAIL FOR GLOB IGNORE IMMEDIATE INITIALLY INSTEAD LIKE MATCH KEY OF OFFSET PRAGMA RAISE REPLACE RESTRICT ROW STATEMENT TEMP TRIGGER VACUUM VIEW %ifdef SQLITE_OMIT_COMPOUND_SELECT EXCEPT INTERSECT UNION %endif REINDEX RENAME AUTOINCR CDATE CTIME CTIMESTAMP ALTER . // Define operator precedence early so that this is the first occurance // of the operator tokens in the grammer. Keeping the operators together // causes them to be assigned integer values that are close together, // which keeps parser tables smaller. // |
︙ | ︙ |
Changes to src/tokenize.c.
︙ | ︙ | |||
11 12 13 14 15 16 17 | ************************************************************************* ** An tokenizer for SQL ** ** This file contains C code that splits an SQL input string up into ** individual tokens and sends those tokens one-by-one over to the ** parser for analysis. ** | | | | | < | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ************************************************************************* ** An tokenizer for SQL ** ** This file contains C code that splits an SQL input string up into ** individual tokens and sends those tokens one-by-one over to the ** parser for analysis. ** ** $Id: tokenize.c,v 1.94 2004/11/03 03:59:58 drh Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> #include <stdlib.h> /* ** The sqlite3KeywordCode function looks up an identifier to determine if ** it is a keyword. If it is a keyword, the token code of that keyword is ** returned. If the input is not a keyword, TK_ID is returned. ** ** The implementation of this routine was generated by a program, ** mkkeywordhash.c, located in the tool subdirectory of the distribution. ** The output of the mkkeywordhash.c program is written into a file ** named keywordhash.c and then included into this source file by ** the #include below. */ #include "keywordhash.c" /* ** If X is a character that can be used in an identifier and ** X&0x80==0 then isIdChar[X] will be 1. If X&0x80==0x80 then ** X is always an identifier character. (Hence all UTF-8 ** characters can be part of an identifier). isIdChar[X] will |
︙ | ︙ |
Changes to tool/mkkeywordhash.c.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ** All the keywords of the SQL language are stored as in a hash ** table composed of instances of the following structure. */ typedef struct Keyword Keyword; struct Keyword { char *zName; /* The keyword name */ char *zTokenType; /* Token value for this keyword */ int id; /* Unique ID for this record */ int hash; /* Hash on the keyword */ int offset; /* Offset to start of name string */ int len; /* Length of this keyword, not counting final \000 */ int prefix; /* Number of characters in prefix */ int iNext; /* Index in aKeywordTable[] of next with same hash */ int substrId; /* Id to another keyword this keyword is embedded in */ int substrOffset; /* Offset into substrId for start of this keyword */ }; /* ** These are the keywords */ static Keyword aKeywordTable[] = { | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > | | | | > | | | | | | | | | | | | | > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > | | | | | | | | | | | | | | | | | | | | | | | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | ** All the keywords of the SQL language are stored as in a hash ** table composed of instances of the following structure. */ typedef struct Keyword Keyword; struct Keyword { char *zName; /* The keyword name */ char *zTokenType; /* Token value for this keyword */ int mask; /* Code this keyword if non-zero */ int id; /* Unique ID for this record */ int hash; /* Hash on the keyword */ int offset; /* Offset to start of name string */ int len; /* Length of this keyword, not counting final \000 */ int prefix; /* Number of characters in prefix */ int iNext; /* Index in aKeywordTable[] of next with same hash */ int substrId; /* Id to another keyword this keyword is embedded in */ int substrOffset; /* Offset into substrId for start of this keyword */ }; /* ** Define masks used to determine which keywords are allowed */ #ifdef SQLITE_OMIT_ALTER_TABLE # define ALTER 0 #else # define ALTER 1 #endif #define ALWAYS 2 #ifdef SQLITE_OMIT_ATTACH # define ATTACH 0 #else # define ATTACH 4 #endif #ifdef SQLITE_OMIT_AUTOINCREMENT # define AUTOINCR 0 #else # define AUTOINCR 8 #endif #ifdef SQLITE_OMIT_COMPOUND_SELECT # define COMPOUND 0 #else # define COMPOUND 16 #endif #ifdef SQLITE_OMIT_CONFLICT_CLAUSE # define CONFLICT 0 #else # define CONFLICT 32 #endif #ifdef SQLITE_OMIT_EXPLAIN # define EXPLAIN 0 #else # define EXPLAIN 64 #endif #ifdef SQLITE_OMIT_FOREIGN_KEY # define FKEY 0 #else # define FKEY 128 #endif #ifdef SQLITE_OMIT_PRAGMA # define PRAGMA 0 #else # define PRAGMA 256 #endif #ifdef SQLITE_OMIT_REINDEX # define REINDEX 0 #else # define REINDEX 512 #endif #ifdef SQLITE_OMIT_TRIGGER # define TRIGGER 0 #else # define TRIGGER 1024 #endif #ifdef SQLITE_OMIT_VACUUM # define VACUUM 0 #else # define VACUUM 2048 #endif #ifdef SQLITE_OMIT_VIEW # define VIEW 0 #else # define VIEW 4096 #endif /* ** These are the keywords */ static Keyword aKeywordTable[] = { { "ABORT", "TK_ABORT", CONFLICT|TRIGGER }, { "AFTER", "TK_AFTER", TRIGGER }, { "ALL", "TK_ALL", ALWAYS }, { "ALTER", "TK_ALTER", ALTER }, { "AND", "TK_AND", ALWAYS }, { "AS", "TK_AS", ALWAYS }, { "ASC", "TK_ASC", ALWAYS }, { "ATTACH", "TK_ATTACH", ATTACH }, { "AUTOINCREMENT", "TK_AUTOINCR", AUTOINCR }, { "BEFORE", "TK_BEFORE", TRIGGER }, { "BEGIN", "TK_BEGIN", ALWAYS }, { "BETWEEN", "TK_BETWEEN", ALWAYS }, { "BY", "TK_BY", ALWAYS }, { "CASCADE", "TK_CASCADE", FKEY }, { "CASE", "TK_CASE", ALWAYS }, { "CHECK", "TK_CHECK", ALWAYS }, { "COLLATE", "TK_COLLATE", ALWAYS }, { "COMMIT", "TK_COMMIT", ALWAYS }, { "CONFLICT", "TK_CONFLICT", CONFLICT }, { "CONSTRAINT", "TK_CONSTRAINT", ALWAYS }, { "CREATE", "TK_CREATE", ALWAYS }, { "CROSS", "TK_JOIN_KW", ALWAYS }, { "CURRENT_DATE", "TK_CDATE", ALWAYS }, { "CURRENT_TIME", "TK_CTIME", ALWAYS }, { "CURRENT_TIMESTAMP","TK_CTIMESTAMP", ALWAYS }, { "DATABASE", "TK_DATABASE", ATTACH }, { "DEFAULT", "TK_DEFAULT", ALWAYS }, { "DEFERRED", "TK_DEFERRED", FKEY }, { "DEFERRABLE", "TK_DEFERRABLE", FKEY }, { "DELETE", "TK_DELETE", ALWAYS }, { "DESC", "TK_DESC", ALWAYS }, { "DETACH", "TK_DETACH", ATTACH }, { "DISTINCT", "TK_DISTINCT", ALWAYS }, { "DROP", "TK_DROP", ALWAYS }, { "END", "TK_END", ALWAYS }, { "EACH", "TK_EACH", TRIGGER }, { "ELSE", "TK_ELSE", ALWAYS }, { "EXCEPT", "TK_EXCEPT", COMPOUND }, { "EXCLUSIVE", "TK_EXCLUSIVE", ALWAYS }, { "EXPLAIN", "TK_EXPLAIN", EXPLAIN }, { "FAIL", "TK_FAIL", CONFLICT|TRIGGER }, { "FOR", "TK_FOR", TRIGGER }, { "FOREIGN", "TK_FOREIGN", FKEY }, { "FROM", "TK_FROM", ALWAYS }, { "FULL", "TK_JOIN_KW", ALWAYS }, { "GLOB", "TK_GLOB", ALWAYS }, { "GROUP", "TK_GROUP", ALWAYS }, { "HAVING", "TK_HAVING", ALWAYS }, { "IGNORE", "TK_IGNORE", CONFLICT|TRIGGER }, { "IMMEDIATE", "TK_IMMEDIATE", FKEY }, { "IN", "TK_IN", ALWAYS }, { "INDEX", "TK_INDEX", ALWAYS }, { "INITIALLY", "TK_INITIALLY", FKEY }, { "INNER", "TK_JOIN_KW", ALWAYS }, { "INSERT", "TK_INSERT", ALWAYS }, { "INSTEAD", "TK_INSTEAD", TRIGGER }, { "INTERSECT", "TK_INTERSECT", COMPOUND }, { "INTO", "TK_INTO", ALWAYS }, { "IS", "TK_IS", ALWAYS }, { "ISNULL", "TK_ISNULL", ALWAYS }, { "JOIN", "TK_JOIN", ALWAYS }, { "KEY", "TK_KEY", ALWAYS }, { "LEFT", "TK_JOIN_KW", ALWAYS }, { "LIKE", "TK_LIKE", ALWAYS }, { "LIMIT", "TK_LIMIT", ALWAYS }, { "MATCH", "TK_MATCH", ALWAYS }, { "NATURAL", "TK_JOIN_KW", ALWAYS }, { "NOT", "TK_NOT", ALWAYS }, { "NOTNULL", "TK_NOTNULL", ALWAYS }, { "NULL", "TK_NULL", ALWAYS }, { "OF", "TK_OF", ALWAYS }, { "OFFSET", "TK_OFFSET", ALWAYS }, { "ON", "TK_ON", ALWAYS }, { "OR", "TK_OR", ALWAYS }, { "ORDER", "TK_ORDER", ALWAYS }, { "OUTER", "TK_JOIN_KW", ALWAYS }, { "PRAGMA", "TK_PRAGMA", PRAGMA }, { "PRIMARY", "TK_PRIMARY", ALWAYS }, { "RAISE", "TK_RAISE", TRIGGER }, { "REFERENCES", "TK_REFERENCES", FKEY }, { "REINDEX", "TK_REINDEX", REINDEX }, { "RENAME", "TK_RENAME", ALTER }, { "REPLACE", "TK_REPLACE", CONFLICT }, { "RESTRICT", "TK_RESTRICT", FKEY }, { "RIGHT", "TK_JOIN_KW", ALWAYS }, { "ROLLBACK", "TK_ROLLBACK", ALWAYS }, { "ROW", "TK_ROW", TRIGGER }, { "SELECT", "TK_SELECT", ALWAYS }, { "SET", "TK_SET", ALWAYS }, { "STATEMENT", "TK_STATEMENT", TRIGGER }, { "TABLE", "TK_TABLE", ALWAYS }, { "TEMP", "TK_TEMP", ALWAYS }, { "TEMPORARY", "TK_TEMP", ALWAYS }, { "THEN", "TK_THEN", ALWAYS }, { "TRANSACTION", "TK_TRANSACTION", ALWAYS }, { "TRIGGER", "TK_TRIGGER", TRIGGER }, { "UNION", "TK_UNION", COMPOUND }, { "UNIQUE", "TK_UNIQUE", ALWAYS }, { "UPDATE", "TK_UPDATE", ALWAYS }, { "USING", "TK_USING", ALWAYS }, { "VACUUM", "TK_VACUUM", VACUUM }, { "VALUES", "TK_VALUES", ALWAYS }, { "VIEW", "TK_VIEW", VIEW }, { "WHEN", "TK_WHEN", ALWAYS }, { "WHERE", "TK_WHERE", ALWAYS }, }; /* Number of keywords */ static int NKEYWORD = (sizeof(aKeywordTable)/sizeof(aKeywordTable[0])); /* An array to map all upper-case characters into their corresponding ** lower-case character. */ const unsigned char sqlite3UpperToLower[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, |
︙ | ︙ | |||
196 197 198 199 200 201 202 203 204 205 206 207 208 209 | */ int main(int argc, char **argv){ int i, j, k, h; int bestSize, bestCount; int count; int nChar; int aHash[1000]; /* 1000 is much bigger than NKEYWORD */ /* Fill in the lengths of strings and hashes for all entries. */ for(i=0; i<NKEYWORD; i++){ Keyword *p = &aKeywordTable[i]; p->len = strlen(p->zName); p->hash = UpperToLower[p->zName[0]]*5 + UpperToLower[p->zName[p->len-1]]*3 + p->len; | > > > > > > > > > > | 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | */ int main(int argc, char **argv){ int i, j, k, h; int bestSize, bestCount; int count; int nChar; int aHash[1000]; /* 1000 is much bigger than NKEYWORD */ /* Remove entries from the list of keywords that have mask==0 */ for(i=j=0; i<NKEYWORD; i++){ if( aKeywordTable[i].mask==0 ) continue; if( j<i ){ aKeywordTable[j] = aKeywordTable[i]; } j++; } NKEYWORD = j; /* Fill in the lengths of strings and hashes for all entries. */ for(i=0; i<NKEYWORD; i++){ Keyword *p = &aKeywordTable[i]; p->len = strlen(p->zName); p->hash = UpperToLower[p->zName[0]]*5 + UpperToLower[p->zName[p->len-1]]*3 + p->len; |
︙ | ︙ |