<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Flex Bison C++ Example: example::Scanner Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.9 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespaceexample.html">example</a>::<a class="el" href="classexample_1_1Scanner.html">Scanner</a>
</div>
</div>
<div class="contents">
<h1>example::Scanner Class Reference</h1><!-- doxytag: class="example::Scanner" --><!-- doxytag: inherits="ExampleFlexLexer" --><a class="el" href="classexample_1_1Scanner.html" title="Scanner is a derived class to add some extra function to the scanner class.">Scanner</a> is a derived class to add some extra function to the scanner class.
<a href="#_details">More...</a>
<p>
<code>#include <<a class="el" href="scanner_8h_source.html">scanner.h</a>></code>
<p>
<div class="dynheader">
Inheritance diagram for example::Scanner:</div>
<div class="dynsection">
<p><center><img src="classexample_1_1Scanner.png" usemap="#example::Scanner_map" border="0" alt=""></center>
<map name="example::Scanner_map">
<area href="classExampleFlexLexer.html" alt="ExampleFlexLexer" shape="rect" coords="0,56,115,80">
<area href="classFlexLexer.html" alt="FlexLexer" shape="rect" coords="0,0,115,24">
</map>
</div>
<p>
<a href="classexample_1_1Scanner-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classexample_1_1Scanner.html#155a119623eb650753829e3357d59d53">Scanner</a> (std::istream *arg_yyin=0, std::ostream *arg_yyout=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Create a new scanner object. <a href="#155a119623eb650753829e3357d59d53"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classexample_1_1Scanner.html#aaab23709ccc98af2b062110b9fbfb0b">~Scanner</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Required for virtual functions. <a href="#aaab23709ccc98af2b062110b9fbfb0b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="structexample_1_1Parser_1_1token.html#be6390b38a559513455b7cdb0be57938">Parser::token_type</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classexample_1_1Scanner.html#60e1b0f8a420164e464823b8578d6d7d">lex</a> (<a class="el" href="unionexample_1_1Parser_1_1semantic__type.html">Parser::semantic_type</a> *yylval, <a class="el" href="classexample_1_1location.html">Parser::location_type</a> *yylloc)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">This is the main lexing function. <a href="#60e1b0f8a420164e464823b8578d6d7d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classexample_1_1Scanner.html#5625c85cbc498968f3045cea6fd67fb5">set_debug</a> (bool b)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Enable debug output (via arg_yyout) if compiled into the scanner. <a href="#5625c85cbc498968f3045cea6fd67fb5"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<a class="el" href="classexample_1_1Scanner.html" title="Scanner is a derived class to add some extra function to the scanner class.">Scanner</a> is a derived class to add some extra function to the scanner class.
<p>
Flex itself creates a class named yyFlexLexer, which is renamed using macros to <a class="el" href="classExampleFlexLexer.html">ExampleFlexLexer</a>. However we change the context of the generated <a class="el" href="classExampleFlexLexer.html#52dace47f333320dfb4ffb21f8c6e474" title="The main scanner function which does all the work.">yylex()</a> function to be contained within the <a class="el" href="classexample_1_1Scanner.html" title="Scanner is a derived class to add some extra function to the scanner class.">Scanner</a> class. This is required because the <a class="el" href="classExampleFlexLexer.html#52dace47f333320dfb4ffb21f8c6e474" title="The main scanner function which does all the work.">yylex()</a> defined in <a class="el" href="classExampleFlexLexer.html">ExampleFlexLexer</a> has no parameters.
<p>Definition at line <a class="el" href="scanner_8h_source.html#l00034">34</a> of file <a class="el" href="scanner_8h_source.html">scanner.h</a>.</p>
<hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="155a119623eb650753829e3357d59d53"></a><!-- doxytag: member="example::Scanner::Scanner" ref="155a119623eb650753829e3357d59d53" args="(std::istream *arg_yyin=0, std::ostream *arg_yyout=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">example::Scanner::Scanner </td>
<td>(</td>
<td class="paramtype">std::istream * </td>
<td class="paramname"> <em>arg_yyin</em> = <code>0</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::ostream * </td>
<td class="paramname"> <em>arg_yyout</em> = <code>0</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Create a new scanner object.
<p>
The streams arg_yyin and arg_yyout default to cin and cout, but that assignment is only made when initializing in <a class="el" href="classExampleFlexLexer.html#52dace47f333320dfb4ffb21f8c6e474" title="The main scanner function which does all the work.">yylex()</a>.
<p>Definition at line <a class="el" href="scanner_8cc_source.html#l01911">1911</a> of file <a class="el" href="scanner_8cc_source.html">scanner.cc</a>.</p>
</div>
</div><p>
<a class="anchor" name="aaab23709ccc98af2b062110b9fbfb0b"></a><!-- doxytag: member="example::Scanner::~Scanner" ref="aaab23709ccc98af2b062110b9fbfb0b" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">example::Scanner::~Scanner </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Required for virtual functions.
<p>
<p>Definition at line <a class="el" href="scanner_8cc_source.html#l01917">1917</a> of file <a class="el" href="scanner_8cc_source.html">scanner.cc</a>.</p>
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="60e1b0f8a420164e464823b8578d6d7d"></a><!-- doxytag: member="example::Scanner::lex" ref="60e1b0f8a420164e464823b8578d6d7d" args="(Parser::semantic_type *yylval, Parser::location_type *yylloc)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="structexample_1_1Parser_1_1token.html#be6390b38a559513455b7cdb0be57938">Parser::token_type</a> example::Scanner::lex </td>
<td>(</td>
<td class="paramtype"><a class="el" href="unionexample_1_1Parser_1_1semantic__type.html">Parser::semantic_type</a> * </td>
<td class="paramname"> <em>yylval</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classexample_1_1location.html">Parser::location_type</a> * </td>
<td class="paramname"> <em>yylloc</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
This is the main lexing function.
<p>
It is generated by flex according to the macro declaration YY_DECL above. The generated bison parser then calls this virtual function to fetch new tokens.
</div>
</div><p>
<a class="anchor" name="5625c85cbc498968f3045cea6fd67fb5"></a><!-- doxytag: member="example::Scanner::set_debug" ref="5625c85cbc498968f3045cea6fd67fb5" args="(bool b)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void example::Scanner::set_debug </td>
<td>(</td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>b</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Enable debug output (via arg_yyout) if compiled into the scanner.
<p>
<p>Definition at line <a class="el" href="scanner_8cc_source.html#l01921">1921</a> of file <a class="el" href="scanner_8cc_source.html">scanner.cc</a>.</p>
<p>References <a class="el" href="FlexLexer_8h_source.html#l00098">FlexLexer::yy_flex_debug</a>.</p>
<p>Referenced by <a class="el" href="driver_8cc_source.html#l00019">example::Driver::parse_stream()</a>.</p>
</div>
</div><p>
<hr>The documentation for this class was generated from the following files:<ul>
<li>src/<a class="el" href="scanner_8h_source.html">scanner.h</a><li>src/<a class="el" href="scanner_8cc_source.html">scanner.cc</a></ul>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sat Sep 5 10:26:25 2009 for Flex Bison C++ Example by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address>
</body>
</html>