• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Parser Semantic Actions</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="non_terminals.html" title="Nonterminals">
10<link rel="next" href="phoenix.html" title="Phoenix">
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="non_terminals.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="phoenix.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.semantic_actions"></a><a class="link" href="semantic_actions.html" title="Parser Semantic Actions">Parser
28        Semantic Actions</a>
29</h4></div></div></div>
30<p>
31          Has the form:
32        </p>
33<pre class="programlisting"><span class="identifier">p</span><span class="special">[</span><span class="identifier">f</span><span class="special">]</span>
34</pre>
35<p>
36          where <code class="computeroutput"><span class="identifier">f</span></code> is a function with
37          the signatures:
38        </p>
39<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">Attrib</span> <span class="keyword">const</span><span class="special">&amp;);</span>
40<span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">Attrib</span> <span class="keyword">const</span><span class="special">&amp;,</span> <span class="identifier">Context</span><span class="special">&amp;);</span>
41<span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">Attrib</span> <span class="keyword">const</span><span class="special">&amp;,</span> <span class="identifier">Context</span><span class="special">&amp;,</span> <span class="keyword">bool</span><span class="special">&amp;);</span>
42</pre>
43<p>
44          You can use <a href="../../../../../../../libs/bind/index.html" target="_top">Boost.Bind</a>
45          to bind member functions. For function objects, the allowed signatures
46          are:
47        </p>
48<pre class="programlisting"><span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">Attrib</span> <span class="keyword">const</span><span class="special">&amp;,</span> <span class="identifier">unused_type</span><span class="special">,</span> <span class="identifier">unused_type</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
49<span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">Attrib</span> <span class="keyword">const</span><span class="special">&amp;,</span> <span class="identifier">Context</span><span class="special">&amp;,</span> <span class="identifier">unused_type</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
50<span class="keyword">void</span> <span class="keyword">operator</span><span class="special">()(</span><span class="identifier">Attrib</span> <span class="keyword">const</span><span class="special">&amp;,</span> <span class="identifier">Context</span><span class="special">&amp;,</span> <span class="keyword">bool</span><span class="special">&amp;)</span> <span class="keyword">const</span><span class="special">;</span>
51</pre>
52<p>
53          The <code class="computeroutput"><span class="identifier">unused_type</span></code> is used
54          in the signatures above to signify 'don't care'.
55        </p>
56<p>
57          For more detailed information about semantic actions see: <a class="link" href="../tutorials/semantic_actions.html" title="Parser Semantic Actions">here</a>.
58        </p>
59</div>
60<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
61<td align="left"></td>
62<td align="right"><div class="copyright-footer">Copyright © 2001-2011 Joel de Guzman, Hartmut Kaiser<p>
63        Distributed under the Boost Software License, Version 1.0. (See accompanying
64        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>)
65      </p>
66</div></td>
67</tr></table>
68<hr>
69<div class="spirit-nav">
70<a accesskey="p" href="non_terminals.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="phoenix.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
71</div>
72</body>
73</html>
74