Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

SFlexLexer Class Reference

#include <SFlexLexer.h>

Inherits yyFlexLexer.

Inheritance diagram for SFlexLexer:

Inheritance graph
[legend]
List of all members.

Public Methods

 SFlexLexer (std::istream *in)
 ~SFlexLexer ()
void errMsg (const char *msg)
SFlexLexerToken getToken ()
virtual int lineno () const
void ungetToken ()
bool parseDouble ()
bool parseLong ()
void setErrorCaption (char *cap)
bool readIdentifier (const char *ident)
bool readToken (const SFlexLexerToken token)

Detailed Description

SFlexLexer capsulates one lexical analyzer, which all modifiers can use to load() from file. The logical analyzer is defined by 'lexan.l', the input file for flex (Fast Lexical Analyzer Generator). There is only one instance of SFlexLexer for all modifiers SFooMod. With SFooMod::getLexer() the modifiers can get full access to the underlying lexer. The lexer returns tokens for parsing the content of a file.


Constructor & Destructor Documentation

SFlexLexer::SFlexLexer std::istream *    in
 

Constructor

Parameters:
in  input stream

SFlexLexer::~SFlexLexer  
 

Destructor


Member Function Documentation

void SFlexLexer::errMsg const char *    msg
 

Print an error message with the line number, where the error occured, and what the modifier had expected.

Parameters:
msg  error message

SFlexLexerToken SFlexLexer::getToken  
 

Get the next token in the input-stream

Returns:
next token

virtual int SFlexLexer::lineno   const [inline, virtual]
 

Get the current line number in the input stream where the last token was read

Returns:
current line number

bool SFlexLexer::parseDouble  
 

Check if the next token can be interpreted as double value

Returns:
true when next token is ULONG, LONG or DOUBLE, false otherwise

bool SFlexLexer::parseLong  
 

Check if the next token can be interpreted as integer value

Returns:
true when next token is LONG or ULONG, false otherwise

bool SFlexLexer::readIdentifier const char *    ident
 

Get next token and check if it is an IDENTIFIER and if the text of the token matches 'ident'

Parameters:
ident  text of the expected IDENTIFIER
Returns:
true if token is an IDENTIFIER and text matches, false otherwise (automatically errMsg() is called)

bool SFlexLexer::readToken const SFlexLexerToken    token
 

Get next token and check if it matches the one you have expected

Parameters:
token  the expected token
Returns:
true if token matches the expected token, false otherwise (automatically errMsg() is called)

void SFlexLexer::setErrorCaption char *    cap [inline]
 

Set the text, that will be printed as caption at future errMsg()-calls

Parameters:
cap  caption text
See also:
method errMsg()

void SFlexLexer::ungetToken   [inline]
 

Put the last token back into the input stream; use it if you expected another token and you want to try again; NOTE: calling ungetToken() serveral times will have the same effect as if you called it once, it will only put the current token back !


The documentation for this class was generated from the following files:
Generated on Thu May 22 16:50:44 2003 for Sketch-it! by doxygen1.2.18