Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5566: Spirit.Lex converting a token to its value in a lexer semantic action fails
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-04-11 23:09:40
#5566: Spirit.Lex converting a token to its value in a lexer semantic action fails
------------------------------------------+---------------------------------
Reporter: Reko Tiira <reko@â¦> | Owner: hkaiser
Type: Bugs | Status: closed
Milestone: To Be Determined | Component: spirit
Version: Boost 1.46.1 | Severity: Problem
Resolution: fixed | Keywords:
------------------------------------------+---------------------------------
Comment (by hkaiser):
Replying to [comment:6 Gilles <gillesb68@â¦>]:
> Replying to [comment:5 hkaiser]:
> > Replying to [comment:4 Gilles <gillesb68@â¦>]:
> > > What I see from the token's variant is that the value replaces the
pair of iterators pointing to the matched input sequence. Is there a way
to store the converted value and, in the same time, keeping the pair of
iterators pointing to the matched input sequence ?
> >
> > Yes, simply use position_token instead of the plain token class.
>
> I understand this for a token enclosing the pair pointing the matched
input sequence alone, but how do I declare a token enclosing together :
>
> 1/ the pair of iterators pointing to the matched input sequence; and
>
> 2/ the converted value of the same input sequence ?
Yes, that's what you can do with the `position_token` type. It is
semantically equivalent to the `token` type, except for the additionally
stored iterator pair of the matched input sequence. Please see
libs/example/qi/compiler_tutorial/conjure3 for an example.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5566#comment:7> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:12 UTC