8 #include <vcsn/dyn/registries.hh>
25 && w.get().find(
'.') != std::string::npos)
50 if (lbl.get().empty())
51 return labelset_type::empty;
52 else if (lbl ==
"\\e")
53 return labelset_type::lan;
54 else if (1 < lbl.get().size())
55 return labelset_type::law;
57 return labelset_type::lal;
64 case labelset_type::empty:
return {};
65 case labelset_type::lal:
return "lal<char>";
66 case labelset_type::lan:
return "lan<char>";
67 case labelset_type::law:
return "law<char>";
76 || s.get().size() == 1 && std::isalnum(s.get()[0]))
81 static auto re = std::regex{
"['\\\\]"};
83 + std::regex_replace(s.get(), re,
"\\$&")
99 if (lbl2.get().empty())
105 lbl1 = quote(lbl1) +
"|" + quote(lbl2);
159 res += (
real_ ?
"rmin"
174 edit->add_transition(std::get<0>(t), std::get<1>(t),
175 std::get<2>(t), std::get<3>(t));
178 edit->add_initial(p.first, p.second);
181 edit->add_final(p.first, p.second);
182 return edit->result();
bool open_
Whether the labelset is open.
weightset_type weightset_type_
The weightset scale.
dyn::automaton result(const std::string &ctx={})
Return the built automaton.
labelset_type
Labelset types, increasing generality.
void register_weight_(string_t w)
Record that this weight was seen.
bool weighted_
Whether we saw a non-empty weight.
std::string type(const automaton &a)
The implementation type of a.
labelset_type output_type_
Labelset type for output tape.
void add_initial(string_t s, string_t w=string_t{})
Add s as an initial state.
void add_final(string_t s, string_t w=string_t{})
Add s as a final state.
automaton_editor * make_automaton_editor(const context &ctx)
Build an automatonset from its context.
labelset_type input_type_
Labelset type for input tape.
static dyn::context ctx(const driver &d)
Get the context of the driver.
std::shared_ptr< const detail::weight_base > weight
void reset()
Get ready to build another automaton.
std::string result_context() const
Return the context that was inferred.
std::shared_ptr< detail::automaton_base > automaton
std::vector< transition_t > transitions_
void add_transition(string_t src, string_t dst, string_t lbl, string_t w=string_t{})
Add an acceptor transition from src to dst, labeled by lbl.
std::vector< std::pair< string_t, string_t > > final_states_
The collected final states: (State, Weight).
bool open(bool o)
Whether unknown letters should be added, or rejected.
std::string to_string(direction d)
Conversion to string.
context make_context(const std::string &name)
Build a context from its name.
automaton_editor::string_t string_t
A hash-cons'ed string type.
std::vector< std::pair< string_t, string_t > > initial_states_
The collected initial states: (State, Weight).
#define BUILTIN_UNREACHABLE()
bool real_
Whether we saw a period in a the weight.