You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.1 KiB

  1. /*
  2. * PrctlFileParser.cpp
  3. *
  4. * Created on: 06.02.2013
  5. * Author: Thomas Heinemann
  6. */
  7. #include <sstream>
  8. #include "PrctlFileParser.h"
  9. #include "PrctlParser.h"
  10. namespace storm {
  11. namespace parser {
  12. std::list<storm::property::prctl::AbstractPrctlFormula<double>*> PrctlFileParser(std::string filename) {
  13. // Open file
  14. std::ifstream inputFileStream;
  15. inputFileStream.open(filename, std::ios::in);
  16. if (!inputFileStream.is_open()) {
  17. std::string message = "Error while opening file ";
  18. throw storm::exceptions::FileIoException() << message << filename;
  19. }
  20. std::list<storm::property::prctl::AbstractPrctlFormula<double>*> result;
  21. std::string line;
  22. //The while loop reads the input file line by line
  23. while (std::getline(inputFileStream, line)) {
  24. PrctlParser parser(line);
  25. if (!parser.parsedComment()) {
  26. //lines containing comments will be skipped.
  27. LOG4CPLUS_INFO(logger, "Parsed formula \"" + line + "\" into \"" + parser.getFormula()->toString() + "\"");
  28. result.push_back(parser.getFormula());
  29. }
  30. }
  31. return result;
  32. }
  33. } /* namespace parser */
  34. } /* namespace storm */