mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Do not sort terminal symbols by name. The terminals remain in the same order
that they are encountered in the grammar file. This results in parse tables that are 25% smaller. (CVS 1261) FossilOrigin-Name: f36b122d9767fa9e6dc5bcce04b5606d67cad3d9
This commit is contained in:
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Test\scases\sfor\sprintf\sof\sdouble\soverflows.\s(CVS\s1260)
|
||||
D 2004-02-21T19:41:04
|
||||
C Do\snot\ssort\sterminal\ssymbols\sby\sname.\s\sThe\sterminals\sremain\sin\sthe\ssame\sorder\nthat\sthey\sare\sencountered\sin\sthe\sgrammar\sfile.\s\sThis\sresults\sin\sparse\stables\nthat\sare\s25%\ssmaller.\s(CVS\s1261)
|
||||
D 2004-02-22T00:08:05
|
||||
F Makefile.in cfd75c46b335881999333a9e4b982fa8491f200b
|
||||
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
|
||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||
@ -150,7 +150,7 @@ F test/version.test 92adee5d98cf6e3eb0d1cf5186952e8114931bf6
|
||||
F test/view.test 1ee12c6f8f4791a2c0655120d5562a49400cfe53
|
||||
F test/where.test cb3a2ed062ce4b5f08aff2d08027c6a46d68c47b
|
||||
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
|
||||
F tool/lemon.c 0bd764091cd818717ee62193015873d73ca87e09
|
||||
F tool/lemon.c 38a39c623df325bcbd67152d6f92e09edbee8b83
|
||||
F tool/lempar.c 0b5e7a58634e0d448929b8e85f7981c2aa708d57
|
||||
F tool/memleak.awk b744b6109566206c746d826f6ecdba34662216bc
|
||||
F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8
|
||||
@ -189,7 +189,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
|
||||
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
|
||||
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
|
||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||
P 7d5ede5b6ef515808995d4631f8d19aca95a9105
|
||||
R 646a913df290c066f79aac3643cf5d03
|
||||
P 96a6d2d3ff5bd0aaff188ee1c5e2f02cbea435b2
|
||||
R 0e6582f9731de84f26f84d0ae9c2aae5
|
||||
U drh
|
||||
Z 9d555a968759d9e632af0a2e2d7d8e20
|
||||
Z 8622cd6065d062299240ddf4ac0eb777
|
||||
|
@ -1 +1 @@
|
||||
96a6d2d3ff5bd0aaff188ee1c5e2f02cbea435b2
|
||||
f36b122d9767fa9e6dc5bcce04b5606d67cad3d9
|
21
tool/lemon.c
21
tool/lemon.c
@ -1387,6 +1387,7 @@ char **argv;
|
||||
lem.nsymbol = Symbol_count();
|
||||
Symbol_new("{default}");
|
||||
lem.symbols = Symbol_arrayof();
|
||||
for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i;
|
||||
qsort(lem.symbols,lem.nsymbol+1,sizeof(struct symbol*),
|
||||
(int(*)())Symbolcmpp);
|
||||
for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i;
|
||||
@ -3886,12 +3887,20 @@ char *x;
|
||||
return sp;
|
||||
}
|
||||
|
||||
/* Compare two symbols */
|
||||
int Symbolcmpp(a,b)
|
||||
struct symbol **a;
|
||||
struct symbol **b;
|
||||
{
|
||||
return strcmp((**a).name,(**b).name);
|
||||
/* Compare two symbols for working purposes
|
||||
**
|
||||
** Symbols that begin with upper case letters (terminals or tokens)
|
||||
** must sort before symbols that begin with lower case letters
|
||||
** (non-terminals). Other than that, the order does not matter.
|
||||
**
|
||||
** We find experimentally that leaving the symbols in their original
|
||||
** order (the order they appeared in the grammar file) gives the
|
||||
** smallest parser tables in SQLite.
|
||||
*/
|
||||
int Symbolcmpp(struct symbol **a, struct symbol **b){
|
||||
int i1 = (**a).index + 10000000*((**a).name[0]>'Z');
|
||||
int i2 = (**b).index + 10000000*((**b).name[0]>'Z');
|
||||
return i1-i2;
|
||||
}
|
||||
|
||||
/* There is one instance of the following structure for each
|
||||
|
Reference in New Issue
Block a user