From: drh Date: Wed, 27 Dec 2017 17:14:50 +0000 (+0000) Subject: Change the coverage measurement logic in the lemon-generated parser so that X-Git-Tag: version-3.22.0~127^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7038a991b049d35e7207d05fe587dc1f4cae8da1;p=thirdparty%2Fsqlite.git Change the coverage measurement logic in the lemon-generated parser so that it only checks for coverage of state/lookahead pairs that are valid syntax. It turns out that some states are unreachable if the lookahead is not valid syntax, because the states are only reachable through a shift following a reduce, and the reduce does not happen if the lookahead is a syntax error. FossilOrigin-Name: 9dce46508772bd0f9e940c4d44933154044bb58c1b3511dd0143287bf795dd6b --- diff --git a/manifest b/manifest index 74d89bf960..cb95612f6f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sthe\slemon-generated\sparser,\sdo\snot\sreport\sthe\sEnd-of-input\scharacter\sand\nthe\swildcard\scharacter\sas\smissed\scoverage. -D 2017-12-27T16:13:22.261 +C Change\sthe\scoverage\smeasurement\slogic\sin\sthe\slemon-generated\sparser\sso\sthat\nit\sonly\schecks\sfor\scoverage\sof\sstate/lookahead\spairs\sthat\sare\svalid\ssyntax.\nIt\sturns\sout\sthat\ssome\sstates\sare\sunreachable\sif\sthe\slookahead\sis\snot\svalid\nsyntax,\sbecause\sthe\sstates\sare\sonly\sreachable\sthrough\sa\sshift\sfollowing\sa\nreduce,\sand\sthe\sreduce\sdoes\snot\shappen\sif\sthe\slookahead\sis\sa\ssyntax\serror. +D 2017-12-27T17:14:50.938 F Makefile.in ceb40bfcb30ebba8e1202b34c56ff7e13e112f9809e2381d99be32c2726058f5 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 6480671f7c129e61208d69492b3c71ce4310d49fceac83cfb17f1c081e242b69 @@ -1609,7 +1609,7 @@ F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5 F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce F tool/kvtest-speed.sh 4761a9c4b3530907562314d7757995787f7aef8f F tool/lemon.c 7f7735326ca9c3b48327b241063cee52d35d44e20ebe1b3624a81658052a4d39 -F tool/lempar.c 48ca9d9f280762da24d667f423c5421e09a6839d08a7d6a516d009db22974deb +F tool/lempar.c 1b1279a362b7045b4e3214301665c12e32689e2c9caf33b35587669bac6b22fa F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9 F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862 F tool/logest.c 11346aa019e2e77a00902aa7d0cabd27bd2e8cca @@ -1687,7 +1687,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 93792bc58a2eccc7e07b14307388350bb376db32c5055b79a44e4fa8ff91d58e -R 930e0d52d43acba766af53475563b556 +P 3fe964873da16c0e0b1c4f1945f965d4137df7a307acd6a3eb6585ffbaa2afd1 +R 43f297c7f87ea228ee76b1c746f9c4a6 U drh -Z 594a8d4b6a5a5a1f42055bf091b10e50 +Z 38efd78b8cbae26fc786eb4139191684 diff --git a/manifest.uuid b/manifest.uuid index 5d9f174839..8cb561dc1a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3fe964873da16c0e0b1c4f1945f965d4137df7a307acd6a3eb6585ffbaa2afd1 \ No newline at end of file +9dce46508772bd0f9e940c4d44933154044bb58c1b3511dd0143287bf795dd6b \ No newline at end of file diff --git a/tool/lempar.c b/tool/lempar.c index e5dd50cfb7..97fd421334 100644 --- a/tool/lempar.c +++ b/tool/lempar.c @@ -467,20 +467,25 @@ static unsigned char yycoverage[YYNSTATE][YYNTOKEN]; /* ** Write into out a description of every state/lookahead combination that -** has not previously been seen by the parser. Return the number of -** missed state/lookahead combinations. +** +** (1) has not been used by the parser, and +** (2) is not a syntax error. +** +** Return the number of missed state/lookahead combinations. */ #if defined(YYCOVERAGE) int ParseCoverage(FILE *out){ - int i, j; + int stateno, iLookAhead, i; int nMissed = 0; - for(i=0; i=0 && i+YYNTOKEN<=sizeof(yy_lookahead)/sizeof(yy_lookahead[0]) ); assert( iLookAhead!=YYNOCODE ); + assert( iLookAhead < YYNTOKEN ); i += iLookAhead; - assert( i>=0 && i