BNFC / bnfc

BNF Converter
http://bnfc.digitalgrammars.com/
586 stars 165 forks source link

[Bug] Bison file prefixes for C/C++ not generating correctly #172

Closed dcavar closed 8 years ago

dcavar commented 8 years ago

When generating C or C++ and using prefixes, the generated Bison-file is missing the prefixes in the error function. Example (take any well-formed and otherwise working Test.cf):

bnfc -m --cpp -p test Test.cf

the generated Test.y will have missing prefixes in the error function:

void testyyerror(const char *str)
{
  extern char *testyytext;
  fprintf(stderr,"error: line %d: %s at %s\n", 
    yy_mylinenumber, str, yytext);
}

but it should prepend the prefixes on all the variable references in that function:

void testyyerror(const char *str)
{
  extern char *testyytext;
  fprintf(stderr,"error: line %d: %s at %s\n", 
    testyy_mylinenumber, str, testyytext);
}
pascalh commented 8 years ago

I applied the suggested changes to the C++-backend in my branch. Please confirm that my changes solve the issue.

dcavar commented 8 years ago

Dear Pascal,

As far as I can tell, the Bison-issue is not solved. The previous issues with multi-character comment delimiters seem to be solved, though.

DC

On 03/08/2016 08:20 AM, Pascal Hof wrote:

I applied the suggested changes to the C++-backend in my branch https://github.com/pascalh/bnfc/tree/issue172. Please confirm that my changes solve the issue.

— Reply to this email directly or view it on GitHub https://github.com/BNFC/bnfc/issues/172#issuecomment-193782642.

Damir Cavar https://linguistlist.org/people/damir_cavar.html

gdetrez commented 8 years ago

I believe that @pascalh's pull request #174 is solving this issue. @dcavar if you have time to test it and there is still a problem, feel free to re-open it.