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
4
5namespace mim::plug::regex::detail {
6template<class ConjOrDisj>
7void flatten_in_arg(const Def* arg, DefVec& new_args) {
8 for (const auto* proj : arg->projs()) {
9 // flatten conjs in conjs / disj in disjs
10 if (auto seq_app = Axm::isa<ConjOrDisj>(proj))
11 flatten_in_arg<ConjOrDisj>(seq_app->arg(), new_args);
12 else
13 new_args.push_back(proj);
14 }
15}
16
17template<class ConjOrDisj>
18DefVec flatten_in_arg(const Def* arg) {
19 DefVec new_args;
20 flatten_in_arg<ConjOrDisj>(arg, new_args);
21 return new_args;
22}
23} // namespace mim::plug::regex
static auto isa(const Def *def)
Definition axm.h:107
Vector< const Def * > DefVec
Definition def.h:77