Regex: Assert that the regex direction matches the vm direction

This commit is contained in:
Maxime Coste 2017-10-09 18:43:11 +08:00
parent 74ed102cab
commit c8966ca701

View File

@ -109,9 +109,7 @@ public:
ThreadedRegexVM(const CompiledRegex& program) ThreadedRegexVM(const CompiledRegex& program)
: m_program{program} : m_program{program}
{ {
kak_assert(m_program); kak_assert(m_program and direction == m_program.direction);
if (direction != program.direction)
throw runtime_error{"Regex and VM direction mismatch"};
} }
ThreadedRegexVM(const ThreadedRegexVM&) = delete; ThreadedRegexVM(const ThreadedRegexVM&) = delete;