23 :
public ExpSet::const_visitor
33 using super_t =
typename expressionset_t::const_visitor;
36 "thompson: requires nullable labels");
39 constexpr
static const char*
me() {
return "thompson"; }
57 return std::move(
res_);
68 virtual
void visit(const tuple_t&,
std::true_type)
override
70 raise(
me(),
": tuple is not supported");
93 res_->labelset()->conv(*
rs_.labelset(),
113 e.head()->accept(*
this);
117 for (
auto c: e.tail())
128 e.sub()->accept(*
this);
141 e.sub()->accept(*
this);
145 res_->set_weight(t,
ws_.mul(w,
res_->weight_of(t)));
150 e.sub()->accept(*
this);
154 res_->set_weight(t,
ws_.mul(
res_->weight_of(t), w));
173 template <Automaton Aut,
typename ExpSet>
177 const ExpSet&
rs,
const typename ExpSet::value_t&
r)
187 template <Automaton Aut,
typename ExpSet>
205 template <
typename ExpSet>
212 using expressionset_t = ExpSet;
213 const auto& e = exp->as<expressionset_t>();
216 using ctx_t = decltype(ctx);
#define VCSN_RAT_UNSUPPORTED(Type)
automaton make_automaton(const Aut &aut)
Build a dyn::automaton.
typename detail::weightset_t_of_impl< base_t< ValueSet >>::type weightset_t_of
std::shared_ptr< detail::mutable_automaton_impl< Context >> mutable_automaton
weightset_t_of< expressionset_t > weightset_t
thompson_visitor(const context_t &ctx, const expressionset_t &rs)
Build an automaton of context ctx.
typename detail::labelset_t_of_impl< base_t< ValueSet >>::type labelset_t_of
SharedPtr make_shared_ptr(Args &&...args)
Same as std::make_shared, but parameterized by the shared_ptr type, not the (pointed to) element_type...
weight_t_of< expressionset_t > weight_t
Provide a variadic mul on top of a binary mul(), and one().
An inner node with multiple children.
state_t_of< automaton_t > state_t
Aut thompson(const context_t_of< Aut > &ctx, const ExpSet &rs, const typename ExpSet::value_t &r)
Build a Thompson automaton from an expression.
typename detail::weight_t_of_impl< base_t< ValueSet >>::type weight_t_of
VCSN_RAT_VISIT(lweight, e)
typename detail::state_t_of_impl< base_t< ValueSet >>::type state_t_of
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.
nullableset_context_t< context< LabelSet, WeightSet > > make_nullableset_context(const context< LabelSet, WeightSet > &ctx)
The nullableset context of a context.
std::shared_ptr< detail::automaton_base > automaton
static constexpr const char * me()
Name of this algorithm, for error messages.
context_t_of< automaton_t > context_t
typename detail::context_t_of_impl< base_t< ValueSet >>::type context_t_of
VCSN_RAT_VISIT(rweight, e)
typename detail::label_t_of_impl< base_t< ValueSet >>::type label_t_of
typename super_t::tuple_t tuple_t
static dyn::context ctx(const driver &d)
Get the context of the driver.
An inner node implementing a weight.
Build a Thompson automaton from an expression.
std::shared_ptr< detail::expression_base > expression
virtual void visit(const tuple_t &, std::true_type) override
const expressionset_t & rs_
typename expressionset_t::const_visitor super_t
label_t_of< automaton_t > label_t
thompson_visitor(const expressionset_t &rs)
auto in(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions arriving to state s.
automaton_t operator()(const typename expressionset_t::value_t &v)
automaton thompson(const expression &exp)
Bridge.