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

ParserSpec Class Reference

#include <parser_spec.hh>

Inheritance diagram for ParserSpec:

Inheritance graph
[legend]
Collaboration diagram for ParserSpec:

Collaboration graph
[legend]
List of all members.

Public Methods

 ParserSpec (PropRegistry &registry_, ITokenSpec &tokens_)
virtual IEbnfNodeBuildergetEbnfNodeBuilder ()
virtual void addProduction (const string &name, const string &retTypeName, const Position &retTypePos, const string &formalArgs, const Position &formalArgsPos, const string &exceptList, const Position &exceptListPos, const string &preambleCode, const Position &preambleCodePos, EbnfNode *expansion, const Position &pos) throw (ParseException)
virtual void setPreambleCode (const string &block, const Position &pos)
virtual void setClassName (const string &className)
virtual void setInheritance (const string &inheritance, const Position &pos)
virtual void addCodeBlock (const string &block, const Position &pos)
bool isProduction (const string &name)
ProductionSpecgetProduction (const string &name) throw (ParseException)
virtual void dump (ostream &os) const

Public Attributes

EbnfNodeBuildernodeBuilder
string className
CodeChunk preambleCode
vector<CodeChunkuserCode
CodeChunk inheritance
ITokenSpectokens
vector<ProductionSpecproductions

Detailed Description

This is the concrete IParserSpec implementation for generating LL(k) parsers.

Definition at line 59 of file parser_spec.hh.


Constructor & Destructor Documentation

ParserSpec::ParserSpec ( PropRegistry & registry_,
ITokenSpec & tokens_ )
 

Definition at line 56 of file parser_spec.cc.


Member Function Documentation

IEbnfNodeBuilder & ParserSpec::getEbnfNodeBuilder ( ) [virtual]
 

Returns a reference to an ebnf node builder that will create the productions' oarse trees suitable for this parser spec representation.

Reimplemented from IParserSpec.

Definition at line 62 of file parser_spec.cc.

void ParserSpec::addProduction ( const string & name,
const string & retTypeName,
const Position & retTypePos,
const string & formalArgs,
const Position & formalArgsPos,
const string & exceptList,
const Position & exceptListPos,
const string & preambleCode,
const Position & preambleCodePos,
EbnfNode * expansion,
const Position & pos ) throw (ParseException) [virtual]
 

Adds a new production declaration to this parser spec.

name is the production's name formalArgs is a string containing the list of formal arguments declarations, in the same order as they appeared into the production's declarastion, without the enclosing parentheses. exceptList is the list of exception type identifiers that can be thrown from this production. preambleCode is the first block of user code of this production. expansion the EBNF expansion's parse tree. Can be null.

All the Position arguments (except the last one) represent the textual position of the previous argument in the list.

Exceptions:
ParseException   if the production could not be added (duplicate name, aso).

Reimplemented from IParserSpec.

Definition at line 68 of file parser_spec.cc.

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

Sets the preamble block to the given string, which must be the block of code that preceded the syntax section in the input grammar file, without the enclosing brackets.

Reimplemented from IParserSpec.

Definition at line 93 of file parser_spec.cc.

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

Stes the parser's class name.

Reimplemented from IParserSpec.

Definition at line 99 of file parser_spec.cc.

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

Specifies an inheritance string for the parser's class.

Reimplemented from IParserSpec.

Definition at line 105 of file parser_spec.cc.

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

Adds a block of user code to the scanner spec. The block string is a block of code found inside the syntax section, without the enclosing brackets.

Reimplemented from IParserSpec.

Definition at line 112 of file parser_spec.cc.

bool ParserSpec::isProduction ( const string & name )
 

Returns true if the given name is a production name.

Definition at line 124 of file parser_spec.cc.

Referenced by NontermFixAlgo::operator()().

ProductionSpec & ParserSpec::getProduction ( const string & name ) throw (ParseException)
 

Returns a reference to the production with the given name.

Exceptions:
ParseException   if no production with the given name was found into the productions list.

Definition at line 131 of file parser_spec.cc.

Referenced by NontermFixAlgo::operator()().

void ParserSpec::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 IParserSpec.

Definition at line 144 of file parser_spec.cc.


Member Data Documentation

EbnfNodeBuilder & ParserSpec::nodeBuilder
 

The nodebuilder implementation used by this parser spec.

Definition at line 115 of file parser_spec.hh.

string ParserSpec::className
 

The name of the generated parser class.

Definition at line 120 of file parser_spec.hh.

CodeChunk ParserSpec::preambleCode
 

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

Definition at line 125 of file parser_spec.hh.

vector< CodeChunk > ParserSpec::userCode
 

The user code that will be lumped inside parser's class. If jultiple blocks of user code are found inside the lexical section, they are concatenated into one big chunk of code and stored into this string.

Definition at line 132 of file parser_spec.hh.

CodeChunk ParserSpec::inheritance
 

This string contains the inheritance provided by the user for the parser class.

Definition at line 138 of file parser_spec.hh.

ITokenSpec & ParserSpec::tokens
 

The complete list of tokens this parser will use (this list is supposed o be built according to the lexical section).

Definition at line 144 of file parser_spec.hh.

vector< ProductionSpec > ParserSpec::productions<ProductionSpec>
 

Definition at line 146 of file parser_spec.hh.


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