1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Generator Directives Controlling Automatic Delimiting (verbatim[], no_delimit[], delimit[])</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="../directive.html" title="Generator Directives"> 9<link rel="prev" href="repeat.html" title="Repetition Generator Directive (repeat[])"> 10<link rel="next" href="upperlower.html" title="Generator Directives Controlling Case Sensitivity (upper[], lower[])"> 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="repeat.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../directive.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="upperlower.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.karma.reference.directive.delimit"></a><a class="link" href="delimit.html" title="Generator Directives Controlling Automatic Delimiting (verbatim[], no_delimit[], delimit[])">Generator 28 Directives Controlling Automatic Delimiting (<code class="computeroutput"><span class="identifier">verbatim</span><span class="special">[]</span></code>, <code class="computeroutput"><span class="identifier">no_delimit</span><span class="special">[]</span></code>, <code class="computeroutput"><span class="identifier">delimit</span><span class="special">[]</span></code>)</a> 29</h5></div></div></div> 30<h6> 31<a name="spirit.karma.reference.directive.delimit.h0"></a> 32 <span class="phrase"><a name="spirit.karma.reference.directive.delimit.description"></a></span><a class="link" href="delimit.html#spirit.karma.reference.directive.delimit.description">Description</a> 33 </h6> 34<p> 35 The directives <code class="computeroutput"><span class="identifier">delimit</span><span class="special">[]</span></code>, <code class="computeroutput"><span class="identifier">no_delimit</span><span class="special">[]</span></code>, and <code class="computeroutput"><span class="identifier">verbatim</span><span class="special">[]</span></code> can be used to control automatic delimiting. 36 The directives <code class="computeroutput"><span class="identifier">verbatim</span><span class="special">[]</span></code> and <code class="computeroutput"><span class="identifier">no_delimit</span><span class="special">[]</span></code> disable any automatic delimiting, while 37 the directive <code class="computeroutput"><span class="identifier">delimit</span><span class="special">[]</span></code> (re-)enables automatic delimiting. 38 </p> 39<h6> 40<a name="spirit.karma.reference.directive.delimit.h1"></a> 41 <span class="phrase"><a name="spirit.karma.reference.directive.delimit.header"></a></span><a class="link" href="delimit.html#spirit.karma.reference.directive.delimit.header">Header</a> 42 </h6> 43<p> 44 For the <code class="computeroutput"><span class="identifier">verbatim</span><span class="special">[]</span></code> 45 directive: 46 </p> 47<pre class="programlisting"><span class="comment">// forwards to <boost/spirit/home/karma/directive/verbatim.hpp></span> 48<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">karma_verbatim</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 49</pre> 50<p> 51 For the <code class="computeroutput"><span class="identifier">no_delimit</span><span class="special">[]</span></code> 52 directive: 53 </p> 54<pre class="programlisting"><span class="comment">// forwards to <boost/spirit/home/karma/directive/no_delimit.hpp></span> 55<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">karma_no_delimit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 56</pre> 57<p> 58 For the <code class="computeroutput"><span class="identifier">delimit</span><span class="special">[]</span></code> 59 directive: 60 </p> 61<pre class="programlisting"><span class="comment">// forwards to <boost/spirit/home/karma/directive/delimit.hpp></span> 62<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">karma_delimit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 63</pre> 64<p> 65 Also, see <a class="link" href="../../../structure/include.html" title="Include">Include Structure</a>. 66 </p> 67<h6> 68<a name="spirit.karma.reference.directive.delimit.h2"></a> 69 <span class="phrase"><a name="spirit.karma.reference.directive.delimit.namespace"></a></span><a class="link" href="delimit.html#spirit.karma.reference.directive.delimit.namespace">Namespace</a> 70 </h6> 71<div class="informaltable"><table class="table"> 72<colgroup><col></colgroup> 73<thead><tr><th> 74 <p> 75 Name 76 </p> 77 </th></tr></thead> 78<tbody> 79<tr><td> 80 <p> 81 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">verbatim</span> <span class="comment">// 82 alias: boost::spirit::karma::verbatim</span></code> 83 </p> 84 </td></tr> 85<tr><td> 86 <p> 87 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">no_delimit</span> <span class="comment">// 88 alias: boost::spirit::karma::no_delimit</span></code> 89 </p> 90 </td></tr> 91<tr><td> 92 <p> 93 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">delimit</span> <span class="comment">// 94 alias: boost::spirit::karma::delimit</span></code> 95 </p> 96 </td></tr> 97</tbody> 98</table></div> 99<h6> 100<a name="spirit.karma.reference.directive.delimit.h3"></a> 101 <span class="phrase"><a name="spirit.karma.reference.directive.delimit.model_of"></a></span><a class="link" href="delimit.html#spirit.karma.reference.directive.delimit.model_of">Model of</a> 102 </h6> 103<div class="blockquote"><blockquote class="blockquote"><p> 104 <a class="link" href="../generator_concepts/unarygenerator.html" title="UnaryGenerator"><code class="computeroutput"><span class="identifier">UnaryGenerator</span></code></a> 105 </p></blockquote></div> 106<div class="variablelist"> 107<p class="title"><b>Notation</b></p> 108<dl class="variablelist"> 109<dt><span class="term"><code class="computeroutput"><span class="identifier">a</span></code></span></dt> 110<dd><p> 111 A generator object 112 </p></dd> 113<dt><span class="term"><code class="computeroutput"><span class="identifier">d</span></code></span></dt> 114<dd><p> 115 A generator object, or a <a class="link" href="../basics.html#spirit.karma.reference.basics.lazy_argument">Lazy 116 Argument</a> that evaluates to a generator object 117 </p></dd> 118<dt><span class="term"><code class="computeroutput"><span class="identifier">A</span></code>, <code class="computeroutput"><span class="identifier">D</span></code></span></dt> 119<dd><p> 120 Attribute types of the generators <code class="computeroutput"><span class="identifier">a</span></code> 121 and <code class="computeroutput"><span class="identifier">d</span></code> 122 </p></dd> 123</dl> 124</div> 125<h6> 126<a name="spirit.karma.reference.directive.delimit.h4"></a> 127 <span class="phrase"><a name="spirit.karma.reference.directive.delimit.expression_semantics"></a></span><a class="link" href="delimit.html#spirit.karma.reference.directive.delimit.expression_semantics">Expression 128 Semantics</a> 129 </h6> 130<p> 131 Semantics of an expression is defined only where it differs from, or 132 is not defined in <a class="link" href="../generator_concepts/unarygenerator.html" title="UnaryGenerator"><code class="computeroutput"><span class="identifier">UnaryGenerator</span></code></a>. 133 </p> 134<div class="informaltable"><table class="table"> 135<colgroup> 136<col> 137<col> 138</colgroup> 139<thead><tr> 140<th> 141 <p> 142 Expression 143 </p> 144 </th> 145<th> 146 <p> 147 Semantics 148 </p> 149 </th> 150</tr></thead> 151<tbody> 152<tr> 153<td> 154 <p> 155 <code class="computeroutput"><span class="identifier">delimit</span><span class="special">[</span><span class="identifier">a</span><span class="special">]</span></code> 156 </p> 157 </td> 158<td> 159 <p> 160 Enable automatic delimiting for the embedded generator <code class="computeroutput"><span class="identifier">a</span></code> while using the <code class="computeroutput"><span class="identifier">space</span></code> generator as the delimiting 161 generator. If used inside a <code class="computeroutput"><span class="identifier">verbatim</span><span class="special">[]</span></code> directive it re-enables the 162 delimiter generator as used outside of this <code class="computeroutput"><span class="identifier">verbatim</span><span class="special">[]</span></code> instead. The directive succeeds 163 as long as the embedded generator succeeded (unless the underlying 164 output stream reports an error). 165 </p> 166 </td> 167</tr> 168<tr> 169<td> 170 <p> 171 <code class="computeroutput"><span class="identifier">delimit</span><span class="special">(</span><span class="identifier">d</span><span class="special">)[</span><span class="identifier">a</span><span class="special">]</span></code> 172 </p> 173 </td> 174<td> 175 <p> 176 Enable automatic delimiting for the embedded generator <code class="computeroutput"><span class="identifier">a</span></code> while using the generator 177 <code class="computeroutput"><span class="identifier">d</span></code> as the delimiting 178 generator. The directive succeeds as long as the embedded generator 179 succeeded (unless the underlying output stream reports an error). 180 </p> 181 </td> 182</tr> 183<tr> 184<td> 185 <p> 186 <code class="computeroutput"><span class="identifier">verbatim</span><span class="special">[</span><span class="identifier">a</span><span class="special">]</span></code> 187 </p> 188 </td> 189<td> 190 <p> 191 Disable automatic delimiting for the embedded generator <code class="computeroutput"><span class="identifier">a</span></code>. The directive succeeds 192 as long as the embedded generator succeeded (unless the underlying 193 output stream reports an error). This directive it has no effect 194 if it is used when no delimiting is active. When delimiting 195 is active this directive performs a post-delimit step (which 196 is different from the behavior of <code class="computeroutput"><span class="identifier">no_delimit</span><span class="special">[]</span></code>). 197 </p> 198 </td> 199</tr> 200<tr> 201<td> 202 <p> 203 <code class="computeroutput"><span class="identifier">no_delimit</span><span class="special">[</span><span class="identifier">a</span><span class="special">]</span></code> 204 </p> 205 </td> 206<td> 207 <p> 208 Disable automatic delimiting for the embedded generator <code class="computeroutput"><span class="identifier">a</span></code>. The directive succeeds 209 as long as the embedded generator succeeded (unless the underlying 210 output stream reports an error). This directive it has no effect 211 if it is used when no delimiting is active. When delimiting 212 is active this directive does not perform a post-delimit step 213 (which is different from the behavior of <code class="computeroutput"><span class="identifier">verbatim</span><span class="special">[]</span></code>. 214 </p> 215 </td> 216</tr> 217</tbody> 218</table></div> 219<h6> 220<a name="spirit.karma.reference.directive.delimit.h5"></a> 221 <span class="phrase"><a name="spirit.karma.reference.directive.delimit.attributes"></a></span><a class="link" href="delimit.html#spirit.karma.reference.directive.delimit.attributes">Attributes</a> 222 </h6> 223<p> 224 See <a class="link" href="../../quick_reference/compound_attribute_rules.html#spirit.karma.quick_reference.compound_attribute_rules.notation">Compound 225 Attribute Notation</a>. 226 </p> 227<div class="informaltable"><table class="table"> 228<colgroup> 229<col> 230<col> 231</colgroup> 232<thead><tr> 233<th> 234 <p> 235 Expression 236 </p> 237 </th> 238<th> 239 <p> 240 Attribute 241 </p> 242 </th> 243</tr></thead> 244<tbody> 245<tr> 246<td> 247 <p> 248 <code class="computeroutput"><span class="identifier">delimit</span><span class="special">[</span><span class="identifier">a</span><span class="special">]</span></code> 249 </p> 250 </td> 251<td> 252 <p> 253</p> 254<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">a</span><span class="special">:</span> <span class="identifier">A</span> <span class="special">--></span> <span class="identifier">delimit</span><span class="special">[</span><span class="identifier">a</span><span class="special">]:</span> <span class="identifier">A</span> 255<span class="identifier">a</span><span class="special">:</span> <span class="identifier">Unused</span> <span class="special">--></span> <span class="identifier">delimit</span><span class="special">[</span><span class="identifier">a</span><span class="special">]:</span> <span class="identifier">Unused</span></pre> 256<p> 257 </p> 258 </td> 259</tr> 260<tr> 261<td> 262 <p> 263 <code class="computeroutput"><span class="identifier">delimit</span><span class="special">(</span><span class="identifier">d</span><span class="special">)[</span><span class="identifier">a</span><span class="special">]</span></code> 264 </p> 265 </td> 266<td> 267 <p> 268</p> 269<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">a</span><span class="special">:</span> <span class="identifier">A</span><span class="special">,</span> <span class="identifier">d</span><span class="special">:</span> <span class="identifier">D</span> <span class="special">--></span> <span class="identifier">delimit</span><span class="special">(</span><span class="identifier">d</span><span class="special">)[</span><span class="identifier">a</span><span class="special">]:</span> <span class="identifier">A</span> 270<span class="identifier">a</span><span class="special">:</span> <span class="identifier">Unused</span><span class="special">,</span> <span class="identifier">d</span><span class="special">:</span> <span class="identifier">D</span> <span class="special">--></span> <span class="identifier">delimit</span><span class="special">(</span><span class="identifier">d</span><span class="special">)[</span><span class="identifier">a</span><span class="special">]:</span> <span class="identifier">Unused</span></pre> 271<p> 272 </p> 273 </td> 274</tr> 275<tr> 276<td> 277 <p> 278 <code class="computeroutput"><span class="identifier">verbatim</span><span class="special">[</span><span class="identifier">a</span><span class="special">]</span></code> 279 </p> 280 </td> 281<td> 282 <p> 283</p> 284<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">a</span><span class="special">:</span> <span class="identifier">A</span> <span class="special">--></span> <span class="identifier">verbatim</span><span class="special">[</span><span class="identifier">a</span><span class="special">]:</span> <span class="identifier">A</span> 285<span class="identifier">a</span><span class="special">:</span> <span class="identifier">Unused</span> <span class="special">--></span> <span class="identifier">verbatim</span><span class="special">[</span><span class="identifier">a</span><span class="special">]:</span> <span class="identifier">Unused</span></pre> 286<p> 287 </p> 288 </td> 289</tr> 290<tr> 291<td> 292 <p> 293 <code class="computeroutput"><span class="identifier">no_delimit</span><span class="special">[</span><span class="identifier">a</span><span class="special">]</span></code> 294 </p> 295 </td> 296<td> 297 <p> 298</p> 299<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">a</span><span class="special">:</span> <span class="identifier">A</span> <span class="special">--></span> <span class="identifier">no_delimit</span><span class="special">[</span><span class="identifier">a</span><span class="special">]:</span> <span class="identifier">A</span> 300<span class="identifier">a</span><span class="special">:</span> <span class="identifier">Unused</span> <span class="special">--></span> <span class="identifier">no_delimit</span><span class="special">[</span><span class="identifier">a</span><span class="special">]:</span> <span class="identifier">Unused</span></pre> 301<p> 302 </p> 303 </td> 304</tr> 305</tbody> 306</table></div> 307<h6> 308<a name="spirit.karma.reference.directive.delimit.h6"></a> 309 <span class="phrase"><a name="spirit.karma.reference.directive.delimit.complexity"></a></span><a class="link" href="delimit.html#spirit.karma.reference.directive.delimit.complexity">Complexity</a> 310 </h6> 311<div class="blockquote"><blockquote class="blockquote"><p> 312 The overall complexity of the generator directives <code class="computeroutput"><span class="identifier">delimit</span><span class="special">[]</span></code>, <code class="computeroutput"><span class="identifier">verbatim</span><span class="special">[]</span></code>, and <code class="computeroutput"><span class="identifier">no_delimit</span><span class="special">[]</span></code> is defined by the complexity of its 313 embedded generators. The complexity of the directives themselves is 314 O(1). 315 </p></blockquote></div> 316<h6> 317<a name="spirit.karma.reference.directive.delimit.h7"></a> 318 <span class="phrase"><a name="spirit.karma.reference.directive.delimit.example"></a></span><a class="link" href="delimit.html#spirit.karma.reference.directive.delimit.example">Example</a> 319 </h6> 320<div class="note"><table border="0" summary="Note"> 321<tr> 322<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../images/note.png"></td> 323<th align="left">Note</th> 324</tr> 325<tr><td align="left" valign="top"><p> 326 The test harness for the example(s) below is presented in the <a class="link" href="../basics.html#spirit.karma.reference.basics.examples">Basics Examples</a> 327 section. 328 </p></td></tr> 329</table></div> 330<p> 331 Some includes: 332 </p> 333<p> 334</p> 335<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">karma</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 336<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span> 337<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">string</span><span class="special">></span> 338</pre> 339<p> 340 </p> 341<p> 342 Some using declarations: 343 </p> 344<p> 345</p> 346<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">karma</span><span class="special">::</span><span class="identifier">double_</span><span class="special">;</span> 347<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">karma</span><span class="special">::</span><span class="identifier">delimit</span><span class="special">;</span> 348<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">karma</span><span class="special">::</span><span class="identifier">verbatim</span><span class="special">;</span> 349</pre> 350<p> 351 </p> 352<p> 353 Basic usage of <code class="computeroutput"><span class="identifier">delimit</span></code> 354 generator directive: 355 </p> 356<p> 357</p> 358<pre class="programlisting"><span class="identifier">test_generator_attr</span><span class="special">(</span><span class="string">"[ 2.0 , 4.3 ] "</span><span class="special">,</span> 359 <span class="identifier">delimit</span><span class="special">[</span><span class="char">'['</span> <span class="special"><<</span> <span class="identifier">double_</span> <span class="special"><<</span> <span class="char">','</span> <span class="special"><<</span> <span class="identifier">double_</span> <span class="special"><<</span> <span class="char">']'</span><span class="special">],</span> <span class="number">2.0</span><span class="special">,</span> <span class="number">4.3</span><span class="special">);</span> 360<span class="identifier">test_generator_attr</span><span class="special">(</span><span class="string">"[*2.0*,*4.3*]*"</span><span class="special">,</span> 361 <span class="identifier">delimit</span><span class="special">(</span><span class="char">'*'</span><span class="special">)[</span><span class="char">'['</span> <span class="special"><<</span> <span class="identifier">double_</span> <span class="special"><<</span> <span class="char">','</span> <span class="special"><<</span> <span class="identifier">double_</span> <span class="special"><<</span> <span class="char">']'</span><span class="special">],</span> <span class="number">2.0</span><span class="special">,</span> <span class="number">4.3</span><span class="special">);</span> 362<span class="identifier">test_generator_attr</span><span class="special">(</span><span class="string">"[2.0, 4.3 ] "</span><span class="special">,</span> 363 <span class="identifier">delimit</span><span class="special">[</span><span class="identifier">verbatim</span><span class="special">[</span><span class="char">'['</span> <span class="special"><<</span> <span class="identifier">double_</span> <span class="special"><<</span> <span class="char">','</span><span class="special">]</span> <span class="special"><<</span> <span class="identifier">double_</span> <span class="special"><<</span> <span class="char">']'</span><span class="special">],</span> <span class="number">2.0</span><span class="special">,</span> <span class="number">4.3</span><span class="special">);</span> 364</pre> 365<p> 366 </p> 367</div> 368<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 369<td align="left"></td> 370<td align="right"><div class="copyright-footer">Copyright © 2001-2011 Joel de Guzman, Hartmut Kaiser<p> 371 Distributed under the Boost Software License, Version 1.0. (See accompanying 372 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>) 373 </p> 374</div></td> 375</tr></table> 376<hr> 377<div class="spirit-nav"> 378<a accesskey="p" href="repeat.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../directive.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="upperlower.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 379</div> 380</body> 381</html> 382