-
Notifications
You must be signed in to change notification settings - Fork 172
Closed
Labels
C++bugskeletonIssue concerning the generation of skeleton/template AST traversalsIssue concerning the generation of skeleton/template AST traversals
Milestone
Description
Prg. Program ::= Name Name ;
token Name letter+ ;
The --cpp-nostl backend produces this Skeleton.C:
#include "Skeleton.H"
void Skeleton::visitProgram(Program *program) {} //abstract class
void Skeleton::visitPrg(Prg *prg)
{
/* Code For Prg Goes Here */
visitName_(prg->name_1);
visitName_(prg->name_2);
}
void Skeleton::visitName(Name p)
{
/* Code for Name Goes Here */
}
...Note the extra underscore in calls visitName_.
I think the (quite ugly) code implementing the skeleton generator makes the type name from the variable name name_1, but expects only names of the form name_ without trailing number.
bnfc/source/src/BNFC/Backend/CPP/NoSTL/CFtoCVisitSkel.hs
Lines 264 to 272 in e5574db
| --The visit-function name of a basic type | |
| funName :: String -> String | |
| funName v = | |
| if "integer_" `isPrefixOf` v then "Integer" | |
| else if "char_" `isPrefixOf` v then "Char" | |
| else if "string_" `isPrefixOf` v then "String" | |
| else if "double_" `isPrefixOf` v then "Double" | |
| else if "ident_" `isPrefixOf` v then "Ident" | |
| else toUpper (head v) : init (tail v) -- User-defined type |
See also #239 for a similar problem with the C backend.
Metadata
Metadata
Assignees
Labels
C++bugskeletonIssue concerning the generation of skeleton/template AST traversalsIssue concerning the generation of skeleton/template AST traversals