From cf3e518506547d05641e92c6e9000fb343a5ec00 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 6 Jan 2010 13:07:30 +0000 Subject: [PATCH] Fix an issue with lemon generating incorrect grammars. This issue does not effect SQLite. FossilOrigin-Name: 077a6bee2dd4668a5b13c37aa7d4c052350ec782 --- manifest | 18 +++++++++--------- manifest.uuid | 2 +- tool/lemon.c | 10 ++++++---- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index 1314a6dc79..959dc6ca24 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Version\s3.6.22\sRelease\sCandidate\s2 -D 2010-01-05T15:30:36 +C Fix\san\sissue\swith\slemon\sgenerating\sincorrect\sgrammars.\s\sThis\sissue\sdoes\nnot\seffect\sSQLite. +D 2010-01-06T13:07:31 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -762,7 +762,7 @@ F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439 F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4 F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5 -F tool/lemon.c 3088e4dec7f93c6b0925cf5bac04c8b7c8688835 +F tool/lemon.c f3a625c38b5621674f27775b307ea100b6a7b62d F tool/lempar.c 01ca97f87610d1dac6d8cd96ab109ab1130e76dc F tool/mkkeywordhash.c d2e6b4a5965e23afb80fbe74bb54648cd371f309 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e @@ -786,14 +786,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 4ecb4725b76042ac414caf90039d5d0a5f8f7068 -R 8c69565948e98c03e3dd1dcbed92c860 +P 28d0d7710761114a44a1a3a425a6883c661f06e7 +R cb14a38f5906a10fa21936447376b66a U drh -Z ced91d02ef4d59db7742a1c68eea0156 +Z 437ad8ccf6b703d6a3f5435217fbeff7 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFLQ1sfoxKgR168RlERAoMSAJ4oSysPgDgbT0TYZR0idPBdpGRnXACfQOVY -SZcqrXAqkdego3RbALXEHK4= -=UKAs +iD8DBQFLRIsWoxKgR168RlERAko3AJ9cRW4W+hFzWCSEF5rdeL83LKknrgCfQKRR +l/RSoin5yCY/+/3Q1I6oeNA= +=d16B -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index 90c0776206..efd93353cd 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -28d0d7710761114a44a1a3a425a6883c661f06e7 \ No newline at end of file +077a6bee2dd4668a5b13c37aa7d4c052350ec782 \ No newline at end of file diff --git a/tool/lemon.c b/tool/lemon.c index 75c29fc3e5..b5095f3a17 100644 --- a/tool/lemon.c +++ b/tool/lemon.c @@ -491,6 +491,7 @@ void acttab_action(acttab *p, int lookahead, int action){ */ int acttab_insert(acttab *p){ int i, j, k, n; + int nActtab; /* Number of slots in the p->aAction[] table */ assert( p->nLookahead>0 ); /* Make sure we have enough space to hold the expanded action table @@ -498,7 +499,8 @@ int acttab_insert(acttab *p){ ** must be appended to the current action table */ n = p->mxLookahead + 1; - if( p->nAction + n >= p->nActionAlloc ){ + nActtab = p->nAction + n; + if( nActtab >= p->nActionAlloc ){ int oldAlloc = p->nActionAlloc; p->nActionAlloc = p->nAction + n + p->nActionAlloc + 20; p->aAction = realloc( p->aAction, @@ -516,11 +518,11 @@ int acttab_insert(acttab *p){ /* Scan the existing action table looking for an offset where we can ** insert the current transaction set. Fall out of the loop when that ** offset is found. In the worst case, we fall out of the loop when - ** i reaches p->nAction, which means we append the new transaction set. + ** i reaches nActtab, which means we append the new transaction set. ** ** i is the index in p->aAction[] where p->mnLookahead is inserted. */ - for(i=p->nAction-1; i>=0; i--){ + for(i=nActtab-1; i>=0; i--){ /* First look for an existing action table entry that can be reused */ if( p->aAction[i].lookahead==p->mnLookahead ){ if( p->aAction[i].action!=p->mnAction ) continue; @@ -543,7 +545,7 @@ int acttab_insert(acttab *p){ } if( i<0 ){ /* If no reusable entry is found, look for an empty slot */ - for(i=0; inAction; i++){ + for(i=0; iaAction[i].lookahead<0 ){ for(j=0; jnLookahead; j++){ k = p->aLookahead[j].lookahead - p->mnLookahead + i; -- 2.47.2