MimIR 0.1
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/axiom.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.conj
13///@{
14enum class conj : flags_t {
15};
16
18///@}
19
20/// @name %%regex.disj
21///@{
22enum class disj : flags_t {
23};
24
26///@}
27
28/// @name %%regex.range
29///@{
30enum class range : flags_t {
31};
32
34///@}
35
36/// @name %%regex.lit
37///@{
38enum class lit : flags_t {
39};
40
41///@}
42
43/// @name %%regex.not_
44///@{
45enum class not_ : flags_t {
46};
47
49///@}
50
51/// @name %%regex.cls
52///@{
53enum class cls : flags_t {
54 d = 0x4c62066400000500,
55 D = 0x4c62066400000501,
56 w = 0x4c62066400000502,
57 W = 0x4c62066400000503,
58 s = 0x4c62066400000504,
59 S = 0x4c62066400000505,
60};
61
62///@}
63
64/// @name %%regex.any
65///@{
66enum class any : flags_t {
67};
68
69///@}
70
71/// @name %%regex.quant
72///@{
73enum class quant : flags_t {
74 optional = 0x4c62066400000700,
75 star = 0x4c62066400000701,
76 plus = 0x4c62066400000702,
77};
78
79template<quant>
81
82///@}
83
84/// @name %%regex.lower_regex
85///@{
86enum class lower_regex : flags_t {
87};
88
89///@}
90
92
93#define MIM_regex_NORMALIZER_IMPL \
94 void register_normalizers(Normalizers& normalizers) {\
95 normalizers[flags_t(Annex::Base<conj>)] = &normalize_conj; \
96 normalizers[flags_t(Annex::Base<disj>)] = &normalize_disj; \
97 normalizers[flags_t(Annex::Base<range>)] = &normalize_range; \
98 normalizers[flags_t(Annex::Base<not_>)] = &normalize_not; \
99 normalizers[flags_t(quant::optional)] = &normalize_quant<quant::optional>; \
100 normalizers[flags_t(quant::star)] = &normalize_quant<quant::star>; \
101 normalizers[flags_t(quant::plus)] = &normalize_quant<quant::plus>; \
102 }
103} // namespace plug::regex
104
105#ifndef DOXYGEN // don't include in Doxygen documentation
106
107template<> constexpr flags_t Annex::Base<plug::regex::conj> = 0x4c62066400000000;
108template<> constexpr size_t Annex::Num<plug::regex::conj> = 0;
109template<> constexpr flags_t Annex::Base<plug::regex::disj> = 0x4c62066400000100;
110template<> constexpr size_t Annex::Num<plug::regex::disj> = 0;
111template<> constexpr flags_t Annex::Base<plug::regex::range> = 0x4c62066400000200;
112template<> constexpr size_t Annex::Num<plug::regex::range> = 0;
113template<> constexpr flags_t Annex::Base<plug::regex::lit> = 0x4c62066400000300;
114template<> constexpr size_t Annex::Num<plug::regex::lit> = 0;
115template<> constexpr flags_t Annex::Base<plug::regex::not_> = 0x4c62066400000400;
116template<> constexpr size_t Annex::Num<plug::regex::not_> = 0;
117template<> constexpr flags_t Annex::Base<plug::regex::cls> = 0x4c62066400000500;
118template<> constexpr size_t Annex::Num<plug::regex::cls> = 6;
119template<> constexpr flags_t Annex::Base<plug::regex::any> = 0x4c62066400000600;
120template<> constexpr size_t Annex::Num<plug::regex::any> = 0;
121template<> constexpr flags_t Annex::Base<plug::regex::quant> = 0x4c62066400000700;
122template<> constexpr size_t Annex::Num<plug::regex::quant> = 3;
123template<> constexpr flags_t Annex::Base<plug::regex::lower_regex> = 0x4c62066400000800;
124template<> constexpr size_t Annex::Num<plug::regex::lower_regex> = 0;
125
126template<> struct Axiom::Match<plug::regex::lit> { using type = Axiom; };
127template<> struct Axiom::Match<plug::regex::cls> { using type = Axiom; };
128template<> struct Axiom::Match<plug::regex::lower_regex> { using type = Axiom; };
129
130#endif
131} // namespace mim
132
133#ifndef DOXYGEN // don't include in Doxygen documentation
134
135template<> struct fe::is_bit_enum<mim::plug::regex::cls> : std::true_type {};
136template<> struct fe::is_bit_enum<mim::plug::regex::quant> : std::true_type {};
137
138#endif
Helper class to retrieve Infer::arg if present.
Definition def.h:86
Ref normalize_range(Ref type, Ref callee, Ref arg)
Ref normalize_not(Ref type, Ref callee, Ref arg)
Ref normalize_quant(Ref type, Ref callee, Ref arg)
static constexpr plugin_t Plugin_Id
Definition autogen.h:10
void register_normalizers(Normalizers &normalizers)
Ref normalize_disj(Ref type, Ref, Ref arg)
Ref normalize_conj(Ref type, Ref callee, Ref arg)
Definition cfg.h:11
u64 flags_t
Definition types.h:45
absl::flat_hash_map< flags_t, NormalizeFn > Normalizers
Definition plugin.h:19
u64 plugin_t
Definition types.h:46
static constexpr size_t Num
Definition plugin.h:115
static constexpr flags_t Base
Definition plugin.h:118