示例#1
0
 inline info what(Expr const& xpr)
 {
     // Report invalid expression error as early as possible.
     // If you got an error_invalid_expression
     // error message here, then the expression (expr) is not a
     // valid spirit karma expression.
     BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
     return compile<karma::domain>(xpr).what(unused);
 }
 inline info what(Expr const& expr)
 {
     // Report invalid expression error as early as possible.
     // If you got an error_expr_is_not_convertible_to_a_parser
     // error message here, then the expression (expr) is not a
     // valid spirit qi expression.
     BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
     return compile<qi::domain>(expr).what(unused);
 }
void display_attribute_of_parser(std::ostream& os, T const &)
{
    // Report invalid expression error as early as possible.
    // If you got an error_invalid_expression error message here,
    // then the expression (expr) is not a valid spirit qi expression.
    BOOST_SPIRIT_ASSERT_MATCH(spirit::qi::domain, T);

    typedef typename attribute_of_parser<T>::type type;
    os << typeid(type).name() << std::endl;
}
示例#4
0
 inline bool
 generate(
     detail::output_iterator<OutputIterator, Properties>& sink
   , Expr const& expr)
 {
     // Report invalid expression error as early as possible.
     // If you got an error_invalid_expression error message here,
     // then the expression (expr) is not a valid spirit karma expression.
     BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
     return compile<karma::domain>(expr).generate(sink, unused, unused, unused);
 }
示例#5
0
    inline bool
    tokenize_and_parse(Iterator& first, Iterator last, Lexer const& lex
      , ParserExpr const& xpr, Attribute& attr)
    {
        // Report invalid expression error as early as possible.
        // If you got an error_invalid_expression error message here,
        // then the expression (expr) is not a valid spirit qi expression.
        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, ParserExpr);

        typename Lexer::iterator_type iter = lex.begin(first, last);
        return compile<qi::domain>(xpr).parse(
            iter, lex.end(), unused, unused, attr);
    }
示例#6
0
文件: rule.hpp 项目: AVCProject/AVC
    rule<OutputIterator_, T1_, T2_, T3_, T4_>& operator%=(
        rule<OutputIterator_, T1_, T2_, T3_, T4_>& r, Expr const& expr)
    {
        // Report invalid expression error as early as possible.
        // If you got an error_invalid_expression error message here,
        // then the expression (expr) is not a valid spirit qi expression.
        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);

        typedef typename
            rule<OutputIterator_, T1_, T2_, T3_, T4_>::encoding_modifier_type
        encoding_modifier_type;

        r.f = detail::bind_parser<mpl::true_>(
            compile<qi::domain>(expr, encoding_modifier_type()));
        return r;
    }
示例#7
0
    inline bool
    generate(
        detail::output_iterator<OutputIterator, Properties>& sink
      , Expr const& expr
      , BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr))
    {
        // Report invalid expression error as early as possible.
        // If you got an error_invalid_expression error message here,
        // then the expression (expr) is not a valid spirit karma expression.
        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);

        typedef fusion::vector<
            BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
        > vector_type;

        vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
        return compile<karma::domain>(expr).generate(sink, unused, unused, attr);
    }
示例#8
0
    inline bool
    generate(
        OutputIterator& target_sink
      , Expr const& expr
      , Attr const& attr)
    {
        // Report invalid expression error as early as possible.
        // If you got an error_invalid_expression error message here,
        // then the expression (expr) is not a valid spirit karma expression.
        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);

        typedef traits::properties_of<
            typename result_of::compile<karma::domain, Expr>::type
        > properties;

        // wrap user supplied iterator into our own output iterator
        detail::output_iterator<OutputIterator
          , mpl::int_<properties::value> > sink(target_sink);
        return compile<karma::domain>(expr).generate(sink, unused, unused, attr);
    }
示例#9
0
    inline bool
    parse(
        Iterator& first
      , Iterator last
      , Expr const& expr
      , Attr& attr)
    {
        // Make sure the iterator is at least a forward_iterator. If you got an 
        // compilation error here, then you are using an input_iterator while
        // calling this function, you need to supply at least a 
        // forward_iterator instead.
        BOOST_CONCEPT_ASSERT((ForwardIterator<Iterator>));

        // Report invalid expression error as early as possible.
        // If you got an error_invalid_expression error message here,
        // then the expression (expr) is not a valid spirit qi expression.
        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);

        return compile<qi::domain>(expr).parse(first, last, unused, unused, attr);
    }