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

ScannerSpec Class Reference

#include <scanner_spec.hh>

Inheritance diagram for ScannerSpec:

Inheritance graph
[legend]
Collaboration diagram for ScannerSpec:

Collaboration graph
[legend]
List of all members.

Public Methods

 ScannerSpec (ITokenSpec &tokens_, PropRegistry &registry)
virtual ~ScannerSpec ()
virtual IReNodeBuildergetReNodeBuilder ()
virtual void addRegToken (const vector< string > &states, const string &name, ReNode *regexp, const string &tokenAction, const Position &pos) throw (ParseException)
virtual void addSkipToken (const vector< string > &states, const string &name, ReNode *regexp, const string &tokenAction, const Position &pos) throw (ParseException)
virtual void addMoreToken (const vector< string > &states, const string &name, ReNode *regexp, const string &tokenAction, const Position &pos) throw (ParseException)
virtual void addKeywordToken (const vector< string > &states, const string &name, ReNode *regexp, const string &tokenAction, const Position &pos) throw (ParseException)
virtual void addSpecialToken (const string &name, const Position &pos) throw (ParseException)
virtual void setPreambleCode (const string &block, const Position &pos)
virtual void addCodeBlock (const string &block, const Position &pos)
virtual void setInheritance (const string &inheritance, const Position &pos)
virtual void setClassName (const string &className_)
virtual void dump (ostream &os) const

Public Attributes

string className
vector<LexicalStateSpecstates
CodeChunk preambleCode
vector<CodeChunkuserCode
CodeChunk inheritance
ITokenSpectokens

Private Methods

void updateStates (const vector< string > &tokStates, DfaSourceRe *regexp)

Private Attributes

DfaReNodeBuildernodeBuilder
DfaSourceRestarRe

Constructor & Destructor Documentation

ScannerSpec::ScannerSpec ( ITokenSpec & tokens_,
PropRegistry & registry )
 

Definition at line 61 of file scanner_spec.cc.

ScannerSpec::~ScannerSpec ( ) [virtual]
 

Definition at line 71 of file scanner_spec.cc.


Member Function Documentation

IReNodeBuilder & ScannerSpec::getReNodeBuilder ( ) [virtual]
 

Returns a referece to the regexps node builder that should be used bu the parser to create the parse tree ndoes of the regular expressions of this scanner.

Reimplemented from IScannerSpec.

Definition at line 77 of file scanner_spec.cc.

void ScannerSpec::addRegToken ( const vector< string > & states,
const string & name,
ReNode * regexp,
const string & tokenAction,
const Position & pos ) throw (ParseException) [virtual]
 

Adds a new regular token declaratino to this scanner spec.

states is the list of lexical states into which this token will be accepted. name is the name of the token regexp points to the root of the parse tree that describes the token's regexp. tokenAction contains the user code to be executed after a token of this type is matched

Exceptions:
ParseException   if the token was not added (duplicate token, aso).

Reimplemented from IScannerSpec.

Definition at line 83 of file scanner_spec.cc.

void ScannerSpec::addSkipToken ( const vector< string > & states,
const string & name,
ReNode * regexp,
const string & tokenAction,
const Position & pos ) throw (ParseException) [virtual]
 

Adds a new "skip" token declaratino to this scanner spec.

states is the list of lexical states into which this token will be accepted. name is the name of the token regexp points to the root of the parse tree that describes the token's regexp. tokenAction contains the user code to be executed after a token of this type is matched

Exceptions:
ParseException   if the token was not added (duplicate token, aso).

Reimplemented from IScannerSpec.

Definition at line 101 of file scanner_spec.cc.

void ScannerSpec::addMoreToken ( const vector< string > & states,
const string & name,
ReNode * regexp,
const string & tokenAction,
const Position & pos ) throw (ParseException) [virtual]
 

Adds a new "more" token declaratino to this scanner spec.

states is the list of lexical states into which this token will be accepted. name is the name of the token regexp points to the root of the parse tree that describes the token's regexp. tokenAction contains the user code to be executed after a token of this type is matched

Exceptions:
ParseException   if the token was not added (duplicate token, aso).

Reimplemented from IScannerSpec.

Definition at line 119 of file scanner_spec.cc.

