Index: tool/lemon.c ================================================================== --- tool/lemon.c +++ tool/lemon.c @@ -295,11 +295,10 @@ char *vardest; /* Code for the default non-terminal destructor */ char *filename; /* Name of the input file */ char *outname; /* Name of the current output file */ char *tokenprefix; /* A prefix added to token names in the .h file */ int nconflict; /* Number of parsing conflicts */ - int nexpected; /* Number of expected parsing conflicts */ int tablesize; /* Size of the parse tables */ int basisflag; /* Print only basis configurations */ int has_fallback; /* True if any %fallback is seen in the grammar */ int nolinenosflag; /* True if #line statements should not be printed */ char *argv0; /* Name of the program */ @@ -1435,11 +1434,10 @@ fprintf(stderr,"Exactly one filename argument is required.\n"); exit(1); } memset(&lem, 0, sizeof(lem)); lem.errorcnt = 0; - lem.nexpected = -1; /* Initialize the machine */ Strsafe_init(); Symbol_init(); State_init(); @@ -1520,19 +1518,16 @@ printf("Parser statistics: %d terminals, %d nonterminals, %d rules\n", lem.nterminal, lem.nsymbol - lem.nterminal, lem.nrule); printf(" %d states, %d parser table entries, %d conflicts\n", lem.nstate, lem.tablesize, lem.nconflict); } - if( lem.nexpected < 0 ) { - lem.nexpected = 0; /* grammar didn't have an %expect declaration. */ - } - if( lem.nconflict != lem.nexpected ){ - fprintf(stderr,"%d parsing conflicts (%d expected).\n",lem.nconflict,lem.nexpected); + if( lem.nconflict > 0 ){ + fprintf(stderr,"%d parsing conflicts.\n",lem.nconflict); } /* return 0 on success, 1 on failure. */ - exitcode = ((lem.errorcnt > 0) || (lem.nconflict != lem.nexpected)) ? 1 : 0; + exitcode = ((lem.errorcnt > 0) || (lem.nconflict > 0)) ? 1 : 0; successful_exit = (exitcode == 0); exit(exitcode); return (exitcode); } /******************** From the file "msort.c" *******************************/ @@ -1954,11 +1949,10 @@ RESYNC_AFTER_RULE_ERROR, RESYNC_AFTER_DECL_ERROR, WAITING_FOR_DESTRUCTOR_SYMBOL, WAITING_FOR_DATATYPE_SYMBOL, WAITING_FOR_FALLBACK_ID, - WAITING_FOR_EXPECT_VALUE, WAITING_FOR_WILDCARD_ID }; struct pstate { char *filename; /* Name of the input file */ int tokenlineno; /* Linenumber at which current token starts */ @@ -2270,18 +2264,10 @@ }else if( strcmp(x,"fallback")==0 ){ psp->fallback = 0; psp->state = WAITING_FOR_FALLBACK_ID; }else if( strcmp(x,"wildcard")==0 ){ psp->state = WAITING_FOR_WILDCARD_ID; - }else if( strcmp(x,"expect")==0 ){ - if (psp->gp->nexpected >= 0) { - ErrorMsg(psp->filename,psp->tokenlineno, "Multiple %expect declarations."); - psp->errorcnt++; - psp->state = RESYNC_AFTER_DECL_ERROR; - } else { - psp->state = WAITING_FOR_EXPECT_VALUE; - } }else{ ErrorMsg(psp->filename,psp->tokenlineno, "Unknown declaration keyword: \"%%%s\".",x); psp->errorcnt++; psp->state = RESYNC_AFTER_DECL_ERROR; @@ -2305,23 +2291,10 @@ psp->decllinenoslot = &sp->destLineno; psp->insertLineMacro = 1; psp->state = WAITING_FOR_DECL_ARG; } break; - case WAITING_FOR_EXPECT_VALUE: - psp->gp->nexpected = (int) strtol(x, &endptr, 10); - if( (*endptr != '\0') || (endptr == x) ) { - ErrorMsg(psp->filename,psp->tokenlineno, - "Integer expected after %%expect keyword"); - psp->errorcnt++; - } else if (psp->gp->nexpected < 0) { - ErrorMsg(psp->filename,psp->tokenlineno, - "Integer can't be negative after %%expect keyword"); - psp->errorcnt++; - } - psp->state = WAITING_FOR_DECL_OR_RULE; - break; case WAITING_FOR_DATATYPE_SYMBOL: if( !isalpha(x[0]) ){ ErrorMsg(psp->filename,psp->tokenlineno, "Symbol name missing after %destructor keyword"); psp->errorcnt++;