45 #ifndef YY_HOAYY_PARSEAUT_HH_INCLUDED
46 # define YY_HOAYY_PARSEAUT_HH_INCLUDED
48 #line 33 "parseaut.yy"
51 #include <spot/misc/common.hh>
52 #include <spot/priv/robin_hood.hh>
56 #include <unordered_map>
58 #include <spot/twa/formula2bdd.hh>
59 #include <spot/parseaut/public.hh>
60 #include "spot/priv/accmap.hh"
61 #include <spot/tl/parse.hh>
62 #include <spot/twaalgos/alternation.hh>
64 using namespace std::string_literals;
66 #ifndef HAVE_STRVERSCMP
68 extern "C" int strverscmp(
const char *s1,
const char *s2);
73 #define PARSE_ERROR_LIST res.h->errors, res.fcache
75 inline namespace hoayy_support
77 typedef std::map<int, bdd> map_t;
84 typedef robin_hood::unordered_flat_map<std::string, bdd> formula_cache;
86 typedef std::pair<int, std::string*> pair;
94 enum label_style_t { Mixed_Labels, State_Labels, Trans_Labels,
96 enum acc_style_t { Mixed_Acc, State_Acc, Trans_Acc };
102 bool declared =
false;
104 spot::location used_loc;
106 spot::parsed_aut_ptr h;
107 spot::twa_ptr aut_or_ks;
109 std::string format_version;
110 spot::location format_version_loc;
112 formula_cache fcache;
114 spot::acc_mapper_int* acc_mapper =
nullptr;
116 std::vector<int> controllable_ap;
117 bool has_controllable_ap =
false;
118 std::vector<spot::location> controllable_ap_loc;
119 spot::location controllable_aps_loc;
120 std::vector<bdd> guards;
121 std::vector<bdd>::const_iterator cur_guard;
131 int unknown_ap_max = -1;
132 spot::location unknown_ap_max_location;
133 bool in_alias =
false;
135 std::vector<state_info> info_states;
136 std::vector<std::pair<spot::location,
137 std::vector<unsigned>>> start;
138 std::unordered_map<std::string, bdd> alias;
143 operator bool()
const
148 std::unordered_map<std::string, prop_info> props;
149 spot::location states_loc;
150 spot::location ap_loc;
151 spot::location state_label_loc;
152 spot::location accset_loc;
158 std::vector<std::string>* state_names =
nullptr;
159 std::map<unsigned, unsigned>* highlight_edges =
nullptr;
160 std::map<unsigned, unsigned>* highlight_states =
nullptr;
161 std::map<unsigned, unsigned> states_map;
162 std::vector<bool>* state_player =
nullptr;
163 spot::location state_player_loc;
164 std::set<int> ap_set;
171 bool has_state_label =
false;
172 bool ignore_more_ap =
false;
174 bool ignore_acc =
false;
176 bool ignore_acc_silent =
false;
177 bool ignore_more_acc =
false;
180 label_style_t label_style = Mixed_Labels;
181 acc_style_t acc_style = Mixed_Acc;
183 bool accept_all_needed =
false;
184 bool accept_all_seen =
false;
185 bool aliased_states =
false;
190 bool trans_acc_seen =
false;
192 std::map<std::string, spot::location> labels;
194 prop_info prop_is_true(
const std::string& p)
196 auto i = props.find(p);
197 if (i == props.end())
198 return prop_info{spot::location(),
false};
202 prop_info prop_is_false(
const std::string& p)
204 auto i = props.find(p);
205 if (i == props.end())
206 return prop_info{spot::location(),
false};
207 return prop_info{i->second.loc, !i->second.val};
218 #line 219 "parseaut.hh"
223 # include <stdexcept>
227 #if defined __cplusplus
228 # define YY_CPLUSPLUS __cplusplus
230 # define YY_CPLUSPLUS 199711L
234 #if 201103L <= YY_CPLUSPLUS
235 # define YY_MOVE std::move
236 # define YY_MOVE_OR_COPY move
237 # define YY_MOVE_REF(Type) Type&&
238 # define YY_RVREF(Type) Type&&
239 # define YY_COPY(Type) Type
242 # define YY_MOVE_OR_COPY copy
243 # define YY_MOVE_REF(Type) Type&
244 # define YY_RVREF(Type) const Type&
245 # define YY_COPY(Type) const Type&
249 #if 201103L <= YY_CPLUSPLUS
250 # define YY_NOEXCEPT noexcept
254 # define YY_NOTHROW throw ()
258 #if 201703 <= YY_CPLUSPLUS
259 # define YY_CONSTEXPR constexpr
261 # define YY_CONSTEXPR
266 #ifndef YY_ATTRIBUTE_PURE
267 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
268 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
270 # define YY_ATTRIBUTE_PURE
274 #ifndef YY_ATTRIBUTE_UNUSED
275 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
276 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
278 # define YY_ATTRIBUTE_UNUSED
283 #if ! defined lint || defined __GNUC__
284 # define YY_USE(E) ((void) (E))
290 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
291 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
292 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
293 _Pragma ("GCC diagnostic push") \
294 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
296 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
297 _Pragma ("GCC diagnostic push") \
298 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
299 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
301 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
302 _Pragma ("GCC diagnostic pop")
304 # define YY_INITIAL_VALUE(Value) Value
306 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
307 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
308 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
310 #ifndef YY_INITIAL_VALUE
311 # define YY_INITIAL_VALUE(Value)
314 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
315 # define YY_IGNORE_USELESS_CAST_BEGIN \
316 _Pragma ("GCC diagnostic push") \
317 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
318 # define YY_IGNORE_USELESS_CAST_END \
319 _Pragma ("GCC diagnostic pop")
321 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
322 # define YY_IGNORE_USELESS_CAST_BEGIN
323 # define YY_IGNORE_USELESS_CAST_END
328 # define YY_CAST(Type, Val) static_cast<Type> (Val)
329 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
331 # define YY_CAST(Type, Val) ((Type) (Val))
332 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
336 # if defined __cplusplus
337 # if 201103L <= __cplusplus
338 # define YY_NULLPTR nullptr
340 # define YY_NULLPTR 0
343 # define YY_NULLPTR ((void*)0)
351 # define HOAYYDEBUG 1
353 # define HOAYYDEBUG 0
356 # define HOAYYDEBUG 1
361 #line 362 "parseaut.hh"
372 # pragma GCC message "bison: do not #define HOAYYSTYPE in C++, use %define api.value.type"
379 #line 209 "parseaut.yy"
386 std::list<pair>* list;
388 std::vector<unsigned>* states;
390 #line 391 "parseaut.hh"
404 : std::runtime_error (m)
409 : std::runtime_error (s.what ())
410 , location (s.location)
434 CONTROLLABLE_AP = 265,
441 SPOT_HIGHLIGHT_EDGES = 272,
442 SPOT_HIGHLIGHT_STATES = 273,
443 SPOT_STATE_PLAYER = 274,
506 S_CONTROLLABLE_AP = 10,
513 S_SPOT_HIGHLIGHT_EDGES = 17,
514 S_SPOT_HIGHLIGHT_STATES = 18,
515 S_SPOT_STATE_PLAYER = 19,
529 S_LINEDIRECTIVE = 33,
574 S_78_format_version = 78,
576 S_80_controllable_aps = 80,
579 S_83_header_items = 83,
580 S_84_header_item = 84,
590 S_94_highlight_edges = 94,
591 S_95_highlight_states = 95,
592 S_96_state_player = 96,
593 S_97_header_spec = 97,
594 S_98_state_conj_2 = 98,
595 S_99_init_state_conj_2 = 99,
596 S_100_label_expr = 100,
598 S_102_acceptance_cond = 102,
600 S_104_state_num = 104,
601 S_105_checked_state_num = 105,
604 S_108_state_name = 108,
606 S_110_state_label_opt = 110,
607 S_111_trans_label = 111,
609 S_113_acc_sets = 113,
610 S_114_state_acc_opt = 114,
611 S_115_trans_acc_opt = 115,
612 S_116_labeled_edges = 116,
613 S_117_some_labeled_edges = 117,
614 S_118_incorrectly_unlabeled_edge = 118,
615 S_119_labeled_edge = 119,
616 S_120_state_conj_checked = 120,
617 S_121_unlabeled_edges = 121,
618 S_122_unlabeled_edge = 122,
619 S_123_incorrectly_labeled_edge = 123,
622 S_dstar_header = 126,
624 S_dstar_state_id = 128,
626 S_dstar_accsigs = 130,
627 S_dstar_state_accsig = 131,
628 S_dstar_transitions = 132,
629 S_dstar_states = 133,
632 S_136_nc_states = 136,
633 S_137_nc_one_ident = 137,
634 S_138_nc_ident_list = 138,
635 S_139_nc_transition_block = 139,
636 S_140_nc_state = 140,
637 S_141_nc_transitions = 141,
638 S_142_nc_formula_or_ident = 142,
639 S_143_nc_formula = 143,
640 S_144_nc_opt_dest = 144,
641 S_145_nc_src_dest = 145,
642 S_146_nc_transition = 146,
644 S_148_lbtt_header_states = 148,
645 S_149_lbtt_header = 149,
646 S_150_lbtt_body = 150,
647 S_151_lbtt_states = 151,
648 S_152_lbtt_state = 152,
649 S_153_lbtt_acc = 153,
650 S_154_lbtt_guard = 154,
651 S_155_lbtt_transitions = 155
667 template <
typename Base>
679 #if 201103L <= YY_CPLUSPLUS
682 : Base (std::move (that))
683 , value (std::move (that.value))
684 , location (std::move (that.location))
714 std::string
name () const YY_NOEXCEPT
716 return parser::symbol_name (this->kind ());
723 bool empty () const YY_NOEXCEPT;
735 #if YY_CPLUSPLUS < 201103L
750 #if 201103L <= YY_CPLUSPLUS
789 parser (
void* scanner_yyarg,
result_& res_yyarg, spot::location initial_loc_yyarg);
792 #if 201103L <= YY_CPLUSPLUS
811 void set_debug_stream (std::ostream &);
839 const symbol_type& lookahead ()
const YY_NOEXCEPT {
return yyla_; }
841 const location_type& location ()
const YY_NOEXCEPT {
return yyla_.location; }
854 #if YY_CPLUSPLUS < 201103L
863 typedef short state_type;
866 int yy_syntax_error_arguments_ (
const context& yyctx,
871 virtual std::string yysyntax_error_ (
const context& yyctx)
const;
875 static state_type yy_lr_goto_state_ (state_type yystate,
int yysym);
879 static bool yy_pact_value_is_default_ (
int yyvalue) YY_NOEXCEPT;
883 static bool yy_table_value_is_error_ (
int yyvalue) YY_NOEXCEPT;
885 static const short yypact_ninf_;
886 static const short yytable_ninf_;
894 static std::string yytnamerr_ (
const char *yystr);
897 static const char*
const yytname_[];
903 static const short yypact_[];
908 static const unsigned char yydefact_[];
911 static const short yypgoto_[];
914 static const short yydefgoto_[];
919 static const short yytable_[];
921 static const short yycheck_[];
925 static const unsigned char yystos_[];
928 static const unsigned char yyr1_[];
931 static const signed char yyr2_[];
936 static const short yyrline_[];
938 virtual void yy_reduce_print_ (
int r)
const;
940 virtual void yy_stack_print_ ()
const;
945 std::ostream* yycdebug_;
950 template <
typename Base>
958 template <
typename Base>
966 by_state () YY_NOEXCEPT;
969 typedef state_type kind_type;
972 by_state (kind_type s) YY_NOEXCEPT;
975 by_state (const by_state& that) YY_NOEXCEPT;
978 void clear () YY_NOEXCEPT;
981 void move (by_state& that);
989 enum { empty_state = 0 };
997 struct stack_symbol_type : basic_symbol<by_state>
1000 typedef basic_symbol<by_state> super_type;
1002 stack_symbol_type ();
1004 stack_symbol_type (YY_RVREF (stack_symbol_type) that);
1006 stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
1007 #if YY_CPLUSPLUS < 201103L
1010 stack_symbol_type& operator= (stack_symbol_type& that);
1014 stack_symbol_type& operator= (
const stack_symbol_type& that);
1019 template <
typename T,
typename S = std::vector<T> >
1024 typedef typename S::iterator iterator;
1025 typedef typename S::const_iterator const_iterator;
1026 typedef typename S::size_type size_type;
1027 typedef typename std::ptrdiff_t index_type;
1029 stack (size_type n = 200) YY_NOEXCEPT
1033 #if 201103L <= YY_CPLUSPLUS
1035 stack (
const stack&) =
delete;
1037 stack& operator= (
const stack&) =
delete;
1044 operator[] (index_type i)
const
1046 return seq_[size_type (size () - 1 - i)];
1053 operator[] (index_type i)
1055 return seq_[size_type (size () - 1 - i)];
1062 push (YY_MOVE_REF (T) t)
1064 seq_.push_back (T ());
1065 operator[] (0).move (t);
1070 pop (std::ptrdiff_t n = 1) YY_NOEXCEPT
1078 clear () YY_NOEXCEPT
1085 size () const YY_NOEXCEPT
1087 return index_type (seq_.size ());
1092 begin () const YY_NOEXCEPT
1094 return seq_.begin ();
1099 end () const YY_NOEXCEPT
1108 slice (
const stack& stack, index_type range) YY_NOEXCEPT
1114 operator[] (index_type i)
const
1116 return stack_[range_ - i];
1120 const stack& stack_;
1125 #if YY_CPLUSPLUS < 201103L
1127 stack (
const stack&);
1129 stack& operator= (
const stack&);
1137 typedef stack<stack_symbol_type> stack_type;
1140 stack_type yystack_;
1147 void yypush_ (
const char* m, YY_MOVE_REF (stack_symbol_type) sym);
1155 void yypush_ (
const char* m, state_type s, YY_MOVE_REF (
symbol_type) sym);
1158 void yypop_ (
int n = 1) YY_NOEXCEPT;
1172 spot::location initial_loc;
1178 #line 1179 "parseaut.hh"
Definition: parseaut.hh:836
int expected_tokens(symbol_kind_type yyarg[], int yyargn) const
Present a slice of the top of a stack.
Definition: parseaut.hh:1106
A Bison parser.
Definition: parseaut.hh:368
void error(const syntax_error &err)
Report a syntax error.
token_kind_type token_type
Backward compatibility alias (Bison 3.6).
Definition: parseaut.hh:487
symbol_kind::symbol_kind_type symbol_kind_type
(Internal) symbol kind.
Definition: parseaut.hh:656
token::token_kind_type token_kind_type
Token kind, as returned by yylex.
Definition: parseaut.hh:484
std::ostream & debug_stream() const
The current debugging stream.
spot::location location_type
Symbol locations.
Definition: parseaut.hh:398
static std::string symbol_name(symbol_kind_type yysymbol)
int debug_level_type
Type for debugging levels.
Definition: parseaut.hh:814
value_type semantic_type
Backward compatibility (Bison 3.8).
Definition: parseaut.hh:395
virtual void error(const location_type &loc, const std::string &msg)
parser(void *scanner_yyarg, result_ &res_yyarg, spot::location initial_loc_yyarg)
Build a parser object.
An environment that describes atomic propositions.
Definition: environment.hh:33
A class implementing Kleene's three-valued logic.
Definition: trival.hh:34
Definition: parseaut.hh:669
Base super_type
Alias to Base.
Definition: parseaut.hh:671
basic_symbol()
Default constructor.
Definition: parseaut.hh:674
symbol_kind_type type_get() const
Backward compatibility (Bison 3.6).
void clear()
Destroy contents, and record that is empty.
Definition: parseaut.hh:708
basic_symbol(const basic_symbol &that)
Copy constructor.
basic_symbol(typename Base::kind_type t, const value_type &v, const location_type &l)
Constructor for symbols with semantic value.
basic_symbol(typename Base::kind_type t, location_type &l)
Constructor for valueless symbols.
std::string name() const
The user-facing name of this symbol.
Definition: parseaut.hh:714
~basic_symbol()
Destroy the symbol.
Definition: parseaut.hh:700
Type access provider for token (enum) based symbols.
Definition: parseaut.hh:743
by_kind()
Default constructor.
void clear()
Record that this symbol is empty.
by_kind(kind_type t)
Constructor from (external) token numbers.
by_kind(const by_kind &that)
Copy constructor.
token_kind_type kind_type
The symbol kind as needed by the constructor.
Definition: parseaut.hh:745
Symbol kinds.
Definition: parseaut.hh:491
symbol_kind_type
Definition: parseaut.hh:493
"External" symbols: returned by the scanner.
Definition: parseaut.hh:786
Syntax errors thrown from user actions.
Definition: parseaut.hh:402
Token kinds.
Definition: parseaut.hh:420
token_kind_type yytokentype
Backward compatibility alias (Bison 3.6).
Definition: parseaut.hh:480
Definition: parseaut.hh:140
Definition: parseaut.hh:101
Definition: parseaut.hh:99
An acceptance formula.
Definition: acc.hh:487
An acceptance mark.
Definition: acc.hh:89
Symbol semantic values.
Definition: parseaut.hh:378