From fa2860ae50df355d91ee9d5e7ab309d3fa3a6701 Mon Sep 17 00:00:00 2001 From: Hartmut Kaiser Date: Sat, 10 Sep 2011 22:25:33 +0000 Subject: [PATCH] Wave: merging from trunk [SVN r74339] --- ChangeLog | 9 ++++++ doc/class_reference_context.html | 6 ++-- include/boost/wave/language_support.hpp | 6 ++-- include/boost/wave/util/file_position.hpp | 35 +--------------------- include/boost/wave/util/flex_string.hpp | 7 +---- index.html | 4 +-- samples/cpp_tokens/cpp_tokens.cpp | 1 + samples/cpp_tokens/slex/cpp_slex_lexer.hpp | 10 ++++--- 8 files changed, 28 insertions(+), 50 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2719442..76d4558 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,15 @@ TODO (known issues): CHANGELOG +Boost V1.48.0 + - V2.3.1 + - Added the flag support_option_emit_contnewlines allowing to control whether + backslash newline sequences are emitted by the Wave library. The default is + as before: these tokens will be silently ignored (after the token positions + have been properly updated). Note: this option is supported by the SLex lexer + module only. + - Fixed #5887: flex_string.hpp needs to include + Boost V1.47.0 - V2.3.0 - After preprocessing the body of any #pragma wave option() the wave tool now diff --git a/doc/class_reference_context.html b/doc/class_reference_context.html index e4c92e0..e1d3203 100644 --- a/doc/class_reference_context.html +++ b/doc/class_reference_context.html @@ -381,7 +381,8 @@

This functions allows to specify the language mode, in which the Wave library should work. The possible language modes are defined by the enumerated type language_support:

-
    enum language_support {
// support flags for C++98
support_normal = 0x01,
support_cpp = support_normal,

// support flags for C99

support_option_long_long = 0x02,
support_option_variadics = 0x04,
support_c99 = support_option_variadics | support_option_long_long | 0x08,

// the mask for the main language settings

support_option_mask = 0xFF80,

// additional fine tuning of the general behavior
support_option_insert_whitespace = 0x0080,
support_option_preserve_comments = 0x0100,
support_option_no_character_validation = 0x0200,
support_option_convert_trigraphs = 0x0400,
support_option_single_line = 0x0800,
support_option_prefer_pp_numbers = 0x1000,
support_option_emit_line_directives = 0x2000,
support_option_include_guard_detection = 0x4000,
support_option_emit_pragma_directives = 0x8000
};
+
    enum language_support {
// support flags for C++98
support_normal = 0x01,
support_cpp = support_normal,

// support flags for C99

support_option_long_long = 0x02,
support_option_variadics = 0x04,
support_c99 = support_option_variadics | support_option_long_long | 0x08,

// the mask for the main language settings

support_option_mask = 0xFFB0,

// additional fine tuning of the general behavior + support_option_emit_contline = 0x0040,
support_option_insert_whitespace = 0x0080,
support_option_preserve_comments = 0x0100,
support_option_no_character_validation = 0x0200,
support_option_convert_trigraphs = 0x0400,
support_option_single_line = 0x0800,
support_option_prefer_pp_numbers = 0x1000,
support_option_emit_line_directives = 0x2000,
support_option_include_guard_detection = 0x4000,
support_option_emit_pragma_directives = 0x8000
};

When used with support_option_variadics the support for variadics, placemarkers and the operator _Pragma() is enabled in normal C++ mode. When used with the support_option_long_long the support for long long suffixes is enabled in C++ mode.

