23 :
public ExpSet::const_visitor
34 using super_t =
typename expressionset_t::const_visitor;
37 "thompson: requires nullable labels");
40 constexpr
static const char*
me() {
return "thompson"; }
60 return std::move(
res_);
62 catch (
const std::runtime_error& e)
65 " while computing thompson automaton of: ",
79 void visit(const tuple_t&,
std::true_type)
override 81 raise(
me(),
": tuple is not supported");
109 res_->labelset()->conv(*
rs_.labelset(),
117 for (
const auto& c: e)
129 e.head()->accept(*
this);
133 for (
const auto& c: e.tail())
144 e.sub()->accept(*
this);
157 e.sub()->accept(*
this);
161 res_->set_weight(t,
ws_.mul(w,
res_->weight_of(t)));
166 e.sub()->accept(*
this);
170 res_->set_weight(t,
ws_.mul(
res_->weight_of(t), w));
188 template <Automaton Aut,
typename ExpSet>
191 const ExpSet& rs,
const typename ExpSet::value_t&
r)
201 template <Automaton Aut,
typename ExpSet>
203 thompson(
const ExpSet& rs,
const typename ExpSet::value_t&
r)
218 template <
typename ExpSet>
228 using ctx_t = decltype(ctx);
230 return ::vcsn::thompson<automaton_t>(
ctx, e.valueset(), e.value());
std::shared_ptr< detail::mutable_automaton_impl< Context > > mutable_automaton
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::weightset_t_of_impl< base_t< ValueSet > >::type weightset_t_of
static constexpr const char * me()
Name of this algorithm, for error messages.
typename expressionset_t::const_visitor super_t
typename detail::state_t_of_impl< base_t< ValueSet > >::type state_t_of
nullableset_context_t< context< LabelSet, WeightSet > > make_nullableset_context(const context< LabelSet, WeightSet > &ctx)
The nullableset context of a context.
SharedPtr make_shared_ptr(Args &&... args)
Same as std::make_shared, but parameterized by the shared_ptr type, not the (pointed to) element_type...
An inner node with multiple children.
weightset_t_of< expressionset_t > weightset_t
context_t_of< automaton_t > context_t
VCSN_RAT_VISIT(lweight, e)
VCSN_RAT_VISIT(rweight, e)
label_t_of< automaton_t > label_t
An inner node to name the subexpression.
weight_t_of< expressionset_t > weight_t
typename detail::context_t_of_impl< base_t< ValueSet > >::type context_t_of
typename expressionset_t::value_t expression_t
Provide a variadic mul on top of a binary mul(), and one().
typename super_t::tuple_t tuple_t
void visit(const tuple_t &, std::true_type) override
typename detail::labelset_t_of_impl< base_t< ValueSet > >::type labelset_t_of
auto in(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions arriving to state s.
typename detail::label_t_of_impl< base_t< ValueSet > >::type label_t_of
state_t_of< automaton_t > state_t
std::string to_string(identities i)
Wrapper around operator<<.
An inner node implementing a weight.
Build a Thompson automaton from an expression.
automaton_t operator()(const expression_t &v)
The Thompson automaton of v.
static dyn::context ctx(const driver &d)
Get the context of the driver.
thompson_visitor(const expressionset_t &rs)
value_impl< detail::expression_tag > expression
#define VCSN_RAT_UNSUPPORTED(Type)
typename detail::weight_t_of_impl< base_t< ValueSet > >::type weight_t_of
thompson_visitor(const context_t &ctx, const expressionset_t &rs)
Build an automaton of context ctx.
const expressionset_t & rs_
auto out(const Aut &aut, state_t_of< Aut > s)
Indexes of visible transitions leaving state s.