remove lexername from driver

This commit is contained in:
Thomas Avé 2017-01-04 21:06:42 +01:00
parent 601be444a7
commit 32b7fae8af
3 changed files with 4 additions and 7 deletions

View File

@ -21,10 +21,9 @@ namespace pds {
* @param inputfile An istream which should be read to be used as token rules specifications
* @param outputdir A string representing the directory where generated files should be places
* @param language The language to generate output for (backends is queried for this language)
* @param lexername The name to give to the generated lexer that is used by the parser, this gets cleaned to only contains alphanumeric chars or underscore and start with a non-digit (AKA a valid identifier)
* @param parsername The name to give to the generated parser, this gets cleaned to only contains alphanumeric chars or underscore and start with a non-digit (AKA a valid identifier)
*/
Driver(std::unique_ptr<BackendManager> backends, std::istream& inputfile, std::string outputdir, std::string language, std::string lexername, std::string parsername);
Driver(std::unique_ptr<BackendManager> backends, std::istream& inputfile, std::string outputdir, std::string language, std::string parsername);
/**
* Destructor
@ -43,7 +42,6 @@ namespace pds {
std::istream& m_inputfile;
std::string m_outputdir;
std::string m_language;
std::string m_lexername;
std::string m_parsername;
};

View File

@ -20,14 +20,13 @@ namespace {
namespace pds {
Driver::Driver(std::unique_ptr<BackendManager> backends, std::istream& inputfile, std::string outputdir, std::string language, std::string lexername, std::string parsername):
m_backends(std::move(backends)), m_inputfile(inputfile), m_outputdir(outputdir), m_language(language), m_lexername(clean(lexername)), m_parsername(clean(parsername)) {
Driver::Driver(std::unique_ptr<BackendManager> backends, std::istream& inputfile, std::string outputdir, std::string language, std::string parsername):
m_backends(std::move(backends)), m_inputfile(inputfile), m_outputdir(outputdir), m_language(language), m_parsername(clean(parsername)) {
}
Driver::~Driver(){}
int Driver::run() {
if (!m_lexername.length()) throw DriverException("no valid lexer name possible");
if (!m_parsername.length()) throw DriverException("no valid parser name possible");
Config config = InputParser::parseInput(m_inputfile);
Backend* back = m_backends->findBackend(m_language, config.parserType);

View File

@ -34,7 +34,7 @@ int main(int argc, char** argv) {
auto backendManager = std::make_unique<pds::BackendManager>(pds::BackendManager());
backendManager->registerLR<pds::backends::CppLRBackend>();
pds::Driver driver(std::move(backendManager), infile, options["outputdir"], options["language"], "TestLexer", "testParser");
pds::Driver driver(std::move(backendManager), infile, options["outputdir"], options["language"], "testParser");
return driver.run();