Re: spirit with application crash
Seth <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
On 14-10-16 01:33, Jens Kallup wrote:
> Hello,
>
> I have following code. The Compiler+Linker makes an executable.
> But if run the Parser Part, the application crashes:
>
>
> dbase: /usr/local/include/boost/spirit/home/qi/nonterminal/rule.hpp:201:
> boost::spirit::qi::rule<Iterator, T1, T2, T3, T4>&
> boost::spirit::qi::rule<Iterator, T1, T2, T3, T4>::operator=(const
> boost::spirit::qi::rule<Iterator, T1, T2, T3, T4>&) [with Iterator =
> __gnu_cxx::__normal_iterator<const char*,
> std::__cxx11::basic_string<char> >; T1 =
> client::dbase_skipper<__gnu_cxx::__normal_iterator<const char*,
> std::__cxx11::basic_string<char> > >; T2 = boost::spirit::unused_type;
> T3 = boost::spirit::unused_type; T4 = boost::spirit::unused_type]:
> Zusicherung »rhs.f && "Did you mean rhs.alias() instead of rhs?"« nicht
> erfüllt.
>
Firstly, make your sample minimal and self contained. Nobody needs to
install Qt just to compile your sample just so they can see a silly
message in a popup dialog.
Secondly, eliminate (better: build the grammar incrementally, so you see
when it breaks).
For some reason you did already know to put .alias() on the start rule
definition, but not on the symbol rule definition. It is required there
too (because you're copy-assigning rules).
As a hint: make your skipper accept only non-empty sequences. In fact,
you don't need to tell it how to accept repeats of the same thing, since
Skippers get applied until they don't match anyways. As written, your
parser will never finish.
I don't see why "skip" needs to alias "myskip" either; it's not even used.
my_skip =
ascii::space |
("**" >> *(char_ - eol) >> (eol | eoi)) |
("&&" >> *(char_ - eol) >> (eol | eoi)) |
("//" >> *(char_ - eol) >> (eol | eoi)) |
("/*" >> *(char_ - "*/") >> "*/")
;
Lastly, on recent boost (1.59+ at least AFAIR) you don't need to #define
BOOST_SPIRIT_USE_PHOENIX_V3
See it live http://coliru.stacked-crooked.com/a/8eef1244cec09387
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-general