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