Qi Symbols mapping to AST enum
Michael Powell <[email protected]> Wed, 28 Nov 2018 18:35:44 -0500
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <CAMEoF_Gd-np_U3X80WY+0WgEb9W=0uDt-tM0+74JnHAbDezPvA@mail.gmail.com> |
Hello,
I've got a qi::symbols capturing some built-in types. At the moment, I
gather, they are mapped to std::string. However, I would rather map
them to an AST level enum.
For instance,
struct builtin_type_t : qi::symbols<char, std::string> {
builtin_type_t() {
this->add("double", "double")
("float", "float")
// ...
;
}
} builtin_type;
Instead,
namespace ast {
enum type_t { type_double, type_float /* , ... */ };
}
struct builtin_type_t : qi::symbols<char, ast::type_t> {
builtin_type_t() {
this->add("double", ast::type_double)
("float", ast::type_float)
// ...
;
}
} builtin_type;
I assume this is possible? Am I missing something about that?
Thanks!
Michael Powell