torc::generic::Driver Class Reference

#include <Driver.hpp>

Collaboration diagram for torc::generic::Driver:

Collaboration graph
[legend]

List of all members.

Public Member Functions

bool parseStream (std::istream &inStream, const std::string &inStreamName="stream input")
bool parseString (const std::string &inString, const std::string &inStreamName="string stream")
bool parseFile (const std::string &inFileName)
void error (const class location &inLocation, const std::string &inMessage)
void error (const std::string &inMessage)
ScannergetLexer () const throw ()
std::string & getStreamName () throw ()
EdifContextSharedPtr getContext () const throw ()
Error getParserError () const throw ()
bool getIsParserErrorSet () const throw ()
void setParserError (const Error &inSource) throw ()
 Driver (const EdifContextSharedPtr &inEdifCntx)
 construct a new parser driver context

Private Attributes

bool mTraceScanning
bool mTraceParsing
std::string mStreamName
ScannermLexer
EdifContextSharedPtr mEdifCntx
ErrorSharedPtr mErrorObj


Detailed Description

The Driver class brings together all components. It creates an instance of the Parser and Scanner classes and connects them. Then the input stream is fed into the scanner object and the parser gets it's token sequence. Furthermore the driver object is available in the grammar rules as a parameter. Therefore the driver class contains a reference to the structure into which the parsed data is saved.

Definition at line 48 of file Driver.hpp.


Constructor & Destructor Documentation

torc::generic::Driver::Driver ( const EdifContextSharedPtr &  inEdifCntx  ) 

construct a new parser driver context

Definition at line 47 of file Driver.cpp.


Member Function Documentation

bool torc::generic::Driver::parseStream ( std::istream &  inStream,
const std::string &  inStreamName = "stream input" 
)

Invoke the scanner and parser for a stream.

Parameters:
inStream input stream
inStreamName stream name for error messages
Returns:
true if successfully parsed

Definition at line 58 of file Driver.cpp.

bool torc::generic::Driver::parseString ( const std::string &  inString,
const std::string &  inStreamName = "string stream" 
)

Invoke the scanner and parser on an input string.

Parameters:
inString input string
inStreamName stream name for error messages
Returns:
true if successfully parsed

Definition at line 82 of file Driver.cpp.

bool torc::generic::Driver::parseFile ( const std::string &  inFileName  ) 

Invoke the scanner and parser on a file. Use parseStream with a std::ifstream if detection of file reading errors is required.

Parameters:
inFileName input file name
Returns:
true if successfully parsed

Definition at line 72 of file Driver.cpp.

void torc::generic::Driver::error ( const class location inLocation,
const std::string &  inMessage 
)

Error handling with associated line number. This can be modified to output the error e.g. to a dialog box.

void torc::generic::Driver::error ( const std::string &  inMessage  ) 

General error handling. This can be modified to output the error e.g. to a dialog box.

Definition at line 95 of file Driver.cpp.


Member Data Documentation

Pointer to the current lexer instance, this is used to connect the parser to the scanner. It is used in the yylex macro.

Definition at line 121 of file Driver.hpp.

EdifContextSharedPtr torc::generic::Driver::mEdifCntx [private]

Reference to the Edif context filled during parsing of the Edif file.

Definition at line 125 of file Driver.hpp.

ErrorSharedPtr torc::generic::Driver::mErrorObj [private]

Reference to the Error object

Definition at line 128 of file Driver.hpp.


The documentation for this class was generated from the following files:

Generated on Thu Oct 13 16:50:40 2011 for TORC by  doxygen 1.5.6