3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Spirit V2.5</title>
5 <link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
7 <link rel="home" href="../../index.html" title="Spirit 2.5.2">
8 <link rel="up" href="../what_s_new.html" title="What's New">
9 <link rel="prev" href="spirit_2_5_1.html" title="Spirit V2.5.1">
10 <link rel="next" href="spirit_2_4_2.html" title="Spirit V2.4.2">
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../../more/index.htm">More</a></td>
22 <div class="spirit-nav">
23 <a accesskey="p" href="spirit_2_5_1.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../what_s_new.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="spirit_2_4_2.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
26 <div class="titlepage"><div><div><h3 class="title">
27 <a name="spirit.what_s_new.spirit_2_5"></a><a class="link" href="spirit_2_5.html" title="Spirit V2.5">Spirit V2.5</a>
28 </h3></div></div></div>
30 <a name="spirit.what_s_new.spirit_2_5.h0"></a>
31 <span class="phrase"><a name="spirit.what_s_new.spirit_2_5.what_s_changed_in__emphasis_spirit_qi__emphasis__and__emphasis_spirit_karma__emphasis__from_v2_4_2__boost_v1_46_0__to_v2_5__boost_v1_47_0_"></a></span><a class="link" href="spirit_2_5.html#spirit.what_s_new.spirit_2_5.what_s_changed_in__emphasis_spirit_qi__emphasis__and__emphasis_spirit_karma__emphasis__from_v2_4_2__boost_v1_46_0__to_v2_5__boost_v1_47_0_">What's
32 changed in <span class="emphasis"><em>Spirit.Qi</em></span> and <span class="emphasis"><em>Spirit.Karma</em></span>
33 from V2.4.2 (Boost V1.46.0) to V2.5 (Boost V1.47.0)</a>
36 This version of <a href="http://boost-spirit.com" target="_top">Spirit</a> now supports
37 the new version of <a href="../../../../../../libs/phoenix/doc/html/index.html" target="_top">Boost.Phoenix</a>
38 (V3), which has been released as part of Boost V1.47. Please note that this
39 support is purely preliminary and should not be considered production quality.
40 The reason why we are releasing this now is to enable people who want to
41 use the new version of <a href="../../../../../../libs/phoenix/doc/html/index.html" target="_top">Boost.Phoenix</a>
42 in their code to do so without any conflicts with existing code using <a href="http://boost-spirit.com" target="_top">Spirit</a>. Generally, no <a href="http://boost-spirit.com" target="_top">Spirit</a>
43 code needs to be changed. To activate the use of <a href="../../../../../../libs/phoenix/doc/html/index.html" target="_top">Boost.Phoenix</a>
44 V3 for <a href="http://boost-spirit.com" target="_top">Spirit</a> you need to define
45 the following preprocessor constant for your builds (before including any
46 of Spirit's include files):
48 <pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">BOOST_SPIRIT_USE_PHOENIX_V3</span> <span class="number">1</span>
51 <a name="spirit.what_s_new.spirit_2_5.h1"></a>
52 <span class="phrase"><a name="spirit.what_s_new.spirit_2_5.new_features_in_qi_or_karma"></a></span><a class="link" href="spirit_2_5.html#spirit.what_s_new.spirit_2_5.new_features_in_qi_or_karma">New Features
55 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
57 Added <a class="link" href="../support/utree.html" title="The utree data structure"><code class="computeroutput"><span class="identifier">utree</span></code></a>,
58 a generic, hierarchical, and dynamic data structure that can represent
59 abstract syntax trees. It's well integrated with <span class="emphasis"><em>Spirit.Qi</em></span>
60 and <span class="emphasis"><em>Spirit.Karma</em></span>. It can be passed as an attribute
61 while parsing to almost any grammar. At the same time, it can be used
62 as an attribute to generate output from.
65 Added a new macro <code class="computeroutput"><span class="identifier">BOOST_SPIRIT_TERMINAL_NAME</span></code>
66 which takes in two parameters (the terminal name and its type). Before,
67 there was only one parameter (the terminal name) and the type assumed
68 the terminal name with <code class="computeroutput"><span class="identifier">_type</span></code>
69 appended. This produced invalid C++ identifiers with terminals such as
70 <code class="computeroutput"><span class="identifier">int_</span></code>, which resulted
71 in generated a type <code class="computeroutput"><span class="identifier">int__type</span></code>
72 with a bogus double underscore that is reserved for system use in C++.
75 The numeric parsers now allow arbitrary radix from 2..10 and 16
78 The placeholder <code class="computeroutput"><span class="identifier">_val</span></code>
79 now can be used in top level semantic actions outside of any right hand
80 side of a rule. Here is an example:
81 <pre class="programlisting"><span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span>
82 <span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">test_attr</span><span class="special">(</span><span class="string">"456"</span><span class="special">,</span> <span class="identifier">int_</span><span class="special">[</span><span class="identifier">_val</span> <span class="special">=</span> <span class="identifier">_1</span><span class="special">],</span> <span class="identifier">i</span><span class="special">)</span> <span class="special">&&</span> <span class="identifier">i</span> <span class="special">==</span> <span class="number">456</span><span class="special">);</span>
84 In this case _val refers to the attribute value, which is passed in to
85 the <code class="computeroutput"><span class="identifier">parse</span><span class="special">()</span></code>
86 or <code class="computeroutput"><span class="identifier">phrase_parse</span><span class="special">()</span></code>
87 functions. Similar constructs are now possible in <span class="emphasis"><em>Spirit.Karma</em></span>
89 <pre class="programlisting"><span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">123</span><span class="special">;</span>
90 <span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">test</span><span class="special">(</span><span class="string">"123"</span><span class="special">,</span> <span class="identifier">int_</span><span class="special">[</span><span class="identifier">_1</span> <span class="special">=</span> <span class="identifier">_val</span><span class="special">],</span> <span class="identifier">i</span><span class="special">));</span>
92 This change unifies the handling of the <code class="computeroutput"><span class="identifier">_val</span></code>
93 placeholder allowing to use it everywhere, not only in semantic actions
94 attached to the right hand sides of a rule.
97 Added support for <span class="emphasis"><em>Spirit.Karma</em></span> <a class="link" href="../karma/reference/numeric/unsigned_int.html" title="Unsigned Integer Number Generators (uint_, etc.)">unsigned
98 numeric generators</a> with arbitrary radix values in the (inclusive)
99 range from <code class="computeroutput"><span class="number">2</span></code> .. <code class="computeroutput"><span class="number">36</span></code>.
103 <a name="spirit.what_s_new.spirit_2_5.h2"></a>
104 <span class="phrase"><a name="spirit.what_s_new.spirit_2_5.bug_fixes_in_qi_or_karma"></a></span><a class="link" href="spirit_2_5.html#spirit.what_s_new.spirit_2_5.bug_fixes_in_qi_or_karma">Bug Fixes
107 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
108 <li class="listitem">
109 <span class="emphasis"><em>Spirit.Qi</em></span> integer literals (like <code class="computeroutput"><span class="identifier">int_</span><span class="special">(</span><span class="number">10</span><span class="special">)</span></code>)
110 do not consume input on failure anymore.
112 <li class="listitem">
113 Fixed Boost ticket #5246: mmap_file_iterator Fails to initialize correctly.
115 <li class="listitem">
116 Fixed Boost ticket #5246: mmap_file_iterator Fails to initialize correctly.
118 <li class="listitem">
119 Fixed a const correctness problem in <code class="computeroutput"><span class="identifier">karma</span><span class="special">::</span><span class="identifier">real_policies</span><span class="special"><></span></code> preventing the use of const floating
120 point types with the generator. Thanks to Jeroen Habraken (a.k.a. VeXocide)
121 for reporting it and for submitting a patch and a test.
123 <li class="listitem">
124 Fixed the <span class="emphasis"><em>Spirit.Qi</em></span> <a class="link" href="../qi/reference/auxiliary/attr.html" title="Attribute Parser (attr)"><code class="computeroutput"><span class="identifier">attr</span><span class="special">(</span><span class="identifier">attrib</span><span class="special">)</span></code></a>
125 parser, the <span class="emphasis"><em>Spirit.Qi</em></span> <a class="link" href="../qi/reference/string/symbols.html" title="Symbols Parser (symbols)"><code class="computeroutput"><span class="identifier">symbols</span><span class="special"><></span></code></a>
126 parser, and the <span class="emphasis"><em>Spirit.Karma</em></span> <a class="link" href="../karma/reference/string/symbols.html" title="Symbols Generator (symbols)"><code class="computeroutput"><span class="identifier">symbols</span><span class="special"><></span></code></a>
127 generator to properly handle container attributes. These were broken
128 in Boost V1.46.1 (thanks to Aaron Graham and Joerg Becker for reporting
131 <li class="listitem">
132 Fixed the <a class="link" href="../qi/reference/stream/stream.html" title="Stream Parsers (stream, wstream, etc.)"><code class="computeroutput"><span class="identifier">stream</span></code></a> parser to properly adjust
133 the iterator of the underlying input stream in the case when the stream
134 parser component was successful. Thanks to Brian O'Kennedy who reported
135 the problem on Stackoverflow.
137 <li class="listitem">
138 Fixed failing Karma numerics generators when used with adapted ADTs (thanks
139 to Colin Rundel for reporting that problem).
143 <a name="spirit.what_s_new.spirit_2_5.h3"></a>
144 <span class="phrase"><a name="spirit.what_s_new.spirit_2_5.breaking_changes"></a></span><a class="link" href="spirit_2_5.html#spirit.what_s_new.spirit_2_5.breaking_changes">Breaking
147 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
148 <li class="listitem">
149 The <span class="emphasis"><em>Spirit.Qi</em></span> directive <a class="link" href="../qi/reference/directive/repeat.html" title="Repetition Parser Directive (repeat[])"><code class="computeroutput"><span class="identifier">repeat</span></code></a> erroneously implemented
150 commit/rollback semantics for its attribute, leaving it untouched if
151 the directive failed. This behaviour has been removed as it is inconsistent
152 with similar components. Existing code relying on this functionality
153 will break. Please refer to the <span class="emphasis"><em>Spirit.Qi</em></span> directive
154 <a class="link" href="../qi/reference/directive/hold.html" title="Parser Directive for Attribute Commit/Rollback (hold[])"><code class="computeroutput"><span class="identifier">hold</span></code></a>
155 to see how to fix your code.
157 <li class="listitem">
158 Added a preprocessor define <code class="computeroutput"><span class="identifier">BOOST_SPIRIT_NO_PREDEFINED_TERMINALS</span></code>
159 to prevent instantiations of predefined terminal objects which slows
160 down compile time a lot. When <code class="computeroutput"><span class="identifier">BOOST_SPIRIT_NO_PREDEFINED_TERMINALS</span></code>
161 is defined, the user instantiates the terminals that he needs. So, instead
162 of writing <code class="computeroutput"><span class="keyword">using</span> <span class="identifier">qi</span><span class="special">::</span><span class="identifier">uint_</span></code>
163 one writes instead: <code class="computeroutput"><span class="identifier">qi</span><span class="special">::</span><span class="identifier">uint_type</span>
164 <span class="identifier">uint_</span></code>.
168 <a name="spirit.what_s_new.spirit_2_5.h4"></a>
169 <span class="phrase"><a name="spirit.what_s_new.spirit_2_5.new_features_in_lex"></a></span><a class="link" href="spirit_2_5.html#spirit.what_s_new.spirit_2_5.new_features_in_lex">New
172 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
173 <li class="listitem">
174 Added the possibility to specify a token id while creating a token definition
175 using <code class="computeroutput"><span class="identifier">lex</span><span class="special">::</span><span class="identifier">char_</span></code> and <code class="computeroutput"><span class="identifier">lex</span><span class="special">::</span><span class="identifier">string</span></code>.
176 Both primitives now accept a second parameter which will be interpreted
177 as the requested token id for any token generated from this definition.
179 <li class="listitem">
180 Added a new token type <code class="computeroutput"><span class="identifier">lex</span><span class="special">::</span><span class="identifier">lexertl</span><span class="special">::</span><span class="identifier">position_token</span><span class="special"><></span></code>, which is essentially plup-in
181 compatible with the existing <code class="computeroutput"><span class="identifier">lex</span><span class="special">::</span><span class="identifier">lexertl</span><span class="special">::</span><span class="identifier">token</span><span class="special"><></span></code> class. However it additionally
182 stores the pair of iterators pointing to the underlying matched input
183 sequence as an iterator_range.
187 <a name="spirit.what_s_new.spirit_2_5.h5"></a>
188 <span class="phrase"><a name="spirit.what_s_new.spirit_2_5.bug_fixes_in_lex"></a></span><a class="link" href="spirit_2_5.html#spirit.what_s_new.spirit_2_5.bug_fixes_in_lex">Bug
191 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
192 Fixed a problem with associating token definitions with all states (using
193 <code class="computeroutput"><span class="string">"*"</span></code> as the state
194 name) when actions were attached to them.
197 <a name="spirit.what_s_new.spirit_2_5.h6"></a>
198 <span class="phrase"><a name="spirit.what_s_new.spirit_2_5.making_stuff_work"></a></span><a class="link" href="spirit_2_5.html#spirit.what_s_new.spirit_2_5.making_stuff_work">Making
201 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
202 <li class="listitem">
203 Added the <span class="emphasis"><em>Spirit.Karma</em></span> customization point <a class="link" href="../advanced/customize/extract_from_container.html" title="Extract From a Container Attribute Value to Generate Output (Karma)"><code class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">extract_from_container</span></code></a>, which
204 will be invoked instead of the older customization point <a class="link" href="../advanced/customize/extract_from.html" title="Extract an Attribute Value to Generate Output (Karma)"><code class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">extract_from</span></code></a> if the attribute
205 is a container (<a class="link" href="../advanced/customize/is_container.html" title="Determine if a Type Should be Treated as a Container (Qi and Karma)"><code class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">is_container</span></code></a> returns <code class="computeroutput"><span class="keyword">true</span></code> for the attribute).
207 <li class="listitem">
208 The type <code class="computeroutput"><span class="identifier">hold_any</span></code> now
209 takes a template argument: <code class="computeroutput"><span class="identifier">basic_hold_any</span><span class="special"><</span><span class="identifier">Char</span><span class="special">></span></code>, where <code class="computeroutput"><span class="identifier">Char</span></code>
210 is the character type used for the streaming operators (<code class="computeroutput"><span class="keyword">operator</span><span class="special">>>()</span></code>
211 and <code class="computeroutput"><span class="keyword">operator</span><span class="special"><<()</span></code>).
212 The <code class="computeroutput"><span class="identifier">hold_any</span></code> is still
213 available as a <code class="computeroutput"><span class="keyword">typedef</span> <span class="identifier">basic_hold_any</span><span class="special"><</span><span class="keyword">char</span><span class="special">></span> <span class="identifier">hold_any</span></code>;
215 <li class="listitem">
216 Semantic actions now support attribute compatibility. This is a breaking
217 change but #define BOOST_SPIRIT_ACTIONS_ALLOW_ATTR_COMPAT must be defined
218 in order for the new behavior to kick in. By default, the old behavior
221 <li class="listitem">
222 Alternatives now support attribute compatibility.
224 <li class="listitem">
225 The attribute handling for container attributes of sequences and container
226 components (list, Kleene, Plus, and repeat) has been completely rewritten.
227 It now supports many more use cases and behaves much more predictable
228 than the older version. Thanks to Thomas Taylor, Richard Crossley, Semen,
229 Adalberto Castelo, and many others for reporting bugs and helping in
230 making the new code behave as expected.
234 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
235 <td align="left"></td>
236 <td align="right"><div class="copyright-footer">Copyright © 2001-2011 Joel de Guzman, Hartmut Kaiser<p>
237 Distributed under the Boost Software License, Version 1.0. (See accompanying
238 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
243 <div class="spirit-nav">
244 <a accesskey="p" href="spirit_2_5_1.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../what_s_new.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="spirit_2_4_2.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>