Boost logo

Boost Users :

Subject: Re: [Boost-users] [Spirit] Equivalent of limit_d in spirit 2.x
From: Roland Bock (rbock_at_[hidden])
Date: 2010-07-19 00:21:30

Hartmut Kaiser wrote:
>> Spirit 1.8 has a directive called limit_d which allowed to set the value
>> range. Is there an equivalent for this in Spirit 2.x?
>> There is not anything like this, but you can achieve the same with a
>> semantic action:
>> limit_d(min, max)[uint_p]
>> is equivalent to (when using qi::uint_, qi::_pass, and qi::_1):
>> uint_[_pass = (min <= _1 && _1 <= max)]
>> Regards Hartmut
>> Thanks for the quick reply!
>> Just out of curiosity: Where can I find this in the documentation? I
>> missed the _pass somehow.
> ference/phoenix.html
> Regards Hartmut

Thanks again!

I'd like to make two suggestions for the documentation:

a) It would be cool to have something like this in the tutorial:

   uint_[_pass = (min <= _1 && _1 <= max)][ref(year) = _1]

It shows an example usage of _pass and spirit's ability to handle
multiple semantic actions.

b) The links from the spirit documentation into the phoenix
documentation could be more targeted (currently they link to the index
page). In the given example, I have some trouble in finding more
information about _pass in the phoenix documentation.



Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at