Commit 14c05776 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz

parseaut: keep track of the format of each parsed automaton

* src/parseaut/public.hh (parsed_aut): Add a type field.
* src/parseaut/parseaut.yy: Fill it.
* src/dstarparse/dstarparse.yy: Use this field instead of
the private enumeration.
parent 6079b1dc
......@@ -38,12 +38,9 @@
{
typedef std::map<int, bdd> map_t;
enum dstar_type { Rabin, Streett };
struct result_
{
spot::parsed_aut_ptr d;
dstar_type type;
spot::ltl::environment* env;
std::vector<bdd> guards;
std::vector<bdd>::const_iterator cur_guard;
......@@ -128,13 +125,13 @@ opt_eols: | opt_eols EOL
auttype: DRA
{
result.type = Rabin;
result.d->type = spot::parsed_aut_type::DRA;
result.plus = 1;
result.minus = 0;
}
| DSA
{
result.type = Streett;
result.d->type = spot::parsed_aut_type::DSA;
result.plus = 0;
result.minus = 1;
}
......@@ -189,9 +186,9 @@ sizes:
result.accpair_count = $4;
result.accpair_count_seen = true;
result.d->aut->set_acceptance(2 * $4,
result.type == Rabin ?
spot::acc_cond::acc_code::rabin($4) :
spot::acc_cond::acc_code::streett($4));
result.d->type == spot::parsed_aut_type::DRA
? spot::acc_cond::acc_code::rabin($4)
: spot::acc_cond::acc_code::streett($4));
}
| sizes STATES opt_eols NUMBER opt_eols
{
......
......@@ -246,10 +246,9 @@ aut: aut-1 { res.h->loc = @$; YYACCEPT; }
| ENDOFFILE { YYABORT; }
| error ENDOFFILE { YYABORT; }
aut-1: hoa
| never
| lbtt
aut-1: hoa { res.h->type = spot::parsed_aut_type::HOA; }
| never { res.h->type = spot::parsed_aut_type::NeverClaim; }
| lbtt { res.h->type = spot::parsed_aut_type::LBTT; }
/**********************************************************************/
/* Rules for HOA */
......
......@@ -43,6 +43,8 @@ namespace spot
struct parse_aut_error_list {};
#endif
enum class parsed_aut_type { HOA, NeverClaim, LBTT, DRA, DSA, Unknown };
/// \brief Temporary encoding of an omega automaton produced by
/// the parser.
struct SPOT_API parsed_aut
......@@ -52,6 +54,7 @@ namespace spot
twa_graph_ptr aut;
bool aborted = false;
spot::location loc;
parsed_aut_type type = parsed_aut_type::Unknown;
};
typedef std::shared_ptr<parsed_aut> parsed_aut_ptr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment