mgf::Scanner Class Reference

Scanner is a derived class to add some extra function to the scanner class. More...

#include <Scanner.h>

List of all members.

Public Member Functions

 Scanner (std::istream *arg_yyin=0, std::ostream *arg_yyout=0)
 Create a new scanner object.
virtual ~Scanner ()
 Required for virtual functions.
virtual Parser::token_type lex (Parser::semantic_type *yylval, Parser::location_type *yylloc)
 This is the main lexing function.
void set_debug (bool b)
 Enable debug output (via arg_yyout) if compiled into the scanner.

Detailed Description

Scanner is a derived class to add some extra function to the scanner class.

Flex itself creates a class named yyFlexLexer, which is renamed using macros to ExampleFlexLexer. However we change the context of the generated yylex() function to be contained within the Scanner class. This is required because the yylex() defined in ExampleFlexLexer has no parameters.


Constructor & Destructor Documentation

mgf::Scanner::Scanner ( std::istream *  arg_yyin = 0,
std::ostream *  arg_yyout = 0 
)

Create a new scanner object.

The streams arg_yyin and arg_yyout default to cin and cout, but that assignment is only made when initializing in yylex().

mgf::Scanner::~Scanner (  )  [virtual]

Required for virtual functions.


Member Function Documentation

virtual Parser::token_type mgf::Scanner::lex ( Parser::semantic_type yylval,
Parser::location_type yylloc 
) [virtual]

This is the main lexing function.

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.

void mgf::Scanner::set_debug ( bool  b  ) 

Enable debug output (via arg_yyout) if compiled into the scanner.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Typedefs

Generated on Thu Nov 24 07:44:09 2011 for libmgf by  doxygen 1.6.1