<!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: src/scanner.h Source File</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><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>File Members</span></a></li>
</ul>
</div>
<h1>src/scanner.h</h1><a href="scanner_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// $Id: scanner.h 17 2007-08-19 18:51:39Z tb $</span>
<a name="l00002"></a>00002
<a name="l00003"></a>00003 <span class="preprocessor">#ifndef EXAMPLE_SCANNER_H</span>
<a name="l00004"></a>00004 <span class="preprocessor"></span><span class="preprocessor">#define EXAMPLE_SCANNER_H</span>
<a name="l00005"></a>00005 <span class="preprocessor"></span>
<a name="l00006"></a>00006 <span class="comment">// Flex expects the signature of yylex to be defined in the macro YY_DECL, and</span>
<a name="l00007"></a>00007 <span class="comment">// the C++ parser expects it to be declared. We can factor both as follows.</span>
<a name="l00008"></a>00008
<a name="l00009"></a>00009 <span class="preprocessor">#ifndef YY_DECL</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span>
<a name="l00011"></a><a class="code" href="scanner_8h.html#e5b01ac2fa5a6ad5fb97559638abe686">00011</a> <span class="preprocessor">#define YY_DECL \</span>
<a name="l00012"></a>00012 <span class="preprocessor"> example::Parser::token_type \</span>
<a name="l00013"></a>00013 <span class="preprocessor"> example::Scanner::lex( \</span>
<a name="l00014"></a>00014 <span class="preprocessor"> example::Parser::semantic_type* yylval, \</span>
<a name="l00015"></a>00015 <span class="preprocessor"> example::Parser::location_type* yylloc \</span>
<a name="l00016"></a>00016 <span class="preprocessor"> )</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span>
<a name="l00019"></a>00019 <span class="preprocessor">#ifndef __FLEX_LEXER_H</span>
<a name="l00020"></a><a class="code" href="scanner_8h.html#f699458ba5331ddec7e15a878f42f8f5">00020</a> <span class="preprocessor"></span><span class="preprocessor">#define yyFlexLexer ExampleFlexLexer</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="FlexLexer_8h.html">FlexLexer.h</a>"</span>
<a name="l00022"></a>00022 <span class="preprocessor">#undef yyFlexLexer</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span>
<a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="parser_8h.html">parser.h</a>"</span>
<a name="l00026"></a>00026
<a name="l00027"></a>00027 <span class="keyword">namespace </span>example {
<a name="l00028"></a>00028
<a name="l00034"></a><a class="code" href="classexample_1_1Scanner.html">00034</a> <span class="keyword">class </span><a class="code" href="classexample_1_1Scanner.html" title="Scanner is a derived class to add some extra function to the scanner class.">Scanner</a> : <span class="keyword">public</span> <a class="code" href="classExampleFlexLexer.html">ExampleFlexLexer</a>
<a name="l00035"></a>00035 {
<a name="l00036"></a>00036 <span class="keyword">public</span>:
<a name="l00040"></a>00040 <a class="code" href="classexample_1_1Scanner.html#155a119623eb650753829e3357d59d53" title="Create a new scanner object.">Scanner</a>(std::istream* arg_yyin = 0,
<a name="l00041"></a>00041 std::ostream* arg_yyout = 0);
<a name="l00042"></a>00042
<a name="l00044"></a>00044 <span class="keyword">virtual</span> <a class="code" href="classexample_1_1Scanner.html#aaab23709ccc98af2b062110b9fbfb0b" title="Required for virtual functions.">~Scanner</a>();
<a name="l00045"></a>00045
<a name="l00049"></a>00049 <span class="keyword">virtual</span> <a class="code" href="structexample_1_1Parser_1_1token.html#be6390b38a559513455b7cdb0be57938">Parser::token_type</a> <a class="code" href="classexample_1_1Scanner.html#60e1b0f8a420164e464823b8578d6d7d" title="This is the main lexing function.">lex</a>(
<a name="l00050"></a>00050 <a class="code" href="unionexample_1_1Parser_1_1semantic__type.html" title="Symbol semantic values.">Parser::semantic_type</a>* yylval,
<a name="l00051"></a>00051 <a class="code" href="classexample_1_1location.html" title="Abstract a location.">Parser::location_type</a>* yylloc
<a name="l00052"></a>00052 );
<a name="l00053"></a>00053
<a name="l00055"></a>00055 <span class="keywordtype">void</span> <a class="code" href="classexample_1_1Scanner.html#5625c85cbc498968f3045cea6fd67fb5" title="Enable debug output (via arg_yyout) if compiled into the scanner.">set_debug</a>(<span class="keywordtype">bool</span> b);
<a name="l00056"></a>00056 };
<a name="l00057"></a>00057
<a name="l00058"></a>00058 } <span class="comment">// namespace example</span>
<a name="l00059"></a>00059
<a name="l00060"></a>00060 <span class="preprocessor">#endif // EXAMPLE_SCANNER_H</span>
</pre></div></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>