src/scanner.h

Go to the documentation of this file.
00001 // $Id: scanner.h 17 2007-08-19 18:51:39Z tb $
00002 
00003 #ifndef EXAMPLE_SCANNER_H
00004 #define EXAMPLE_SCANNER_H
00005 
00006 // Flex expects the signature of yylex to be defined in the macro YY_DECL, and
00007 // the C++ parser expects it to be declared. We can factor both as follows.
00008 
00009 #ifndef YY_DECL
00010 
00011 #define YY_DECL                                         \
00012     example::Parser::token_type                         \
00013     example::Scanner::lex(                              \
00014         example::Parser::semantic_type* yylval,         \
00015         example::Parser::location_type* yylloc          \
00016     )
00017 #endif
00018 
00019 #ifndef __FLEX_LEXER_H
00020 #define yyFlexLexer ExampleFlexLexer
00021 #include "FlexLexer.h"
00022 #undef yyFlexLexer
00023 #endif
00024 
00025 #include "parser.h"
00026 
00027 namespace example {
00028 
00034 class Scanner : public ExampleFlexLexer
00035 {
00036 public:
00040     Scanner(std::istream* arg_yyin = 0,
00041             std::ostream* arg_yyout = 0);
00042 
00044     virtual ~Scanner();
00045 
00049     virtual Parser::token_type lex(
00050         Parser::semantic_type* yylval,
00051         Parser::location_type* yylloc
00052         );
00053 
00055     void set_debug(bool b);
00056 };
00057 
00058 } // namespace example
00059 
00060 #endif // EXAMPLE_SCANNER_H

Generated on Mon Aug 20 13:34:21 2007 for Flex Bison C++ Example by  doxygen 1.5.2