Boost logo

Boost Users :

Subject: Re: [Boost-users] [spirit] Compile error when using qi::locals<>
From: Simon (turner25_at_[hidden])
Date: 2013-06-07 12:49:22


I can't seem to be able to make that small example... I'm getting a variety
of other errors.
I realise I am probably not only fighting spirit's idioms, but I'm probably
struggling with the concepts of LL,LARL and other grammar concepts.

I think I should read a good book on grammars and parsers. One that could
make a good foundation for using spirit later. Anyone can recommend one
(or two)?

Thanks,
  Simon

On Thu, Jun 6, 2013 at 9:53 AM, Simon <turner25_at_[hidden]> wrote:

> Hi Tongari, Michael,
>
> I wrote the exact same thing in the rule's declaration as in the grammar
> template param.
>
> Basically, I need to match some patterns, create objects using those
> patterns' semantic values. The problem I have is when parsing a list of
> items separated by the same char. I need a way to accumulate them into a
> vector, and then use that vector as the constructor param to a "parent"
> object of those in the list.
>
> I will build a very small example that exhibits the problem I'm having
> and post it here. I should have time over the course of the day.
>
> Thanks,
> Simon
>
>
> On Wed, Jun 5, 2013 at 10:46 PM, TONGARI <tongari95_at_[hidden]> wrote:
>
>> 2013/6/6 Simon <turner25_at_[hidden]>
>>
>>> Hi there,
>>> I'm pretty new to spirit and I need a semantic action to construct an
>>> object (that's fine) using a vector<double>, the vector is the problem.
>>> I'd really appreciate help with this error, or perhaps I'm not using the
>>> right technique, in which case, I'd need suggestions on how to proceed.
>>>
>>> Even if I don't use it anywhere, just adding the following to my
>>> grammar base class template parameter and adding the same to the rule
>>> declaration I need it for, it gives the monster error below.
>>>
>>> boost::spirit::qi::locals<std::vector<hs::Language::AX*> >
>>>
>>> I've also tried to make the vector a pointer, and allocate it on the
>>> first semantic action of a sequence.
>>>
>>> I've searched for an answer but found only one remote reference to
>>> boost needing to be recompiled to use c++11 features. So I did, but it
>>> didn't change anything (I use boost-1.49.0-r2).
>>>
>>> Also, I'm not sure if that is right, but my gcc command has this
>>> parameter: -std=c++0x
>>>
>>>
>>> I've put the full compile output at this address:
>>> http://next.n32.ca/locals.error.txt
>>> I will forget it there, so it should still be available in a few
>>> weeks/months... ;)
>>>
>>> And here are a few extracts of just the error lines:
>>>
>>> /usr/include/boost/spirit/home/qi/nonterminal/grammar.hpp:75:13: error:
>>> no matching function for call to 'assertion_failed(mpl_::failed************
>>> (boost::spirit::qi::grammar<Iterator, T1, T2, T3, T4>::grammar(const
>>> boost::spirit::qi::rule<Iterator_, T1_, T2_, T3_, T4_>&, const string&)
>>> [with Iterator_ = __gnu_cxx::__normal_iterator<const char*,
>>> std::basic_string<char> >, T1_ = hs::Language::AX*(), T2_ =
>>> boost::spirit::unused_type, T3_ = boost::spirit::unused_type, T4_ =
>>> boost::spirit::unused_type, Iterator = __gnu_cxx::__normal_iterator<const
>>> char*, std::basic_string<char> >, T1 = hs::Language::AX*(), T2 =
>>> boost::spirit::locals<std::vector<hs::Language::AX*>*>, T3 =
>>> boost::spirit::unused_type, T4 = boost::spirit::unused_type, std::string =
>>> std::basic_string<char>]::incompatible_start_rule::************)(boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const
>>> char*, std::basic_string<char> >, hs::Language::AX*(),
>>> boost::spirit::unused_type, boost::spirit::unused_type,
>>> boost::spirit::unused_type>))'
>>>
>>>
>>> /usr/include/boost/proto/extends.hpp:537:29: error: use of deleted
>>> function 'boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,
>>> boost::proto::argsns_::term<boost::spirit::qi::reference<const
>>> boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*,
>>> std::basic_string<char> >, hs::Language::AX*(),
>>> boost::spirit::locals<std::vector<hs::Language::AX*>*>,
>>> boost::spirit::unused_type, boost::spirit::unused_type> > >, 0l>::expr()'
>>>
>>> /usr/include/boost/proto/detail/preprocessed/expr_variadic.hpp:37:12:
>>> error: 'boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal,
>>> boost::proto::argsns_::term<boost::spirit::qi::reference<const
>>> boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*,
>>> std::basic_string<char> >, hs::Language::AX*(),
>>> boost::spirit::locals<std::vector<hs::Language::AX*>*>,
>>> boost::spirit::unused_type, boost::spirit::unused_type> > >, 0l>::expr()'
>>> is implicitly deleted because the default definition would be ill-formed:
>>> /usr/include/boost/proto/detail/preprocessed/expr_variadic.hpp:37:12:
>>> error: no matching function for call to 'boost::spirit::qi::reference<const
>>> boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*,
>>> std::basic_string<char> >, hs::Language::AX*(),
>>> boost::spirit::locals<std::vector<hs::Language::AX*>*>,
>>> boost::spirit::unused_type, boost::spirit::unused_type> >::reference()'
>>>
>>
>> According to the error message, I guess you use qi::locals in
>> yourstart-rule but not the grammar itself, the template params for
>> start-rule and grammar should always be the same.
>>
>>
>>
>> _______________________________________________
>> 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