• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Spirit V2.4.2</title>
5<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../index.html" title="Spirit 2.5.8">
8<link rel="up" href="../what_s_new.html" title="What's New">
9<link rel="prev" href="spirit_2_5.html" title="Spirit V2.5">
10<link rel="next" href="spirit_2_4_1.html" title="Spirit V2.4.1">
11</head>
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>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="spirit_2_5.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_1.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h3 class="title">
27<a name="spirit.what_s_new.spirit_2_4_2"></a><a class="link" href="spirit_2_4_2.html" title="Spirit V2.4.2">Spirit V2.4.2</a>
28</h3></div></div></div>
29<h5>
30<a name="spirit.what_s_new.spirit_2_4_2.h0"></a>
31        <span class="phrase"><a name="spirit.what_s_new.spirit_2_4_2.what_s_changed_in__emphasis_spirit_qi__emphasis__and__emphasis_spirit_karma__emphasis__from_v2_4_1__boost_v1_45_0__to_v2_4_2__boost_v1_46_0_"></a></span><a class="link" href="spirit_2_4_2.html#spirit.what_s_new.spirit_2_4_2.what_s_changed_in__emphasis_spirit_qi__emphasis__and__emphasis_spirit_karma__emphasis__from_v2_4_1__boost_v1_45_0__to_v2_4_2__boost_v1_46_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.1 (Boost V1.45.0) to V2.4.2 (Boost V1.46.0)</a>
34      </h5>
35<h5>
36<a name="spirit.what_s_new.spirit_2_4_2.h1"></a>
37        <span class="phrase"><a name="spirit.what_s_new.spirit_2_4_2.new_features_in_qi_or_karma"></a></span><a class="link" href="spirit_2_4_2.html#spirit.what_s_new.spirit_2_4_2.new_features_in_qi_or_karma">New
38        Features in Qi or Karma</a>
39      </h5>
40<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
41<li class="listitem">
42            Added keyword indexes for <span class="emphasis"><em>Spirit.Qi</em></span> and <span class="emphasis"><em>Spirit.Karma</em></span>
43            to the docs.
44          </li>
45<li class="listitem">
46            Introduced a new customization point <a class="link" href="../advanced/customize/assign_to/assign_to_container_from_value.html" title="Store an Attribute Value into a Container after a Parser Produced a Value (Qi)"><code class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">assign_to_container_from_value</span></code></a>
47            which is invoked for container attributes whenever an attribute value
48            needs to be added to that container.
49          </li>
50<li class="listitem">
51            Replaced <code class="computeroutput"><span class="identifier">proto</span><span class="special">::</span><span class="identifier">lit</span></code> (which was used to implement <code class="computeroutput"><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">lit</span></code>) with a separate version allowing
52            to distinguish 'lit(foo)' from 'foo'. This should not change any semantics
53            nor should it break exiting code.
54          </li>
55<li class="listitem">
56            Added the <span class="emphasis"><em>Spirit.Qi</em></span> directive <a class="link" href="../qi/reference/directive/as.html" title="Parser Directives Forcing Atomic Assignment (as&lt;T&gt;, as_string[], as_wstring[])"><code class="computeroutput"><span class="identifier">as</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;[]</span></code></a>
57            (and its string specializations <a class="link" href="../qi/reference/directive/as.html" title="Parser Directives Forcing Atomic Assignment (as&lt;T&gt;, as_string[], as_wstring[])"><code class="computeroutput"><span class="identifier">as_string</span><span class="special">[]</span></code></a>
58            and <a class="link" href="../qi/reference/directive/as.html" title="Parser Directives Forcing Atomic Assignment (as&lt;T&gt;, as_string[], as_wstring[])"><code class="computeroutput"><span class="identifier">as_wstring</span><span class="special">[]</span></code></a>) enabling assignment of container
59            attribute types as a whole.
60          </li>
61<li class="listitem">
62            Added the <span class="emphasis"><em>Spirit.Karma</em></span> directive <a class="link" href="../karma/reference/directive/as.html" title="Generator Directives Forcing Atomic Extraction (as&lt;T&gt;, as_string[], as_wstring[])"><code class="computeroutput"><span class="identifier">as</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&gt;[]</span></code></a>
63            (and its string specializations <a class="link" href="../karma/reference/directive/as.html" title="Generator Directives Forcing Atomic Extraction (as&lt;T&gt;, as_string[], as_wstring[])"><code class="computeroutput"><span class="identifier">as_string</span><span class="special">[]</span></code></a>
64            and <a class="link" href="../karma/reference/directive/as.html" title="Generator Directives Forcing Atomic Extraction (as&lt;T&gt;, as_string[], as_wstring[])"><code class="computeroutput"><span class="identifier">as_wstring</span><span class="special">[]</span></code></a>)
65            enabling handling of container attribute types during output generation
66            as a whole.
67          </li>
68<li class="listitem">
69            In <span class="emphasis"><em>Spirit.Qi</em></span>, <code class="computeroutput"><span class="identifier">lit</span><span class="special">()</span></code> can now be used for numeric literals
70            as well.
71          </li>
72<li class="listitem">
73            The <a class="link" href="../qi/reference/string/symbols.html" title="Symbols Parser (symbols)"><code class="computeroutput"><span class="identifier">symbols</span><span class="special">&lt;&gt;</span></code></a>
74            parser component now has an explicit name used for error handling and
75            debugging, which can be set using the new member functions <code class="computeroutput"><span class="identifier">sym</span><span class="special">.</span><span class="identifier">name</span><span class="special">(...)</span></code>.
76            Thanks to teajay for contributing a patch.
77          </li>
78<li class="listitem">
79            The <a class="link" href="../karma/reference/string/symbols.html" title="Symbols Generator (symbols)"><code class="computeroutput"><span class="identifier">symbols</span><span class="special">&lt;</span><span class="identifier">Attrib</span><span class="special">,</span> <span class="identifier">T</span><span class="special">&gt;</span></code></a>
80            generator component now has an explicit name used for error handling
81            and debugging, which can be set using the new member functions <code class="computeroutput"><span class="identifier">sym</span><span class="special">.</span><span class="identifier">name</span><span class="special">(...)</span></code>.
82          </li>
83</ul></div>
84<h5>
85<a name="spirit.what_s_new.spirit_2_4_2.h2"></a>
86        <span class="phrase"><a name="spirit.what_s_new.spirit_2_4_2.bug_fixes_in_qi_or_karma"></a></span><a class="link" href="spirit_2_4_2.html#spirit.what_s_new.spirit_2_4_2.bug_fixes_in_qi_or_karma">Bug Fixes
87        in Qi or Karma</a>
88      </h5>
89<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
90<li class="listitem">
91            Fixed a problem in handling container attributes for <span class="emphasis"><em>Spirit.Qi</em></span>
92            sequences, which caused the properly parsed attributes of the first elements
93            being overwritten by later elements of the sequence.
94          </li>
95<li class="listitem">
96            Fixed the <span class="emphasis"><em>Spirit.Karma</em></span> generator <a class="link" href="../karma/reference/string.html" title="String Generators"><code class="computeroutput"><span class="identifier">string</span><span class="special">(</span><span class="identifier">s</span><span class="special">)</span></code></a>.
97            It succeeded even if <code class="computeroutput"><span class="identifier">s</span></code>
98            matched only a prefix of its attribute.
99          </li>
100</ul></div>
101<h5>
102<a name="spirit.what_s_new.spirit_2_4_2.h3"></a>
103        <span class="phrase"><a name="spirit.what_s_new.spirit_2_4_2.what_s_changed_in__emphasis_spirit_lex__emphasis__from_v2_4_1__boost_v1_45_0__to_v2_4_2__boost_v1_46_0_"></a></span><a class="link" href="spirit_2_4_2.html#spirit.what_s_new.spirit_2_4_2.what_s_changed_in__emphasis_spirit_lex__emphasis__from_v2_4_1__boost_v1_45_0__to_v2_4_2__boost_v1_46_0_">What's
104        changed in <span class="emphasis"><em>Spirit.Lex</em></span> from V2.4.1 (Boost V1.45.0) to
105        V2.4.2 (Boost V1.46.0)</a>
106      </h5>
107<h5>
108<a name="spirit.what_s_new.spirit_2_4_2.h4"></a>
109        <span class="phrase"><a name="spirit.what_s_new.spirit_2_4_2.new_features_in_lex"></a></span><a class="link" href="spirit_2_4_2.html#spirit.what_s_new.spirit_2_4_2.new_features_in_lex">New
110        Features in Lex</a>
111      </h5>
112<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
113<li class="listitem">
114            Added <code class="computeroutput"><span class="identifier">qi</span><span class="special">::</span><span class="identifier">tokenid</span><span class="special">()</span></code>
115            primitive parser allowing to match arbitrary lexer tokens based on a
116            given token id. The difference to <code class="computeroutput"><span class="identifier">qi</span><span class="special">::</span><span class="identifier">token</span><span class="special">()</span></code> is, that it exposes as its attribute
117            the token id of the matched token (instead of the iterator_range of the
118            matched input, as <code class="computeroutput"><span class="identifier">qi</span><span class="special">::</span><span class="identifier">token</span><span class="special">()</span></code> does).
119          </li>
120<li class="listitem">
121            Added an additional template parameter to the default <code class="computeroutput"><span class="identifier">lexertl</span><span class="special">::</span><span class="identifier">token</span><span class="special">&lt;&gt;</span></code> definition: the type of the token
122            id. This type defaults to <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span></code>.
123            Any type used as the id type needs to be (explicitly) convertible from
124            <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span></code>.
125          </li>
126<li class="listitem">
127            It's now possible to attach lexer semantic actions to token definitions
128            based on <code class="computeroutput"><span class="identifier">lex</span><span class="special">::</span><span class="keyword">char</span><span class="special">()</span></code>
129            and <code class="computeroutput"><span class="identifier">lex</span><span class="special">::</span><span class="identifier">string</span><span class="special">()</span></code>.
130          </li>
131<li class="listitem">
132            It's now possible to specify a lexer state the lexer should automatically
133            be switched to after matching certain tokens. For this reason the token
134            definition syntax has been extended:
135<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Lexer</span><span class="special">&gt;</span>
136<span class="keyword">struct</span> <span class="identifier">lexer</span> <span class="special">:</span> <span class="identifier">lex</span><span class="special">::</span><span class="identifier">lexer</span><span class="special">&lt;</span><span class="identifier">Lexer</span><span class="special">&gt;</span>
137<span class="special">{</span>
138    <span class="identifier">lexer</span><span class="special">()</span>
139    <span class="special">{</span>
140        <span class="identifier">int_</span> <span class="special">=</span> <span class="string">"[1-9][0-9]*"</span><span class="special">;</span>
141        <span class="keyword">this</span><span class="special">-&gt;</span><span class="identifier">self</span><span class="special">(</span><span class="string">"INITIAL"</span><span class="special">,</span> <span class="string">"TARGETSTATE"</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">int_</span><span class="special">;</span>
142    <span class="special">}</span>
143    <span class="identifier">lex</span><span class="special">::</span><span class="identifier">token_def</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;</span> <span class="identifier">int_</span><span class="special">;</span>
144<span class="special">};</span>
145</pre>
146            This example lexer will match a <code class="computeroutput"><span class="identifier">int_</span></code>
147            token and will switch the lexer to the state <code class="computeroutput"><span class="string">"TARGETSTATE"</span></code>
148            afterwards. If the second argument is not specified the lexer remains
149            in the previous state (as before).
150          </li>
151<li class="listitem">
152            The parser primitives <code class="computeroutput"><span class="identifier">qi</span><span class="special">::</span><span class="identifier">token</span></code>
153            and <code class="computeroutput"><span class="identifier">qi</span><span class="special">::</span><span class="identifier">tokenid</span></code> can now be used without any
154            argument. In this case they will match any token.
155          </li>
156<li class="listitem">
157            <code class="computeroutput"><span class="identifier">lex</span><span class="special">::</span><span class="identifier">lit</span><span class="special">()</span></code>
158            has been removed.
159          </li>
160</ul></div>
161<h5>
162<a name="spirit.what_s_new.spirit_2_4_2.h5"></a>
163        <span class="phrase"><a name="spirit.what_s_new.spirit_2_4_2.bug_fixes_in_lex"></a></span><a class="link" href="spirit_2_4_2.html#spirit.what_s_new.spirit_2_4_2.bug_fixes_in_lex">Bug
164        Fixes in Lex</a>
165      </h5>
166<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
167<li class="listitem">
168            Fixed an issue in the Lexer giving problems while assigning tokens to
169            all lexer states at once. This is now possible by simply using "*"
170            as the state name. For instance this will add the token int_ to all lexer
171            states:
172<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Lexer</span><span class="special">&gt;</span>
173<span class="keyword">struct</span> <span class="identifier">lexer</span> <span class="special">:</span> <span class="identifier">lex</span><span class="special">::</span><span class="identifier">lexer</span><span class="special">&lt;</span><span class="identifier">Lexer</span><span class="special">&gt;</span>
174<span class="special">{</span>
175    <span class="identifier">lexer</span><span class="special">()</span>
176    <span class="special">{</span>
177        <span class="identifier">int_</span> <span class="special">=</span> <span class="string">"[1-9][0-9]*"</span><span class="special">;</span>
178        <span class="keyword">this</span><span class="special">-&gt;</span><span class="identifier">self</span><span class="special">(</span><span class="string">"*"</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">int_</span><span class="special">;</span>
179    <span class="special">}</span>
180    <span class="identifier">lex</span><span class="special">::</span><span class="identifier">token_def</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;</span> <span class="identifier">int_</span><span class="special">;</span>
181<span class="special">};</span>
182</pre>
183            Note: the <code class="computeroutput"><span class="identifier">self</span><span class="special">(</span><span class="string">"*"</span><span class="special">)</span>
184            <span class="special">=</span> <span class="special">...</span></code>
185            must be executed after all lexer states have been introduced to the lexer
186            object.
187          </li>
188<li class="listitem">
189            Fixed lexer lookahead. The lookahead operation is now evaluated using
190            the lexer state the <code class="computeroutput"><span class="identifier">token_def</span></code>
191            instance used as its argument is associated with.
192          </li>
193<li class="listitem">
194            Fixed a problem in the <code class="computeroutput"><span class="identifier">multi_pass</span></code>
195            iterator causing wrong tokens to be returned to the user. This could
196            happen in conjunction with a lexer which performed lexer state changes
197            and was using <code class="computeroutput"><span class="identifier">pass_fail</span></code>
198            in semantic actions to make a token match fail.
199          </li>
200</ul></div>
201<h5>
202<a name="spirit.what_s_new.spirit_2_4_2.h6"></a>
203        <span class="phrase"><a name="spirit.what_s_new.spirit_2_4_2.known_problems"></a></span><a class="link" href="spirit_2_4_2.html#spirit.what_s_new.spirit_2_4_2.known_problems">Known
204        Problems</a>
205      </h5>
206<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
207            <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>)
208            consume input on failure, which can lead to problems with the alternative
209            operator.
210          </li></ul></div>
211</div>
212<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
213<td align="left"></td>
214<td align="right"><div class="copyright-footer">Copyright © 2001-2011 Joel de Guzman, Hartmut Kaiser<p>
215        Distributed under the Boost Software License, Version 1.0. (See accompanying
216        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>)
217      </p>
218</div></td>
219</tr></table>
220<hr>
221<div class="spirit-nav">
222<a accesskey="p" href="spirit_2_5.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_1.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
223</div>
224</body>
225</html>
226