MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
autogen.h
Go to the documentation of this file.
1#pragma once
2
3#include <mim/axm.h>
4#include <mim/plugin.h>
5
6/// @namespace mim::plug::regex @ref regex
7namespace mim {
8namespace plug::regex {
9
10static constexpr plugin_t Plugin_Id = 0x4c62066400000000;
11
12/// @name `regex.Pos`
13///@{
14enum class Pos : flags_t {
15};
16
17///@}
18
19/// @name `regex.pos`
20///@{
21enum class pos : flags_t {
22};
23
24///@}
25
26/// @name `regex.Res`
27///@{
28enum class Res : flags_t {
29};
30
31///@}
32
33/// @name `regex.RE`
34///@{
35enum class RE : flags_t {
36};
37
38///@}
39
40/// @name `regex.conj`
41///@{
42enum class conj : flags_t {
43};
44
45const Def* normalize_conj(const Def*, const Def*, const Def*);
46///@}
47
48/// @name `regex.disj`
49///@{
50enum class disj : flags_t {
51};
52
53const Def* normalize_disj(const Def*, const Def*, const Def*);
54///@}
55
56/// @name `regex.range`
57///@{
58enum class range : flags_t {
59};
60
61const Def* normalize_range(const Def*, const Def*, const Def*);
62///@}
63
64/// @name `regex.lit`
65///@{
66enum class lit : flags_t {
67};
68
69///@}
70
71/// @name `regex.not`
72///@{
73enum class not_ : flags_t {
74};
75
76const Def* normalize_not(const Def*, const Def*, const Def*);
77///@}
78
79/// @name `regex.neg_lookahead`
80///@{
81enum class neg_lookahead : flags_t {
82};
83
84///@}
85
86/// @name `regex.cls`
87///@{
88enum class cls : flags_t {
89 d = 0x4c62066400000a00,
90 D = 0x4c62066400000a01,
91 w = 0x4c62066400000a02,
92 W = 0x4c62066400000a03,
93 s = 0x4c62066400000a04,
94 S = 0x4c62066400000a05,
95};
96
97///@}
98
99/// @name `regex.any`
100///@{
101enum class any : flags_t {
102};
103
104///@}
105
106/// @name `regex.empty`
107///@{
108enum class empty : flags_t {
109};
110
111///@}
112
113/// @name `regex.quant`
114///@{
115enum class quant : flags_t {
116 optional = 0x4c62066400000d00,
117 star = 0x4c62066400000d01,
118 plus = 0x4c62066400000d02,
119};
120
121template<quant>
122const Def* normalize_quant(const Def*, const Def*, const Def*);
123
124///@}
125
126/// @name `regex.lower_regex`
127///@{
128enum class lower_regex : flags_t {
129};
130
131///@}
132
134
135#define MIM_regex_NORMALIZER_IMPL \
136 void register_normalizers(Normalizers& normalizers) {\
137 normalizers[flags_t(Annex::Base<conj>)] = &normalize_conj; \
138 normalizers[flags_t(Annex::Base<disj>)] = &normalize_disj; \
139 normalizers[flags_t(Annex::Base<range>)] = &normalize_range; \
140 normalizers[flags_t(Annex::Base<not_>)] = &normalize_not; \
141 normalizers[flags_t(quant::optional)] = &normalize_quant<quant::optional>; \
142 normalizers[flags_t(quant::star)] = &normalize_quant<quant::star>; \
143 normalizers[flags_t(quant::plus)] = &normalize_quant<quant::plus>; \
144 }
145} // namespace plug::regex
146
147#ifndef DOXYGEN // don't include in Doxygen documentation
148
149template<> constexpr flags_t Annex::Base<plug::regex::Pos> = 0x4c62066400000000;
150template<> constexpr size_t Annex::Num<plug::regex::Pos> = 0;
151template<> constexpr flags_t Annex::Base<plug::regex::pos> = 0x4c62066400000100;
152template<> constexpr size_t Annex::Num<plug::regex::pos> = 0;
153template<> constexpr flags_t Annex::Base<plug::regex::Res> = 0x4c62066400000200;
154template<> constexpr size_t Annex::Num<plug::regex::Res> = 0;
155template<> constexpr flags_t Annex::Base<plug::regex::RE> = 0x4c62066400000300;
156template<> constexpr size_t Annex::Num<plug::regex::RE> = 0;
157template<> constexpr flags_t Annex::Base<plug::regex::conj> = 0x4c62066400000400;
158template<> constexpr size_t Annex::Num<plug::regex::conj> = 0;
159template<> constexpr flags_t Annex::Base<plug::regex::disj> = 0x4c62066400000500;
160template<> constexpr size_t Annex::Num<plug::regex::disj> = 0;
161template<> constexpr flags_t Annex::Base<plug::regex::range> = 0x4c62066400000600;
162template<> constexpr size_t Annex::Num<plug::regex::range> = 0;
163template<> constexpr flags_t Annex::Base<plug::regex::lit> = 0x4c62066400000700;
164template<> constexpr size_t Annex::Num<plug::regex::lit> = 0;
165template<> constexpr flags_t Annex::Base<plug::regex::not_> = 0x4c62066400000800;
166template<> constexpr size_t Annex::Num<plug::regex::not_> = 0;
167template<> constexpr flags_t Annex::Base<plug::regex::neg_lookahead> = 0x4c62066400000900;
168template<> constexpr size_t Annex::Num<plug::regex::neg_lookahead> = 0;
169template<> constexpr flags_t Annex::Base<plug::regex::cls> = 0x4c62066400000a00;
170template<> constexpr size_t Annex::Num<plug::regex::cls> = 6;
171template<> constexpr flags_t Annex::Base<plug::regex::any> = 0x4c62066400000b00;
172template<> constexpr size_t Annex::Num<plug::regex::any> = 0;
173template<> constexpr flags_t Annex::Base<plug::regex::empty> = 0x4c62066400000c00;
174template<> constexpr size_t Annex::Num<plug::regex::empty> = 0;
175template<> constexpr flags_t Annex::Base<plug::regex::quant> = 0x4c62066400000d00;
176template<> constexpr size_t Annex::Num<plug::regex::quant> = 3;
177template<> constexpr flags_t Annex::Base<plug::regex::lower_regex> = 0x4c62066400000e00;
178template<> constexpr size_t Annex::Num<plug::regex::lower_regex> = 0;
179
180template<> struct Axm::IsANode<plug::regex::Pos> { using type = Axm; };
181template<> struct Axm::IsANode<plug::regex::pos> { using type = Axm; };
182template<> struct Axm::IsANode<plug::regex::Res> { using type = Axm; };
183template<> struct Axm::IsANode<plug::regex::RE> { using type = Axm; };
184template<> struct Axm::IsANode<plug::regex::lit> { using type = Axm; };
185template<> struct Axm::IsANode<plug::regex::cls> { using type = Axm; };
186template<> struct Axm::IsANode<plug::regex::any> { using type = Axm; };
187template<> struct Axm::IsANode<plug::regex::empty> { using type = Axm; };
188template<> struct Axm::IsANode<plug::regex::lower_regex> { using type = Axm; };
189
190#endif
191} // namespace mim
192
193#ifndef DOXYGEN // don't include in Doxygen documentation
194
195template<> struct fe::is_bit_enum<mim::plug::regex::cls> : std::true_type {};
196template<> struct fe::is_bit_enum<mim::plug::regex::quant> : std::true_type {};
197
198#endif
Base class for all Defs.
Definition def.h:289
The regex Plugin
Definition lower_regex.h:5
const Def * normalize_conj(const Def *type, const Def *callee, const Def *arg)
static constexpr plugin_t Plugin_Id
Definition autogen.h:10
const Def * normalize_range(const Def *type, const Def *callee, const Def *arg)
void register_normalizers(Normalizers &normalizers)
const Def * normalize_disj(const Def *type, const Def *, const Def *arg)
const Def * normalize_quant(const Def *type, const Def *callee, const Def *arg)
const Def * normalize_not(const Def *, const Def *callee, const Def *arg)
Definition ast.h:16
u64 flags_t
Definition types.h:39
ankerl::unordered_dense::map< flags_t, NormalizeFn > Normalizers
Definition plugin.h:27
u64 plugin_t
Definition types.h:40
@ Axm
Definition def.h:125
static constexpr size_t Num
Number of Axm::subtags.
Definition plugin.h:273
static constexpr flags_t Base
Definition plugin.h:274