1[/============================================================================== 2 Copyright (C) 2001-2011 Joel de Guzman 3 Copyright (C) 2001-2012 Hartmut Kaiser 4 5 Distributed under the Boost Software License, Version 1.0. (See accompanying 6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7===============================================================================/] 8 9[section What's New] 10 11[/////////////////////////////////////////////////////////////////////////////] 12[section:spirit_2_5_3 Spirit V2.5.3] 13 14[heading What's changed from V2.5.2 (Boost V1.49.0) to V2.5.3 (Boost V1.50.0)] 15 16* The deprecated headers are removed. It's been there for a couple of years now 17 and it's about time to do some cleanup. 18 19[endsect] 20 21[/////////////////////////////////////////////////////////////////////////////] 22[section:spirit_2_5_2 Spirit V2.5.2] 23 24[heading What's changed from V2.5.1 (Boost V1.48.0) to V2.5.2 (Boost V1.49.0)] 25 26* Integrated Vitaly Budovski's patch to add binary floating point parsers and 27 generators. 28* Fixed #6253: `lex::lexertl::generate_static_dfa` compiler errors if lexer has 29 wchar_t as underlying stream type. 30* Added the possibility to match a token range when parsing with a lexer by 31 using `qi::token(min, max)`, or `qi::tokenid(min, max)`. Both parsers match 32 any token with a token id in the range [min, max]. 33* Fixed a problem in [karma_align `center`]`(num)[a]` and 34 [karma_align `center`]`(num, g)[a]` if used inside a compound generator (such 35 as sequences, Kleene, list, or plus. 36* Fixed `karma::subrule` from the [@../../repository/doc/html/index.html repository] 37 (thanks to Lee Clagett for submitting a patch). 38* Fixed __karma__ examples (thanks to Lee Clagett for submitting a patch). 39* Fixed #6368: [multi_pass] clear_queue isn't forwarded to the storage policy. 40* Fixed a problem in __karma__ when a variant holding a container was used as 41 a generator inside a sequence. 42 43[endsect] 44 45[/////////////////////////////////////////////////////////////////////////////] 46[section:spirit_2_5_1 Spirit V2.5.1] 47 48[heading What's changed from V2.5 (Boost V1.47.0) to V2.5.1 (Boost V1.48.0)] 49 50* The `spirit::istream_iterator` (see __multi_pass__) now checks at 51 construction time whether the underlying stream has reached eof (end of file). 52* __qi__ now properly collapses attributes generated from optionals embedded 53 inside another optional parser (i.e. `-('(' > -int_ >> ')'). That means that 54 attributes like `boost::optional<boost::optional<int> >` will be collapsed 55 to `boost::optional<int>`. Thanks to Peter Schueller for reporting that 56 problem. 57* Actions attached to binary parsers now properly propagate the parser's 58 attribute. Thanks to Mathias Born for reporting this issue. 59 60[heading Bug Fixes in Lex] 61 62* Fixed Boost ticket #5701: lexertl token_value_type returns const unused for 63 nonconst ref. 64* Fixed a problem in the lexer (position_token) causing problems with enabled 65 parser debugging (MSVC2010). 66 67[endsect] 68 69[/////////////////////////////////////////////////////////////////////////////] 70[section:spirit_2_5 Spirit V2.5] 71 72[heading What's changed in __qi__ and __karma__ from V2.4.2 (Boost V1.46.0) to V2.5 (Boost V1.47.0)] 73 74This version of __spirit__ now supports the new version of __boost_phoenix__ (V3), 75which has been released as part of Boost V1.47. Please note that this support 76is purely preliminary and should not be considered production quality. The 77reason why we are releasing this now is to enable people who want to use the 78new version of __boost_phoenix__ in their code to do so without any conflicts with 79existing code using __spirit__. Generally, no __spirit__ code needs to be 80changed. To activate the use of __boost_phoenix__ V3 for __spirit__ you need to 81define the following preprocessor constant for your builds (before including 82any of Spirit's include files): 83 84 #define BOOST_SPIRIT_USE_PHOENIX_V3 1 85 86[heading New Features in Qi or Karma] 87 88* Added __utree__, a generic, hierarchical, and dynamic data structure that can 89 represent abstract syntax trees. It's well integrated with __qi__ and 90 __karma__. It can be passed as an attribute while parsing to almost any 91 grammar. At the same time, it can be used as an attribute to generate output 92 from. 93* Added a new macro `BOOST_SPIRIT_TERMINAL_NAME` which takes in two parameters 94 (the terminal name and its type). Before, there was only one parameter 95 (the terminal name) and the type assumed the terminal name with `_type` 96 appended. This produced invalid C++ identifiers with terminals such as 97 `int_`, which resulted in generated a type `int__type` with a bogus double 98 underscore that is reserved for system use in C++. 99* The numeric parsers now allow arbitrary radix from 2..10 and 16 100* The placeholder `_val` now can be used in top level semantic actions outside 101 of any right hand side of a rule. Here is an example: 102`` 103 int i = 0 104 BOOST_TEST(test_attr("456", int_[_val = _1], i) && i == 456); 105`` 106 In this case _val refers to the attribute value, which is passed in to the 107 `parse()` or `phrase_parse()` functions. 108 Similar constructs are now possible in __karma__ as well: 109`` 110 int i = 123; 111 BOOST_TEST(test("123", int_[_1 = _val], i)); 112`` 113 This change unifies the handling of the `_val` placeholder allowing to use it 114 everywhere, not only in semantic actions attached to the right hand sides of 115 a rule. 116* Added support for __karma__ [unsigned_int unsigned numeric generators] with 117 arbitrary radix values in the (inclusive) range from `2` .. `36`. 118 119[heading Bug Fixes in Qi or Karma] 120 121* __qi__ integer literals (like `int_(10)`) do not consume input on failure 122 anymore. 123* Fixed Boost ticket #5246: mmap_file_iterator Fails to initialize correctly. 124* Fixed Boost ticket #5246: mmap_file_iterator Fails to initialize correctly. 125* Fixed a const correctness problem in `karma::real_policies<>` preventing the 126 use of const floating point types with the generator. Thanks to Jeroen 127 Habraken (a.k.a. VeXocide) for reporting it and for submitting a patch and 128 a test. 129* Fixed the __qi__ __qi_attr__ parser, the __qi__ __qi_symbols__ parser, and 130 the __karma__ [karma_symbols `symbols<>`] generator to properly handle 131 container attributes. These were broken in Boost V1.46.1 (thanks to 132 Aaron Graham and Joerg Becker for reporting the problems). 133* Fixed the __qi_stream__ parser to properly adjust the iterator of the 134 underlying input stream in the case when the stream parser component was 135 successful. Thanks to Brian O'Kennedy who reported the problem on 136 Stackoverflow. 137* Fixed failing Karma numerics generators when used with adapted ADTs (thanks 138 to Colin Rundel for reporting that problem). 139 140[heading Breaking Changes] 141 142* The __qi__ directive __qi_repeat__ erroneously implemented commit/rollback 143 semantics for its attribute, leaving it untouched if the directive failed. 144 This behaviour has been removed as it is inconsistent with similar components. 145 Existing code relying on this functionality will break. Please refer to the 146 __qi__ directive __qi_hold__ to see how to fix your code. 147* Added a preprocessor define `BOOST_SPIRIT_NO_PREDEFINED_TERMINALS` to prevent 148 instantiations of predefined terminal objects which slows down compile time 149 a lot. When `BOOST_SPIRIT_NO_PREDEFINED_TERMINALS` is defined, the user 150 instantiates the terminals that he needs. So, instead of writing `using qi::uint_` 151 one writes instead: `qi::uint_type uint_`. 152 153[heading New Features in Lex] 154 155* Added the possibility to specify a token id while creating a token definition 156 using `lex::char_` and `lex::string`. Both primitives now accept a second 157 parameter which will be interpreted as the requested token id for any token 158 generated from this definition. 159* Added a new token type `lex::lexertl::position_token<>`, which is essentially 160 plup-in compatible with the existing `lex::lexertl::token<>` class. However 161 it additionally stores the pair of iterators pointing to the underlying 162 matched input sequence as an iterator_range. 163 164[heading Bug Fixes in Lex] 165 166* Fixed a problem with associating token definitions with all states (using 167 `"*"` as the state name) when actions were attached to them. 168 169[heading Making Stuff Work] 170 171* Added the __karma__ customization point __customize_extract_from_container__, 172 which will be invoked instead of the older customization point 173 __customize_extract_from__ if the attribute is a container (__customize_is_container__ 174 returns `true` for the attribute). 175* The type `hold_any` now takes a template argument: `basic_hold_any<Char>`, 176 where `Char` is the character type used for the streaming operators 177 (`operator>>()` and `operator<<()`). The `hold_any` is still available as a 178 `typedef basic_hold_any<char> hold_any`; 179* Semantic actions now support attribute compatibility. This is a breaking 180 change but #define BOOST_SPIRIT_ACTIONS_ALLOW_ATTR_COMPAT must be defined 181 in order for the new behavior to kick in. By default, the old behavior 182 is still in place. 183* Alternatives now support attribute compatibility. 184* The attribute handling for container attributes of sequences and container 185 components (list, Kleene, Plus, and repeat) has been completely rewritten. 186 It now supports many more use cases and behaves much more predictable than 187 the older version. Thanks to Thomas Taylor, Richard Crossley, Semen, 188 Adalberto Castelo, and many others for reporting bugs and helping in making 189 the new code behave as expected. 190 191[endsect] 192 193[/////////////////////////////////////////////////////////////////////////////] 194[section:spirit_2_4_2 Spirit V2.4.2] 195 196[heading What's changed in __qi__ and __karma__ from V2.4.1 (Boost V1.45.0) to V2.4.2 (Boost V1.46.0)] 197 198[heading New Features in Qi or Karma] 199 200* Added keyword indexes for __qi__ and __karma__ to the docs. 201* Introduced a new customization point __customize_assign_to_container_from_value__ 202 which is invoked for container attributes whenever an attribute value needs to 203 be added to that container. 204* Replaced `proto::lit` (which was used to implement `spirit::lit`) with a 205 separate version allowing to distinguish 'lit(foo)' from 'foo'. This should 206 not change any semantics nor should it break exiting code. 207* Added the __qi__ directive __qi_as__ (and its string specializations 208 __qi_as_string__ and __qi_as_wstring__) enabling asignment of container 209 attribute types as a whole. 210* Added the __karma__ directive __karma_as__ (and its string specializations 211 __karma_as_string__ and __karma_as_wstring__) enabling handling of container 212 attribute types during output generation as a whole. 213* In __qi__, `lit()` can now be used for numeric literals as well. 214* The __qi_symbols__ parser component now has an explicit name used for 215 error handling and debugging, which can be set using the new member functions 216 `sym.name(...)`. Thanks to teajay for contributing a patch. 217* The [karma_symbols `symbols<Attrib, T>`] generator component now has an 218 explicit name used for error handling and debugging, which can be set using 219 the new member functions `sym.name(...)`. 220 221[heading Bug Fixes in Qi or Karma] 222 223* Fixed a problem in handling container attributes for __qi__ sequences, which 224 caused the properly parsed attributes of the first elements being overwritten 225 by later elements of the sequence. 226* Fixed the __karma__ generator [karma_string `string(s)`]. It succeeded even 227 if `s` matched only a prefix of its attribute. 228 229[heading What's changed in __lex__ from V2.4.1 (Boost V1.45.0) to V2.4.2 (Boost V1.46.0)] 230 231[heading New Features in Lex] 232 233* Added `qi::tokenid()` primitive parser allowing to match arbitrary lexer 234 tokens based on a given token id. The difference to `qi::token()` is, that it 235 exposes as its attribute the token id of the matched token (instead of the 236 iterator_range of the matched input, as `qi::token()` does). 237* Added an additional template parameter to the default `lexertl::token<>` 238 definition: the type of the token id. This type defaults to `std::size_t`. 239 Any type used as the id type needs to be (explicitly) convertible from 240 `std::size_t`. 241* It's now possible to attach lexer semantic actions to token definitions 242 based on `lex::char()` and `lex::string()`. 243* It's now possible to specify a lexer state the lexer should automatically be 244 switched to after matching certain tokens. For this reason the token 245 definition syntax has been extended: 246`` 247 template <typename Lexer> 248 struct lexer : lex::lexer<Lexer> 249 { 250 lexer() 251 { 252 int_ = "[1-9][0-9]*"; 253 this->self("INITIAL", "TARGETSTATE") = int_; 254 } 255 lex::token_def<int> int_; 256 }; 257`` 258 This example lexer will match a `int_` token and will switch the lexer to 259 the state `"TARGETSTATE"` afterwards. If the second argument is not 260 specified the lexer remains in the previous state (as before). 261* The parser primitives `qi::token` and `qi::tokenid` can now be used without 262 any argument. In this case they will match any token. 263* `lex::lit()` has been removed. 264 265[heading Bug Fixes in Lex] 266 267* Fixed an issue in the Lexer giving problems while assigning tokens to all 268 lexer states at once. This is now possible by simply using "*" as the state 269 name. For instance this will add the token int_ to all lexer states: 270`` 271 template <typename Lexer> 272 struct lexer : lex::lexer<Lexer> 273 { 274 lexer() 275 { 276 int_ = "[1-9][0-9]*"; 277 this->self("*") = int_; 278 } 279 lex::token_def<int> int_; 280 }; 281`` 282 Note: the `self("*") = ...` must be executed after all lexer states have 283 been introduced to the lexer object. 284 285* Fixed lexer lookahead. The lookahead operation is now evaluated using the 286 lexer state the `token_def` instance used as its argument is associated 287 with. 288* Fixed a problem in the `multi_pass` iterator causing wrong tokens to be 289 returned to the user. This could happen in conjunction with a lexer which 290 performed lexer state changes and was using `pass_fail` in semantic actions 291 to make a token match fail. 292 293[heading Known Problems] 294 295* __qi__ integer literals (like `int_(10)`) consume input on failure, which can 296 lead to problems with the alternative operator. 297 298[endsect] 299 300[/ spirit_2_4_2] 301 302[/////////////////////////////////////////////////////////////////////////////] 303[section:spirit_2_4_1 Spirit V2.4.1] 304 305[heading What's changed in __qi__ and __karma__ from V2.4 (Boost V1.44.0) to V2.4.1 (Boost V1.45.0)] 306 307[heading Bug Fixes] 308 309* Fixed broken __qi__ debugging facilities for optional attributes. 310* The __qi__ auto parsers and __karma__ auto generators will now properly work 311 with `signed char` and `unsigned char` as well. 312* Fixed a problem in the multi_pass fixed_queue policy. 313* Enabled proper modifier handling for the __qi_skip__ directive. 314* Fixed a floating point formating problem in Karma (Trac ticket #4742). 315* Fixed a problem in [qi_repeat `repeat`]`[]`, which caused the `first` 316 iterator not to be reset on certain parsing failures (see 317 [@http://stackoverflow.com/questions/4009752/boost-spirit-bug-when-mixing-alternates-with-optionals Stack Overflow]). 318 319[endsect] [/ spirit_2_4_1] 320 321[/////////////////////////////////////////////////////////////////////////////] 322[section:spirit_2_4 Spirit V2.4] 323 324[heading What's changed in __qi__ and __karma__ from V2.3 (Boost V1.43.0) to V2.4 (Boost V1.44.0)] 325 326[heading New Features] 327 328* The customization point __customize_transform_attribute__ now takes an additional template 329 parameter `Domain` allowing to better specialize the customization point 330 for either `qi::domain` or `karma::domain`. 331 332[important This is a interface breaking change requiring to modify existing 333 code. If you have a specialization of this customization point in 334 your code you need to add the specialization for the new template 335 parameter, i.e. either `qi::domain` or `karma::domain`.] 336* Semantic actions in __qi__ now implicitly invoke the function `pre` of the 337 customization point __customize_transform_attribute__ to convert the supplied 338 attribute to the exposed attribute type, as needed. The functions 339 `post` and `fail` of this customization point are not invoked by this 340 component (as this would not make any sense). 341* Semantic actions in __karma__ now implicitly invoke the function `pre` of the 342 customization point __customize_transform_attribute__ to convert the supplied 343 attribute to the consumed attribute type, as needed. 344* Added the __karma__ __karma_skip__ directive which is semantically equivalent 345 to the __karma__ __karma_omit__ directive except that it will not execute the 346 embedded generator. 347* Added debug support to __karma__ rules. 348* Added strict mode to __karma__, leaving the current behavior (unchanged) as 349 relaxed mode. Added __karma__ compile time directives `strict[]` and 350 `relaxed[]` allowing to switch between the two. 351* Added __karma__ __karma_duplicate__ directive which duplicates the supplied 352 attribute to all elements of an embedded generator sequence. 353 354[heading Bug Fixes] 355 356* Components in __qi__ and __karma__ now accept one element Fusion sequences as 357 their attributes as long as the element in the Fusion sequence is compatible 358 with the component's attribute type. 359* The character range parser and generator components can now additionally be 360 written as `char_("a", "z")` instead of `char_('a', 'z')` making it 361 consistent with the syntax of the `char_('a')` component (which can be 362 written as `char_("a")` as well). Please note that the mixed syntax forms, 363 i.e. `char_('a', "z")` and `char_("a", 'z')`, are not supported. 364* Fixed attribute handling in __karma__ sequences when all elements of that 365 sequence consume either the same attribute type or containers of that 366 attribute type and the passed in attribute is a container of that attribute 367 type as well. In this case using a repetitive container was supported only 368 when it was the last element of the sequence. Now it is possible to 369 have a [karma_repeat `repeat`]`(num)[a]` generator at any position (well, 370 actually you can have any repetitive container at any position now, but this 371 doesn't always make sense as it normally would eat up all supplied attribute 372 values). 373* Fixed debug output for variants where a variant element is an STL sequence. 374* Fixed a problem in multi_pass, avoiding to loose a character at end of input 375 when switching iterators. 376 377[heading What's changed in __lex__ from V2.3 (Boost V1.43.0) to V2.4 (Boost V1.44.0)] 378 379[heading New Lexer Features] 380 381* The lexer is now well integrated with the debug output generated by Qi's 382 simple_trace utility. Tokens are printed as: '<' matched sequence '>'. 383 384[heading Lexer Bug Fixes] 385 386* Fixed a problem with using lex::_val as a rvalue in lexer semantic 387 expressions. 388* Token values are now available for introspection (as an iterator_range) 389 inside lexer semantic expressions as well. 390 391[endsect] [/ spirit_2_4] 392 393[/////////////////////////////////////////////////////////////////////////////] 394[section:spirit_2_3 Spirit V2.3] 395 396[heading What's changed in __qi__ and __karma__ from V2.2 (Boost V1.42.0) to V2.3 (Boost V1.43.0)] 397 398[heading New Features] 399 400* The customization point `transform_attribute` now has to implement a third 401 function: `void fail(Exposed&)`, which normally will do nothing. This function 402 will be called whenever the right hand side of the `rule` (or the embedded 403 parser of `attr_cast`) fail parsing. This change affects /Qi/ only. See 404 the description of the __customize_transform_attribute__ for more details. 405* Added support for attribute sequences created with `BOOST_FUSION_ADAPT_CLASS` 406 and `BOOST_FUSION_ADAPT_CLASS_NAMED`. This support requires to include the 407 new header file: `#include <boost/spirit/inlcude/support_adapt_class_attributes.hpp>`. 408* Added `karma::ostream_iterator` as a counterpart to `qi::istream_iterator` 409 (see new header file: `#include <boost/spirit/home/support/iterators/ostream_iterator.hpp>`). 410* Added `qi::hold` allowing to make sure the embedded parser does not touch 411 the passed attribute in case it fails parsing. 412* Added [qi_no_skip `qi::no_skip`] directive, which is equivalent to 413 `qi::`__qi_lexeme__, except that it does not pre-skip. 414* Added [karma_no_delimit `karma::no_delimit`] directive, which is equivalent to 415 `karma::`__karma_verbatim__, except that it does not perform a post-delimiting 416 step. 417* Added a new input_iterator policy for the `multi_pass` iterator framework 418 (named `buffering_input_iterator`) allowing to wrap underlying input 419 iterators which do not store the last character read from the input (such as 420 `std::istream_iterator`). This is now used as the default input policy. 421 422[heading Bug Fixes] 423 424* Sequences (in /Qi/ and /Karma/) may now have a component having no attribute 425 even as their last element. 426* Sequences (in /Qi/ and /Karma/) can now take one element attribute sequences 427 as their attribute. 428* Constructs like `karma::buffer[karma::buffer[...]]` don't result in 429 performing double buffering anymore. The same is true if an alternative is 430 wrapped into a `karma::buffer[]` directive (as for instance: `buffer[a] | b`). 431* The __karma__ output iterator (which is used internally, but also is exposed 432 when using the stream based API) is now properly copyable (thanks to Jonas 433 Persson for reporting this issue). 434* The default `multi_pass` iterator is now usable with underlying input 435 iterators which do not store the last character read from the input (such as 436 `std::istream_iterator`). Thanks to Larry Evans and Peter Schueller for 437 independently reporting this problem. 438* The directive `karma::omit[]` now does not accept an arbitrary attribute 439 type anymore. 440* The __karma__ predicates (the and-predicate and the not-predicate) and the 441 directive `karma::omit[]` now disable output altogether instead of 442 intercepting the output into a buffer which got discarded as before. 443* Fixed `karma::rule` to properly handles optional attributes. 444 445[heading What's changed in __lex__ from V2.2 (Boost V1.42.0) to V2.3 (Boost V1.43.0)] 446 447[heading New Lexer Features] 448 449* The library does not minimize the generated lexer tables for dynamic lexers by 450 default anymore. The generated tables will now be minimized for static lexers 451 only. 452* The function `lexer<>::init_dfa()` now takes a single boolean parameter 453 (which defaults to `false`) allowing to force minimization of the generated 454 lexer tables. 455 456[endsect] [/ spirit_2_3] 457 458[//////////////////////////////////////////////////////////////////////////////] 459[section:spirit_2_2 Spirit V2.2] 460 461[heading What's changed in __qi__ and __karma__ from V2.1 (Boost V1.41.0) to V2.2 (Boost V1.42.0)] 462 463[heading New Features] 464 465* Added `auto_` component in __qi__ and __karma__, added API functions 466 `qi::`__create_parser__ and `karma::`__create_generator__. 467* Added `auto_` based overloads for all API functions taking no attributes (see 468 [link spirit.qi.reference.parse_api /Qi/ API] and 469 [link spirit.karma.reference.generate_api /Karma/ API]). 470* Added [karma_columns `karma::columns`] directive. 471* Added [karma_symbols `karma::symbols<Attr, T>`] generator. 472* The __qi__ customization point __customize_push_back_container__ now returns 473 a `bool` to report whether the item has been added to the container. 474* Added an overload for [karma_maxwidth `karma::maxwidth`] directive allowing 475 to specify an additional parameter (any compatible output iterator) receiving 476 the 'overspilled' output (output not fitting into the maxwidth limit). 477* It is now possible to use Phoenix expressions as __karma__ attributes. 478* Added [link spirit.support.multi_pass.reading_from_standard_input_streams `basic_istream_iterator<Char, Traits>`] 479 usable as an equivalent for `std::istream_iterator` except its a __fwditer__ 480 allowing to parse directly from any `std::basic_istream`. 481* Added `qi::`__qi_matches__ directive. 482 483[heading Bug Fixes] 484 485* Fixed karma::alternatives to work with embedded containers of hold_any (i.e. 486 constructs like `*stream | "empty"` (which fixes the Karma example 487 basic_facilities.cpp). 488* Fixed numeric __karma__ generators for character types. 489* Fixed `qi::repeat[]` for unused attributes. 490* Fixed rare compilation problem in `karma::repeat[]`. 491* Fixed sequences in __qi__ and __karma__ to compile properly if the attribute 492 is a (STL) container of (STL) containers. 493* Fixed a problem in `lex::token_def::what`. 494* Fixed __qi__ symbols not to match substrings anymore. Added 495 `qi::symbols::prefix_find` to allow matching of (prefix-) substrings. 496* Inherited parameters for rule's usually have to be wrapped in function 497 objects (i.e. `phoenix::val`), for integral values this was not necessary. 498 Now all string types can be passed without being wrapped as well (i.e. 499 `std::string`, `char const*`, etc.). 500* Added concept checks to all relevant __qi__ API functions enforcing the 501 iterator to be at least of the type `std::forward_iterator_tag`. 502* Fixed the `qi::match` and `qi::phrase_match` set of API functions not to 503 internally utilize a `std::stream_iterator` anymore as this iterator is of 504 the type `std::input_iterator_tag` only, which is not sufficient for __qi__. 505 506[endsect] [/ spirit_2_2] 507 508[//////////////////////////////////////////////////////////////////////////////] 509[section:spirit_2_1 Spirit V2.1] 510 511[heading What's changed in __qi__ and __karma__ from V2.0 (Boost V1.37.0) to V2.1 (Boost V1.41.0)] 512 513* __spirit__ is now based on the newest version of __boost_proto__ 514* `qi::phrase_parse`, `qi::phrase_format` now post-skip by default. 515* `karma::generate_delimited` and `karma::format_delimited` now don't do pre- 516 delimiting by default. 517* Changed parameter sequence of `qi::phrase_parse`, `qi::phrase_match`, 518 `karma::generate_delimited`, and `match_delimited`. The attribute is now 519 always the last parameter. 520* Added new overloads of those functions allowing to explicitly specify the 521 post-skipping and pre-delimiting behavior. 522* Added multi attribute API functions 523* Removed `grammar_def<>` 524* Removed functions `make_parser()` and `make_generator()` 525* Removed `qi::none` and `karma::none` 526* Sequences and lists now accept a standard container as their attribute 527* The string placeholder terminal now can take other strings as its parameter 528 (i.e. std::string) 529* All terminals taking literals now accept a (lazy) function object as well 530* All placeholders for terminals and directives (such as `int_`, `double_`, 531 `verbatim`, etc.) were previously defined in the namespace `boost::spirit` 532 only. Now these are additionally imported into the namespaces 533 `spirit::qi`, `spirit::karma`, and `spirit::lex` (if they are supported by 534 the corresponding sub-library). 535* The terminal placeholders `char_` and `string` are not defined in the 536 namespace `boost::spirit` anymore as they have been moved to the 537 character set namespaces, allowing to do proper character set 538 handling based on the used namespace (as `spirit::ascii`, etc.) 539* The `uint`, `ushort`, `ulong`, and `byte` terminal placeholders have been 540 renamed to `uint_`, `ushort_`, `ulong_`, and `byte_`. 541* `qi::skip[]` now re-enables outer skipper if used inside `lexeme[]` 542* Added `karma::maxwidth[]` directive (see [karma_maxwidth `maxwidth`]) 543* Added `karma::omit[]` allowing to consume the attribute of subject generator 544 without emitting any output (see __karma_omit__). 545* Added `karma::buffer[]` allowing to avoid unwanted output to be generated in 546 case of a generator failing in the middle of a sequence (see __karma_buffer__). 547* `karma::delimit[]` now re-enables outer delimiter if used inside `verbatim[]` 548* Karma: added and-predicate (`operator&()`) and not-predicate (`operator!()`) 549 Both now always consume an attribute. 550* Karma: changed semantics of `char_()`, `string()`, `int_()` et.al., and 551 `double_()` et.al.: all of these generators now always expose an attribute. 552 If they do not have an associated attribute, they generate their immediate 553 literal. If they have an associated attribute, the generators first test if 554 the attribute value is equal to the immediate literal. They fail and do not 555 generate anything if those are not equal. Otherwise they generate their 556 immediate literal. For more information see for instance [signed_int `int_`]. 557* `karma::lit()` can now be used to generate integer and floating point numbers 558* `qi::rule` and `karma::rule` now can be directly initialized using their copy 559 constructor. I.e. this works now: `qi::rule<...> r = ...some parser...;`. 560* Added `qi::attr()` exposing its immediate parameter as its attribute. 561* Added boolean parsers and generators (`bool_`, `true_`, `false_`). 562* Added `attr_cast<>` enabling in place attribute type conversion in Qi and Karma 563 grammars. 564* Almost all Karma generators now accept `optional<>` attributes and will fail 565 generating if this is not initialized. 566* Qi and Karma rules now automatically detect whether to apply auto-rule 567 semantics or not (no need for using `operator%=()` anymore, even if it's still 568 existing). Auto-rule semantics are applied if the right hand side has no 569 semantic actions attached to any of the elements. This works for rule 570 initialization and assignment. 571* Qi and Karma rules now do intrinsic attribute transformation based on the 572 attribute customization point __customize_transform_attribute__. 573* All char_ parsers now always expose an attribute. Earlier `char_(...)` didn't 574 expose an attribute while `char_` did. If you need a literal parser not exposing 575 any attribute use `lit(...)` instead. 576* The qi::int_spec, qi::real_spec, karma::int_spec, and karma real_spec types 577 do not exist anymore. These have been replaced with qi::int_parser, 578 qi::real_parser, karma::int_generator, and karma::real_generator. 579 580[heading What's changed in __lex__ from V2.0 (Boost V1.37.0) to V2.1 (Boost V1.41.0)] 581 582Here is a list of changes in __lex__ since version 2.0. __lex__ 2.1 is a 583complete rewrite of the __lex__ distributed with Boost V1.37. As with all 584code portions of the __spirit__ library, __lex__ is usable as stand alone piece. 585__lex__ now uses the infrastructure provided by __spirit__ version 2.1. 586 587* The lex::lexer_def class has been renamed to lex::lexer, while the original 588 class lex::lexer does not exist anymore. This simplifies the creation of 589 lexers. 590* The lex::lexer class does not have the function `def(Self& self)` anymore, 591 token definitions can be added to the lexer at any time, usually in the 592 constructor of the user defined lexer class: 593`` 594 template <typename Lexer> 595 struct example_tokens : lex::lexer<Lexer> 596 { 597 example_tokens() 598 { 599 // your token definitions here 600 this->self = ... 601 } 602 }; 603`` 604* The new lexer class can now be used directly. The function `make_lexer()` has 605 been removed. 606* The `lex::tokenize_and_parse()` and `lex::tokenize_and_phrase_parse()` functions 607 have been changed to match the parameter sequence as implemented by the 608 `qi::parse()` and `qi::phrase_parse()` functions. 609 Both take an arbitrary number of attribute arguments as the last 610 parameters. This argument list is limited by the macro 611 `SPIRIT_ARGUMENTS_LIMIT`. 612* The `lex::lexertl_lexer`, and `lex::lexertl_token` 613 classes have been moved to the `lex::lexertl` namespace and the names have been 614 changed to `lex::lexertl::lexer`, `lex::lexertl::token`. This also applies to 615 the `lex::lexert_actor_lexer`, and the `static_lexertl_*` family of types. 616* The class `lex::lexertl_token_set` has been removed. This functionality is now 617 available from the lexer class. 618* The __lex__ library has been updated to use the newest version of Ben 619 Hansons __lexertl__ lexer construction library (Boost review pending). 620* The `lex::lexer<Lexer>` template constructor now takes an optional parameter 621 specifying the `match_flags` to be used for table generation. Currently, there 622 are the following flags available: 623`` 624 match_flags::match_default, // no flags 625 match_flags::match_not_dot_newline, // the regex '.' doesn't match newlines 626 match_flags::match_icase // all matching operations are case insensitive 627`` 628 If no parameter is passed to the constructor, `match_flags::match_default` is 629 used, i.e. the `.` matches newlines and matching is case sensitive. 630 631* The `char_()` and `string()` placeholders can now be used for token 632 definitions and are synonymous with `token_def`. 633* Lexer semantic actions now have to conform to a changed interface (see 634 __sec_lex_semactions__ for details). 635* Added placeholder symbols usable from the inside of lexer semantic actions 636 while using Phoenix: `lex::_start`, `lex::_end`, `lex::_eoi`, `lex::_state`, 637 `lex::_val`, and `lex::_pass` (see __sec_lex_semactions__ for more details). 638* Added (lazy) support functions usable from the inside of lexer semantic 639 actions while using Phoenix: `lex::more()`, `lex::less()`, and 640 `lex::lookahead()` (see __sec_lex_semactions__ for more details). 641* Removed `lex::omitted` in favor of `lex::omit` to unify the overall 642 interface. 643 644[endsect] [/ spirit_2_1] 645 646[/////////////////////////////////////////////////////////////////////////////] 647[section:spirit_1_x Spirit Classic] 648 649The Spirit V1.8.x code base has been integrated with Spirit V2. It is 650now called __classic__. Since the directory structure has changed (the 651Spirit Classic headers are now moved to the 652'''$BOOST_ROOT/boost/spirit/home/classic''' directory), we created 653forwarding headers allowing existing applications to compile without 654any change. However, these forwarding headers are deprecated, which 655will result in corresponding warnings generated for each of the 656headers starting with Boost V1.38. The forwarding headers are expected 657to be removed in the future. 658 659The recommended way of using Spirit Classic now is to include header 660files from the directory '''$BOOST_ROOT/boost/spirit/include'''. All 661Spirit Classic headers in this directory have 'classic_' prefixed to 662their name. For example the include 663 664 #include <boost/spirit/core/core.hpp> 665 666now should be written as: 667 668 #include <boost/spirit/include/classic_core.hpp> 669 670To avoid namespace conflicts with the new Spirit V2 library we moved 671Spirit Classic into the namespace `boost::spirit::classic`. All 672references to the former namespace `boost::spirit` need to be adjusted 673as soon as the header names are corrected as described above. As an 674alternative you can define the preprocessor constant 675`BOOST_SPIRIT_USE_OLD_NAMESPACE`, which will force the Spirit Classic 676code to be in the namespace `boost::spirit` as before. This is not 677recommended, though, as it may result in naming clashes. 678 679The change of the namespace will be automatically deactivated whenever 680the deprecated include files are being used. This ensures full 681backwards compatibility for existing applications. 682 683[endsect] [/ spirit_1_x] 684 685[endsect] 686