Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
HOAConsumerDAHeader.h
Go to the documentation of this file.
1#pragma once
2
3#include "cpphoafparser/consumer/hoa_consumer.hh"
4#include "cpphoafparser/util/implicit_edge_helper.hh"
10
11#include <boost/optional.hpp>
12#include <exception>
13
14namespace storm {
15namespace automata {
16
17class HOAConsumerDAHeader : public cpphoafparser::HOAConsumer {
18 protected:
20
21 public:
22 typedef std::shared_ptr<HOAConsumerDAHeader> ptr;
23
24 struct header_parsing_done : public std::exception {};
25
27 return header;
28 }
29
30 virtual bool parserResolvesAliases() {
31 return true;
32 }
33
35 virtual void notifyHeaderStart(const std::string& /*version*/) {
36 // TODO: Check version
37 }
38
40 virtual void setNumberOfStates(unsigned int numberOfStates) {
41 header.numberOfStates = numberOfStates;
42 }
43
48 virtual void addStartStates(const int_list& stateConjunction) {
49 if (header.startState) {
50 throw std::runtime_error("Parsing deterministic HOA automaton: Nondeterministic choice of start states not supported");
51 }
52 if (stateConjunction.size() != 1) {
53 throw std::runtime_error("Parsing deterministic HOA automaton: Conjunctive choice of start states not supported");
54 }
55 header.startState = stateConjunction.at(0);
56 }
57
62 virtual void setAPs(const std::vector<std::string>& aps) {
63 for (const std::string& ap : aps) {
64 header.apSet.add(ap);
65 }
66 }
67
73 virtual void setAcceptanceCondition(unsigned int numberOfSets, acceptance_expr::ptr accExpr) {
74 header.numberOfAcceptanceSets = numberOfSets;
76 }
77
83 virtual void provideAcceptanceName(const std::string& name, const std::vector<cpphoafparser::IntOrString>& extraInfo) {
84 header.accName = name;
85 header.accNameExtraInfo = extraInfo;
86 }
87
95 virtual void addAlias(const std::string& name, label_expr::ptr labelExpr) {
96 // IGNORE
97 (void)name;
98 (void)labelExpr;
99 }
100
104 virtual void setName(const std::string& /*name*/) {
105 // IGNORE
106 }
107
113 virtual void setTool(const std::string& /*name*/, std::shared_ptr<std::string> /*version*/) {
114 // IGNORE
115 }
116
121 virtual void addProperties(const std::vector<std::string>& /*properties*/) {
122 // TODO: check supported
123 }
124
130 virtual void addMiscHeader(const std::string& /*name*/, const std::vector<cpphoafparser::IntOrString>& /*content*/) {
131 // TODO: Check semantic headers
132 }
133
137 virtual void notifyBodyStart() {
138 throw header_parsing_done();
139 }
140
148 virtual void addState(unsigned int /*id*/, std::shared_ptr<std::string> /*info*/, label_expr::ptr /*labelExpr*/,
149 std::shared_ptr<int_list> /*accSignature*/) {
150 // IGNORE
151 }
152
165 virtual void addEdgeImplicit(unsigned int /*stateId*/, const int_list& /*conjSuccessors*/, std::shared_ptr<int_list> /*accSignature*/) {
166 // IGNORE
167 }
168
178 virtual void addEdgeWithLabel(unsigned int /*stateId*/, label_expr::ptr /*labelExpr*/, const int_list& /*conjSuccessors*/,
179 std::shared_ptr<int_list> /*accSignature*/) {
180 // IGNORE
181 }
182
187 virtual void notifyEndOfState(unsigned int /*stateId*/) {
188 // IGNORE
189 }
190
194 virtual void notifyEnd() {}
195
200 virtual void notifyAbort() {
201 throw std::runtime_error("Parsing deterministic automaton: Automaton is incomplete (abort)");
202 }
203
208 virtual void notifyWarning(const std::string& warning) {
209 // IGNORE
210 (void)warning;
211 }
212};
213
214} // namespace automata
215} // namespace storm
void add(const std::string &ap)
Definition APSet.cpp:24
virtual void notifyEndOfState(unsigned int)
Called by the parser to notify the consumer that the definition for state stateId has ended [multiple...
virtual void addEdgeImplicit(unsigned int, const int_list &, std::shared_ptr< int_list >)
Called by the parser for each implicit edge definition [multiple], i.e., where the edge label is dedu...
virtual void addStartStates(const int_list &stateConjunction)
Called by the parser for each "Start: state-conj" item [optional, multiple].
virtual void notifyBodyStart()
Called by the parser to notify that the BODY of the automaton has started [mandatory,...
virtual void addState(unsigned int, std::shared_ptr< std::string >, label_expr::ptr, std::shared_ptr< int_list >)
Called by the parser for each "State: ..." item [multiple].
virtual void setAPs(const std::vector< std::string > &aps)
Called by the parser for the "AP: ap-def" item [optional, once].
virtual void addProperties(const std::vector< std::string > &)
Called by the parser for the "properties: ..." item [optional, multiple].
virtual void notifyHeaderStart(const std::string &)
Called by the parser for the "HOA: version" item [mandatory, once].
virtual void setName(const std::string &)
Called by the parser for the "name: ..." item [optional, once].
virtual void addAlias(const std::string &name, label_expr::ptr labelExpr)
Called by the parser for each "Alias: alias-def" item [optional, multiple].
virtual void addEdgeWithLabel(unsigned int, label_expr::ptr, const int_list &, std::shared_ptr< int_list >)
Called by the parser for each explicit edge definition [optional, multiple], i.e.,...
virtual void addMiscHeader(const std::string &, const std::vector< cpphoafparser::IntOrString > &)
Called by the parser for each unknown header item [optional, multiple].
virtual void setAcceptanceCondition(unsigned int numberOfSets, acceptance_expr::ptr accExpr)
Called by the parser for the "Acceptance: acceptance-def" item [mandatory, once].
virtual void notifyAbort()
Called by the parser to notify the consumer that an "ABORT" message has been encountered (at any time...
std::shared_ptr< HOAConsumerDAHeader > ptr
virtual void notifyEnd()
Called by the parser to notify the consumer that the automata definition has ended [mandatory,...
virtual void setTool(const std::string &, std::shared_ptr< std::string >)
Called by the parser for the "tool: ..." item [optional, once].
virtual void provideAcceptanceName(const std::string &name, const std::vector< cpphoafparser::IntOrString > &extraInfo)
Called by the parser for each "acc-name: ..." item [optional, multiple].
virtual void setNumberOfStates(unsigned int numberOfStates)
Called by the parser for the "States: int(numberOfStates)" item [optional, once].
virtual void notifyWarning(const std::string &warning)
Is called whenever a condition is encountered that merits a (non-fatal) warning.
boost::optional< std::string > accName
Definition HOAHeader.h:17
boost::optional< unsigned int > numberOfAcceptanceSets
Definition HOAHeader.h:15
boost::optional< unsigned int > numberOfStates
Definition HOAHeader.h:12
cpphoafparser::HOAConsumer::acceptance_expr::ptr acceptance_expression
Definition HOAHeader.h:16
boost::optional< unsigned int > startState
Definition HOAHeader.h:11
boost::optional< std::vector< cpphoafparser::IntOrString > > accNameExtraInfo
Definition HOAHeader.h:18
LabParser.cpp.
Definition cli.cpp:18