mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-27 20:41:58 +03:00
Improvements to the formatting of parse.out file from Lemon. Add the -r option
to Lemon to disable the state sorting, making debugging easier. FossilOrigin-Name: a2eaf8294f6d3fb39548987d632e934bb5d71cc9
This commit is contained in:
15
tool/lemon.c
15
tool/lemon.c
@ -1085,7 +1085,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;
|
||||
@ -1405,6 +1405,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."},
|
||||
@ -1416,6 +1417,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."},
|
||||
@ -1502,8 +1504,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);
|
||||
@ -2899,12 +2902,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;
|
||||
@ -2912,7 +2915,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;
|
||||
|
Reference in New Issue
Block a user