Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:08:51

0001 /*=============================================================================
0002     Copyright (c) 2001-2011 Joel de Guzman
0003 
0004     Distributed under the Boost Software License, Version 1.0. (See accompanying
0005     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 ==============================================================================*/
0007 #if !defined(BOOST_SPIRIT_PARSER_OCTOBER_16_2008_0254PM)
0008 #define BOOST_SPIRIT_PARSER_OCTOBER_16_2008_0254PM
0009 
0010 #if defined(_MSC_VER)
0011 #pragma once
0012 #endif
0013 
0014 #include <boost/mpl/has_xxx.hpp>
0015 #include <boost/spirit/home/qi/domain.hpp>
0016 
0017 namespace boost { namespace spirit { namespace qi
0018 {
0019 
0020     //[parser_base_parser
0021     template <typename Derived>
0022     struct parser
0023     {
0024         struct parser_id;
0025         typedef Derived derived_type;
0026         typedef qi::domain domain;
0027 
0028         // Requirement: p.parse(f, l, context, skip, attr) -> bool
0029         //
0030         //  p:          a parser
0031         //  f, l:       first/last iterator pair
0032         //  context:    enclosing rule context (can be unused_type)
0033         //  skip:       skipper (can be unused_type)
0034         //  attr:       attribute (can be unused_type)
0035 
0036         // Requirement: p.what(context) -> info
0037         //
0038         //  p:          a parser
0039         //  context:    enclosing rule context (can be unused_type)
0040 
0041         // Requirement: P::template attribute<Ctx, Iter>::type
0042         //
0043         //  P:          a parser type
0044         //  Ctx:        A context type (can be unused_type)
0045         //  Iter:       An iterator type (can be unused_type)
0046 
0047         Derived const& derived() const
0048         {
0049             return *static_cast<Derived const*>(this);
0050         }
0051     };
0052     //]
0053 
0054     template <typename Derived>
0055     struct primitive_parser : parser<Derived>
0056     {
0057         struct primitive_parser_id;
0058     };
0059 
0060     template <typename Derived>
0061     struct nary_parser : parser<Derived>
0062     {
0063         struct nary_parser_id;
0064 
0065         // Requirement: p.elements -> fusion sequence
0066         //
0067         // p:   a composite parser
0068 
0069         // Requirement: P::elements_type -> fusion sequence
0070         //
0071         // P:   a composite parser type
0072     };
0073 
0074     template <typename Derived>
0075     struct unary_parser : parser<Derived>
0076     {
0077         struct unary_parser_id;
0078 
0079         // Requirement: p.subject -> subject parser
0080         //
0081         // p:   a unary parser
0082 
0083         // Requirement: P::subject_type -> subject parser type
0084         //
0085         // P:   a unary parser type
0086     };
0087 
0088     template <typename Derived>
0089     struct binary_parser : parser<Derived>
0090     {
0091         struct binary_parser_id;
0092 
0093         // Requirement: p.left -> left parser
0094         //
0095         // p:   a binary parser
0096 
0097         // Requirement: P::left_type -> left parser type
0098         //
0099         // P:   a binary parser type
0100 
0101         // Requirement: p.right -> right parser
0102         //
0103         // p:   a binary parser
0104 
0105         // Requirement: P::right_type -> right parser type
0106         //
0107         // P:   a binary parser type
0108     };
0109 }}}
0110 
0111 namespace boost { namespace spirit { namespace traits // classification
0112 {
0113     namespace detail
0114     {
0115         BOOST_MPL_HAS_XXX_TRAIT_DEF(parser_id)
0116         BOOST_MPL_HAS_XXX_TRAIT_DEF(primitive_parser_id)
0117         BOOST_MPL_HAS_XXX_TRAIT_DEF(nary_parser_id)
0118         BOOST_MPL_HAS_XXX_TRAIT_DEF(unary_parser_id)
0119         BOOST_MPL_HAS_XXX_TRAIT_DEF(binary_parser_id)
0120     }
0121 
0122     // parser type identification
0123     template <typename T>
0124     struct is_parser : detail::has_parser_id<T> {};
0125 
0126     template <typename T>
0127     struct is_primitive_parser : detail::has_primitive_parser_id<T> {};
0128 
0129     template <typename T>
0130     struct is_nary_parser : detail::has_nary_parser_id<T> {};
0131 
0132     template <typename T>
0133     struct is_unary_parser : detail::has_unary_parser_id<T> {};
0134 
0135     template <typename T>
0136     struct is_binary_parser : detail::has_binary_parser_id<T> {};
0137 
0138 }}}
0139 
0140 #endif