torc-master
|
#include <Driver.hpp>
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) |
Scanner * | getLexer () const |
std::string & | getStreamName () |
EdifContextSharedPtr | getContext () const |
Error | getParserError () const |
bool | getIsParserErrorSet () const |
void | setParserError (const Error &inSource) |
Driver (const EdifContextSharedPtr &inEdifCntx) | |
construct a new parser driver context More... | |
~Driver () throw () | |
Private Attributes | |
bool | mTraceScanning |
bool | mTraceParsing |
std::string | mStreamName |
Scanner * | mLexer |
EdifContextSharedPtr | mEdifCntx |
ErrorSharedPtr | mErrorObj |
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.
torc::generic::Driver::Driver | ( | const EdifContextSharedPtr & | inEdifCntx | ) |
torc::generic::Driver::~Driver | ( | ) | ||
throw | ( | |||
) |
Definition at line 50 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 81 of file Driver.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
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.
inFileName | input file name |
Definition at line 64 of file Driver.cpp.
bool torc::generic::Driver::parseStream | ( | std::istream & | inStream, |
const std::string & | inStreamName = "stream input" |
||
) |
Invoke the scanner and parser for a stream.
inStream | input stream |
inStreamName | stream name for error messages |
Definition at line 52 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.
inString | input string |
inStreamName | stream name for error messages |
Definition at line 72 of file Driver.cpp.
void torc::generic::Driver::setParserError | ( | const Error & | inSource | ) |
Definition at line 85 of file Driver.cpp.
|
private |
Reference to the Edif context filled during parsing of the Edif file.
Definition at line 113 of file Driver.hpp.
|
private |
Reference to the Error object
Definition at line 116 of file Driver.hpp.
|
private |
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 109 of file Driver.hpp.
|
private |
Definition at line 105 of file Driver.hpp.
|
private |
Definition at line 104 of file Driver.hpp.
|
private |
Definition at line 103 of file Driver.hpp.