00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef HAVE_CONFIG_H
00017 #include "torc/generic/config.h"
00018 #endif
00019
00020 #include "torc/generic/parser/Driver.hpp"
00021 #include "torc/generic/parser/EdifContext.hpp"
00022 #include "torc/generic/parser/EdifParser.hpp"
00023 #include "torc/generic/parser/ParserOptions.hpp"
00024 #include "torc/generic/om/Root.hpp"
00025 #include "torc/generic/parser/Linker.hpp"
00026
00027 namespace torc {
00028
00029 namespace generic {
00030
00031 EdifParser::EdifParser() {
00032 }
00033
00034 EdifParser::~EdifParser() throw() {
00035 }
00036
00037 EdifParser::EdifParser(const EdifParser &inSource) {
00038 }
00039
00040 EdifParser &
00041 EdifParser::operator=(const EdifParser &inSource) throw() {
00042 return *this;
00043 }
00044
00045 void
00046 EdifParser::parse(const std::string &inFileName,
00047 const RootSharedPtr &outRoot,
00048 const LinkerSharedPtr &outLinker,
00049 const ObjectFactorySharedPtr &inFactory,
00050 const ParserOptions &inOptions) throw(Error) {
00051 EdifContextSharedPtr context(
00052 new EdifContext(
00053 outRoot, outLinker, inFactory, inOptions ) );
00054 if( !outRoot || !outLinker || !inFactory )
00055 {
00056 Error e( eMessageIdErrorNullPointer,
00057 __FUNCTION__, __FILE__, __LINE__ );
00058 throw;
00059 }
00060 Driver parserDriver( context );
00061 if( false == parserDriver.parseFile( inFileName ) )
00062 {
00063 throw parserDriver.getParserError();
00064 }
00065 return;
00066 }
00067
00068 void
00069 EdifParser::parse(const std::vector<std::string> &inFileNames,
00070 const RootSharedPtr &outRoot,
00071 const LinkerSharedPtr &outLinker,
00072 const ObjectFactorySharedPtr &inFactory,
00073 const ParserOptions &inOptions) throw(Error) {
00074 std::vector<std::string>::const_iterator it = inFileNames.begin();
00075 std::vector<std::string>::const_iterator end = inFileNames.end();
00076 try
00077 {
00078 for(; it != end; ++it )
00079 {
00080 parse( *it, outRoot, outLinker, inFactory, inOptions );
00081 }
00082 }
00083 catch( Error &e )
00084 {
00085 e.setCurrentLocation(
00086 __FUNCTION__, __FILE__, __LINE__ );
00087 throw;
00088 }
00089 }
00090
00091 }
00092
00093 }