yy::lexer Class Reference

A lexical scanner for the input file format. More...

#include <lexer.hh>

Collaboration diagram for yy::lexer:
Collaboration graph

List of all members.

Public Member Functions

 lexer (driver &d, std::istream *in=0, std::ostream *out=0)
virtual ~lexer ()
parser::token_type yylex (parser::semantic_type *yylval, parser::location_type *yylloc)
 Read next token from input.
virtual void LexerError (const char *msg)
 Error handler.

Private Attributes

 Reference to the driver.

Detailed Description

A lexical scanner for the input file format.

The lexer reads characters from an input stream and groups them to tokens, which are handed to yy::parser to be matched against the input grammar. A token is described using a regular expression. The lexer is the place where whitespace is stripped from the input (except in string literals).

This lexer was generated from lexer.lex using flex.

Definition at line 61 of file lexer.hh.

Constructor & Destructor Documentation

yy::lexer::lexer ( driver d,
std::istream *  in = 0,
std::ostream *  out = 0 


d the driver, used for error reporting.
in input stream from which tokens are read.
out output stream for error messages.

Definition at line 1958 of file lexer.cc.

Member Function Documentation

void yy::lexer::LexerError ( const char *  msg  )  [virtual]

Error handler.

Error messages are forwarded to driver::error, which takes care of printing them.

msg a message describing the error.

Definition at line 1965 of file lexer.cc.

References driver::error(), and theDriver.

parser::token_type yy::lexer::yylex ( parser::semantic_type yylval,
parser::location_type yylloc 

Read next token from input.

This is the most important part of the lexer. It is called repeatedly by the parser through driver::scan to read the next token from the input.

[out] yylval the value of the token.
[out] yylloc the location of the token.
the type code of the token.

Referenced by driver::scan().

Member Data Documentation

Reference to the driver.

Used for error reporting.

Definition at line 68 of file lexer.hh.

Referenced by LexerError().

The documentation for this class was generated from the following files:

Generated on Fri Aug 21 08:15:08 2009 for mqn2mps by  doxygen 1.6.0