Lemon update 2015-09-04 18:03:45 on branch trunk

- Fix over-length source code lines in Lemon. (user: drh)
This commit is contained in:
Randy Heit 2016-03-20 10:19:55 -05:00
parent 9413ea15b6
commit 23f69b6fbc

View file

@ -1279,14 +1279,16 @@ void Configlist_closure(struct lemon *lemp)
/* Sort the configuration list */ /* Sort the configuration list */
void Configlist_sort(){ void Configlist_sort(){
current = (struct config *)msort(current,&(current->next),Configcmp); current = (struct config*)msort((char*)current,(char**)&(current->next),
Configcmp);
currentend = 0; currentend = 0;
return; return;
} }
/* Sort the basis configuration list */ /* Sort the basis configuration list */
void Configlist_sortbasis(){ void Configlist_sortbasis(){
basis = (struct config *)msort(current,&(current->bp),Configcmp); basis = (struct config *)msort((char*)current,(char**)&(current->bp),
Configcmp);
basisend = 0; basisend = 0;
return; return;
} }
@ -1529,7 +1531,8 @@ int main(int argc, char **argv)
if( statistics ){ if( statistics ){
printf("Parser statistics: %d terminals, %d nonterminals, %d rules\n", printf("Parser statistics: %d terminals, %d nonterminals, %d rules\n",
lem.nterminal, lem.nsymbol - lem.nterminal, lem.nrule); lem.nterminal, lem.nsymbol - lem.nterminal, lem.nrule);
printf(" %d states, %d parser table entries, %d conflicts\n", printf(" %d states, %d parser table entries,"
" %d conflicts\n",
lem.nstate, lem.tablesize, lem.nconflict); lem.nstate, lem.tablesize, lem.nconflict);
} }
if( lem.nconflict ){ if( lem.nconflict ){
@ -1780,7 +1783,8 @@ static int handleswitch(int i, FILE *err)
dv = strtod(cp,&end); dv = strtod(cp,&end);
if( *end ){ if( *end ){
if( err ){ if( err ){
fprintf(err,"%sillegal character in floating-point argument.\n",emsg); fprintf(err,
"%sillegal character in floating-point argument.\n",emsg);
errline(i,((size_t)end)-(size_t)argv[i],err); errline(i,((size_t)end)-(size_t)argv[i],err);
} }
errcnt++; errcnt++;
@ -3157,7 +3161,8 @@ PRIVATE FILE *tplt_open(struct lemon *lemp)
} }
in = fopen(user_templatename,"rb"); in = fopen(user_templatename,"rb");
if( in==0 ){ if( in==0 ){
fprintf(stderr,"Can't open the template file \"%s\".\n",user_templatename); fprintf(stderr,"Can't open the template file \"%s\".\n",
user_templatename);
lemp->errorcnt++; lemp->errorcnt++;
return 0; return 0;
} }
@ -3248,7 +3253,10 @@ void emit_destructor_code(
}else if( sp->destructor ){ }else if( sp->destructor ){
cp = sp->destructor; cp = sp->destructor;
fprintf(out,"{\n"); (*lineno)++; fprintf(out,"{\n"); (*lineno)++;
if (!lemp->nolinenosflag) { (*lineno)++; tplt_linedir(out,sp->destLineno,lemp->filename); } if( !lemp->nolinenosflag ){
(*lineno)++;
tplt_linedir(out,sp->destLineno,lemp->filename);
}
}else if( lemp->vardest ){ }else if( lemp->vardest ){
cp = lemp->vardest; cp = lemp->vardest;
if( cp==0 ) return; if( cp==0 ) return;
@ -3445,13 +3453,19 @@ PRIVATE void emit_code(
/* Generate code to do the reduce action */ /* Generate code to do the reduce action */
if( rp->code ){ if( rp->code ){
if (!lemp->nolinenosflag) { (*lineno)++; tplt_linedir(out,rp->line,lemp->filename); } if( !lemp->nolinenosflag ){
(*lineno)++;
tplt_linedir(out,rp->line,lemp->filename);
}
fprintf(out,"{%s",rp->code); fprintf(out,"{%s",rp->code);
for(cp=rp->code; *cp; cp++){ for(cp=rp->code; *cp; cp++){
if( *cp=='\n' ) (*lineno)++; if( *cp=='\n' ) (*lineno)++;
} /* End loop */ } /* End loop */
fprintf(out,"}\n"); (*lineno)++; fprintf(out,"}\n"); (*lineno)++;
if (!lemp->nolinenosflag) { (*lineno)++; tplt_linedir(out,*lineno,lemp->outname); } if( !lemp->nolinenosflag ){
(*lineno)++;
tplt_linedir(out,*lineno,lemp->outname);
}
} /* End if( rp->code ) */ } /* End if( rp->code ) */
return; return;