Quantcast

if_ compile fail

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

if_ compile fail

Jens Kallup

Hello,

I use classic spirit qi phoenix, and I would like if_
but I lost.


symbol_if        =  lexeme[no_case["if"]];

            symbol_matched_if %=
            (
                (lhs_symbol_expr >> "==" >> rhs_symbol_expr)
                [
                    lhs_set_expr(phx::construct<double>(qi::_1)),
                    rhs_set_expr(phx::construct<double>(qi::_2))
                ]
                >> phx::if_(ph::arg1 == 1)
                   [
                   _pass = false
                   ]
            )
            ;

        qi::rule<Iterator, Skipper>
            symbol_unmatched_if,
            symbol_matched_if
        ;


Here comes the output:

/usr/include/boost/spirit/home/qi/nonterminal/rule.hpp: In instantiation of 'static void boost::spirit::qi::rule<Iterator, T1, T2, T3, T4>::define(boost::spirit::qi::rule<Iterator, T1, T2, T3, T4>&, const Expr&, mpl_::false_) [with Auto = mpl_::bool_<true>; Expr = boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::shift_right, boost::proto::argsns_::list2<boost::proto::exprns_::expr<boost::proto::tagns_::tag::subscript, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::shift_right, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::shift_right, boost::proto::argsns_::list2<boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >, double, client::dbase_skipper<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> > >, boost::spirit::unused_type, boost::spirit::unused_type>&, boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<const char (&)[3]>, 0l> >, 2l>&, boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >, double, client::dbase_skipper<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> > >, boost::spirit::unused_type, boost::spirit::unused_type>&>, 2l>&, const boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::comma, boost::proto::argsns_::list2<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::phoenix::detail::tag::function_eval, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<client::lhs_symbol_expr_>, 0l>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::phoenix::tag::construct, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::phoenix::detail::target<double> >, 0l>, boost::phoenix::actor<boost::spirit::argument<0> > >, 2l> > >, 2l> >, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::phoenix::detail::tag::function_eval, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<client::rhs_symbol_expr_>, 0l>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::phoenix::tag::construct, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::phoenix::detail::target<double> >, 0l>, boost::phoenix::actor<boost::spirit::argument<1> > >, 2l> > >, 2l> > >, 2l> >&>, 2l>, boost::phoenix::if_actor<boost::proto::exprns_::basic_expr<boost::phoenix::tag::if_, boost::proto::argsns_::list2<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::equal_to, boost::proto::argsns_::list2<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::phoenix::argument<1> >, 0l> >, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<int>, 0l> > >, 2l> >, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::assign, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::phoenix::argument<3> >, 0l>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<bool>, 0l> > >, 2l> > >, 2l> > >, 2l> >; Iterator = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >; T1 = client::dbase_skipper<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> > >; T2 = boost::spirit::unused_type; T3 = boost::spirit::unused_type; T4 = boost::spirit::unused_type; mpl_::false_ = mpl_::bool_<false>]':
/usr/include/boost/spirit/home/qi/nonterminal/rule.hpp:247:31:   required from 'boost::spirit::qi::rule<Iterator, T1, T2, T3, T4>& boost::spirit::qi::operator%=(boost::spirit::qi::rule<Iterator, T1, T2, T3, T4>&, Expr&&) [with Expr = const boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::shift_right, boost::proto::argsns_::list2<boost::proto::exprns_::expr<boost::proto::tagns_::tag::subscript, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::shift_right, boost::proto::argsns_::list2<const boost::proto::exprns_::expr<boost::proto::tagns_::tag::shift_right, boost::proto::argsns_::list2<boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >, double, client::dbase_skipper<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> > >, boost::spirit::unused_type, boost::spirit::unused_type>&, boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<const char (&)[3]>, 0l> >, 2l>&, boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >, double, client::dbase_skipper<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> > >, boost::spirit::unused_type, boost::spirit::unused_type>&>, 2l>&, const boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::comma, boost::proto::argsns_::list2<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::phoenix::detail::tag::function_eval, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<client::lhs_symbol_expr_>, 0l>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::phoenix::tag::construct, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::phoenix::detail::target<double> >, 0l>, boost::phoenix::actor<boost::spirit::argument<0> > >, 2l> > >, 2l> >, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::phoenix::detail::tag::function_eval, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<client::rhs_symbol_expr_>, 0l>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::phoenix::tag::construct, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::phoenix::detail::target<double> >, 0l>, boost::phoenix::actor<boost::spirit::argument<1> > >, 2l> > >, 2l> > >, 2l> >&>, 2l>, boost::phoenix::if_actor<boost::proto::exprns_::basic_expr<boost::phoenix::tag::if_, boost::proto::argsns_::list2<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::equal_to, boost::proto::argsns_::list2<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::phoenix::argument<1> >, 0l> >, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<int>, 0l> > >, 2l> >, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::assign, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::phoenix::argument<3> >, 0l>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<bool>, 0l> > >, 2l> > >, 2l> > >, 2l> >; Iterator = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >; T1 = client::dbase_skipper<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> > >; T2 = boost::spirit::unused_type; T3 = boost::spirit::unused_type; T4 = boost::spirit::unused_type]'
source/parser/dbase/yymain.cc:921:22:   required from 'client::dbase_grammar<Iterator, FPT, Skipper>::dbase_grammar() [with Iterator = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >; FPT = double; Skipper = client::dbase_skipper<__gnu_cxx::__normal_iterator<const char*, std::basic_string<char> > >]'
source/parser/dbase/yymain.cc:1158:10:   required from here
/usr/include/boost/spirit/home/qi/nonterminal/rule.hpp:177:13: error: static assertion failed: error_invalid_expression
             BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
             ^

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: if_ compile fail

sehe
On 25-02-17 08:54, Jens Kallup wrote:
> phx::if_(ph::arg1 == 1)
>                    [
>                    _pass = false
>                    ]

Proto expressions are not parsers. They synthesize lazy actors.

As such, you may use them inside semantic actions.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Loading...