/ Check-in [602fbd81]
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 | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:602fbd8149b53d8f0e9a223cc1aec912e7df03fca35071e8d707776ce225371c
User & Date: drh 2018-04-06 19:12:55
Context
2018-04-09
00:46
Fix a (harmless) signed integer overflow warning. check-in: 43c2c60c 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: 9b22905b 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: 602fbd81 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: 7594e609 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to tool/lemon.c.

  3250   3250   /* Generate the "*.out" log file */
  3251   3251   void ReportOutput(struct lemon *lemp)
  3252   3252   {
  3253   3253     int i;
  3254   3254     struct state *stp;
  3255   3255     struct config *cfp;
  3256   3256     struct action *ap;
         3257  +  struct rule *rp;
  3257   3258     FILE *fp;
  3258   3259   
  3259   3260     fp = file_open(lemp,".out","wb");
  3260   3261     if( fp==0 ) return;
  3261   3262     for(i=0; i<lemp->nxstate; i++){
  3262   3263       stp = lemp->sorted[i];
  3263   3264       fprintf(fp,"State %d:\n",stp->statenum);
................................................................................
  3302   3303         }
  3303   3304         for(j=0; j<lemp->nterminal; j++){
  3304   3305           if( sp->firstset && SetFind(sp->firstset, j) ){
  3305   3306             fprintf(fp, " %s", lemp->symbols[j]->name);
  3306   3307           }
  3307   3308         }
  3308   3309       }
         3310  +    if( sp->prec>=0 ) fprintf(fp," (precedence=%d)", sp->prec);
  3309   3311       fprintf(fp, "\n");
         3312  +  }
         3313  +  fprintf(fp, "----------------------------------------------------\n");
         3314  +  fprintf(fp, "Rules:\n");
         3315  +  for(rp=lemp->rule; rp; rp=rp->next){
         3316  +    fprintf(fp, "%4d: ", rp->iRule);
         3317  +    rule_print(fp, rp);
         3318  +    fprintf(fp,".");
         3319  +    if( rp->precsym ){
         3320  +      fprintf(fp," [%s precedence=%d]",
         3321  +              rp->precsym->name, rp->precsym->prec);
         3322  +    }
         3323  +    fprintf(fp,"\n");
  3310   3324     }
  3311   3325     fclose(fp);
  3312   3326     return;
  3313   3327   }
  3314   3328   
  3315   3329   /* Search for the file "name" which is in the same directory as
  3316   3330   ** the exacutable */