> Le 30 janv. 2015 à 15:21, Laurence Finston <[email protected]> a écrit : > > Hello, > >> yes, that would be nice. Or if you have a tarball we could >> have a look at. > > My current project is for my work and I'm not allowed to publish any code. > However, I used three scanner/parser pairs in a recent project for my > previous job and it can be downloaded from Github: > https://github.com/gwdg/gwrdifpk > >> Yes, but is this really what you want? You are giving >> credential blindly to any scanner. Shouldn't you just >> pinpoint to the one you actually use? > > No, it's definitely not what I want. I would rather have a friend > declaration for each one and I'd like the types of *STYPE and *LTYPE > arguments to be completely distinct and not have typedefs or #defines making > one a synonym of another.
So really, api.prefix is what you want. > This friend declaration is in the declaration for the class that I use for > the parameter that I pass to each of the scanners and parsers, so it is > desirable for all of the scanner and parser functions to be its "friends". > >> So far, so good. You are mixing together different entities >> with the same name, that's risky business. So far, I consider >> the api.prefix approach better. > > I would prefer it, too, if I could get it to work. The problem seems to be > that Bison and Flex use the prefix for some but not all of the typenames, > variables, macros, functions, and whatever else they define. You're problem is probably that you expect YY* symbols to be automatically renamed, which is not the case. Bison outputs prefixed names, e.g. PREFIXSTYPE. It does not output YYSTYPE and a macro to rename YYSTYPE as PREFIXSTYPE. So you should stop using YYSTYPE and the like, and really use PREFIXSTYPE in your code.
