Browse Source

porting PRCTLParser to class API

tempestpy_adaptions
gereon 12 years ago
parent
commit
dd03c85fea
  1. 12
      src/parser/readPrctlFile.cpp
  2. 18
      src/parser/readPrctlFile.h

12
src/parser/readPrctlFile.cpp

@ -24,7 +24,7 @@ namespace
using namespace bs::qi;
using namespace bs::standard;
struct PRCTLParser : public grammar< char const* >
struct SpiritParser : public grammar< char const* >
{
typedef rule< char const* > rule_none;
typedef rule< char const*, double() > rule_double;
@ -83,7 +83,7 @@ namespace
}
};
PRCTLParser() : PRCTLParser::base_type(file, "PRCTL parser")
SpiritParser() : SpiritParser::base_type(file, "PRCTL parser")
{
variable %= alnum;
ws = *( space );
@ -106,9 +106,9 @@ namespace
};
}
mrmc::formula::PCTLFormula* mrmc::parser::readPrctlFile(const char* filename)
mrmc::parser::PRCTLParser::PRCTLParser(const char* filename)
{
PRCTLParser p;
SpiritParser p;
mrmc::parser::MappedFile file(filename);
char* data = file.data;
@ -117,7 +117,7 @@ mrmc::formula::PCTLFormula* mrmc::parser::readPrctlFile(const char* filename)
std::cout << "File was parsed" << std::endl;
std::string rest(data, file.dataend);
std::cout << "Rest: " << rest << std::endl;
return p.result;
this->formula = p.result;
}
else return NULL;
else this->formula = NULL;
}

18
src/parser/readPrctlFile.h

@ -2,6 +2,7 @@
#define READPRCTLFILE_H_
#include "src/formula/PCTLformula.h"
#include "src/parser/parser.h"
namespace mrmc {
namespace parser {
@ -9,7 +10,22 @@ namespace parser {
/*!
* @brief Load PRCTL file
*/
mrmc::formula::PCTLFormula* readPrctlFile(const char * filename);
class PRCTLParser : Parser
{
public:
PRCTLParser(const char * filename);
/*!
* @brief return formula object parsed from file.
*/
mrmc::formula::PCTLFormula* getFormula()
{
return this->formula;
}
private:
mrmc::formula::PCTLFormula* formula;
};
} // namespace parser
} // namespace mrmc

Loading…
Cancel
Save