File indexing completed on 2025-01-31 10:02:08
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_SPIRIT_REGEX_HPP
0009 #define BOOST_SPIRIT_REGEX_HPP
0010
0011 #include <boost/version.hpp>
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #if defined(BOOST_SPIRIT_NO_REGEX_LIB) && BOOST_VERSION < 103300
0022
0023
0024
0025
0026
0027 #define BOOST_REGEX_NO_LIB
0028 #define BOOST_REGEX_STATIC_LINK
0029 #define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
0030 #include <boost/regex.hpp>
0031 #include <boost/regex/src.cpp>
0032
0033 #else
0034
0035
0036
0037
0038
0039
0040 #include <boost/regex.hpp>
0041 #endif
0042
0043 #include <boost/static_assert.hpp>
0044
0045
0046 #include <boost/spirit/home/classic/namespace.hpp>
0047 #include <boost/spirit/home/classic/meta/as_parser.hpp>
0048 #include <boost/spirit/home/classic/core/parser.hpp>
0049 #include <boost/spirit/home/classic/utility/impl/regex.ipp>
0050 #include <iterator> // for std::iterator_traits
0051
0052
0053 namespace boost { namespace spirit {
0054
0055 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
0056
0057
0058
0059 template <typename CharT = char>
0060 struct rxstrlit : public parser<rxstrlit<CharT> > {
0061
0062 typedef rxstrlit self_t;
0063
0064 rxstrlit(CharT const *first, CharT const *last)
0065 : rx(first, last) {}
0066 rxstrlit(CharT const *first)
0067 : rx(first) {}
0068
0069 template <typename ScannerT>
0070 typename parser_result<self_t, ScannerT>::type
0071 parse(ScannerT const& scan) const
0072 {
0073
0074
0075
0076 typedef typename ScannerT::iterator_t iterator_t;
0077 typedef
0078 typename std::iterator_traits<iterator_t>::iterator_category
0079 iterator_category;
0080
0081 BOOST_STATIC_ASSERT((
0082 boost::is_convertible<iterator_category,
0083 std::bidirectional_iterator_tag>::value
0084 ));
0085
0086 typedef typename parser_result<self_t, ScannerT>::type result_t;
0087 return impl::contiguous_parser_parse<result_t>(rx, scan, scan);
0088 }
0089
0090 private:
0091 impl::rx_parser<CharT> rx;
0092 };
0093
0094
0095
0096 template <typename CharT>
0097 inline rxstrlit<CharT>
0098 regex_p(CharT const *first)
0099 { return rxstrlit<CharT>(first); }
0100
0101
0102 template <typename CharT>
0103 inline rxstrlit<CharT>
0104 regex_p(CharT const *first, CharT const *last)
0105 { return rxstrlit<CharT>(first, last); }
0106
0107
0108 BOOST_SPIRIT_CLASSIC_NAMESPACE_END
0109
0110 }}
0111
0112 #endif