You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are trying to use your library on our project, which already contains 2 parsers generated by bison/flex. We have an issue during compilation because of the yytext variable. See the following clang output:
nlohmann/json.hpp:2870:17: error: expected ';' at end of declaration list
std::string yytext {};
^
CustomLanguageParser.cpp: note: expanded from macro 'yytext'
#define yytext yyg->yytext_r
^
We previously had a similar issue while implementing the 2 parsers (used to parse custom languages), there was a conflict in-between the yytext variable of each parser, which was resolved by using the %prefix 'directive' (See the StackOverflow answer here). This solved our issue until we tried to use your library in our codebase, which raised new errors (conflicts in-between your variable and the parsers #define) about the yytext variable.
For now we are completely stuck as the only solution we found was renaming your yytext variable, which doesn't seems like an acceptable fix to us. Did we miss something or are we the first one to use your library in a codebase already containing bison/flex generated parsers ?
infos:
clang: Apple LLVM version 9.0.0 (clang-900.0.39.2)
flex: 2.6
bison: 3.0
nlohmann/json: 3.0.1
Thanks
The text was updated successfully, but these errors were encountered:
Indeed you may be the first to do so, and since I used flex in the past, I decided to call the token buffer yytext. I think it would not be a problem for me to change the name of the variable.
(Just to make sure - would it be possible to #undef yytext before including json.hpp?)
Agreed, but I think we should still rename the variable. It's the same thing as the min/max Microsoft macros, it's annoying but we must workaround it...
Hi,
We are trying to use your library on our project, which already contains 2 parsers generated by bison/flex. We have an issue during compilation because of the
yytext
variable. See the following clang output:We previously had a similar issue while implementing the 2 parsers (used to parse custom languages), there was a conflict in-between the
yytext
variable of each parser, which was resolved by using the%prefix
'directive' (See the StackOverflow answer here). This solved our issue until we tried to use your library in our codebase, which raised new errors (conflicts in-between your variable and the parsers#define
) about theyytext
variable.For now we are completely stuck as the only solution we found was renaming your
yytext
variable, which doesn't seems like an acceptable fix to us. Did we miss something or are we the first one to use your library in a codebase already containing bison/flex generated parsers ?infos:
Thanks
The text was updated successfully, but these errors were encountered: