mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Modify mkkeywordhash.c so that it puts the original text of each token in
a comment beside the "testcase()" macros. (CVS 6736) FossilOrigin-Name: a7d0817c176832a88788cc973c0aae8dcab57364
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
/*
|
||||
** A header comment placed at the beginning of generated code.
|
||||
@ -15,7 +16,7 @@ static const char zHdr[] =
|
||||
"**\n"
|
||||
"** The code in this file has been automatically generated by\n"
|
||||
"**\n"
|
||||
"** $Header: /home/drh/sqlite/trans/cvs/sqlite/sqlite/tool/mkkeywordhash.c,v 1.37 2009/02/01 00:00:46 drh Exp $\n"
|
||||
"** $Header: /home/drh/sqlite/trans/cvs/sqlite/sqlite/tool/mkkeywordhash.c,v 1.38 2009/06/09 14:27:41 drh Exp $\n"
|
||||
"**\n"
|
||||
"** The code in this file implements a function that determines whether\n"
|
||||
"** or not a given identifier is really an SQL keyword. The same thing\n"
|
||||
@ -44,6 +45,7 @@ struct Keyword {
|
||||
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 */
|
||||
char zOrigName[20]; /* Original keyword name before processing */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -353,6 +355,8 @@ int main(int argc, char **argv){
|
||||
for(i=0; i<nKeyword; i++){
|
||||
Keyword *p = &aKeywordTable[i];
|
||||
p->len = strlen(p->zName);
|
||||
assert( p->len<sizeof(p->zOrigName) );
|
||||
strcpy(p->zOrigName, p->zName);
|
||||
totalLen += p->len;
|
||||
p->hash = (UpperToLower[(int)p->zName[0]]*4) ^
|
||||
(UpperToLower[(int)p->zName[p->len-1]]*3) ^ p->len;
|
||||
@ -576,7 +580,7 @@ int main(int argc, char **argv){
|
||||
" sqlite3StrNICmp(&zText[aOffset[i]],z,n)==0 ){\n");
|
||||
for(i=0; i<nKeyword; i++){
|
||||
printf(" testcase( i==%d ); /* %s */\n",
|
||||
i, aKeywordTable[i].zTokenType);
|
||||
i, aKeywordTable[i].zOrigName);
|
||||
}
|
||||
printf(" return aCode[i];\n");
|
||||
printf(" }\n");
|
||||
|
Reference in New Issue
Block a user