Lemon update 2016-05-24 18:55:08 on branch trunk

— Enhance Lemon and the parser template so that it can once again build parsers that have no unreachable branches. (user: drh)
This commit is contained in:
Marisa Heit 2016-10-13 22:22:04 -05:00
parent 96afce241d
commit 3b1a048885

View file

@ -4233,20 +4233,21 @@ void ReportTable(
fprintf(out, "};\n"); lineno++; fprintf(out, "};\n"); lineno++;
/* Output the yy_shift_ofst[] table */ /* Output the yy_shift_ofst[] table */
fprintf(out, "#define YY_SHIFT_USE_DFLT (%d)\n", mnTknOfst-1); lineno++;
n = lemp->nxstate; n = lemp->nxstate;
while( n>0 && lemp->sorted[n-1]->iTknOfst==NO_OFFSET ) n--; while( n>0 && lemp->sorted[n-1]->iTknOfst==NO_OFFSET ) n--;
fprintf(out, "#define YY_SHIFT_COUNT (%d)\n", n-1); lineno++; fprintf(out, "#define YY_SHIFT_USE_DFLT (%d)\n", lemp->nactiontab); lineno++;
fprintf(out, "#define YY_SHIFT_MIN (%d)\n", mnTknOfst); lineno++; fprintf(out, "#define YY_SHIFT_COUNT (%d)\n", n-1); lineno++;
fprintf(out, "#define YY_SHIFT_MAX (%d)\n", mxTknOfst); lineno++; fprintf(out, "#define YY_SHIFT_MIN (%d)\n", mnTknOfst); lineno++;
fprintf(out, "#define YY_SHIFT_MAX (%d)\n", mxTknOfst); lineno++;
fprintf(out, "static const %s yy_shift_ofst[] = {\n", fprintf(out, "static const %s yy_shift_ofst[] = {\n",
minimum_size_type(mnTknOfst-1, mxTknOfst, &sz)); lineno++; minimum_size_type(mnTknOfst, lemp->nterminal+lemp->nactiontab, &sz));
lineno++;
lemp->tablesize += n*sz; lemp->tablesize += n*sz;
for(i=j=0; i<n; i++){ for(i=j=0; i<n; i++){
int ofst; int ofst;
stp = lemp->sorted[i]; stp = lemp->sorted[i];
ofst = stp->iTknOfst; ofst = stp->iTknOfst;
if( ofst==NO_OFFSET ) ofst = mnTknOfst - 1; if( ofst==NO_OFFSET ) ofst = lemp->nactiontab;
if( j==0 ) fprintf(out," /* %5d */ ", i); if( j==0 ) fprintf(out," /* %5d */ ", i);
fprintf(out, " %4d,", ofst); fprintf(out, " %4d,", ofst);
if( j==9 || i==n-1 ){ if( j==9 || i==n-1 ){