Lemon update 2010-07-19 01:52:07 on branch trunk

- Improvements to the formatting of parse.out file from Lemon. Add the -r option to Lemon to disable the state sorting, making debugging easier. (user: drh)
This commit is contained in:
Randy Heit 2016-03-20 09:58:45 -05:00
parent e20dc913b7
commit cb7eb1abc5

View file

@ -1079,7 +1079,7 @@ static int resolve_conflict(
/* Not enough precedence information. */
apy->type = SRCONFLICT;
errcnt++;
}else if( spx->prec>spy->prec ){ /* Lower precedence wins */
}else if( spx->prec>spy->prec ){ /* higher precedence wins */
apy->type = RD_RESOLVED;
}else if( spx->prec<spy->prec ){
apx->type = SH_RESOLVED;
@ -1412,6 +1412,7 @@ int main(int argc, char **argv)
static int statistics = 0;
static int mhflag = 0;
static int nolinenosflag = 0;
static int noResort = 0;
static struct s_options options[] = {
{OPT_FLAG, "b", (char*)&basisflag, "Print only the basis in report."},
{OPT_FLAG, "c", (char*)&compress, "Don't compress the action table."},
@ -1423,6 +1424,7 @@ int main(int argc, char **argv)
{OPT_FLAG, "p", (char*)&showPrecedenceConflict,
"Show conflicts resolved by precedence rules"},
{OPT_FLAG, "q", (char*)&quiet, "(Quiet) Don't print the report file."},
{OPT_FLAG, "r", (char*)&noResort, "Do not sort or renumber states"},
{OPT_FLAG, "s", (char*)&statistics,
"Print parser stats to standard output."},
{OPT_FLAG, "x", (char*)&version, "Print the version number."},
@ -1506,8 +1508,9 @@ int main(int argc, char **argv)
if( compress==0 ) CompressTables(&lem);
/* Reorder and renumber the states so that states with fewer choices
** occur at the end. */
ResortStates(&lem);
** occur at the end. This is an optimization that helps make the
** generated parser tables smaller. */
if( noResort==0 ) ResortStates(&lem);
/* Generate a report of the parser generated. (the "y.output" file) */
if( !quiet ) ReportOutput(&lem);
@ -2895,12 +2898,12 @@ int PrintAction(struct action *ap, FILE *fp, int indent){
indent,ap->sp->name,ap->x.rp->index);
break;
case SSCONFLICT:
fprintf(fp,"%*s shift %d ** Parsing conflict **",
fprintf(fp,"%*s shift %-3d ** Parsing conflict **",
indent,ap->sp->name,ap->x.stp->statenum);
break;
case SH_RESOLVED:
if( showPrecedenceConflict ){
fprintf(fp,"%*s shift %d -- dropped by precedence",
fprintf(fp,"%*s shift %-3d -- dropped by precedence",
indent,ap->sp->name,ap->x.stp->statenum);
}else{
result = 0;
@ -2908,7 +2911,7 @@ int PrintAction(struct action *ap, FILE *fp, int indent){
break;
case RD_RESOLVED:
if( showPrecedenceConflict ){
fprintf(fp,"%*s reduce %d -- dropped by precedence",
fprintf(fp,"%*s reduce %-3d -- dropped by precedence",
indent,ap->sp->name,ap->x.rp->index);
}else{
result = 0;