The support_c99 switches on the C99 language support, which enables variadics, placemarkers, the operator _Pragma and long long suffixes by default. Additionally it disables the C++ @@ -444,6 +445,7 @@ the BOOST_WAVE_EMIT_PRAGMA_DIRECTIVES is defined during compilation to a value not equal to zero (see here for more information). +

  • If the support_option_emit_contlines flag is set, the Wave library will emit all backslash newline sequences encountered in the input. It will generate a T_CONTLINE token for each of those character sequences. Please note that this option is supported by the custom SLex lexer module only. See the cpp_tokens example for a working example.
  • If the parameter reset_macros is true the set_language function internally resets the list of defined macros, so please be careful not to call it @@ -476,7 +478,7 @@

     

    diff --git a/include/boost/wave/language_support.hpp b/include/boost/wave/language_support.hpp index 7e0c60e..f4e5998 100644 --- a/include/boost/wave/language_support.hpp +++ b/include/boost/wave/language_support.hpp @@ -26,7 +26,7 @@ enum language_support { // support flags for C++98 support_normal = 0x01, support_cpp = support_normal, - + support_option_long_long = 0x02, #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0 @@ -38,7 +38,8 @@ enum language_support { support_cpp0x = support_option_variadics | support_option_long_long | 0x10, #endif - support_option_mask = 0xFF80, + support_option_mask = 0xFFB0, + support_option_emit_contnewlines = 0x0040, support_option_insert_whitespace = 0x0080, support_option_preserve_comments = 0x0100, support_option_no_character_validation = 0x0200, @@ -196,6 +197,7 @@ BOOST_WAVE_OPTION(variadics) // support_option_variadics BOOST_WAVE_OPTION(emit_pragma_directives) // support_option_emit_pragma_directives #endif BOOST_WAVE_OPTION(insert_whitespace) // support_option_insert_whitespace +BOOST_WAVE_OPTION(emit_contnewlines) // support_option_emit_contnewlines #undef BOOST_WAVE_NEED_OPTION #undef BOOST_WAVE_ENABLE_OPTION diff --git a/include/boost/wave/util/file_position.hpp b/include/boost/wave/util/file_position.hpp index a3d1084..87f6f77 100644 --- a/include/boost/wave/util/file_position.hpp +++ b/include/boost/wave/util/file_position.hpp @@ -34,36 +34,6 @@ namespace boost { namespace wave { namespace util { -/////////////////////////////////////////////////////////////////////////////// -namespace debug { - - // Used only when BOOST_ASSERT expands to something - // make sure the string literal does not contain any escapes ('\\' just - // before '\\', '\"' or '?') - template - inline bool - is_escaped_lit(StringT const &value) - { - typename StringT::size_type pos = value.find_first_of ("\\", 0); - if (StringT::npos != pos) { - do { - if ('\\' == value[pos+1] || - '\"' == value[pos+1] || - '?' == value[pos+1]) - { - return true; - } - else { - pos = value.find_first_of ("\\", pos+1); - } - } while (pos != StringT::npos); - } - return false; - } - -/////////////////////////////////////////////////////////////////////////////// -} // namespace debug - /////////////////////////////////////////////////////////////////////////////// // // file_position @@ -85,9 +55,7 @@ public: explicit file_position(string_type const& file_, std::size_t line_ = 1, std::size_t column_ = 1) : file(file_), line(line_), column(column_) - { - BOOST_ASSERT(!debug::is_escaped_lit(file)); - } + {} // accessors string_type const &get_file() const { return file; } @@ -97,7 +65,6 @@ public: void set_file(string_type const &file_) { file = file_; - BOOST_ASSERT(!debug::is_escaped_lit(file)); } void set_line(std::size_t line_) { line = line_; } void set_column(std::size_t column_) { column = column_; } diff --git a/include/boost/wave/util/flex_string.hpp b/include/boost/wave/util/flex_string.hpp index d4558bd..da16235 100644 --- a/include/boost/wave/util/flex_string.hpp +++ b/include/boost/wave/util/flex_string.hpp @@ -102,12 +102,7 @@ class StoragePolicy #include #include #include - -#if defined(__PATHSCALE__) - #include -#else - #include -#endif +#include #include #include diff --git a/index.html b/index.html index 1f87fea..7a3fa31 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,7 @@   - Wave V2.0 + Wave V2.3 @@ -100,7 +100,7 @@ http://www.boost.org/LICENSE_1_0.txt)

    diff --git a/samples/cpp_tokens/cpp_tokens.cpp b/samples/cpp_tokens/cpp_tokens.cpp index bab5ad9..7ee3eaf 100644 --- a/samples/cpp_tokens/cpp_tokens.cpp +++ b/samples/cpp_tokens/cpp_tokens.cpp @@ -94,6 +94,7 @@ main(int argc, char *argv[]) ctx.set_language(boost::wave::support_cpp0x); ctx.set_language(boost::wave::enable_preserve_comments(ctx.get_language())); ctx.set_language(boost::wave::enable_prefer_pp_numbers(ctx.get_language())); + ctx.set_language(boost::wave::enable_emit_contnewlines(ctx.get_language())); context_type::iterator_type first = ctx.begin(); context_type::iterator_type last = ctx.end(); diff --git a/samples/cpp_tokens/slex/cpp_slex_lexer.hpp b/samples/cpp_tokens/slex/cpp_slex_lexer.hpp index f07c073..170863c 100644 --- a/samples/cpp_tokens/slex/cpp_slex_lexer.hpp +++ b/samples/cpp_tokens/slex/cpp_slex_lexer.hpp @@ -637,8 +637,10 @@ public: id = T_EOF; // end of input reached string_type token_val(value.c_str()); - - if (T_CONTLINE != id) { + + if (boost::wave::need_emit_contnewlines(language) || + T_CONTLINE != id) + { // The cast should avoid spurious warnings about missing case labels // for the other token ids's. switch (static_cast(id)) { @@ -673,7 +675,7 @@ public: pos.get_line(), pos.get_column(), pos.get_file()); } break; - + case T_LONGINTLIT: // supported in C99 and long_long mode if (!boost::wave::need_long_long(language)) { // syntax error: not allowed in C++ mode @@ -706,7 +708,7 @@ public: at_eof = true; token_val.clear(); break; - + case T_OR_TRIGRAPH: case T_XOR_TRIGRAPH: case T_LEFTBRACE_TRIGRAPH: