Lexer Class Reference

#include <Lexer.hpp>

Inheritance diagram for Lexer:

Inheritance graph
[legend]

List of all members.

Public Types

typedef std::map< const char
*, int, Lexer::eqstr
KeyWordList

Public Member Functions

 Lexer (std::istream &In, std::ostream &Out=std::cout, const size_t WMaxL=255)
 Constructs a Lexer.
virtual ~Lexer ()
 Destructor.
virtual int yylex ()=0
 Interface with parser.
const size_t & lineno () const
 Read-only access to the current line number.
const char * YYText () const
 Read-only access to the current Word.

Protected Attributes

std::istream & in
 The input std::istream.
std::ostream & out
 The output std::istream.
size_t linenumber
 The current number line.
std::string yytext
 The current "word".
KeyWordList __keyWordList
int declarationToken

Private Attributes

size_t WordMaxLenght
 The maximum autorized length for a "word".

Classes

struct  eqstr


Detailed Description

This class is the base class for all lexers.

Remarks:
It has been written to replace the use of flex which did not worked under MS-Windows (using cygwin). This should make the porting of the code easier.
Author:
Stéphane Del Pino.

Definition at line 44 of file Lexer.hpp.


Member Typedef Documentation

typedef std::map<const char*, int, Lexer::eqstr> Lexer::KeyWordList

a list of known Keyword.

Definition at line 75 of file Lexer.hpp.


Constructor & Destructor Documentation

Lexer::Lexer ( std::istream &  In,
std::ostream &  Out = std::cout,
const size_t  WMaxL = 255 
) [inline]

Constructs a Lexer.

Definition at line 87 of file Lexer.hpp.

References linenumber.

00090     : WordMaxLenght(WMaxL),
00091       in(In),
00092       out(Out)      
00093   {
00094     //    yytext = new char[WMaxL+1];
00095     linenumber = 1;
00096   }

virtual Lexer::~Lexer (  )  [inline, virtual]

Destructor.

Definition at line 99 of file Lexer.hpp.

00100   {
00101     ;
00102   }


Member Function Documentation

virtual int Lexer::yylex (  )  [pure virtual]

Interface with parser.

Implemented in FFLexer, POVLexer, and XMLLexer.

const size_t& Lexer::lineno (  )  const [inline]

Read-only access to the current line number.

Definition at line 108 of file Lexer.hpp.

References linenumber.

00109   {
00110     return linenumber;
00111   }

const char* Lexer::YYText (  )  const [inline]

Read-only access to the current Word.

Definition at line 114 of file Lexer.hpp.

References yytext.

00115   {
00116     return yytext.c_str();
00117   }


Member Data Documentation

size_t Lexer::WordMaxLenght [private]

The maximum autorized length for a "word".

Definition at line 48 of file Lexer.hpp.

std::istream& Lexer::in [protected]

The input std::istream.

Definition at line 60 of file Lexer.hpp.

Referenced by XMLLexer::XMLLexer(), XMLLexer::yylex(), POVLexer::yylex(), and FFLexer::yylex().

std::ostream& Lexer::out [protected]

The output std::istream.

Definition at line 63 of file Lexer.hpp.

size_t Lexer::linenumber [protected]

The current number line.

Definition at line 66 of file Lexer.hpp.

Referenced by Lexer(), lineno(), XMLLexer::yylex(), POVLexer::yylex(), and FFLexer::yylex().

std::string Lexer::yytext [protected]

The current "word".

Definition at line 69 of file Lexer.hpp.

Referenced by XMLLexer::yylex(), POVLexer::yylex(), FFLexer::yylex(), and YYText().

int Lexer::declarationToken [protected]

This contains the token associated to a type. This is used for variables declaration to know its type.

Definition at line 83 of file Lexer.hpp.

Referenced by FFLexer::yylex().


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

Generated on Wed Nov 19 00:08:39 2008 for FreeFEM3D (aka ff3d) by  doxygen 1.5.6