/* Generate code which executes when the rule "rp" is reduced. Write the code to "out". Make sure lineno stays up-to-date.  */
PRIVATE void emit_code(FILE *out, struct rule *rp, struct lemon *lemp, int *lineno)
/* Generate code which executes when the rule "rp" is reduced. Write the code to "out". Make sure lineno stays up-to-date.  */
PRIVATE void emit_code(FILE *out, struct rule *rp, struct lemon *lemp, int *lineno)
{
 const char *cp;
 if( rp->code ){
   if( !lemp->nolinenosflag ){
     (*lineno)++;
     tplt_linedir(out,rp->line,lemp->filename);
   }
   fprintf(out,"{%s",rp->code);
   for(cp=rp->code; *cp; cp++){
     if( *cp=='\n' ) (*lineno)++;
   }
   fprintf(out,"}\n"); (*lineno)++;
   if( !lemp->nolinenosflag ){
     (*lineno)++;
     tplt_linedir(out,*lineno,lemp->outname);
   }
 }
 return;
}