Improve the Lemon parser template (lempar.c) so that it avoids unnecessary

work when the grammer defines YYNOERRORRECOVERY (as SQLite does).  Slightly
smaller and faster code results.

FossilOrigin-Name: 9235b0cf6a37712ae9e5deeb1e5ee064dd5511fa
This commit is contained in:
drh 2016-02-16 01:01:43 +00:00
parent 7ff89807e0
commit dab943cf3d
3 changed files with 13 additions and 7 deletions

View File

@ -1,5 +1,5 @@
C Fix\sa\sharmless\scompiler\swarning\sin\sFTS5.
D 2016-02-15T23:46:36.756
C Improve\sthe\sLemon\sparser\stemplate\s(lempar.c)\sso\sthat\sit\savoids\sunnecessary\nwork\swhen\sthe\sgrammer\sdefines\sYYNOERRORRECOVERY\s(as\sSQLite\sdoes).\s\sSlightly\nsmaller\sand\sfaster\scode\sresults.
D 2016-02-16T01:01:43.571
F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 30f075dc4f27a07abb76088946b2944178d85347
@ -1379,7 +1379,7 @@ F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4
F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5
F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce
F tool/lemon.c 799e73e19a33b8dd7767a7fa34618ed2a9c2397d
F tool/lempar.c 3ec1463a034b37d87d782be5f6b8b10a3b1ecbe7
F tool/lempar.c ff7763747f93c9d7eac6df1e802a200b3f0e2cc0
F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862
F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6
F tool/mkautoconfamal.sh c78caa3214f25dc28ea157b5a82abb311f209906
@ -1427,7 +1427,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh a98af506df552f3b3c0d904f94e4cdc4e1a6d598
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 1640f814c7a5210f08c81e52e5a3fb89ac26f4d4
R b9aa8d782c6b62a0c225e4bb87cb9bb3
P e52c90758c53cbb0f74e0d8582e4c3c1bee04150
R 14b39a221176c006cbe52f2c99fdaa8f
U drh
Z 2752a99e50374be8d380aa3f6a98228d
Z ff87b99d3af559ad671417b818afef7b

View File

@ -1 +1 @@
e52c90758c53cbb0f74e0d8582e4c3c1bee04150
9235b0cf6a37712ae9e5deeb1e5ee064dd5511fa

View File

@ -211,7 +211,9 @@ struct yyParser {
#ifdef YYTRACKMAXSTACKDEPTH
int yyidxMax; /* Maximum value of yyidx */
#endif
#ifndef YYNOERRORRECOVERY
int yyerrcnt; /* Shifts left before out of the error */
#endif
ParseARG_SDECL /* A place to hold %extra_argument */
#if YYSTACKDEPTH<=0
int yystksz; /* Current side of the stack */
@ -774,7 +776,9 @@ void Parse(
}
#endif
yypParser->yyidx = 0;
#ifndef YYNOERRORRECOVERY
yypParser->yyerrcnt = -1;
#endif
yypParser->yystack[0].stateno = 0;
yypParser->yystack[0].major = 0;
#ifndef NDEBUG
@ -801,7 +805,9 @@ void Parse(
if( yyact <= YY_MAX_SHIFTREDUCE ){
if( yyact > YY_MAX_SHIFT ) yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
yy_shift(yypParser,yyact,yymajor,&yyminorunion);
#ifndef YYNOERRORRECOVERY
yypParser->yyerrcnt--;
#endif
yymajor = YYNOCODE;
}else if( yyact <= YY_MAX_REDUCE ){
yy_reduce(yypParser,yyact-YY_MIN_REDUCE);