2
0
mirror of https://github.com/boostorg/wave.git synced 2026-01-23 18:12:16 +00:00

Wave: Fixed the is_defined() issue.

[SVN r37160]
This commit is contained in:
Hartmut Kaiser
2007-03-08 14:04:37 +00:00
parent eb2fce9150
commit 59415cd026
3 changed files with 33 additions and 11 deletions

View File

@@ -82,15 +82,20 @@ CHANGELOG
--disambiguate=1, resembling the previous behaviour. Specifying the option
--disambiguate=0 allows to suppress whitespace insertion alltogether.
- Switched to Re2C V0.11.0
- Added pragma option values push and pop to the opetions line, preserve and
output allowing to store and restore the current option. The syntax is:
- Added pragma option values push and pop to the line, preserve and output
options allowing to store and restore the current option. The syntax is:
#pragma wave options(<option>: push) and
#pragma wave options(<option>: pop)
where <option> may be line, preserve or output. Thanks to Eric Niebler for
suggesting this feature.
- Added the possibility to use static pre-compiled DFA tables for the lexertl
based lexer.
- Incorporated the changes from Andrei's latest version of the flex_string
class.
- Added the is_macro_defined(name) function to the context object as described
in the documentation. This function is usable with any string type compatible
with std::string.
Boost V1.34.0
- Wave Version 1.2.4
- Added the possibility to explicitly enable/disable the generation of #line
@@ -249,9 +254,6 @@ Boost V1.34.0
generation of a #line directive.
- Worked around a linker issue for the True64/CXX compiler, complaining about
multiple defined symbols when using the flex_string class.
- Added the is_macro_defined(name) function to the context object as described
in the documentation. This function is usable with any string type compatible
with std::string.
Sat Feb 18 2005
- Version 1.2.3

View File

@@ -196,10 +196,7 @@ public:
is_predefined); }
template <typename StringT>
bool is_defined_macro(StringT const &str)
{ return macros.is_defined(str.begin(), str.end()); }
template <typename IteratorT2>
bool is_defined_macro(IteratorT2 const &begin, IteratorT2 const &end)
{ return macros.is_defined(begin, end); }
{ return macros.is_defined(str); }
bool get_macro_definition(typename token_type::string_type const &name,
bool &has_params, bool &is_predefined, position_type &pos,
std::vector<token_type> &parameters, token_sequence_type &definition)
@@ -258,6 +255,10 @@ protected:
boost::wave::context<IteratorT, lexer_type, InputPolicyT, HooksT> >;
#endif
template <typename IteratorT2>
bool is_defined_macro(IteratorT2 const &begin, IteratorT2 const &end)
{ return macros.is_defined(begin, end); }
// maintain include paths (helper functions)
bool find_include_file (std::string &s, std::string &d, bool is_system,
char const *current_file) const

View File

@@ -99,8 +99,14 @@ public:
bool is_defined(string_type const &name,
typename defined_macros_type::iterator &it,
defined_macros_type *scope = 0) const;
// expects a token sequence as its parameters
template <typename IteratorT>
bool is_defined(IteratorT const &begin, IteratorT const &end);
// expects an arbitrary string as its parameter
template<typename StringT>
bool is_defined(StringT const &str);
// Get the macro definition for the given macro scope
bool get_macro(string_type const &name, bool &has_parameters,
@@ -393,7 +399,7 @@ token_id id = token_id(*begin);
}
IteratorT it = begin;
string_type name ((*it).get_value().c_str());
string_type name ((*it).get_value());
typename defined_macros_type::iterator cit(current_macros -> find(name));
if (++it != end) {
@@ -405,6 +411,19 @@ typename defined_macros_type::iterator cit(current_macros -> find(name));
return cit != current_macros -> end();
}
///////////////////////////////////////////////////////////////////////////////
// same as above, only takes an arbitrary string type as its parameter
template <typename ContextT>
template<typename StringT>
inline bool
macromap<ContextT>::is_defined(StringT const &str)
{
string_type name (str.c_str());
typename defined_macros_type::iterator cit(current_macros -> find(name));
return cit != current_macros -> end();
}
///////////////////////////////////////////////////////////////////////////////
//
// Get the macro definition for the given macro scope