1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Phoenix</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="../quick_reference.html" title="Quick Reference"> 9<link rel="prev" href="semantic_actions.html" title="Generator Semantic Actions"> 10<link rel="next" href="../reference.html" title="Reference"> 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="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> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h4 class="title"> 27<a name="spirit.karma.quick_reference.phoenix"></a><a class="link" href="phoenix.html" title="Phoenix">Phoenix</a> 28</h4></div></div></div> 29<p> 30 <a href="../../../../../../../libs/phoenix/doc/html/index.html" target="_top">Boost.Phoenix</a> 31 makes it easier to attach semantic actions. You just inline your lambda 32 expressions: 33 </p> 34<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> 35</pre> 36<p> 37 <span class="emphasis"><em>Spirit.Karma</em></span> provides some <a href="../../../../../../../libs/phoenix/doc/html/index.html" target="_top">Boost.Phoenix</a> 38 placeholders to access important information from the <code class="computeroutput"><span class="identifier">Attrib</span></code> 39 and <code class="computeroutput"><span class="identifier">Context</span></code> that are otherwise 40 fiddly to extract. 41 </p> 42<div class="variablelist"> 43<p class="title"><b>Spirit.Karma specific Phoenix placeholders</b></p> 44<dl class="variablelist"> 45<dt><span class="term"><code class="computeroutput"><span class="identifier">_1</span><span class="special">,</span> 46 <span class="identifier">_2</span><span class="special">,</span> 47 <span class="special">...</span> <span class="special">,</span> 48 <span class="identifier">_N</span></code></span></dt> 49<dd><p> 50 Nth attribute of <code class="computeroutput"><span class="identifier">g</span></code> 51 </p></dd> 52<dt><span class="term"><code class="computeroutput"><span class="identifier">_val</span></code></span></dt> 53<dd><p> 54 The enclosing rule's synthesized attribute. 55 </p></dd> 56<dt><span class="term"><code class="computeroutput"><span class="identifier">_r1</span><span class="special">,</span> 57 <span class="identifier">_r2</span><span class="special">,</span> 58 <span class="special">...</span> <span class="special">,</span> 59 <span class="identifier">_rN</span></code></span></dt> 60<dd><p> 61 The enclosing rule's Nth inherited attribute. 62 </p></dd> 63<dt><span class="term"><code class="computeroutput"><span class="identifier">_a</span><span class="special">,</span> 64 <span class="identifier">_b</span><span class="special">,</span> 65 <span class="special">...</span> <span class="special">,</span> 66 <span class="identifier">_j</span></code></span></dt> 67<dd><p> 68 The enclosing rule's local variables (<code class="computeroutput"><span class="identifier">_a</span></code> 69 refers to the first). 70 </p></dd> 71<dt><span class="term"><code class="computeroutput"><span class="identifier">_pass</span></code></span></dt> 72<dd><p> 73 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. 74 </p></dd> 75</dl> 76</div> 77<div class="important"><table border="0" summary="Important"> 78<tr> 79<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../../../images/important.png"></td> 80<th align="left">Important</th> 81</tr> 82<tr><td align="left" valign="top"><p> 83 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 84 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> 85 as well. 86 </p></td></tr> 87</table></div> 88<p> 89 For more information see <a class="link" href="../tutorials/semantic_actions.html" title="Generator Semantic Actions">Semantic 90 Actions</a>. 91 </p> 92</div> 93<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 94<td align="left"></td> 95<td align="right"><div class="copyright-footer">Copyright © 2001-2011 Joel de Guzman, Hartmut Kaiser<p> 96 Distributed under the Boost Software License, Version 1.0. (See accompanying 97 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>) 98 </p> 99</div></td> 100</tr></table> 101<hr> 102<div class="spirit-nav"> 103<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> 104</div> 105</body> 106</html> 107