A lexical scanner for the input file format. More...
#include <lexer.hh>

Public Member Functions | |
| lexer (driver &d, std::istream *in=0, std::ostream *out=0) | |
| Constructor. | |
| virtual | ~lexer () |
| Destructor. | |
| 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 | |
| driver & | theDriver |
| Reference to the driver. | |
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.
| yy::lexer::lexer | ( | driver & | d, | |
| std::istream * | in = 0, |
|||
| std::ostream * | out = 0 | |||
| ) |
| 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. |
Referenced by driver::scan().
driver& yy::lexer::theDriver [private] |
Reference to the driver.
Used for error reporting.
Definition at line 68 of file lexer.hh.
Referenced by LexerError().
1.6.0