Fix a bug in lemon that leads to an assertion fault given an invalid
grammar.  The bug and this fix do not effect on SQLite.  Ticket #2107. (CVS 3528)

FossilOrigin-Name: f2ad230f6dce98d664370d77845b5f585de20f08
diff --git a/manifest b/manifest
index 8339a8a..02dd578 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Change\sthe\stable_info\spragma\sso\sthat\sit\sreturns\sNULL\sfor\sthe\sdefault\nvalue\sif\sthere\sis\sno\sdefault\svalue.\s\sTicket\s#2078.\s(CVS\s3527)
-D 2006-11-30T13:06:37
+C Fix\sa\sbug\sin\slemon\sthat\sleads\sto\san\sassertion\sfault\sgiven\san\sinvalid\ngrammar.\s\sThe\sbug\sand\sthis\sfix\sdo\snot\seffect\son\sSQLite.\s\sTicket\s#2107.\s(CVS\s3528)
+D 2006-12-14T01:06:22
 F Makefile.in 8e14898d41a53033ecb687d93c9cd5d109fb9ae3
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -352,7 +352,7 @@
 F test/where2.test 61d5b20d9bedc8788a773bbdc5b2ef887725928e
 F test/where3.test 3b5ad2c58069e12be2bd86bc5e211a82810521aa
 F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
-F tool/lemon.c 4e62a7119a9da4c5178ec095784ca7d44c77ce71
+F tool/lemon.c c200a81e346853c2902d5c43de8274af627a72bb
 F tool/lempar.c 0a2a5cf96a98a64a5594625ad8fbdbe41dbaca50
 F tool/memleak.awk 4e7690a51bf3ed757e611273d43fe3f65b510133
 F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8
@@ -423,7 +423,7 @@
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 27f56c20514030e009fc3aa7e060d2e6276ddb83
-R 7c1a7cdbe8c77d6b79a9b0d34b791a42
+P 5f21c3a5f02b4f2c4550f5904e9d0e1e2eafb0f3
+R ff4e890d4e50d38dfc084d0df0ba3d75
 U drh
-Z 57ae5b430b0d2d59eaddb5ae882d4b0d
+Z c7ee88553b14e37d6f61a63315c281d7
diff --git a/manifest.uuid b/manifest.uuid
index 17656f0..02d72d8 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-5f21c3a5f02b4f2c4550f5904e9d0e1e2eafb0f3
\ No newline at end of file
+f2ad230f6dce98d664370d77845b5f585de20f08
\ No newline at end of file
diff --git a/tool/lemon.c b/tool/lemon.c
index 2dd2a46..dbb00c1 100644
--- a/tool/lemon.c
+++ b/tool/lemon.c
@@ -361,8 +361,6 @@
   rc = ap1->sp->index - ap2->sp->index;
   if( rc==0 ) rc = (int)ap1->type - (int)ap2->type;
   if( rc==0 ){
-    assert( ap1->type==REDUCE || ap1->type==RD_RESOLVED || ap1->type==CONFLICT);
-    assert( ap2->type==REDUCE || ap2->type==RD_RESOLVED || ap2->type==CONFLICT);
     rc = ap1->x.rp->index - ap2->x.rp->index;
   }
   return rc;
@@ -1019,6 +1017,10 @@
   struct symbol *spx, *spy;
   int errcnt = 0;
   assert( apx->sp==apy->sp );  /* Otherwise there would be no conflict */
+  if( apx->type==SHIFT && apy->type==SHIFT ){
+    apy->type = CONFLICT;
+    errcnt++;
+  }
   if( apx->type==SHIFT && apy->type==REDUCE ){
     spx = apx->sp;
     spy = apy->x.rp->precsym;