Skip to content

Commit 8b90f28

Browse files
committed
edit-automaton: don't accept \e on pre-/post-transitions
* vcsn/algos/edit-automaton.hh: there is not reason to accept `$ 0 <1/2>\e`, spell it `$ 0 <1/2>`.
1 parent ec15abb commit 8b90f28

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

vcsn/algos/edit-automaton.hh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ namespace vcsn
167167
require(s != res_->pre() || d != res_->post(),
168168
"edit_automaton: invalid transition from pre to post: ",
169169
src, " -> ", dst, " (", entry, ")");
170+
const auto& ls = *res_->labelset();
170171
if (s == res_->pre() || d == res_->post())
171172
{
172173
if (entry.get().empty())
@@ -175,18 +176,16 @@ namespace vcsn
175176
{
176177
using std::begin;
177178
// Adding a pre/post transition: be sure that it's only
178-
// a weight. Entries see the special label as an empty
179-
// one.
180-
auto e = conv(ps_, entry, sep_);
181-
auto i = begin(e);
182-
VCSN_REQUIRE(e.size() == 1
183-
&& (res_->labelset()->is_special(label_of(*i))
184-
|| res_->labelset()->is_one(label_of(*i))),
179+
// a weight.
180+
const auto p = conv(ps_, entry, sep_);
181+
const auto m = *begin(p);
182+
VCSN_REQUIRE(p.size() == 1
183+
&& ls.is_special(label_of(m)),
185184
"edit_automaton: invalid ",
186185
s == res_->pre() ? "initial" : "final",
187186
" entry: ", entry.get());
188187
res_->add_transition(s, d,
189-
res_->prepost_label(), weight_of(*i));
188+
res_->prepost_label(), weight_of(m));
190189
}
191190
}
192191
else

0 commit comments

Comments
 (0)