Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56838 - in trunk: boost/spirit/home/karma/char boost/spirit/home/qi/char boost/spirit/home/support boost/spirit/home/support/detail libs/spirit/test/lex
From: hartmut.kaiser_at_[hidden]
Date: 2009-10-14 14:31:16


Author: hkaiser
Date: 2009-10-14 14:31:15 EDT (Wed, 14 Oct 2009)
New Revision: 56838
URL: http://svn.boost.org/trac/boost/changeset/56838

Log:
Spirit: more fixes related to VC7.1
Text files modified:
   trunk/boost/spirit/home/karma/char/char.hpp | 4 +-
   trunk/boost/spirit/home/qi/char/char.hpp | 8 ++--
   trunk/boost/spirit/home/support/detail/what_function.hpp | 2
   trunk/boost/spirit/home/support/meta_compiler.hpp | 72 ++++++++++++++++++++++++++++++++++++++++
   trunk/libs/spirit/test/lex/regression001.cpp | 2
   5 files changed, 80 insertions(+), 8 deletions(-)

Modified: trunk/boost/spirit/home/karma/char/char.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/char/char.hpp (original)
+++ trunk/boost/spirit/home/karma/char/char.hpp 2009-10-14 14:31:15 EDT (Wed, 14 Oct 2009)
@@ -228,8 +228,8 @@
         info what(Context& /*context*/) const
         {
             info result("char-range", char_encoding::toucs4(from));
- boost::get<std::string&>(result.value) += '-';
- boost::get<std::string&>(result.value) += to_utf8(char_encoding::toucs4(to));
+ boost::get<std::string>(result.value) += '-';
+ boost::get<std::string>(result.value) += to_utf8(char_encoding::toucs4(to));
             return result;
         }
 

Modified: trunk/boost/spirit/home/qi/char/char.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/char/char.hpp (original)
+++ trunk/boost/spirit/home/qi/char/char.hpp 2009-10-14 14:31:15 EDT (Wed, 14 Oct 2009)
@@ -202,8 +202,8 @@
         info what(Context& /*context*/) const
         {
             info result("char-range", char_encoding::toucs4(from));
- boost::get<std::string&>(result.value) += '-';
- boost::get<std::string&>(result.value) += to_utf8(char_encoding::toucs4(to));
+ boost::get<std::string>(result.value) += '-';
+ boost::get<std::string>(result.value) += to_utf8(char_encoding::toucs4(to));
             return result;
         }
 
@@ -240,8 +240,8 @@
         info what(Context& /*context*/) const
         {
             info result("no-case-char-range", char_encoding::toucs4(from_lo));
- boost::get<std::string&>(result.value) += '-';
- boost::get<std::string&>(result.value) += to_utf8(char_encoding::toucs4(to_lo));
+ boost::get<std::string>(result.value) += '-';
+ boost::get<std::string>(result.value) += to_utf8(char_encoding::toucs4(to_lo));
             return result;
         }
 

Modified: trunk/boost/spirit/home/support/detail/what_function.hpp
==============================================================================
--- trunk/boost/spirit/home/support/detail/what_function.hpp (original)
+++ trunk/boost/spirit/home/support/detail/what_function.hpp 2009-10-14 14:31:15 EDT (Wed, 14 Oct 2009)
@@ -28,7 +28,7 @@
         template <typename Component>
         void operator()(Component const& component) const
         {
- get<std::list<info>&>(what.value).push_back(component.what(context));
+ get<std::list<info> >(what.value).push_back(component.what(context));
         }
 
         info& what;

Modified: trunk/boost/spirit/home/support/meta_compiler.hpp
==============================================================================
--- trunk/boost/spirit/home/support/meta_compiler.hpp (original)
+++ trunk/boost/spirit/home/support/meta_compiler.hpp 2009-10-14 14:31:15 EDT (Wed, 14 Oct 2009)
@@ -12,6 +12,8 @@
 #pragma once
 #endif
 
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
 #include <boost/proto/proto.hpp>
 #include <boost/spirit/home/support/make_component.hpp>
 #include <boost/spirit/home/support/modify.hpp>
@@ -54,6 +56,9 @@
             !use_operator<Domain, proto::tag::subscript>::value
         ), error_proto_tag_subscript_cannot_be_used, ());
 
+#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
+ // this is the non-broken part for compilers properly supporting
+ // partial template specialization (VC7.1 does not)
         struct cases
         {
             template <typename Tag, typename Enable = void>
@@ -113,6 +118,73 @@
>
             {};
         };
+#else
+ // this part actually constitutes invalid C++ code, but it allows us to
+ // convince VC7.1 to do what we want
+ struct cases
+ {
+ template <typename Tag, typename Enable = void>
+ struct case_
+ : proto::not_<proto::_>
+ {};
+
+ ///////////////////////////////////////////////////////////////////
+ // terminals
+ ///////////////////////////////////////////////////////////////////
+ template <>
+ struct case_<proto::tag::terminal>
+ : proto::when<
+ proto::if_<use_terminal<Domain, proto::_value>()>,
+ detail::make_terminal<Domain>
+ >
+ {};
+
+ template <typename Tag>
+ struct case_<Tag>
+ : proto::or_<
+ ///////////////////////////////////////////////////////////////////
+ // binary operators
+ ///////////////////////////////////////////////////////////////////
+ proto::when<proto::binary_expr<
+ typename enable_if<use_operator<Domain, Tag>, Tag>::type
+ , meta_grammar, meta_grammar>
+ , detail::make_binary<Domain, Tag, meta_grammar>
+ >,
+ ///////////////////////////////////////////////////////////////////
+ // unary operators
+ ///////////////////////////////////////////////////////////////////
+ proto::when<proto::unary_expr<
+ typename enable_if<use_operator<Domain, Tag>, Tag>::type
+ , meta_grammar>
+ , detail::make_unary<Domain, Tag, meta_grammar>
+ >
+ >
+ {};
+
+ template <>
+ struct case_<proto::tag::subscript>
+ : proto::or_<
+ ///////////////////////////////////////////////////////////////////
+ // directives
+ ///////////////////////////////////////////////////////////////////
+ proto::when<proto::binary_expr<proto::tag::subscript
+ , proto::and_<
+ proto::terminal<proto::_>
+ , proto::if_<use_directive<Domain, proto::_value >()> >
+ , meta_grammar>,
+ detail::make_directive<Domain, meta_grammar>
+ >,
+ ///////////////////////////////////////////////////////////////////
+ // semantic actions
+ ///////////////////////////////////////////////////////////////////
+ proto::when<proto::binary_expr<proto::tag::subscript
+ , meta_grammar, proto::_>,
+ detail::make_action<Domain, meta_grammar>
+ >
+ >
+ {};
+ };
+#endif
 
         struct meta_grammar
           : proto::switch_<cases>

Modified: trunk/libs/spirit/test/lex/regression001.cpp
==============================================================================
--- trunk/libs/spirit/test/lex/regression001.cpp (original)
+++ trunk/libs/spirit/test/lex/regression001.cpp 2009-10-14 14:31:15 EDT (Wed, 14 Oct 2009)
@@ -56,7 +56,7 @@
     base_iterator last = &first[str.size()];
 
     for(lexer_type::iterator_type i = position_helper_lexer.begin(first, last);
- i != position_helper_lexer.end() && *i; i++ )
+ i != position_helper_lexer.end() && (*i).is_valid(); i++ )
     {
     }
     return boost::report_errors();


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk