blob: ba26ae7642ac0aace911b96ad7fdf3c67a3eaca4 [file] [log] [blame]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Phoenix</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.0">
<link rel="home" href="../../../index.html" title="Spirit 2.4.1">
<link rel="up" href="../quick_reference.html" title="Quick Reference">
<link rel="prev" href="semantic_actions.html" title="Semantic Actions">
<link rel="next" href="../reference.html" title="Reference">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="semantic_actions.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../quick_reference.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="../reference.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="spirit.karma.quick_reference.phoenix"></a><a class="link" href="phoenix.html" title="Phoenix">Phoenix</a>
</h4></div></div></div>
<p>
<a href="../../../../../phoenix/doc/html/index.html" target="_top">Boost.Phoenix</a> makes
it easier to attach semantic actions. You just inline your lambda expressions:
</p>
<pre class="programlisting"><span class="identifier">g</span><span class="special">[</span><span class="identifier">phoenix</span><span class="special">-</span><span class="identifier">lambda</span><span class="special">-</span><span class="identifier">expression</span><span class="special">]</span>
</pre>
<p>
<span class="emphasis"><em>Spirit.Karma</em></span> provides some <a href="../../../../../phoenix/doc/html/index.html" target="_top">Boost.Phoenix</a>
placeholders to access important information from the <code class="computeroutput"><span class="identifier">Attrib</span></code>
and <code class="computeroutput"><span class="identifier">Context</span></code> that are otherwise
fiddly to extract.
</p>
<div class="variablelist">
<p class="title"><b>Spirit.Karma specific Phoenix placeholders</b></p>
<dl>
<dt><span class="term"><code class="computeroutput"><span class="identifier">_1</span><span class="special">,</span>
<span class="identifier">_2</span><span class="special">,</span>
<span class="special">...</span> <span class="special">,</span>
<span class="identifier">_N</span></code></span></dt>
<dd><p>
Nth attribute of <code class="computeroutput"><span class="identifier">g</span></code>
</p></dd>
<dt><span class="term"><code class="computeroutput"><span class="identifier">_val</span></code></span></dt>
<dd><p>
The enclosing rule's synthesized attribute.
</p></dd>
<dt><span class="term"><code class="computeroutput"><span class="identifier">_r1</span><span class="special">,</span>
<span class="identifier">_r2</span><span class="special">,</span>
<span class="special">...</span> <span class="special">,</span>
<span class="identifier">_rN</span></code></span></dt>
<dd><p>
The enclosing rule's Nth inherited attribute.
</p></dd>
<dt><span class="term"><code class="computeroutput"><span class="identifier">_a</span><span class="special">,</span>
<span class="identifier">_b</span><span class="special">,</span>
<span class="special">...</span> <span class="special">,</span>
<span class="identifier">_j</span></code></span></dt>
<dd><p>
The enclosing rule's local variables (<code class="computeroutput"><span class="identifier">_a</span></code>
refers to the first).
</p></dd>
<dt><span class="term"><code class="computeroutput"><span class="identifier">_pass</span></code></span></dt>
<dd><p>
Assign <code class="computeroutput"><span class="keyword">false</span></code> to <code class="computeroutput"><span class="identifier">_pass</span></code> to force a generator failure.
</p></dd>
</dl>
</div>
<div class="important"><table border="0" summary="Important">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../../../images/important.png"></td>
<th align="left">Important</th>
</tr>
<tr><td align="left" valign="top"><p>
All placeholders mentioned above are defined in the namespace <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span></code> and, for your convenience, are
available in the namespace <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">karma</span></code>
as well.
</p></td></tr>
</table></div>
<p>
For more information see <a class="link" href="../tutorials/semantic_actions.html" title="Semantic Actions">Semantic
Actions</a>.
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2010 Joel de Guzman, Hartmut Kaiser<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="semantic_actions.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../quick_reference.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="../reference.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>