Add preprocessor

The parser now parses macros and inclusion directives.
This commit is contained in:
Jonathan Müller 2017-02-12 21:43:14 +01:00
commit 0684be5788
6 changed files with 519 additions and 11 deletions

View file

@ -56,7 +56,7 @@ namespace cppast
{
public:
/// \effects Sets the given C++ standard and compilation flags.
void set_standard(cpp_standard standard, type_safe::flag_set<compile_flag> flags)
void set_flags(cpp_standard standard, type_safe::flag_set<compile_flag> flags = {})
{
do_set_flags(standard, flags);
}
@ -79,6 +79,13 @@ namespace cppast
do_remove_macro_definition(std::move(name));
}
/// \returns A unique name of the configuration.
/// \notes This allows detecting mismatches of configurations and parsers.
const char* name() const noexcept
{
return do_get_name();
}
protected:
compile_config(std::vector<std::string> def_flags) : flags_(std::move(def_flags))
{
@ -110,6 +117,10 @@ namespace cppast
/// \effects Undefines the given macro.
virtual void do_remove_macro_definition(std::string name) = 0;
/// \returns A unique name of the configuration.
/// \notes This allows detecting mismatches of configurations and parsers.
virtual const char* do_get_name() const noexcept = 0;
std::vector<std::string> flags_;
};
} // namespace cppast