From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2008-05-29 10:50:21
> I started playing with spirit-2/lex (on the trunk), specifically
> examples/lex/example4.cpp, thought
> I'd try to parse some python. I've hit an error that was already asked
> about a month or so ago.
What problem have you hit?
> It appears to be because this guy:
> doesn't have 'construct' overloads for various types (conversion to
> unsigned is the one
> that comes up in the example). I dug around and found construct.hpp,
> which does have them, but they forward to parse(), using proto
> placeholders from over in
> support/placeholders.hpp. This ends up coming round again to
> At this point I can't decide whether this is going to be detangleable
> or not.
> I thought I'd ask for some hints on what things are supposed to look
> like in the end, if so. In any event, the code is absolutely
> fascinating. Time well spent.
It's supposed to work as follows:
- Any parser uses one of the assign_to() overloads to assign it's attribute
value to the specified destination.
- The assign_to() functions use construct overloads to do the conversion
from an iterator range to the requested type (if appropriate). This
distinction has been made decouple Spirit specifics from the conversion
itself and to allow the user to provide his/her own construct() overloads
for custom parsers (to be found via ADL).
- Some of the (predefined) construct() functions use Spirit parsers
themselves to do the conversion. But here we use only parser primitives
which provide their attributes as (already converted) values, not as
I still have a hard time to see your problem. The construct() functions use
qi::parse only for the conversion of iterator ranges to the attribute type,
so there shouldn't be any cyclic dependencies.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk