os/ossrv/ossrv_pub/boost_apis/boost/spirit/utility/regex.hpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/spirit/utility/regex.hpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,108 @@
     1.4 +/*=============================================================================
     1.5 +    Copyright (c) 2002-2003 Hartmut Kaiser
     1.6 +    http://spirit.sourceforge.net/
     1.7 +
     1.8 +    Use, modification and distribution is subject to the Boost Software
     1.9 +    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
    1.10 +    http://www.boost.org/LICENSE_1_0.txt)
    1.11 +=============================================================================*/
    1.12 +#ifndef BOOST_SPIRIT_REGEX_HPP
    1.13 +#define BOOST_SPIRIT_REGEX_HPP
    1.14 +
    1.15 +#include <boost/version.hpp>
    1.16 +
    1.17 +///////////////////////////////////////////////////////////////////////////////
    1.18 +//
    1.19 +//  Include the regular expression library of boost (Boost.Regex)
    1.20 +//
    1.21 +//  Note though, that this library is not distributed with Spirit. You have to
    1.22 +//  obtain a separate copy from http://www.boost.org.
    1.23 +//
    1.24 +///////////////////////////////////////////////////////////////////////////////
    1.25 +#if defined(BOOST_SPIRIT_NO_REGEX_LIB) && BOOST_VERSION < 103300
    1.26 +//
    1.27 +//  Include all the Boost.regex library. Please note that this will not work,
    1.28 +//  if you are using the boost/spirit/regex.hpp header from more than one
    1.29 +//  translation units.
    1.30 +//
    1.31 +#define BOOST_REGEX_NO_LIB
    1.32 +#define BOOST_REGEX_STATIC_LINK
    1.33 +#define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
    1.34 +#include <boost/regex.hpp>
    1.35 +#include <boost/regex/src.cpp>
    1.36 +
    1.37 +#else
    1.38 +//
    1.39 +//  Include the Boost.Regex headers only. Note, that you will have to link your
    1.40 +//  application against the Boost.Regex library as described in the related
    1.41 +//  documentation.
    1.42 +//  This is the only way for Boost newer than V1.32.0
    1.43 +//
    1.44 +#include <boost/regex.hpp>
    1.45 +#endif // defined(BOOST_SPIRIT_NO_REGEX_LIB)
    1.46 +
    1.47 +#include <boost/static_assert.hpp>
    1.48 +
    1.49 +///////////////////////////////////////////////////////////////////////////////
    1.50 +#include <boost/spirit/meta/as_parser.hpp>
    1.51 +#include <boost/spirit/core/parser.hpp>
    1.52 +#include <boost/spirit/utility/impl/regex.ipp>
    1.53 +#include <boost/detail/iterator.hpp> // for boost::detail::iterator_traits
    1.54 +
    1.55 +///////////////////////////////////////////////////////////////////////////////
    1.56 +namespace boost { namespace spirit {
    1.57 +
    1.58 +///////////////////////////////////////////////////////////////////////////////
    1.59 +// rxstrlit class
    1.60 +template <typename CharT = char>
    1.61 +struct rxstrlit : public parser<rxstrlit<CharT> > {
    1.62 +
    1.63 +    typedef rxstrlit self_t;
    1.64 +
    1.65 +    rxstrlit(CharT const *first, CharT const *last)
    1.66 +    : rx(first, last) {}
    1.67 +    rxstrlit(CharT const *first)
    1.68 +    : rx(first) {}
    1.69 +
    1.70 +    template <typename ScannerT>
    1.71 +    typename parser_result<self_t, ScannerT>::type
    1.72 +    parse(ScannerT const& scan) const
    1.73 +    {
    1.74 +    //  Due to limitations in the boost::regex library the iterators wrapped in
    1.75 +    //  the ScannerT object should be at least bidirectional iterators. Plain
    1.76 +    //  forward iterators do not work here.
    1.77 +        typedef typename ScannerT::iterator_t iterator_t;
    1.78 +        typedef
    1.79 +            typename boost::detail::iterator_traits<iterator_t>::iterator_category
    1.80 +            iterator_category;
    1.81 +
    1.82 +        BOOST_STATIC_ASSERT((
    1.83 +            boost::is_convertible<iterator_category,
    1.84 +                std::bidirectional_iterator_tag>::value
    1.85 +        ));
    1.86 +
    1.87 +        typedef typename parser_result<self_t, ScannerT>::type result_t;
    1.88 +        return impl::contiguous_parser_parse<result_t>(rx, scan, scan);
    1.89 +    }
    1.90 +
    1.91 +private:
    1.92 +    impl::rx_parser<CharT> rx;   // contains the boost regular expression parser
    1.93 +};
    1.94 +
    1.95 +///////////////////////////////////////////////////////////////////////////////
    1.96 +// Generator functions
    1.97 +template <typename CharT>
    1.98 +inline rxstrlit<CharT>
    1.99 +regex_p(CharT const *first)
   1.100 +{ return rxstrlit<CharT>(first); }
   1.101 +
   1.102 +//////////////////////////////////
   1.103 +template <typename CharT>
   1.104 +inline rxstrlit<CharT>
   1.105 +regex_p(CharT const *first, CharT const *last)
   1.106 +{ return rxstrlit<CharT>(first, last); }
   1.107 +
   1.108 +///////////////////////////////////////////////////////////////////////////////
   1.109 +}} // namespace boost::spirit
   1.110 +
   1.111 +#endif // BOOST_SPIRIT_REGEX_HPP