1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>NaryLexer</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="../lexer_concepts.html" title="Lexer Concepts"> 9<link rel="prev" href="unarylexer.html" title="UnaryLexer"> 10<link rel="next" href="../lex_basics.html" title="Basics"> 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="unarylexer.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../lexer_concepts.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="../lex_basics.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h5 class="title"> 27<a name="spirit.lex.reference.lexer_concepts.narylexer"></a><a class="link" href="narylexer.html" title="NaryLexer">NaryLexer</a> 28</h5></div></div></div> 29<h6> 30<a name="spirit.lex.reference.lexer_concepts.narylexer.h0"></a> 31 <span class="phrase"><a name="spirit.lex.reference.lexer_concepts.narylexer.description"></a></span><a class="link" href="narylexer.html#spirit.lex.reference.lexer_concepts.narylexer.description">Description</a> 32 </h6> 33<p> 34 <span class="emphasis"><em>NaryLexer</em></span> is a composite lexer component that has 35 one or more subjects. The NaryLexer allows its subjects to be treated 36 in the same way as a single instance of a <a class="link" href="lexer.html" title="Lexer"><code class="computeroutput"><span class="identifier">Lexer</span></code></a> following the Composite 37 Design Pattern. 38 </p> 39<h6> 40<a name="spirit.lex.reference.lexer_concepts.narylexer.h1"></a> 41 <span class="phrase"><a name="spirit.lex.reference.lexer_concepts.narylexer.refinement_of"></a></span><a class="link" href="narylexer.html#spirit.lex.reference.lexer_concepts.narylexer.refinement_of">Refinement 42 of</a> 43 </h6> 44<div class="blockquote"><blockquote class="blockquote"><p> 45 <a class="link" href="lexer.html" title="Lexer"><code class="computeroutput"><span class="identifier">Lexer</span></code></a> 46 </p></blockquote></div> 47<div class="variablelist"> 48<p class="title"><b>Notation</b></p> 49<dl class="variablelist"> 50<dt><span class="term"><code class="computeroutput"><span class="identifier">l</span></code></span></dt> 51<dd><p> 52 A NaryLexer. 53 </p></dd> 54<dt><span class="term"><code class="computeroutput"><span class="identifier">L</span></code></span></dt> 55<dd><p> 56 A NaryLexer type. 57 </p></dd> 58</dl> 59</div> 60<h6> 61<a name="spirit.lex.reference.lexer_concepts.narylexer.h2"></a> 62 <span class="phrase"><a name="spirit.lex.reference.lexer_concepts.narylexer.valid_expressions"></a></span><a class="link" href="narylexer.html#spirit.lex.reference.lexer_concepts.narylexer.valid_expressions">Valid 63 Expressions</a> 64 </h6> 65<p> 66 In addition to the requirements defined in <a class="link" href="lexer.html" title="Lexer"><code class="computeroutput"><span class="identifier">Lexer</span></code></a>, for any NaryLexer the 67 following must be met: 68 </p> 69<div class="informaltable"><table class="table"> 70<colgroup> 71<col> 72<col> 73<col> 74</colgroup> 75<thead><tr> 76<th> 77 <p> 78 Expression 79 </p> 80 </th> 81<th> 82 <p> 83 Semantics 84 </p> 85 </th> 86<th> 87 <p> 88 Return type 89 </p> 90 </th> 91</tr></thead> 92<tbody><tr> 93<td> 94 <p> 95 <code class="computeroutput"><span class="identifier">l</span><span class="special">.</span><span class="identifier">elements</span></code> 96 </p> 97 </td> 98<td> 99 <p> 100 The tuple of elements. 101 </p> 102 </td> 103<td> 104 <p> 105 A <a href="../../../../../../../../libs/fusion/doc/html/index.html" target="_top">Boost.Fusion</a> 106 Sequence of <a class="link" href="lexer.html" title="Lexer"><code class="computeroutput"><span class="identifier">Lexer</span></code></a> types. 107 </p> 108 </td> 109</tr></tbody> 110</table></div> 111<h6> 112<a name="spirit.lex.reference.lexer_concepts.narylexer.h3"></a> 113 <span class="phrase"><a name="spirit.lex.reference.lexer_concepts.narylexer.type_expressions"></a></span><a class="link" href="narylexer.html#spirit.lex.reference.lexer_concepts.narylexer.type_expressions">Type 114 Expressions</a> 115 </h6> 116<div class="informaltable"><table class="table"> 117<colgroup> 118<col> 119<col> 120</colgroup> 121<thead><tr> 122<th> 123 <p> 124 Expression 125 </p> 126 </th> 127<th> 128 <p> 129 Description 130 </p> 131 </th> 132</tr></thead> 133<tbody> 134<tr> 135<td> 136 <p> 137 <code class="computeroutput"><span class="identifier">l</span><span class="special">.</span><span class="identifier">elements_type</span></code> 138 </p> 139 </td> 140<td> 141 <p> 142 Elements tuple type. 143 </p> 144 </td> 145</tr> 146<tr> 147<td> 148 <p> 149 <code class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">is_nary_lexer</span><span class="special"><</span><span class="identifier">L</span><span class="special">>::</span><span class="identifier">type</span></code> 150 </p> 151 </td> 152<td> 153 <p> 154 Metafunction that evaluates to <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span></code> 155 if a certain type, <code class="computeroutput"><span class="identifier">L</span></code> 156 is a NaryLexer, <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">false_</span></code> 157 otherwise (See <a href="../../../../../../../../libs/mpl/doc/refmanual/integral-constant.html" target="_top">MPL 158 Boolean Constant</a>). 159 </p> 160 </td> 161</tr> 162</tbody> 163</table></div> 164<h6> 165<a name="spirit.lex.reference.lexer_concepts.narylexer.h4"></a> 166 <span class="phrase"><a name="spirit.lex.reference.lexer_concepts.narylexer.invariants"></a></span><a class="link" href="narylexer.html#spirit.lex.reference.lexer_concepts.narylexer.invariants">Invariants</a> 167 </h6> 168<p> 169 For each element, <code class="computeroutput"><span class="identifier">E</span></code>, 170 in any NaryLexer, <code class="computeroutput"><span class="identifier">L</span></code>, 171 the following invariant always holds: 172 </p> 173<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> 174 <code class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">is_lexer</span><span class="special"><</span><span class="identifier">E</span><span class="special">>::</span><span class="identifier">type</span></code> evaluates to <code class="computeroutput"><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">true_</span></code> 175 </li></ul></div> 176<h6> 177<a name="spirit.lex.reference.lexer_concepts.narylexer.h5"></a> 178 <span class="phrase"><a name="spirit.lex.reference.lexer_concepts.narylexer.models"></a></span><a class="link" href="narylexer.html#spirit.lex.reference.lexer_concepts.narylexer.models">Models</a> 179 </h6> 180<p> 181 The following lexer components conform to this model: 182 </p> 183<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> 184 lexer sequence component 185 </li></ul></div> 186<p> 187 <span class="bold"><strong>FIXME</strong></span> Add more links to models of NaryLexer 188 concept 189 </p> 190</div> 191<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 192<td align="left"></td> 193<td align="right"><div class="copyright-footer">Copyright © 2001-2011 Joel de Guzman, Hartmut Kaiser<p> 194 Distributed under the Boost Software License, Version 1.0. (See accompanying 195 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>) 196 </p> 197</div></td> 198</tr></table> 199<hr> 200<div class="spirit-nav"> 201<a accesskey="p" href="unarylexer.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../lexer_concepts.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="../lex_basics.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 202</div> 203</body> 204</html> 205