Fix a bug in lemon in computation of which non-terminals can generate an
empty string. This bug and the fix make absolutely no difference for the
grammar used by SQLite, but it can make a difference when lemon is used
in other grammars.
FossilOrigin-Name: ce32775b232da894343f62deefaf19b0ec484636
diff --git a/tool/lemon.c b/tool/lemon.c
index 1fb0308..a089bc7 100644
--- a/tool/lemon.c
+++ b/tool/lemon.c
@@ -686,8 +686,9 @@
for(rp=lemp->rule; rp; rp=rp->next){
if( rp->lhs->lambda ) continue;
for(i=0; i<rp->nrhs; i++){
- struct symbol *sp = rp->rhs[i];
- if( sp->type!=TERMINAL || sp->lambda==LEMON_FALSE ) break;
+ struct symbol *sp = rp->rhs[i];
+ assert( sp->type==NONTERMINAL || sp->lambda==LEMON_FALSE );
+ if( sp->lambda==LEMON_FALSE ) break;
}
if( i==rp->nrhs ){
rp->lhs->lambda = LEMON_TRUE;