Thorin 1.9.0
The Higher ORder INtermediate representation
Loading...
Searching...
No Matches
autogen.h
Go to the documentation of this file.
1#pragma once
2
3#include <thorin/axiom.h>
4#include <thorin/plugin.h>
5
6/// @namespace thorin::plug::regex @ref regex
7namespace thorin {
8namespace plug::regex {
9
10static constexpr plugin_t Plugin_Id = 0x4c62066400000000;
11
12/// @name %%regex.conj
13///@{
14#ifdef DOXYGEN // see https://github.com/doxygen/doxygen/issues/9668
15enum conj : flags_t {
16#else
17enum class conj : flags_t {
18#endif
19};
20
22///@}
23
24/// @name %%regex.disj
25///@{
26#ifdef DOXYGEN // see https://github.com/doxygen/doxygen/issues/9668
27enum disj : flags_t {
28#else
29enum class disj : flags_t {
30#endif
31};
32
34///@}
35
36/// @name %%regex.range
37///@{
38#ifdef DOXYGEN // see https://github.com/doxygen/doxygen/issues/9668
39enum range : flags_t {
40#else
41enum class range : flags_t {
42#endif
43};
44
46///@}
47
48/// @name %%regex.lit
49///@{
50#ifdef DOXYGEN // see https://github.com/doxygen/doxygen/issues/9668
51enum lit : flags_t {
52#else
53enum class lit : flags_t {
54#endif
55};
56
57///@}
58
59/// @name %%regex.not_
60///@{
61#ifdef DOXYGEN // see https://github.com/doxygen/doxygen/issues/9668
62enum not_ : flags_t {
63#else
64enum class not_ : flags_t {
65#endif
66};
67
69///@}
70
71/// @name %%regex.cls
72///@{
73#ifdef DOXYGEN // see https://github.com/doxygen/doxygen/issues/9668
74enum cls : flags_t {
75#else
76enum class cls : flags_t {
77#endif
78 d = 0x4c62066400000500,
79 D = 0x4c62066400000501,
80 w = 0x4c62066400000502,
81 W = 0x4c62066400000503,
82 s = 0x4c62066400000504,
83 S = 0x4c62066400000505,
84};
85
87///@}
88
89/// @name %%regex.any
90///@{
91#ifdef DOXYGEN // see https://github.com/doxygen/doxygen/issues/9668
92enum any : flags_t {
93#else
94enum class any : flags_t {
95#endif
96};
97
98///@}
99
100/// @name %%regex.quant
101///@{
102#ifdef DOXYGEN // see https://github.com/doxygen/doxygen/issues/9668
104#else
105enum class quant : flags_t {
106#endif
107 optional = 0x4c62066400000700,
108 star = 0x4c62066400000701,
109 plus = 0x4c62066400000702,
110};
111
113template<quant>
115
116///@}
117
118/// @name %%regex.lower_regex
119///@{
120#ifdef DOXYGEN // see https://github.com/doxygen/doxygen/issues/9668
122#else
123enum class lower_regex : flags_t {
124#endif
125};
126
127///@}
128
130
131#define THORIN_regex_NORMALIZER_IMPL \
132 void register_normalizers(Normalizers& normalizers) {\
133 normalizers[flags_t(Annex::Base<conj>)] = &normalize_conj; \
134 normalizers[flags_t(Annex::Base<disj>)] = &normalize_disj; \
135 normalizers[flags_t(Annex::Base<range>)] = &normalize_range; \
136 normalizers[flags_t(Annex::Base<not_>)] = &normalize_not; \
137 normalizers[flags_t(quant::optional)] = &normalize_quant<quant::optional>; \
138 normalizers[flags_t(quant::star)] = &normalize_quant<quant::star>; \
139 normalizers[flags_t(quant::plus)] = &normalize_quant<quant::plus>; \
140 }
141} // namespace plug::regex
142
143#ifndef DOXYGEN // don't include in Doxygen documentation
144template<> constexpr flags_t Annex::Base<plug::regex::conj> = 0x4c62066400000000;
145template<> constexpr size_t Annex::Num<plug::regex::conj> = 0;
146template<> constexpr flags_t Annex::Base<plug::regex::disj> = 0x4c62066400000100;
147template<> constexpr size_t Annex::Num<plug::regex::disj> = 0;
148template<> constexpr flags_t Annex::Base<plug::regex::range> = 0x4c62066400000200;
149template<> constexpr size_t Annex::Num<plug::regex::range> = 0;
150template<> constexpr flags_t Annex::Base<plug::regex::lit> = 0x4c62066400000300;
151template<> constexpr size_t Annex::Num<plug::regex::lit> = 0;
152template<> constexpr flags_t Annex::Base<plug::regex::not_> = 0x4c62066400000400;
153template<> constexpr size_t Annex::Num<plug::regex::not_> = 0;
154template<> constexpr flags_t Annex::Base<plug::regex::cls> = 0x4c62066400000500;
155template<> constexpr size_t Annex::Num<plug::regex::cls> = 6;
156template<> constexpr flags_t Annex::Base<plug::regex::any> = 0x4c62066400000600;
157template<> constexpr size_t Annex::Num<plug::regex::any> = 0;
158template<> constexpr flags_t Annex::Base<plug::regex::quant> = 0x4c62066400000700;
159template<> constexpr size_t Annex::Num<plug::regex::quant> = 3;
160template<> constexpr flags_t Annex::Base<plug::regex::lower_regex> = 0x4c62066400000800;
161template<> constexpr size_t Annex::Num<plug::regex::lower_regex> = 0;
162
163template<> struct Axiom::Match<plug::regex::lit> { using type = Axiom; };
164template<> struct Axiom::Match<plug::regex::cls> { using type = Axiom; };
165template<> struct Axiom::Match<plug::regex::lower_regex> { using type = Axiom; };
166#endif
167} // namespace thorin
Helper class to retrieve Infer::arg if present.
Definition def.h:85
@ Axiom
Definition def.h:39
static constexpr plugin_t Plugin_Id
Definition autogen.h:10
void register_normalizers(Normalizers &normalizers)
Ref normalize_not(Ref type, Ref callee, Ref arg)
Ref normalize_disj(Ref type, Ref, Ref arg)
Ref normalize_quant(Ref type, Ref callee, Ref arg)
Ref normalize_conj(Ref type, Ref callee, Ref arg)
Ref normalize_range(Ref type, Ref callee, Ref arg)
Definition cfg.h:11
absl::flat_hash_map< flags_t, NormalizeFn > Normalizers
Definition plugin.h:19
u64 plugin_t
Definition types.h:47
u64 flags_t
Definition types.h:46
static constexpr flags_t Base
Definition plugin.h:121
#define THORIN_ENUM_OPERATORS(E)
Use this to declare all kind of bit and comparison operators for an enum E.
Definition util.h:189