This version of Spirit now supports the new version of Boost.Phoenix (V3), which has been released as part of Boost V1.47. Please note that this support is purely preliminary and should not be considered production quality. The reason why we are releasing this now is to enable people who want to use the new version of Boost.Phoenix in their code to do so without any conflicts with existing code using Spirit. Generally, no Spirit code needs to be changed. To activate the use of Boost.Phoenix V3 for Spirit you need to define the following preprocessor constant for your builds (before including any of Spirit's include files):
#define BOOST_SPIRIT_USE_PHOENIX_V3 1
utree, a generic, hierarchical, and dynamic data structure that can represent abstract syntax trees. It's well integrated with Spirit.Qi and Spirit.Karma. It can be passed as an attribute while parsing to almost any grammar. At the same time, it can be used as an attribute to generate output from.
BOOST_SPIRIT_TERMINAL_NAMEwhich takes in two parameters (the terminal name and its type). Before, there was only one parameter (the terminal name) and the type assumed the terminal name with
_typeappended. This produced invalid C++ identifiers with terminals such as
int_, which resulted in generated a type
int__typewith a bogus double underscore that is reserved for system use in C++.
_valnow can be used in top level semantic actions outside of any right hand side of a rule. Here is an example:
int i = 0 BOOST_TEST(test_attr("456", int_[_val = _1], i) && i == 456);In this case _val refers to the attribute value, which is passed in to the
phrase_parse()functions. Similar constructs are now possible in Spirit.Karma as well:
int i = 123; BOOST_TEST(test("123", int_[_1 = _val], i));This change unifies the handling of the
_valplaceholder allowing to use it everywhere, not only in semantic actions attached to the right hand sides of a rule.
int_(10)) do not consume input on failure anymore.
karma::real_policies<>preventing the use of const floating point types with the generator. Thanks to Jeroen Habraken (a.k.a. VeXocide) for reporting it and for submitting a patch and a test.
attr(attrib)parser, the Spirit.Qi
symbols<>parser, and the Spirit.Karma
symbols<>generator to properly handle container attributes. These were broken in Boost V1.46.1 (thanks to Aaron Graham and Joerg Becker for reporting the problems).
streamparser to properly adjust the iterator of the underlying input stream in the case when the stream parser component was successful. Thanks to Brian O'Kennedy who reported the problem on Stackoverflow.
repeaterroneously implemented commit/rollback semantics for its attribute, leaving it untouched if the directive failed. This behaviour has been removed as it is inconsistent with similar components. Existing code relying on this functionality will break. Please refer to the Spirit.Qi directive
holdto see how to fix your code.
BOOST_SPIRIT_NO_PREDEFINED_TERMINALSto prevent instantiations of predefined terminal objects which slows down compile time a lot. When
BOOST_SPIRIT_NO_PREDEFINED_TERMINALSis defined, the user instantiates the terminals that he needs. So, instead of writing
using qi::uint_one writes instead:
lex::string. Both primitives now accept a second parameter which will be interpreted as the requested token id for any token generated from this definition.
lex::lexertl::position_token<>, which is essentially plup-in compatible with the existing
lex::lexertl::token<>class. However it additionally stores the pair of iterators pointing to the underlying matched input sequence as an iterator_range.
"*"as the state name) when actions were attached to them.
traits::extract_from_container, which will be invoked instead of the older customization point
traits::extract_fromif the attribute is a container (
truefor the attribute).
hold_anynow takes a template argument:
Charis the character type used for the streaming operators (
hold_anyis still available as a
typedef basic_hold_any<char> hold_any;