SQLite

Check-in [602fbd8149]
Login

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

Overview
Comment:Enhance LEMON to show precendence of symbols and all rules in the report that is generated in parallel to the parser.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 602fbd8149b53d8f0e9a223cc1aec912e7df03fca35071e8d707776ce225371c
User & Date: drh 2018-04-06 19:12:55.023
Context
2018-04-09
00:46
Fix a (harmless) signed integer overflow warning. (check-in: 43c2c60caf user: drh tags: trunk)
2018-04-06
19:36
Demonstration of how the parser can be augmented to recognize a PostgreSQL-style UPSERT. This check-in implements parsing only. (check-in: 9b22905b15 user: drh tags: upsert)
19:12
Enhance LEMON to show precendence of symbols and all rules in the report that is generated in parallel to the parser. (check-in: 602fbd8149 user: drh tags: trunk)
16:22
Fix a problem in the sessions module causing sqlite3session_apply_strm() to allocate enough memory for the entire input buffer - which defeats the point of a streaming interface. (check-in: 7594e60935 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to tool/lemon.c.
3250
3251
3252
3253
3254
3255
3256

3257
3258
3259
3260
3261
3262
3263
/* Generate the "*.out" log file */
void ReportOutput(struct lemon *lemp)
{
  int i;
  struct state *stp;
  struct config *cfp;
  struct action *ap;

  FILE *fp;

  fp = file_open(lemp,".out","wb");
  if( fp==0 ) return;
  for(i=0; i<lemp->nxstate; i++){
    stp = lemp->sorted[i];
    fprintf(fp,"State %d:\n",stp->statenum);







>







3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
/* Generate the "*.out" log file */
void ReportOutput(struct lemon *lemp)
{
  int i;
  struct state *stp;
  struct config *cfp;
  struct action *ap;
  struct rule *rp;
  FILE *fp;

  fp = file_open(lemp,".out","wb");
  if( fp==0 ) return;
  for(i=0; i<lemp->nxstate; i++){
    stp = lemp->sorted[i];
    fprintf(fp,"State %d:\n",stp->statenum);
3302
3303
3304
3305
3306
3307
3308

3309












3310
3311
3312
3313
3314
3315
3316
      }
      for(j=0; j<lemp->nterminal; j++){
        if( sp->firstset && SetFind(sp->firstset, j) ){
          fprintf(fp, " %s", lemp->symbols[j]->name);
        }
      }
    }

    fprintf(fp, "\n");












  }
  fclose(fp);
  return;
}

/* Search for the file "name" which is in the same directory as
** the exacutable */







>

>
>
>
>
>
>
>
>
>
>
>
>







3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
      }
      for(j=0; j<lemp->nterminal; j++){
        if( sp->firstset && SetFind(sp->firstset, j) ){
          fprintf(fp, " %s", lemp->symbols[j]->name);
        }
      }
    }
    if( sp->prec>=0 ) fprintf(fp," (precedence=%d)", sp->prec);
    fprintf(fp, "\n");
  }
  fprintf(fp, "----------------------------------------------------\n");
  fprintf(fp, "Rules:\n");
  for(rp=lemp->rule; rp; rp=rp->next){
    fprintf(fp, "%4d: ", rp->iRule);
    rule_print(fp, rp);
    fprintf(fp,".");
    if( rp->precsym ){
      fprintf(fp," [%s precedence=%d]",
              rp->precsym->name, rp->precsym->prec);
    }
    fprintf(fp,"\n");
  }
  fclose(fp);
  return;
}

/* Search for the file "name" which is in the same directory as
** the exacutable */