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

TokenSpec Class Reference

#include <token_spec.hh>

Inheritance diagram for TokenSpec:

Inheritance graph
[legend]
Collaboration diagram for TokenSpec:

Collaboration graph
[legend]
List of all members.

Public Methods

virtual void setClassName (const string &className)
virtual void setInheritance (const string &inheritance, const Position &pos)
virtual void setPreambleCode (const string &preambleCode, const Position &pos)
virtual void addCodeBlock (const string &block, const Position &pos)
virtual void addToken (const string &tokName, Tkinds tokKind, ReNode *regexp, const string &tokAction, const Position &pos) throw (ParseException)
virtual void addToken (const string &tokName, const Position &pos) throw (ParseException)
virtual bool isToken (const string &tokName)
virtual int getTokenId (const string &tokName)
virtual TokenDescoperator[] (int tokid)
virtual int count ()
virtual void dump (ostream &os) const

Private Attributes

vector<TokenDesctokens

Member Function Documentation

void TokenSpec::setClassName ( const string & className ) [virtual]
 

Sets the token's class name.

Reimplemented from ITokenSpec.

Definition at line 49 of file token_spec.cc.

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

Sets the token's class inheritance.

Reimplemented from ITokenSpec.

Definition at line 55 of file token_spec.cc.

void TokenSpec::setPreambleCode ( const string & preambleCode,
const Position & pos ) [virtual]
 

Sets the token's class preamble code.

Reimplemented from ITokenSpec.

Definition at line 63 of file token_spec.cc.

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

Adds a njew block of user code to be merged into the token's class.

Reimplemented from ITokenSpec.

Definition at line 71 of file token_spec.cc.

void TokenSpec::addToken ( const string & tokName,
Tkinds tokKind,
ReNode * regexp,
const string & tokAction,
const Position & pos ) throw (ParseException) [virtual]
 

Adds a new regular or skip token into the list. The token's id will be set to its position into the list. It is VERY important that the list keeps the tokens in their textual order (as they appeared into the input source), and thtat their ids are given in the same order.

Exceptions:
ParseException   if a token with the same name already exists in the list.

Reimplemented from ITokenSpec.

Definition at line 76 of file token_spec.cc.

void TokenSpec::addToken ( const string & tokName,
const Position & pos ) throw (ParseException) [virtual]
 

Adds a new special token into the list. For a special token, only the name and id are needed.

Exceptions:
ParseException   if a token with the same name already exists.

Reimplemented from ITokenSpec.

Definition at line 88 of file token_spec.cc.

bool TokenSpec::isToken ( const string & tokName ) [virtual]
 

Returns true if a tokenwith the given name exists in the list.

Reimplemented from ITokenSpec.

Definition at line 103 of file token_spec.cc.

int TokenSpec::getTokenId ( const string & tokName ) [virtual]
 

Returns the id of the oktne with the given name, or -1 if no token with that id is found into the list.

Reimplemented from ITokenSpec.

Definition at line 109 of file token_spec.cc.

TokenDesc & TokenSpec::operator[] ( int tokid ) [virtual]
 

Returns a reference to an implementation-defined TokenDesc object that contains data about he token with the given id.

invariant: &this[i].id() == i, for any vaild i.

Reimplemented from ITokenSpec.

Definition at line 118 of file token_spec.cc.

int TokenSpec::count ( ) [virtual]
 

Returns the number of tokens.

Reimplemented from ITokenSpec.

Definition at line 125 of file token_spec.cc.

Referenced by ScannerDfaWriter::writeScanner(), and TokenWriter::writeTokenClass().

void TokenSpec::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 ITokenSpec.

Definition at line 134 of file token_spec.cc.


Member Data Documentation

vector< TokenDesc > TokenSpec::tokens<TokenDesc> [private]
 

Definition at line 169 of file token_spec.hh.


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