Added class for initial construct of PRISM programs (to capture position information). Added more validity checks for programs and tests for them (not all though).
LOG_THROW(!globalProgramInformation.hasInitialStatesExpression,storm::exceptions::WrongFormatException,"Parsing error in "<<this->getFilename()<<", line "<<get_line(qi::_3)<<": Program must not define two initial constructs.");
LOG_THROW(!globalProgramInformation.hasInitialConstruct,storm::exceptions::WrongFormatException,"Parsing error in "<<this->getFilename()<<", line "<<get_line(qi::_3)<<": Program must not define two initial constructs.");
LOG_THROW(identifierTypePair!=this->identifierToTypeMap.end(),storm::exceptions::InvalidArgumentException,"No type available for identifier '"<<expression->getConstantName()<<"'.");
LOG_THROW(identifierTypePair->second==ExpressionReturnType::Bool,storm::exceptions::InvalidTypeException,"Type mismatch for constant '"<<expression->getConstantName()<<"': expected bool, but found "<<expression->getReturnType()<<".");
LOG_THROW(identifierTypePair->second==ExpressionReturnType::Bool,storm::exceptions::InvalidTypeException,"Type mismatch for constant '"<<expression->getConstantName()<<"': expected 'bool', but found '"<<expression->getReturnType()<<"'.");
LOG_THROW(identifierTypePair!=this->identifierToTypeMap.end(),storm::exceptions::InvalidArgumentException,"No type available for identifier '"<<expression->getConstantName()<<"'.");
LOG_THROW(identifierTypePair->second==ExpressionReturnType::Bool,storm::exceptions::InvalidTypeException,"Type mismatch for constant '"<<expression->getConstantName()<<"': expected double, but found "<<expression->getReturnType()<<".");
LOG_THROW(identifierTypePair->second==ExpressionReturnType::Double,storm::exceptions::InvalidTypeException,"Type mismatch for constant '"<<expression->getConstantName()<<"': expected 'double', but found '"<<expression->getReturnType()<<"'.");
LOG_THROW(identifierTypePair!=this->identifierToTypeMap.end(),storm::exceptions::InvalidArgumentException,"No type available for identifier '"<<expression->getConstantName()<<"'.");
LOG_THROW(identifierTypePair->second==ExpressionReturnType::Bool,storm::exceptions::InvalidTypeException,"Type mismatch for constant '"<<expression->getConstantName()<<"': expected int, but found "<<expression->getReturnType()<<".");
LOG_THROW(identifierTypePair->second==ExpressionReturnType::Int,storm::exceptions::InvalidTypeException,"Type mismatch for constant '"<<expression->getConstantName()<<"': expected 'int', but found '"<<expression->getReturnType()<<"'.");
LOG_THROW(identifierTypePair!=this->identifierToTypeMap.end(),storm::exceptions::InvalidArgumentException,"No type available for identifier '"<<expression->getVariableName()<<"'.");
LOG_THROW(identifierTypePair->second==ExpressionReturnType::Bool,storm::exceptions::InvalidTypeException,"Type mismatch for variable '"<<expression->getVariableName()<<"': expected "<<identifierTypePair->first<<", but found "<<expression->getReturnType()<<".");
LOG_THROW(identifierTypePair->second==expression->getReturnType(),storm::exceptions::InvalidTypeException,"Type mismatch for variable '"<<expression->getVariableName()<<"': expected '"<<identifierTypePair->first<<"', but found '"<<expression->getReturnType()<<"'.");
LOG_THROW(definedUndefinedConstants.find(constantExpressionPair.first)!=definedUndefinedConstants.end(),storm::exceptions::InvalidArgumentException,"Unable to define non-existant constant.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<constant.getFilename()<<", line "<<constant.getLineNumber()<<": defining expression refers to unknown constants.");
// Now check that the constants appear with the right types (this throws an exception if this is not
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": initial value expression refers to unknown constants.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": lower bound expression refers to unknown constants.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": "<<e.what());
}
LOG_THROW(variable.getUpperBoundExpression().getVariables().empty(),storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": upper bound expression must not refer to variables.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": upper bound expression refers to unknown constants.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": "<<e.what());
}
// Check the initial value of the variable.
LOG_THROW(variable.getInitialValueExpression().getVariables().empty(),storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": initial value expression must not refer to variables.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": initial value expression refers to unknown constants.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": initial value expression refers to unknown constants.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": lower bound expression refers to unknown constants.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": "<<e.what());
}
LOG_THROW(variable.getUpperBoundExpression().getVariables().empty(),storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": upper bound expression must not refer to variables.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": upper bound expression refers to unknown constants.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": "<<e.what());
}
// Check the initial value of the variable.
LOG_THROW(variable.getInitialValueExpression().getVariables().empty(),storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": initial value expression must not refer to variables.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<variable.getFilename()<<", line "<<variable.getLineNumber()<<": initial value expression refers to unknown constants.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<command.getFilename()<<", line "<<command.getLineNumber()<<": guard refers to unknown identifiers.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<command.getFilename()<<", line "<<command.getLineNumber()<<": "<<e.what());
}
LOG_THROW(command.getGuardExpression().hasBooleanReturnType(),storm::exceptions::WrongFormatException,"Error in "<<command.getFilename()<<", line "<<command.getLineNumber()<<": expression for guard must evaluate to type 'bool'.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<command.getFilename()<<", line "<<command.getLineNumber()<<": likelihood expression refers to unknown identifiers.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<command.getFilename()<<", line "<<command.getLineNumber()<<": assignment illegally refers to variable '"<<assignment.getVariableName()<<"'.");
}else{
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<command.getFilename()<<", line "<<command.getLineNumber()<<": assignment refers to unknown variable '"<<assignment.getVariableName()<<"'.");
}
}
LOG_THROW(alreadyAssignedIdentifiers.find(assignment.getVariableName())==alreadyAssignedIdentifiers.end(),storm::exceptions::WrongFormatException,"Error in "<<command.getFilename()<<", line "<<command.getLineNumber()<<": duplicate assignment to variable '"<<assignment.getVariableName()<<"'.");
LOG_THROW(variableTypePair->second==assignment.getExpression().getReturnType(),storm::exceptions::WrongFormatException,"Error in "<<command.getFilename()<<", line "<<command.getLineNumber()<<": illegally assigning a value of type '"<<assignment.getExpression().getReturnType()<<"' to variable '"<<variableTypePair->first<<"' of type '"<<variableTypePair->second<<"'.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<command.getFilename()<<", line "<<command.getLineNumber()<<": likelihood expression refers to unknown identifiers.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<stateReward.getFilename()<<", line "<<stateReward.getLineNumber()<<": state reward expression refers to unknown identifiers.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<stateReward.getFilename()<<", line "<<stateReward.getLineNumber()<<": "<<e.what());
}
LOG_THROW(stateReward.getStatePredicateExpression().hasBooleanReturnType(),storm::exceptions::WrongFormatException,"Error in "<<stateReward.getFilename()<<", line "<<stateReward.getLineNumber()<<": state predicate must evaluate to type 'bool'.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<stateReward.getFilename()<<", line "<<stateReward.getLineNumber()<<": state reward value expression refers to unknown identifiers.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<stateReward.getFilename()<<", line "<<stateReward.getLineNumber()<<": "<<e.what());
}
LOG_THROW(stateReward.getRewardValueExpression().hasNumericalReturnType(),storm::exceptions::WrongFormatException,"Error in "<<stateReward.getFilename()<<", line "<<stateReward.getLineNumber()<<": reward value expression must evaluate to numerical type.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<transitionReward.getFilename()<<", line "<<transitionReward.getLineNumber()<<": state reward expression refers to unknown identifiers.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<transitionReward.getFilename()<<", line "<<transitionReward.getLineNumber()<<": "<<e.what());
}
LOG_THROW(transitionReward.getStatePredicateExpression().hasBooleanReturnType(),storm::exceptions::WrongFormatException,"Error in "<<transitionReward.getFilename()<<", line "<<transitionReward.getLineNumber()<<": state predicate must evaluate to type 'bool'.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<transitionReward.getFilename()<<", line "<<transitionReward.getLineNumber()<<": state reward value expression refers to unknown identifiers.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<transitionReward.getFilename()<<", line "<<transitionReward.getLineNumber()<<": "<<e.what());
}
LOG_THROW(transitionReward.getRewardValueExpression().hasNumericalReturnType(),storm::exceptions::WrongFormatException,"Error in "<<transitionReward.getFilename()<<", line "<<transitionReward.getLineNumber()<<": reward value expression must evaluate to numerical type.");
}
}
// Check the initial states expression (if the program defines it).
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<this->getFilename()<<", line "<<this->getLineNumber()<<": initial expression refers to unknown identifiers.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<this->getInitialConstruct().getFilename()<<", line "<<this->getInitialConstruct().getLineNumber()<<": initial expression refers to unknown identifiers.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<this->getInitialConstruct().getFilename()<<", line "<<this->getInitialConstruct().getLineNumber()<<": "<<e.what());
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<label.getFilename()<<", line "<<label.getLineNumber()<<": label expression refers to unknown identifiers.");
LOG_THROW(false,storm::exceptions::WrongFormatException,"Error in "<<label.getFilename()<<", line "<<label.getLineNumber()<<": "<<e.what());
}
LOG_THROW(label.getStatePredicateExpression().hasBooleanReturnType(),storm::exceptions::WrongFormatException,"Error in "<<label.getFilename()<<", line "<<label.getLineNumber()<<": label predicate must evaluate to type 'bool'.");
LOG_THROW(isValid,storm::exceptions::WrongFormatException,"Error in "<<formula.getFilename()<<", line "<<formula.getLineNumber()<<": formula expression refers to unknown identifiers.");