5 changed files with 96 additions and 13 deletions
-
29src/parser/JaniParser.cpp
-
39src/parser/JaniParser.h
-
25src/storage/jani/Model.h
-
9src/utility/storm.cpp
-
3src/utility/storm.h
@ -1,4 +1,27 @@ |
|||||
//
|
#include "JaniParser.h"
|
||||
// Created by Sebastian Junges on 20/05/16.
|
#include "src/storage/jani/Model.h"
|
||||
//
|
#include "src/exceptions/FileIoException.h"
|
||||
|
|
||||
|
#include <iostream>
|
||||
|
#include <fstream>
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace parser { |
||||
|
void JaniParser::readFile(std::string const &path) { |
||||
|
std::ifstream file; |
||||
|
file.exceptions ( std::ifstream::failbit ); |
||||
|
try { |
||||
|
file.open(path); |
||||
|
} |
||||
|
catch (std::ifstream::failure e) { |
||||
|
STORM_LOG_THROW(false, storm::exceptions::FileIoException, "Exception during file opening on " << path << "."); |
||||
|
return; |
||||
|
} |
||||
|
file.exceptions( std::ifstream::goodbit ); |
||||
|
|
||||
|
parsedStructure << file; |
||||
|
file.close(); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
@ -1,8 +1,39 @@ |
|||||
// |
|
||||
// Created by Sebastian Junges on 18/05/16. |
|
||||
// |
|
||||
|
|
||||
#ifndef STORM_JANIPARSER_H |
#ifndef STORM_JANIPARSER_H |
||||
#define STORM_JANIPARSER_H |
#define STORM_JANIPARSER_H |
||||
|
|
||||
|
#include <src/storage/jani/Model.h> |
||||
|
#include "src/exceptions/FileIoException.h" |
||||
|
|
||||
|
// JSON parser |
||||
|
#include "json.hpp" |
||||
|
|
||||
|
using json = nlohmann::json; |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace jani { |
||||
|
class Model; |
||||
|
class Automaton; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
namespace parser { |
||||
|
class JaniParser { |
||||
|
|
||||
|
json parsedStructure; |
||||
|
|
||||
|
static storm::jani::Model parse(std::string const& path); |
||||
|
|
||||
|
protected: |
||||
|
void readFile(std::string const& path); |
||||
|
storm::jani::Automaton parseAutomaton(json const& automatonStructure); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
}; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
#endif //STORM_JANIPARSER_H |
#endif //STORM_JANIPARSER_H |
Reference in new issue
xxxxxxxxxx