| <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="lexer.html" title="Supported Regular Expressions"> |
| </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="lexer.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.lex.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">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> |
| </pre> |
| <p> |
| <span class="emphasis"><em>Spirit.Lex</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">Context</span></code> |
| that are otherwise difficult to extract. |
| </p> |
| <div class="variablelist"> |
| <p class="title"><b>Spirit.Lex specific Phoenix placeholders</b></p> |
| <dl> |
| <dt><span class="term"><code class="computeroutput"><span class="identifier">_start</span><span class="special">,</span> |
| <span class="identifier">_end</span></code></span></dt> |
| <dd><p> |
| Iterators pointing to the begin and the end of the matched input |
| sequence. |
| </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="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> |
| to force the current match to fail. |
| </p></dd> |
| <dt><span class="term"><code class="computeroutput"><span class="identifier">_tokenid</span></code></span></dt> |
| <dd><p> |
| The token id of the matched token. |
| </p></dd> |
| <dt><span class="term"><code class="computeroutput"><span class="identifier">_val</span></code></span></dt> |
| <dd><p> |
| The token value of the matched token. |
| </p></dd> |
| <dt><span class="term"><code class="computeroutput"><span class="identifier">_state</span></code></span></dt> |
| <dd><p> |
| The lexer state the token has been matched in. |
| </p></dd> |
| <dt><span class="term"><code class="computeroutput"><span class="identifier">_eoi</span></code></span></dt> |
| <dd><p> |
| Iterator referring to the current end of the input sequence. |
| </p></dd> |
| </dl> |
| </div> |
| <div class="tip"><table border="0" summary="Tip"> |
| <tr> |
| <td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../images/tip.png"></td> |
| <th align="left">Tip</th> |
| </tr> |
| <tr><td align="left" valign="top"><p> |
| All of the placeholders in the list above (except <code class="computeroutput"><span class="identifier">_eoi</span></code>) |
| can be changed from the inside of the semantic action allowing to modify |
| 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>. |
| </p></td></tr> |
| </table></div> |
| <p> |
| For more information see <a class="link" href="../abstracts/lexer_semantic_actions.html" title="Lexer Semantic Actions">Lexer |
| 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 © 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="lexer.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> |
| </div> |
| </body> |
| </html> |