| Home | Libraries | People | FAQ | More

### Spirit V2.3

##### What's changed in Spirit.Qi and Spirit.Karma from V2.2 (Boost V1.42.0) to V2.3 (Boost V1.43.0)

##### New Features

- The customization point `transform_attribute` now has to implement a third function: `void fail(Exposed&)`, which normally will do nothing. This function will be called whenever the right hand side of the `rule` (or the embedded parser of `attr_cast`) fail parsing. This change affects Qi only. See the description of the `traits::transform_attribute` for more details.
- Added support for attribute sequences created with `BOOST_FUSION_ADAPT_CLASS` and `BOOST_FUSION_ADAPT_CLASS_NAMED`. This support requires to include the new header file: `#include <boost/spirit/include/support_adapt_class_attributes.hpp>`.
- Added `karma::ostream_iterator` as a counterpart to `qi::istream_iterator` (see new header file: `#include <boost/spirit/home/support/iterators/ostream_iterator.hpp>`).
- Added `qi::hold` allowing to make sure the embedded parser does not touch the passed attribute in case it fails parsing.
- Added `qi::no_skip` directive, which is equivalent to `qi::``lexeme`, except that it does not pre-skip.
- Added `karma::no_delimit` directive, which is equivalent to `karma::``verbatim`, except that it does not perform a post-delimiting step.
- Added a new input_iterator policy for the `multi_pass` iterator framework (named `buffering_input_iterator`) allowing to wrap underlying input iterators which do not store the last character read from the input (such as `std::istream_iterator`). This is now used as the default input policy.

##### Bug Fixes

- Sequences (in Qi and Karma) may now have a component having no attribute even as their last element.
- Sequences (in Qi and Karma) can now take one element attribute sequences as their attribute.
- Constructs like `karma::buffer[karma::buffer[...]]` don't result in performing double buffering anymore. The same is true if an alternative is wrapped into a `karma::buffer[]` directive (as for instance: `buffer[a] | b`).
- The Spirit.Karma output iterator (which is used internally, but also is exposed when using the stream based API) is now properly copyable (thanks to Jonas Persson for reporting this issue).
- The default `multi_pass` iterator is now usable with underlying input iterators which do not store the last character read from the input (such as `std::istream_iterator`). Thanks to Larry Evans and Peter Schueller for independently reporting this problem.
- The directive `karma::omit[]` now does not accept an arbitrary attribute type anymore.
- The Spirit.Karma predicates (the and-predicate and the not-predicate) and the directive `karma::omit[]` now disable output altogether instead of intercepting the output into a buffer which got discarded as before.
- Fixed `karma::rule` to properly handles optional attributes.

##### What's changed in Spirit.Lex from V2.2 (Boost V1.42.0) to V2.3 (Boost V1.43.0)

##### New Lexer Features

- The library does not minimize the generated lexer tables for dynamic lexers by default anymore. The generated tables will now be minimized for static lexers only.
- The function `lexer<>::init_dfa()` now takes a single boolean parameter (which defaults to `false`) allowing to force minimization of the generated lexer tables.