• 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 Directive Ignoring Attribute (omit[])</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="Parser Directives">
9<link rel="prev" href="no_case.html" title="Parser Directive Inhibiting Case Sensitivity (no_case[])">
10<link rel="next" href="raw.html" title="Directive for Transduction Parsing (raw[])">
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="no_case.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="raw.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.qi.reference.directive.omit"></a><a class="link" href="omit.html" title="Parser Directive Ignoring Attribute (omit[])">Parser Directive
28          Ignoring Attribute (<code class="computeroutput"><span class="identifier">omit</span><span class="special">[]</span></code>)</a>
29</h5></div></div></div>
30<h6>
31<a name="spirit.qi.reference.directive.omit.h0"></a>
32            <span class="phrase"><a name="spirit.qi.reference.directive.omit.description"></a></span><a class="link" href="omit.html#spirit.qi.reference.directive.omit.description">Description</a>
33          </h6>
34<p>
35            The <code class="computeroutput"><span class="identifier">omit</span><span class="special">[]</span></code>
36            ignores the attribute of its subject parser replacing it with <code class="computeroutput"><span class="identifier">unused</span></code>.
37          </p>
38<h6>
39<a name="spirit.qi.reference.directive.omit.h1"></a>
40            <span class="phrase"><a name="spirit.qi.reference.directive.omit.header"></a></span><a class="link" href="omit.html#spirit.qi.reference.directive.omit.header">Header</a>
41          </h6>
42<pre class="programlisting"><span class="comment">// forwards to &lt;boost/spirit/home/qi/directive/omit.hpp&gt;</span>
43<span class="preprocessor">#include</span> <span class="special">&lt;</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">qi_omit</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
44</pre>
45<p>
46            Also, see <a class="link" href="../../../structure/include.html" title="Include">Include Structure</a>.
47          </p>
48<h6>
49<a name="spirit.qi.reference.directive.omit.h2"></a>
50            <span class="phrase"><a name="spirit.qi.reference.directive.omit.namespace"></a></span><a class="link" href="omit.html#spirit.qi.reference.directive.omit.namespace">Namespace</a>
51          </h6>
52<div class="informaltable"><table class="table">
53<colgroup><col></colgroup>
54<thead><tr><th>
55                    <p>
56                      Name
57                    </p>
58                  </th></tr></thead>
59<tbody><tr><td>
60                    <p>
61                      <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">spirit</span><span class="special">::</span><span class="identifier">omit</span> <span class="comment">// alias:
62                      boost::spirit::qi::omit</span></code>
63                    </p>
64                  </td></tr></tbody>
65</table></div>
66<h6>
67<a name="spirit.qi.reference.directive.omit.h3"></a>
68            <span class="phrase"><a name="spirit.qi.reference.directive.omit.model_of"></a></span><a class="link" href="omit.html#spirit.qi.reference.directive.omit.model_of">Model
69            of</a>
70          </h6>
71<div class="blockquote"><blockquote class="blockquote"><p>
72              <a class="link" href="../parser_concepts/unaryparser.html" title="UnaryParser"><code class="computeroutput"><span class="identifier">UnaryParser</span></code></a>
73            </p></blockquote></div>
74<div class="variablelist">
75<p class="title"><b>Notation</b></p>
76<dl class="variablelist">
77<dt><span class="term"><code class="computeroutput"><span class="identifier">a</span></code></span></dt>
78<dd><p>
79                  A <a class="link" href="../parser_concepts/parser.html" title="Parser"><code class="computeroutput"><span class="identifier">Parser</span></code></a>.
80                </p></dd>
81</dl>
82</div>
83<h6>
84<a name="spirit.qi.reference.directive.omit.h4"></a>
85            <span class="phrase"><a name="spirit.qi.reference.directive.omit.expression_semantics"></a></span><a class="link" href="omit.html#spirit.qi.reference.directive.omit.expression_semantics">Expression
86            Semantics</a>
87          </h6>
88<p>
89            Semantics of an expression is defined only where it differs from, or
90            is not defined in <a class="link" href="../parser_concepts/unaryparser.html" title="UnaryParser"><code class="computeroutput"><span class="identifier">UnaryParser</span></code></a>.
91          </p>
92<div class="informaltable"><table class="table">
93<colgroup>
94<col>
95<col>
96</colgroup>
97<thead><tr>
98<th>
99                    <p>
100                      Expression
101                    </p>
102                  </th>
103<th>
104                    <p>
105                      Semantics
106                    </p>
107                  </th>
108</tr></thead>
109<tbody><tr>
110<td>
111                    <p>
112                      <code class="computeroutput"><span class="identifier">omit</span><span class="special">[</span><span class="identifier">a</span><span class="special">]</span></code>
113                    </p>
114                  </td>
115<td>
116                    <p>
117                      Ignore the attribute of the subject parser, <code class="computeroutput"><span class="identifier">a</span></code>
118                    </p>
119                  </td>
120</tr></tbody>
121</table></div>
122<h6>
123<a name="spirit.qi.reference.directive.omit.h5"></a>
124            <span class="phrase"><a name="spirit.qi.reference.directive.omit.attributes"></a></span><a class="link" href="omit.html#spirit.qi.reference.directive.omit.attributes">Attributes</a>
125          </h6>
126<div class="informaltable"><table class="table">
127<colgroup>
128<col>
129<col>
130</colgroup>
131<thead><tr>
132<th>
133                    <p>
134                      Expression
135                    </p>
136                  </th>
137<th>
138                    <p>
139                      Attribute
140                    </p>
141                  </th>
142</tr></thead>
143<tbody><tr>
144<td>
145                    <p>
146                      <code class="computeroutput"><span class="identifier">omit</span><span class="special">[</span><span class="identifier">a</span><span class="special">]</span></code>
147                    </p>
148                  </td>
149<td>
150                    <p>
151                      <code class="computeroutput"><span class="identifier">unused_type</span></code>
152                    </p>
153                  </td>
154</tr></tbody>
155</table></div>
156<h6>
157<a name="spirit.qi.reference.directive.omit.h6"></a>
158            <span class="phrase"><a name="spirit.qi.reference.directive.omit.complexity"></a></span><a class="link" href="omit.html#spirit.qi.reference.directive.omit.complexity">Complexity</a>
159          </h6>
160<div class="blockquote"><blockquote class="blockquote"><p>
161              The complexity is defined by the complexity of the subject parser,
162              <code class="computeroutput"><span class="identifier">a</span></code>
163            </p></blockquote></div>
164<h6>
165<a name="spirit.qi.reference.directive.omit.h7"></a>
166            <span class="phrase"><a name="spirit.qi.reference.directive.omit.example"></a></span><a class="link" href="omit.html#spirit.qi.reference.directive.omit.example">Example</a>
167          </h6>
168<div class="note"><table border="0" summary="Note">
169<tr>
170<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../images/note.png"></td>
171<th align="left">Note</th>
172</tr>
173<tr><td align="left" valign="top"><p>
174              The test harness for the example(s) below is presented in the <a class="link" href="../basics.html#spirit.qi.reference.basics.examples">Basics Examples</a>
175              section.
176            </p></td></tr>
177</table></div>
178<p>
179            Some using declarations:
180          </p>
181<p>
182</p>
183<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">qi</span><span class="special">::</span><span class="identifier">omit</span><span class="special">;</span>
184<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">qi</span><span class="special">::</span><span class="identifier">int_</span><span class="special">;</span>
185<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">ascii</span><span class="special">::</span><span class="identifier">char_</span><span class="special">;</span>
186</pre>
187<p>
188          </p>
189<p>
190            This parser ignores the first two characters and extracts the succeeding
191            <code class="computeroutput"><span class="keyword">int</span></code>:
192          </p>
193<p>
194</p>
195<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">i</span><span class="special">;</span>
196<span class="identifier">test_parser_attr</span><span class="special">(</span><span class="string">"xx345"</span><span class="special">,</span> <span class="identifier">omit</span><span class="special">[</span><span class="identifier">char_</span> <span class="special">&gt;&gt;</span> <span class="identifier">char_</span><span class="special">]</span> <span class="special">&gt;&gt;</span> <span class="identifier">int_</span><span class="special">,</span> <span class="identifier">i</span><span class="special">);</span>
197<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">i</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// should print 345</span>
198</pre>
199<p>
200          </p>
201</div>
202<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
203<td align="left"></td>
204<td align="right"><div class="copyright-footer">Copyright © 2001-2011 Joel de Guzman, Hartmut Kaiser<p>
205        Distributed under the Boost Software License, Version 1.0. (See accompanying
206        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>)
207      </p>
208</div></td>
209</tr></table>
210<hr>
211<div class="spirit-nav">
212<a accesskey="p" href="no_case.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="raw.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
213</div>
214</body>
215</html>
216