Boost logo

Boost Users :

Subject: Re: [Boost-users] [Spirit] leaf_node_d compile time error
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2009-04-26 13:23:10


Hey Chris,

> Hi, I'm upgrading some code from boost 1.33 to 1.38, and upgrading
> compilers from
> gcc 4.1 to 4.3.3. Code that used to work is no longer compiling, and
> I'm running out
> of ideas what might be the problem. While the real code is
> significantly larger, I've
> managed to extract the problem down to this short example.
>
> #define BOOST_SPIRIT_USE_OLD_NAMESPACE
> #include "boost/spirit/include/classic_core.hpp"
> #include "boost/spirit/include/classic_ast.hpp"

This needs to be:
#include "boost/spirit/include/classic_parse_tree.hpp"

>
> using namespace boost::spirit;
>
> struct Test_Parser : public grammar<Test_Parser> {
> template <typename ScannerT>
> struct definition {
> definition(Test_Parser const & /*self*/) {
>
> test_filter = leaf_node_d[ ch_p('=') ] //<<<<<<< HERE
> ;
> }
> rule<ScannerT> test_filter;
> rule<ScannerT> const & start() const { return test_filter; }
> };
> };
>
> int main() {
> using namespace boost::spirit;
> char const * str = "=";
> Test_Parser parser;
> parse_info<> info = parse(str, parser, space_p);

And this:
tree_parse_info<> info = pt_parse(str, parser, space_p);

Then it should compile.

HTH
Regards Hartmut

> }
>
> When I use leaf_node_d[], it doesn't compile. Removing leaf_node_d,
> and all is well. The error is ugly, but ultimately is this:
> error: no type named node_factory_t in
> class boost::spirit::leaf_node_parser<T>::parse(const ScannerT&) const
>
> I've spent a few hours trying to grok the code and am falling short.
> Any help
> would be appreciated.
>
> g++ -I $BOOST_ROOT foo.cpp
> /usr/local43/include/boost-
> 1_38/boost/spirit/home/classic/tree/common.hpp:
> In member function typename
> boost::spirit::parser_result<boost::spirit::leaf_node_parser<T>,
> ScannerT>::type boost::spirit::leaf_node_parser<T>::parse(const
> ScannerT&) const [with ScannerT = boost::spirit::scanner<const char*,
> boost::spirit::scanner_policies<boost::spirit::skipper_iteration_policy
> <boost::spirit::iteration_policy>,
> boost::spirit::match_policy, boost::spirit::action_policy> >, T =
> boost::spirit::chlit<char>]:
> /usr/local43/include/boost-
> 1_38/boost/spirit/home/classic/core/non_terminal/impl/rule.ipp:235:
> instantiated from typename boost::spirit::match_result<ScannerT,
> ContextResultT>::type boost::spirit::impl::concrete_parser<ParserT,
> ScannerT, AttrT>::do_parse_virtual(const ScannerT&) const [with
> ParserT = boost::spirit::leaf_node_parser<boost::spirit::chlit<char>
> >, ScannerT = boost::spirit::scanner<const char*,
> boost::spirit::scanner_policies<boost::spirit::skipper_iteration_policy
> <boost::spirit::iteration_policy>,
> boost::spirit::match_policy, boost::spirit::action_policy> >, AttrT =
> boost::spirit::nil_t]
> foo.cpp:28: instantiated from here
> /usr/local43/include/boost-
> 1_38/boost/spirit/home/classic/tree/common.hpp:903:
> error: no type named node_factory_t in class
> boost::spirit::leaf_node_parser<T>::parse(const ScannerT&) const [with
> ScannerT = boost::spirit::scanner<const char*,
> boost::spirit::scanner_policies<boost::spirit::skipper_iteration_policy
> <boost::spirit::iteration_policy>,
> boost::spirit::match_policy, boost::spirit::action_policy> >, T =
> boost::spirit::chlit<char>]::result_t
> make: *** [.obj/foo.o] Error 1
>
> --
> Chris
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net