void ScannerSpec::addKeywordToken ( const vector< string > & states,
const string & name,
ReNode * regexp,
const string & tokenAction,
const Position & pos ) throw (ParseException) [virtual]
 

Adds a new "keyword" token declaratino to this scanner spec.

states is the list of lexical states into which this token will be accepted. name is the name of the token regexp points to the root of the parse tree that describes the token's regexp. tokenAction contains the user code to be executed after a token of this type is matched

Exceptions:
ParseException   if the token was not added (duplicate token, aso).

Reimplemented from IScannerSpec.

Definition at line 137 of file scanner_spec.cc.

void ScannerSpec::addSpecialToken ( const string & name,
const Position & pos ) throw (ParseException) [virtual]
 

Adds a new "special" token declaration to this scanner spec.

name is the token's name.

Exceptions:
ParseException   if the token was not added (duplicate token, aso).

Reimplemented from IScannerSpec.

Definition at line 155 of file scanner_spec.cc.

void ScannerSpec::setPreambleCode ( const string & block,
const Position & pos ) [virtual]
 

Sets the preamble code string for this scanner spwecification. The \s block string contains the block of code that precceded the lexical section without the enclosing brackets.

Reimplemented from IScannerSpec.

Definition at line 165 of file scanner_spec.cc.

void ScannerSpec::addCodeBlock ( const string & block,
const Position & pos ) [virtual]
 

Adds a new block of user code to this scanner spec. The block string contains a block of userr code that was found inside the lexical section, without the enclosing brackets.

Reimplemented from IScannerSpec.

Definition at line 172 of file scanner_spec.cc.

void ScannerSpec::setInheritance ( const string & inheritance,
const Position & pos ) [virtual]
 

Sets the inheritance string for this scanner spec. The inheritance string contains the string that followed the ":" after the scanner's class name, up to the "{".

Reimplemented from IScannerSpec.

Definition at line 178 of file scanner_spec.cc.

void ScannerSpec::setClassName ( const string & className_ ) [virtual]
 

Sets the scanner slass name.

Reimplemented from IScannerSpec.

Definition at line 186 of file scanner_spec.cc.

void ScannerSpec::dump ( ostream & os ) const [virtual]
 

If DEBUG is enabled, this method will dump all the data currently contained into this spec into the given stream

Reimplemented from IScannerSpec.

Definition at line 256 of file scanner_spec.cc.

void ScannerSpec::updateStates ( const vector< string > & tokStates,
DfaSourceRe * regexp ) [private]
 

Updates the regexps for all the states whose names are in tokStates by adding the new regexp to them.

Definition at line 198 of file scanner_spec.cc.


Member Data Documentation

DfaReNodeBuilder & ScannerSpec::nodeBuilder [private]
 

The regexp node builder used by this concrete implementation of teh lexer parse tree.

Definition at line 161 of file scanner_spec.hh.

DfaSourceRe * ScannerSpec::starRe [private]
 

Here we keep the regular expression resulting from tokens that have <*> as their states list.

Definition at line 168 of file scanner_spec.hh.

string ScannerSpec::className
 

The name of the generated scanner class.

Definition at line 177 of file scanner_spec.hh.

vector< LexicalStateSpec > ScannerSpec::states
 

This is the actual description of the scanner: lexical states and their associated regexps. At least one entry (the DEFAULT) state is always created.

Definition at line 185 of file scanner_spec.hh.

CodeChunk ScannerSpec::preambleCode
 

The user code to be inserted before the scanner's class declaration.

Definition at line 191 of file scanner_spec.hh.

vector< CodeChunk > ScannerSpec::userCode
 

The user code that will be lumped inside the scanner's class. Each chunk together with its position is kept in here (in textual order).

Definition at line 197 of file scanner_spec.hh.

CodeChunk ScannerSpec::inheritance
 

this string contains the inheritance provided by the user for the scanner class.

Definition at line 203 of file scanner_spec.hh.

ITokenSpec & ScannerSpec::tokens
 

Contains the token names, in their textual order. The position into this vector is also the token's id.

Definition at line 209 of file scanner_spec.hh.


The documentation for this class was generated from the following files:
Generated at Tue Jul 9 21:08:37 2002 for CppCC by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001