MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
regex.h
Go to the documentation of this file.
1#pragma once
2
3#include <type_traits>
4
6
7namespace mim::plug::regex::detail {
8template<class ConjOrDisj>
9void flatten_in_arg(const Def* arg, DefVec& new_args) {
10 for (const auto* proj : arg->projs()) {
11 // flatten conjs in conjs / disj in disjs
12 if (auto seq_app = Axm::isa<ConjOrDisj>(proj))
13 flatten_in_arg<ConjOrDisj>(seq_app->arg(), new_args);
14 else {
15 if constexpr (std::is_same_v<ConjOrDisj, conj>)
16 if (Axm::isa<regex::empty>(proj)) continue;
17 new_args.push_back(proj);
18 }
19 }
20}
21
22template<class ConjOrDisj>
23DefVec flatten_in_arg(const Def* arg) {
24 DefVec new_args;
25 flatten_in_arg<ConjOrDisj>(arg, new_args);
26 return new_args;
27}
28} // namespace mim::plug::regex::detail
static auto isa(const Def *def)
Definition axm.h:107
Vector< const Def * > DefVec
Definition def.h:77