• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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="Parser 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.qi.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">p</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          Spirit.Qi provides some <a href="../../../../../../../libs/phoenix/doc/html/index.html" target="_top">Boost.Phoenix</a>
38          placeholders to 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.Qi 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="identifier">_N</span></code></span></dt>
48<dd><p>
49                Nth attribute of <code class="computeroutput"><span class="identifier">p</span></code>
50              </p></dd>
51<dt><span class="term"><code class="computeroutput"><span class="identifier">_val</span></code></span></dt>
52<dd><p>
53                The enclosing rule's synthesized attribute.
54              </p></dd>
55<dt><span class="term"><code class="computeroutput"><span class="identifier">_r1</span><span class="special">,</span>
56            <span class="identifier">_r2</span><span class="special">...</span>
57            <span class="special">,</span> <span class="identifier">_rN</span></code></span></dt>
58<dd><p>
59                The enclosing rule's Nth inherited attribute.
60              </p></dd>
61<dt><span class="term"><code class="computeroutput"><span class="identifier">_a</span><span class="special">,</span>
62            <span class="identifier">_b</span><span class="special">...</span>
63            <span class="special">,</span> <span class="identifier">_j</span></code></span></dt>
64<dd><p>
65                The enclosing rule's local variables (<code class="computeroutput"><span class="identifier">_a</span></code>
66                refers to the first).
67              </p></dd>
68<dt><span class="term"><code class="computeroutput"><span class="identifier">_pass</span></code></span></dt>
69<dd><p>
70                Assign <code class="computeroutput"><span class="keyword">false</span></code> to <code class="computeroutput"><span class="identifier">_pass</span></code> to force a parser failure.
71              </p></dd>
72</dl>
73</div>
74<div class="important"><table border="0" summary="Important">
75<tr>
76<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../../../images/important.png"></td>
77<th align="left">Important</th>
78</tr>
79<tr><td align="left" valign="top"><p>
80            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
81            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">qi</span></code>
82            as well.
83          </p></td></tr>
84</table></div>
85<p>
86          For more detailed information about semantic actions see: <a class="link" href="../tutorials/semantic_actions.html" title="Parser Semantic Actions">here</a>.
87        </p>
88</div>
89<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
90<td align="left"></td>
91<td align="right"><div class="copyright-footer">Copyright © 2001-2011 Joel de Guzman, Hartmut Kaiser<p>
92        Distributed under the Boost Software License, Version 1.0. (See accompanying
93        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>)
94      </p>
95</div></td>
96</tr></table>
97<hr>
98<div class="spirit-nav">
99<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>
100</div>
101</body>
102</html>
103