aboutsummaryrefslogtreecommitdiff
path: root/tool/lemon.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2012-01-07 15:17:18 +0000
committerdrh <drh@noemail.net>2012-01-07 15:17:18 +0000
commit7dd1ac600e7e82f5faabe51b05e67b0e68e8ef79 (patch)
tree906b707516d1937d9da153052692f92fa2bb991a /tool/lemon.c
parent60e4a7487976a3b300a1ec13e54d107f5ae19047 (diff)
downloadsqlite-7dd1ac600e7e82f5faabe51b05e67b0e68e8ef79.tar.gz
sqlite-7dd1ac600e7e82f5faabe51b05e67b0e68e8ef79.zip
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
Diffstat (limited to 'tool/lemon.c')
-rw-r--r--tool/lemon.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tool/lemon.c b/tool/lemon.c
index 1fb0308be..a089bc7ba 100644
--- a/tool/lemon.c
+++ b/tool/lemon.c
@@ -686,8 +686,9 @@ void FindFirstSets(struct lemon *lemp)
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;