Boost logo

Boost Users :

Subject: Re: [Boost-users] [Spirit 2] on_error to string
From: TONGARI (tongari95_at_[hidden])
Date: 2011-04-06 14:08:54


2011/4/7 Vincent Agnus <vincent.agnus_at_[hidden]>

> thanks for our answer !
>
> Your solution work, but it is not exactly I want. Indeed this expression
> return the typename of a tag (for example literal-char) instead its value (
> "A" , "B" , .... ).
>

Does my first suggestion solve your first attempt?
    i.e. (ostream&)m_error << ...

for example if my start rule is
> start = qi::char_("a-z") > qi::char_("!");
>
> and I parse the string "a#" then I expect that _4 contain "!" ,
> phx::bind(&boost::spirit::info::tag, qi::_4) return "literal-char"
>
> 2 questions :
> a) I have a look in boost::spirit::info class is the
> boost::spirit::info::value member is containing the data I want ( ie "!")
>

True here, but it's a more subtle thing than I can explain...
Not every case can you get a utf8_string form boost::spirit::info::value.

For example, "... > qi::char_('a', 'z')" you can get the value as a
utf8_string "a-z";
while "... > qi::char_("a-z")" you can only get a nil object from value.

b) perhaps it exists an alternative like
> phx::construct<>( phx::val("") << _4 )
>

I don't know what you mean here.



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