Browse Source

Fixed issues with PRISM parser.

tempestpy_adaptions
dehnert 12 years ago
parent
commit
dd317bf6a4
  1. 1
      src/ir/IntegerVariable.cpp
  2. 8
      src/ir/Module.cpp
  3. 2
      src/ir/Variable.cpp
  4. 4
      src/parser/prismparser/PrismGrammar.cpp

1
src/ir/IntegerVariable.cpp

@ -28,6 +28,7 @@ namespace storm {
IntegerVariable::IntegerVariable(IntegerVariable const& oldVariable, std::string const& newName, uint_fast64_t newGlobalIndex, std::map<std::string, std::string> const& renaming, storm::parser::prism::VariableState const& variableState)
: Variable(oldVariable, newName, newGlobalIndex, renaming, variableState), lowerBound(oldVariable.lowerBound->clone(renaming, variableState)), upperBound(oldVariable.upperBound->clone(renaming, variableState)) {
// Nothing to do here.
}
std::shared_ptr<storm::ir::expressions::BaseExpression> IntegerVariable::getLowerBound() const {

8
src/ir/Module.cpp

@ -51,8 +51,8 @@ namespace storm {
LOG4CPLUS_ERROR(logger, "Boolean variable " << moduleName << "." << booleanVariable.getName() << " was not renamed.");
throw storm::exceptions::InvalidArgumentException() << "Boolean variable " << moduleName << "." << booleanVariable.getName() << " was not renamed.";
} else {
this->booleanVariables.emplace_back(booleanVariable, renamingPair->second, variableState.getNextGlobalBooleanVariableIndex(), renaming, variableState);
variableState.addBooleanVariable(renamingPair->second);
uint_fast64_t globalIndex = variableState.addBooleanVariable(renamingPair->second);
this->booleanVariables.emplace_back(booleanVariable, renamingPair->second, globalIndex, renaming, variableState);
}
}
// Now do the same for the integer variables.
@ -63,8 +63,8 @@ namespace storm {
LOG4CPLUS_ERROR(logger, "Integer variable " << moduleName << "." << integerVariable.getName() << " was not renamed.");
throw storm::exceptions::InvalidArgumentException() << "Integer variable " << moduleName << "." << integerVariable.getName() << " was not renamed.";
} else {
this->integerVariables.emplace_back(integerVariable, renamingPair->second, variableState.getNextGlobalIntegerVariableIndex(), renaming, variableState);
variableState.addIntegerVariable(renamingPair->second);
uint_fast64_t globalIndex = variableState.addIntegerVariable(renamingPair->second);
this->integerVariables.emplace_back(integerVariable, renamingPair->second, globalIndex, renaming, variableState);
}
}

2
src/ir/Variable.cpp

@ -25,7 +25,7 @@ namespace storm {
}
Variable::Variable(Variable const& var, std::string const& newName, uint_fast64_t newGlobalIndex, std::map<std::string, std::string> const& renaming, storm::parser::prism::VariableState const& variableState)
: localIndex(var.getLocalIndex()), globalIndex(newGlobalIndex), variableName(var.getName()) {
: localIndex(var.getLocalIndex()), globalIndex(newGlobalIndex), variableName(newName) {
if (var.initialValue != nullptr) {
this->initialValue = var.initialValue->clone(renaming, variableState);
}

4
src/parser/prismparser/PrismGrammar.cpp

@ -38,10 +38,6 @@ namespace storm {
namespace parser {
namespace prism {
void dump(const std::string& s) {
std::cerr << "Dump: " << s << std::endl;
}
std::shared_ptr<BaseExpression> PrismGrammar::addIntegerConstant(std::string const& name, std::shared_ptr<BaseExpression> const& value) {
this->state->integerConstants_.add(name, value);
this->state->allConstantNames_.add(name, name);

Loading…
Cancel
Save