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

ITokenSpec Class Reference

#include <itoken_spec.hh>

Inheritance diagram for ITokenSpec:

Inheritance graph
[legend]
Collaboration diagram for ITokenSpec:

Collaboration graph
[legend]
List of all members.

Public Types

typedef enum ITokenSpec::t_Tkinds  Tkinds
enum  t_Tkinds {
  regular, skip, more, keyword,
  special
}

Public Methods

virtual ~ITokenSpec ()
virtual void dump (ostream &os) const=0
The interface towards the scanner:
virtual void setClassName (const string &className)=0
virtual void setInheritance (const string &inheritance, const Position &pos)=0
virtual void setPreambleCode (const string &preambleCode, const Position &pos)=0
virtual void addCodeBlock (const string &block, const Position &pos)=0
Tokens list access
This interface is for the classes that need the tokens' list.

virtual void addToken (const string &tokName, Tkinds tokKind, ReNode *regexp, const string &tokAction, const Position &pos)=0 throw (ParseException)
virtual void addToken (const string &tokname, const Position &pos)=0 throw (ParseException)
virtual bool isToken (const string &tokName)=0
virtual int getTokenId (const string &tokName)=0
virtual ITokenDescoperator[] (int tokid)=0
ITokenDescoperator[] (const string &tokName)
virtual int count ()=0

Public Attributes

string className
CodeChunk preambleCode
vector<CodeChunkuserCode
CodeChunk inheritance

Detailed Description

THis class is the interface for storing information about tokens and the token's class. It thus serves two purposes: first, it is used as the "list of all defined tokens" wherever this list is needed. Secondly, it stores the informatino taken from the token customization section.

Definition at line 74 of file itoken_spec.hh.


Member Typedef Documentation

typedef enum ITokenSpec::t_Tkinds ITokenSpec::Tkinds
 


Member Enumeration Documentation

enum ITokenSpec::t_Tkinds
 

Enumeration values:
regular  
skip  
more  
keyword  
special  

Definition at line 78 of file itoken_spec.hh.


Constructor & Destructor Documentation

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

Force virtual destructors.

Definition at line 175 of file itoken_spec.hh.


Member Function Documentation

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

Sets the token's class name.

Reimplemented in TokenSpec.

Referenced by ITokenSpec_setClassName().

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

Sets the token's class inheritance.

Reimplemented in TokenSpec.

Referenced by ITokenSpec_setInheritance().

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

Sets the token's class preamble code.

Reimplemented in TokenSpec.

Referenced by ITokenSpec_setPreambleCode().

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

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

Reimplemented in TokenSpec.

Referenced by ITokenSpec_addCodeBlock().

void ITokenSpec::addToken ( const string & tokName,
Tkinds tokKind,
ReNode * regexp,
const string & tokAction,
const Position & pos ) throw (ParseException) [pure 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 in TokenSpec.

Referenced by ScannerSpec::ScannerSpec().

void ITokenSpec::addToken ( const string & tokName,
const Position & pos ) throw (ParseException) [pure 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 in TokenSpec.

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

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

Reimplemented in TokenSpec.

int ITokenSpec::getTokenId ( const string & tokName ) [pure 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 in TokenSpec.

Referenced by operator[]().

ITokenDesc & ITokenSpec::operator[] ( int tokid ) [pure 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 in TokenSpec.

ITokenDesc & ITokenSpec::operator[] ( const string & tokName ) [inline]
 

Definition at line 160 of file itoken_spec.hh.

int ITokenSpec::count ( ) [pure virtual]
 

Returns the number of tokens.

Reimplemented in TokenSpec.

Referenced by ScannerSpec::dump(), and LAnalyzer::makeLa().

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

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

Reimplemented in TokenSpec.

Referenced by ScannerSpec::dump().


Member Data Documentation

string ITokenSpec::className
 

Definition at line 189 of file itoken_spec.hh.

CodeChunk ITokenSpec::preambleCode
 

Definition at line 191 of file itoken_spec.hh.

vector< CodeChunk > ITokenSpec::userCode<CodeChunk>
 

Definition at line 193 of file itoken_spec.hh.

CodeChunk ITokenSpec::inheritance
 

Definition at line 195 of file itoken_spec.hh.


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