/ Check-in [f2ad230f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:f2ad230f6dce98d664370d77845b5f585de20f08
User & Date: drh 2006-12-14 01:06:22
Context
2006-12-16
16:25
Query optimizer enhancement: In "FROM a,b,c left join d" allow the C table to be reordered with A and B. This used to be the case but the capability was removed by (3203) and (3052) in response to ticket #1652. This change restores the capability. (CVS 3529) check-in: 7393c81b user: drh tags: trunk
2006-12-14
01:06
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) check-in: f2ad230f user: drh tags: trunk
2006-11-30
13:06
Change the table_info pragma so that it returns NULL for the default value if there is no default value. Ticket #2078. (CVS 3527) check-in: 5f21c3a5 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tool/lemon.c.

357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
....
1015
1016
1017
1018
1019
1020
1021




1022
1023
1024
1025
1026
1027
1028
struct action *ap1;
struct action *ap2;
{
  int rc;
  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;
}

/* Sort parser actions */
struct action *Action_sort(ap)
................................................................................
struct action *apx;
struct action *apy;
struct symbol *errsym;   /* The error symbol (if defined.  NULL otherwise) */
{
  struct symbol *spx, *spy;
  int errcnt = 0;
  assert( apx->sp==apy->sp );  /* Otherwise there would be no conflict */




  if( apx->type==SHIFT && apy->type==REDUCE ){
    spx = apx->sp;
    spy = apy->x.rp->precsym;
    if( spy==0 || spx->prec<0 || spy->prec<0 ){
      /* Not enough precedence information. */
      apy->type = CONFLICT;
      errcnt++;







<
<







 







>
>
>
>







357
358
359
360
361
362
363


364
365
366
367
368
369
370
....
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
struct action *ap1;
struct action *ap2;
{
  int rc;
  rc = ap1->sp->index - ap2->sp->index;
  if( rc==0 ) rc = (int)ap1->type - (int)ap2->type;
  if( rc==0 ){


    rc = ap1->x.rp->index - ap2->x.rp->index;
  }
  return rc;
}

/* Sort parser actions */
struct action *Action_sort(ap)
................................................................................
struct action *apx;
struct action *apy;
struct symbol *errsym;   /* The error symbol (if defined.  NULL otherwise) */
{
  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;
    if( spy==0 || spx->prec<0 || spy->prec<0 ){
      /* Not enough precedence information. */
      apy->type = CONFLICT;
      errcnt++;