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="Semantic Actions"> 10<link rel="next" href="lexer.html" title="Supported Regular Expressions"> 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="lexer.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.lex.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">l</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.Lex</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">Context</span></code> 39 that are otherwise difficult to extract. 40 </p> 41<div class="variablelist"> 42<p class="title"><b>Spirit.Lex specific Phoenix placeholders</b></p> 43<dl class="variablelist"> 44<dt><span class="term"><code class="computeroutput"><span class="identifier">_start</span><span class="special">,</span> 45 <span class="identifier">_end</span></code></span></dt> 46<dd><p> 47 Iterators pointing to the begin and the end of the matched input 48 sequence. 49 </p></dd> 50<dt><span class="term"><code class="computeroutput"><span class="identifier">_pass</span></code></span></dt> 51<dd><p> 52 Assign <code class="computeroutput"><span class="identifier">lex</span><span class="special">::</span><span class="identifier">pass_flags</span><span class="special">::</span><span class="identifier">pass_fail</span></code> to <code class="computeroutput"><span class="identifier">_pass</span></code> 53 to force the current match to fail. 54 </p></dd> 55<dt><span class="term"><code class="computeroutput"><span class="identifier">_tokenid</span></code></span></dt> 56<dd><p> 57 The token id of the matched token. 58 </p></dd> 59<dt><span class="term"><code class="computeroutput"><span class="identifier">_val</span></code></span></dt> 60<dd><p> 61 The token value of the matched token. 62 </p></dd> 63<dt><span class="term"><code class="computeroutput"><span class="identifier">_state</span></code></span></dt> 64<dd><p> 65 The lexer state the token has been matched in. 66 </p></dd> 67<dt><span class="term"><code class="computeroutput"><span class="identifier">_eoi</span></code></span></dt> 68<dd><p> 69 Iterator referring to the current end of the input sequence. 70 </p></dd> 71</dl> 72</div> 73<div class="tip"><table border="0" summary="Tip"> 74<tr> 75<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../images/tip.png"></td> 76<th align="left">Tip</th> 77</tr> 78<tr><td align="left" valign="top"><p> 79 All of the placeholders in the list above (except <code class="computeroutput"><span class="identifier">_eoi</span></code>) 80 can be changed from the inside of the semantic action allowing to modify 81 the lexer behavior. They are defined 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">lex</span></code>. 82 </p></td></tr> 83</table></div> 84<p> 85 For more information see <a class="link" href="../abstracts/lexer_semantic_actions.html" title="Lexer Semantic Actions">Lexer 86 Semantic Actions</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="lexer.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 100</div> 101</body> 102</html> 103