12#ifndef MCRL2_LTS_PARSE_H
13#define MCRL2_LTS_PARSE_H
30 const std::regex
regex_parameter {
"\\s*([a-zA-Z_][a-zA-Z0-9_'@]*)\\((\\d+)\\)\\s*([a-zA-Z_][a-zA-Z0-9_'@#\\-> \t=,\\(\\):]*)?\\s*((\"[^\"]*\"\\s*)*)"};
37 const std::regex
regex_transition {
"(0|([1-9][0-9]*))+\\s+(0|([1-9][0-9]*|\\[[^\\]]*\\]))+\\s+\"([^\"]*)\""};
61 std::vector<std::string> result;
64 std::regex_token_iterator<std::string::const_iterator> end;
65 for (; cur != end; ++cur)
67 std::string value = cur->str();
70 result.push_back(value.substr(1, value.size() - 2));
85 std::string name = what[1];
86 std::string cardinality = what[2];
89 builder.add_parameter(name, cardinality, sort, domain_values);
113 std::string source = what[1];
114 std::string
target = what[3];
115 std::string
label = what[5];
125 throw mcrl2::runtime_error(
"Could not parse the following line as an initial distribution: " + line +
".");
127 builder.add_initial_distribution(what[0]);
141 while (std::getline(
from, line))
178 std::istringstream is(text);
Read-only balanced binary tree of terms.
std::vector< std::string > parse_domain_values(const std::string &text)
void run(std::istream &from)
void parse_parameter(const std::string &line)
states next_state(states state)
const std::regex regex_quoted_string
void parse_state(const std::string &line)
const std::regex regex_parameter
simple_fsm_parser(probabilistic_lts_fsm_t &fsm)
const std::regex regex_transition
void parse_initial_distribution(const std::string &line)
detail::fsm_builder builder
void parse_transition(const std::string &line)
const std::regex regex_probabilistic_initial_distribution
The class lts_fsm_t contains labelled transition systems in .fsm format.
Standard exception class for reporting runtime errors.
The code in this file is used to construct an lts in fsm format.
void parse_fsm_specification(std::istream &from, probabilistic_lts_fsm_t &result)
std::size_t label(const outgoing_pair_t &p)
Label of a pair of a label and target state.
std::size_t from(const outgoing_transitions_per_state_action_t::const_iterator &i)
From state of an iterator exploring transitions per outgoing state and action.
void trim(std::string &text)
Remove all trailing and leading spaces from the input.
std::string trim_copy(const std::string &text)
Remove all trailing and leading spaces from the input.
std::vector< std::size_t > parse_natural_number_sequence(const std::string &text)
Parses a sequence of natural numbers (separated by spaces) from a string.