diff --git a/.clang-format b/.clang-format index a77eca4..d722c5c 100644 --- a/.clang-format +++ b/.clang-format @@ -2,6 +2,8 @@ AlignConsecutiveAssignments: true AllowShortBlocksOnASingleLine: Always AllowShortCompoundRequirementOnASingleLine: true +AllowShortEnumsOnASingleLine: true +AllowShortFunctionsOnASingleLine: true AllowShortIfStatementsOnASingleLine: WithoutElse AllowShortLoopsOnASingleLine: true BasedOnStyle: Chromium diff --git a/flake.lock b/flake.lock index 9985190..4d4c120 100644 --- a/flake.lock +++ b/flake.lock @@ -16,9 +16,26 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1708475490, + "narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "0e74ca98a74bc7270d28838369593635a5db3260", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "nixpkgs": "nixpkgs", + "treefmt-nix": "treefmt-nix", "utils": "utils" } }, @@ -37,6 +54,24 @@ "type": "github" } }, + "treefmt-nix": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1717850719, + "narHash": "sha256-npYqVg+Wk4oxnWrnVG7416fpfrlRhp/lQ6wQ4DHI8YE=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "4fc1c45a5f50169f9f29f6a98a438fb910b834ed", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, "utils": { "inputs": { "systems": "systems" diff --git a/flake.nix b/flake.nix index 7140bd4..45c8d9f 100644 --- a/flake.nix +++ b/flake.nix @@ -3,12 +3,14 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + treefmt-nix.url = "github:numtide/treefmt-nix"; utils.url = "github:numtide/flake-utils"; }; outputs = { self, nixpkgs, + treefmt-nix, utils, ... }: @@ -18,7 +20,7 @@ inherit system; overlays = [ - (self: super: { + (_self: super: { ccacheWrapper = super.ccacheWrapper.override { extraConfig = '' export CCACHE_COMPRESS=1 @@ -54,9 +56,8 @@ deps = with ( if !stdenv.isDarwin then pkgs.pkgsStatic - else pkgs - ); # TODO: Remove when fixed on darwin - + else pkgs # TODO: Remove when fixed on darwin + ); [ curl fmt @@ -110,7 +111,18 @@ default = draconisplusplus; }; - formatter = alejandra; + formatter = treefmt-nix.lib.mkWrapper pkgs { + projectRootFile = "flake.nix"; + programs = { + alejandra.enable = true; + deadnix.enable = true; + + clang-format = { + enable = true; + package = pkgs.clang-tools_18; + }; + }; + }; devShell = mkShell.override {inherit stdenv;} { packages = diff --git a/include/ctre.hpp b/include/ctre.hpp index 95ab981..b771bd4 100644 --- a/include/ctre.hpp +++ b/include/ctre.hpp @@ -233,225 +233,258 @@ Software. #ifndef CTLL__FIXED_STRING__GPP #define CTLL__FIXED_STRING__GPP -#include -#include -#include #include +#include #include +#include +#include namespace ctll { -struct length_value_t { - uint32_t value; - uint8_t length; -}; + struct length_value_t { + uint32_t value; + uint8_t length; + }; -constexpr length_value_t length_and_value_of_utf8_code_point(uint8_t first_unit) noexcept { - if ((first_unit & 0b1000'0000) == 0b0000'0000) return {static_cast(first_unit), 1}; - else if ((first_unit & 0b1110'0000) == 0b1100'0000) return {static_cast(first_unit & 0b0001'1111), 2}; - else if ((first_unit & 0b1111'0000) == 0b1110'0000) return {static_cast(first_unit & 0b0000'1111), 3}; - else if ((first_unit & 0b1111'1000) == 0b1111'0000) return {static_cast(first_unit & 0b0000'0111), 4}; - else if ((first_unit & 0b1111'1100) == 0b1111'1000) return {static_cast(first_unit & 0b0000'0011), 5}; - else if ((first_unit & 0b1111'1100) == 0b1111'1100) return {static_cast(first_unit & 0b0000'0001), 6}; - else return {0, 0}; -} + constexpr length_value_t length_and_value_of_utf8_code_point( + uint8_t first_unit) noexcept { + if ((first_unit & 0b1000'0000) == 0b0000'0000) + return {static_cast(first_unit), 1}; + else if ((first_unit & 0b1110'0000) == 0b1100'0000) + return {static_cast(first_unit & 0b0001'1111), 2}; + else if ((first_unit & 0b1111'0000) == 0b1110'0000) + return {static_cast(first_unit & 0b0000'1111), 3}; + else if ((first_unit & 0b1111'1000) == 0b1111'0000) + return {static_cast(first_unit & 0b0000'0111), 4}; + else if ((first_unit & 0b1111'1100) == 0b1111'1000) + return {static_cast(first_unit & 0b0000'0011), 5}; + else if ((first_unit & 0b1111'1100) == 0b1111'1100) + return {static_cast(first_unit & 0b0000'0001), 6}; + else + return {0, 0}; + } -constexpr char32_t value_of_trailing_utf8_code_point(uint8_t unit, bool & correct) noexcept { - if ((unit & 0b1100'0000) == 0b1000'0000) return unit & 0b0011'1111; - else { - correct = false; - return 0; - } -} + constexpr char32_t value_of_trailing_utf8_code_point(uint8_t unit, + bool& correct) noexcept { + if ((unit & 0b1100'0000) == 0b1000'0000) + return unit & 0b0011'1111; + else { + correct = false; + return 0; + } + } -constexpr length_value_t length_and_value_of_utf16_code_point(uint16_t first_unit) noexcept { - if ((first_unit & 0b1111110000000000) == 0b1101'1000'0000'0000) return {static_cast(first_unit & 0b0000001111111111), 2}; - else return {first_unit, 1}; -} + constexpr length_value_t length_and_value_of_utf16_code_point( + uint16_t first_unit) noexcept { + if ((first_unit & 0b1111110000000000) == 0b1101'1000'0000'0000) + return {static_cast(first_unit & 0b0000001111111111), 2}; + else + return {first_unit, 1}; + } -struct construct_from_pointer_t { }; + struct construct_from_pointer_t {}; -constexpr auto construct_from_pointer = construct_from_pointer_t{}; + constexpr auto construct_from_pointer = construct_from_pointer_t {}; -template struct fixed_string { - char32_t content[N] = {}; - size_t real_size{0}; - bool correct_flag{true}; - - template constexpr fixed_string(construct_from_pointer_t, const T * input) noexcept { - if constexpr (std::is_same_v) { - #ifdef CTRE_STRING_IS_UTF8 - size_t out{0}; - for (size_t i{0}; i < N; ++i) { - if ((i == (N-1)) && (input[i] == 0)) break; - length_value_t info = length_and_value_of_utf8_code_point(input[i]); - switch (info.length) { - case 6: - if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag); - [[fallthrough]]; - case 5: - if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag); - [[fallthrough]]; - case 4: - if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag); - [[fallthrough]]; - case 3: - if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag); - [[fallthrough]]; - case 2: - if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag); - [[fallthrough]]; - case 1: - content[out++] = static_cast(info.value); - real_size++; - break; - default: - correct_flag = false; - return; - } - } - #else - for (size_t i{0}; i < N; ++i) { - content[i] = static_cast(input[i]); - if ((i == (N-1)) && (input[i] == 0)) break; - real_size++; - } - #endif - #if __cpp_char8_t - } else if constexpr (std::is_same_v) { - size_t out{0}; - for (size_t i{0}; i < N; ++i) { - if ((i == (N-1)) && (input[i] == 0)) break; - length_value_t info = length_and_value_of_utf8_code_point(input[i]); - switch (info.length) { - case 6: - if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag); - [[fallthrough]]; - case 5: - if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag); - [[fallthrough]]; - case 4: - if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag); - [[fallthrough]]; - case 3: - if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag); - [[fallthrough]]; - case 2: - if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag); - [[fallthrough]]; - case 1: - content[out++] = static_cast(info.value); - real_size++; - break; - default: - correct_flag = false; - return; - } - } - #endif - } else if constexpr (std::is_same_v) { - size_t out{0}; - for (size_t i{0}; i < N; ++i) { - length_value_t info = length_and_value_of_utf16_code_point(input[i]); - if (info.length == 2) { - if (++i < N) { - if ((input[i] & 0b1111'1100'0000'0000) == 0b1101'1100'0000'0000) { - content[out++] = ((info.value << 10) | (input[i] & 0b0000'0011'1111'1111)) + 0x10000; - } else { - correct_flag = false; - break; - } - } - } else { - if ((i == (N-1)) && (input[i] == 0)) break; - content[out++] = info.value; - } - } - real_size = out; - } else if constexpr (std::is_same_v || std::is_same_v) { - for (size_t i{0}; i < N; ++i) { - content[i] = static_cast(input[i]); - if ((i == (N-1)) && (input[i] == 0)) break; - real_size++; - } - } - } - - template constexpr fixed_string(const std::array & in) noexcept: fixed_string{construct_from_pointer, in.data()} { } - template constexpr fixed_string(const T (&input)[N+1]) noexcept: fixed_string{construct_from_pointer, input} { } - - constexpr fixed_string(const fixed_string & other) noexcept { - for (size_t i{0}; i < N; ++i) { - content[i] = other.content[i]; - } - real_size = other.real_size; - correct_flag = other.correct_flag; - } - constexpr bool correct() const noexcept { - return correct_flag; - } - constexpr size_t size() const noexcept { - return real_size; - } - constexpr const char32_t * begin() const noexcept { - return content; - } - constexpr const char32_t * end() const noexcept { - return content + size(); - } - constexpr char32_t operator[](size_t i) const noexcept { - return content[i]; - } - template constexpr bool is_same_as(const fixed_string & rhs) const noexcept { - if (real_size != rhs.size()) return false; - for (size_t i{0}; i != real_size; ++i) { - if (content[i] != rhs[i]) return false; - } - return true; - } - constexpr operator std::basic_string_view() const noexcept { - return std::basic_string_view{content, size()}; - } -}; + template + struct fixed_string { + char32_t content[N] = {}; + size_t real_size {0}; + bool correct_flag {true}; -template <> class fixed_string<0> { - static constexpr char32_t empty[1] = {0}; -public: - template constexpr fixed_string(const T *) noexcept { - - } - constexpr fixed_string(std::initializer_list) noexcept { - - } - constexpr fixed_string(const fixed_string &) noexcept { - - } - constexpr bool correct() const noexcept { - return true; - } - constexpr size_t size() const noexcept { - return 0; - } - constexpr const char32_t * begin() const noexcept { - return empty; - } - constexpr const char32_t * end() const noexcept { - return empty + size(); - } - constexpr char32_t operator[](size_t) const noexcept { - return 0; - } - constexpr operator std::basic_string_view() const noexcept { - return std::basic_string_view{empty, 0}; - } -}; + template + constexpr fixed_string(construct_from_pointer_t, const T* input) noexcept { + if constexpr (std::is_same_v) { +#ifdef CTRE_STRING_IS_UTF8 + size_t out {0}; + for (size_t i {0}; i < N; ++i) { + if ((i == (N - 1)) && (input[i] == 0)) break; + length_value_t info = length_and_value_of_utf8_code_point(input[i]); + switch (info.length) { + case 6: + if (++i < N) + info.value = + (info.value << 6) | + value_of_trailing_utf8_code_point(input[i], correct_flag); + [[fallthrough]]; + case 5: + if (++i < N) + info.value = + (info.value << 6) | + value_of_trailing_utf8_code_point(input[i], correct_flag); + [[fallthrough]]; + case 4: + if (++i < N) + info.value = + (info.value << 6) | + value_of_trailing_utf8_code_point(input[i], correct_flag); + [[fallthrough]]; + case 3: + if (++i < N) + info.value = + (info.value << 6) | + value_of_trailing_utf8_code_point(input[i], correct_flag); + [[fallthrough]]; + case 2: + if (++i < N) + info.value = + (info.value << 6) | + value_of_trailing_utf8_code_point(input[i], correct_flag); + [[fallthrough]]; + case 1: + content[out++] = static_cast(info.value); + real_size++; + break; + default: + correct_flag = false; + return; + } + } +#else + for (size_t i {0}; i < N; ++i) { + content[i] = static_cast(input[i]); + if ((i == (N - 1)) && (input[i] == 0)) break; + real_size++; + } +#endif +#if __cpp_char8_t + } else if constexpr (std::is_same_v) { + size_t out {0}; + for (size_t i {0}; i < N; ++i) { + if ((i == (N - 1)) && (input[i] == 0)) break; + length_value_t info = length_and_value_of_utf8_code_point(input[i]); + switch (info.length) { + case 6: + if (++i < N) + info.value = + (info.value << 6) | + value_of_trailing_utf8_code_point(input[i], correct_flag); + [[fallthrough]]; + case 5: + if (++i < N) + info.value = + (info.value << 6) | + value_of_trailing_utf8_code_point(input[i], correct_flag); + [[fallthrough]]; + case 4: + if (++i < N) + info.value = + (info.value << 6) | + value_of_trailing_utf8_code_point(input[i], correct_flag); + [[fallthrough]]; + case 3: + if (++i < N) + info.value = + (info.value << 6) | + value_of_trailing_utf8_code_point(input[i], correct_flag); + [[fallthrough]]; + case 2: + if (++i < N) + info.value = + (info.value << 6) | + value_of_trailing_utf8_code_point(input[i], correct_flag); + [[fallthrough]]; + case 1: + content[out++] = static_cast(info.value); + real_size++; + break; + default: + correct_flag = false; + return; + } + } +#endif + } else if constexpr (std::is_same_v) { + size_t out {0}; + for (size_t i {0}; i < N; ++i) { + length_value_t info = length_and_value_of_utf16_code_point(input[i]); + if (info.length == 2) { + if (++i < N) { + if ((input[i] & 0b1111'1100'0000'0000) == 0b1101'1100'0000'0000) { + content[out++] = + ((info.value << 10) | (input[i] & 0b0000'0011'1111'1111)) + + 0x10000; + } else { + correct_flag = false; + break; + } + } + } else { + if ((i == (N - 1)) && (input[i] == 0)) break; + content[out++] = info.value; + } + } + real_size = out; + } else if constexpr (std::is_same_v || + std::is_same_v) { + for (size_t i {0}; i < N; ++i) { + content[i] = static_cast(input[i]); + if ((i == (N - 1)) && (input[i] == 0)) break; + real_size++; + } + } + } -template fixed_string(const CharT (&)[N]) -> fixed_string; -template fixed_string(const std::array &) -> fixed_string; + template + constexpr fixed_string(const std::array& in) noexcept + : fixed_string {construct_from_pointer, in.data()} {} + template + constexpr fixed_string(const T (&input)[N + 1]) noexcept + : fixed_string {construct_from_pointer, input} {} -template fixed_string(fixed_string) -> fixed_string; + constexpr fixed_string(const fixed_string& other) noexcept { + for (size_t i {0}; i < N; ++i) { content[i] = other.content[i]; } + real_size = other.real_size; + correct_flag = other.correct_flag; + } + constexpr bool correct() const noexcept { return correct_flag; } + constexpr size_t size() const noexcept { return real_size; } + constexpr const char32_t* begin() const noexcept { return content; } + constexpr const char32_t* end() const noexcept { return content + size(); } + constexpr char32_t operator[](size_t i) const noexcept { + return content[i]; + } + template + constexpr bool is_same_as(const fixed_string& rhs) const noexcept { + if (real_size != rhs.size()) return false; + for (size_t i {0}; i != real_size; ++i) { + if (content[i] != rhs[i]) return false; + } + return true; + } + constexpr operator std::basic_string_view() const noexcept { + return std::basic_string_view {content, size()}; + } + }; -} + template <> + class fixed_string<0> { + static constexpr char32_t empty[1] = {0}; + + public: + template + constexpr fixed_string(const T*) noexcept {} + constexpr fixed_string(std::initializer_list) noexcept {} + constexpr fixed_string(const fixed_string&) noexcept {} + constexpr bool correct() const noexcept { return true; } + constexpr size_t size() const noexcept { return 0; } + constexpr const char32_t* begin() const noexcept { return empty; } + constexpr const char32_t* end() const noexcept { return empty + size(); } + constexpr char32_t operator[](size_t) const noexcept { return 0; } + constexpr operator std::basic_string_view() const noexcept { + return std::basic_string_view {empty, 0}; + } + }; + + template + fixed_string(const CharT (&)[N]) -> fixed_string; + template + fixed_string(const std::array&) -> fixed_string; + + template + fixed_string(fixed_string) -> fixed_string; + +} // namespace ctll #endif @@ -464,34 +497,34 @@ template fixed_string(fixed_string) -> fixed_string; #include #if defined __cpp_nontype_template_parameter_class - #define CTLL_CNTTP_COMPILER_CHECK 1 +#define CTLL_CNTTP_COMPILER_CHECK 1 #elif defined __cpp_nontype_template_args // compiler which defines correctly feature test macro (not you clang) - #if __cpp_nontype_template_args >= 201911L - #define CTLL_CNTTP_COMPILER_CHECK 1 - #elif __cpp_nontype_template_args >= 201411L +#if __cpp_nontype_template_args >= 201911L +#define CTLL_CNTTP_COMPILER_CHECK 1 +#elif __cpp_nontype_template_args >= 201411L // appleclang 13+ - #if defined __apple_build_version__ - #if defined __clang_major__ && __clang_major__ >= 13 +#if defined __apple_build_version__ +#if defined __clang_major__ && __clang_major__ >= 13 // but only in c++20 and more - #if __cplusplus > 201703L - #define CTLL_CNTTP_COMPILER_CHECK 1 - #endif - #endif - #else +#if __cplusplus > 201703L +#define CTLL_CNTTP_COMPILER_CHECK 1 +#endif +#endif +#else // clang 12+ - #if defined __clang_major__ && __clang_major__ >= 12 +#if defined __clang_major__ && __clang_major__ >= 12 // but only in c++20 and more - #if __cplusplus > 201703L - #define CTLL_CNTTP_COMPILER_CHECK 1 - #endif - #endif - #endif - #endif +#if __cplusplus > 201703L +#define CTLL_CNTTP_COMPILER_CHECK 1 +#endif +#endif +#endif +#endif #endif #ifndef CTLL_CNTTP_COMPILER_CHECK - #define CTLL_CNTTP_COMPILER_CHECK 0 +#define CTLL_CNTTP_COMPILER_CHECK 0 #endif #ifdef _MSC_VER @@ -501,105 +534,160 @@ template fixed_string(fixed_string) -> fixed_string; #endif namespace ctll { - -template struct conditional_helper; - -template <> struct conditional_helper { - template using type = A; -}; -template <> struct conditional_helper { - template using type = B; -}; + template + struct conditional_helper; -template using conditional = typename conditional_helper::template type; - -} + template <> + struct conditional_helper { + template + using type = A; + }; + + template <> + struct conditional_helper { + template + using type = B; + }; + + template + using conditional = typename conditional_helper::template type; + +} // namespace ctll #endif namespace ctll { -template struct list { }; - -struct _nothing { }; + template + struct list {}; -using empty_list = list<>; + struct _nothing {}; -// calculate size of list content -template constexpr auto size(list) noexcept { return sizeof...(Ts); } + using empty_list = list<>; - -// check if the list is empty -template constexpr bool empty(list) noexcept { return false; } -constexpr bool empty(empty_list) { return true; } + // calculate size of list content + template + constexpr auto size(list) noexcept { + return sizeof...(Ts); + } -// concat two lists together left to right -template constexpr auto concat(list, list) noexcept -> list { return {}; } + // check if the list is empty + template + constexpr bool empty(list) noexcept { + return false; + } + constexpr bool empty(empty_list) { return true; } -// push something to the front of a list -template constexpr auto push_front(T, list) noexcept -> list { return {}; } + // concat two lists together left to right + template + constexpr auto concat(list, + list) noexcept -> list { + return {}; + } -// pop element from the front of a list -template constexpr auto pop_front(list) noexcept -> list { return {}; } -constexpr auto pop_front(empty_list) -> empty_list; + // push something to the front of a list + template + constexpr auto push_front(T, list) noexcept -> list { + return {}; + } -// pop element from the front of a list and return new typelist too -template struct list_pop_pair { - Front front{}; - List list{}; - constexpr list_pop_pair() = default; -}; + // pop element from the front of a list + template + constexpr auto pop_front(list) noexcept -> list { + return {}; + } + constexpr auto pop_front(empty_list) -> empty_list; -template constexpr auto pop_and_get_front(list, T = T()) noexcept -> list_pop_pair> { return {}; } -template constexpr auto pop_and_get_front(empty_list, T = T()) noexcept -> list_pop_pair { return {}; } + // pop element from the front of a list and return new typelist too + template + struct list_pop_pair { + Front front {}; + List list {}; + constexpr list_pop_pair() = default; + }; -// return front of the list -template constexpr auto front(list, T = T()) noexcept -> Head { return {}; } -template constexpr auto front(empty_list, T = T()) noexcept -> T { return {}; } + template + constexpr auto pop_and_get_front(list, T = T()) noexcept + -> list_pop_pair> { + return {}; + } + template + constexpr auto pop_and_get_front(empty_list, T = T()) noexcept + -> list_pop_pair { + return {}; + } -// rotate list -template struct rotate_item { - template friend constexpr auto operator+(list, rotate_item) noexcept -> list { return {}; } -}; + // return front of the list + template + constexpr auto front(list, T = T()) noexcept -> Head { + return {}; + } + template + constexpr auto front(empty_list, T = T()) noexcept -> T { + return {}; + } -template constexpr auto rotate(list) -> decltype((list<>{} + ... + rotate_item{})) { - return {}; -} + // rotate list + template + struct rotate_item { + template + friend constexpr auto operator+(list, + rotate_item) noexcept -> list { + return {}; + } + }; -// set operations -template struct item_matcher { - struct not_selected { - template friend constexpr auto operator+(list, not_selected) -> list; - }; - template struct wrapper { - template friend constexpr auto operator+(list, wrapper) -> list; - }; + template + constexpr auto rotate(list) -> decltype((list<> {} + ... + + rotate_item {})) { + return {}; + } - static constexpr auto check(T) { return std::true_type{}; } - static constexpr auto check(...) { return std::false_type{}; } - static constexpr auto select(T) { return not_selected{}; } - template static constexpr auto select(Y) { return wrapper{}; } -}; + // set operations + template + struct item_matcher { + struct not_selected { + template + friend constexpr auto operator+(list, not_selected) -> list; + }; + template + struct wrapper { + template + friend constexpr auto operator+(list, + wrapper) -> list; + }; -template constexpr bool exists_in(T, list) noexcept { - return (item_matcher::check(Ts{}) || ... || false); -} + static constexpr auto check(T) { return std::true_type {}; } + static constexpr auto check(...) { return std::false_type {}; } + static constexpr auto select(T) { return not_selected {}; } + template + static constexpr auto select(Y) { + return wrapper {}; + } + }; -template constexpr auto add_item(T item, list l) noexcept { - if constexpr (exists_in(item, l)) { - return l; - } else { - return list{}; - } -} + template + constexpr bool exists_in(T, list) noexcept { + return (item_matcher::check(Ts {}) || ... || false); + } -template constexpr auto remove_item(T, list) noexcept { - item_matcher matcher; - return decltype((list<>{} + ... + matcher.select(Ts{}))){}; -} + template + constexpr auto add_item(T item, list l) noexcept { + if constexpr (exists_in(item, l)) { + return l; + } else { + return list {}; + } + } -} + template + constexpr auto remove_item(T, list) noexcept { + item_matcher matcher; + return decltype((list<> {} + ... + matcher.select(Ts {}))) {}; + } + +} // namespace ctll #endif @@ -608,115 +696,149 @@ template constexpr auto remove_item(T, list) namespace ctll { -// terminal type representing symbol / character of any type -template struct term { - static constexpr auto value = v; -}; + // terminal type representing symbol / character of any type + template + struct term { + static constexpr auto value = v; + }; -// epsilon = nothing on input tape -// also used as an command for parsing means "do nothing" -struct epsilon { - static constexpr auto value = '-'; -}; + // epsilon = nothing on input tape + // also used as an command for parsing means "do nothing" + struct epsilon { + static constexpr auto value = '-'; + }; -// empty_stack_symbol = nothing on stack -struct empty_stack_symbol {}; + // empty_stack_symbol = nothing on stack + struct empty_stack_symbol {}; -// push is alias to list -template using push = list; + // push is alias to list + template + using push = list; -// accept/reject type for controlling output of LL1 machine -struct accept { constexpr explicit operator bool() noexcept { return true; } }; -struct reject { constexpr explicit operator bool() noexcept { return false; } }; + // accept/reject type for controlling output of LL1 machine + struct accept { + constexpr explicit operator bool() noexcept { return true; } + }; + struct reject { + constexpr explicit operator bool() noexcept { return false; } + }; -// action type, every action item in grammar must inherit from -struct action { - struct action_tag { }; -}; + // action type, every action item in grammar must inherit from + struct action { + struct action_tag {}; + }; -// move one character forward and pop it from stack command -struct pop_input { - struct pop_input_tag { }; -}; + // move one character forward and pop it from stack command + struct pop_input { + struct pop_input_tag {}; + }; -// additional overloads for type list -template constexpr auto push_front(pop_input, list) -> list { return {}; } + // additional overloads for type list + template + constexpr auto push_front(pop_input, list) -> list { + return {}; + } -template constexpr auto push_front(epsilon, list) -> list { return {}; } + template + constexpr auto push_front(epsilon, list) -> list { + return {}; + } -template constexpr auto push_front(list, list) -> list { return {}; } + template + constexpr auto push_front(list, list) -> list { + return {}; + } -template constexpr auto pop_front_and_push_front(T item, list l) { - return push_front(item, pop_front(l)); -} + template + constexpr auto pop_front_and_push_front(T item, list l) { + return push_front(item, pop_front(l)); + } -// SPECIAL matching types for nicer grammars + // SPECIAL matching types for nicer grammars -// match any term -struct anything { - constexpr inline anything() noexcept { } - template constexpr anything(term) noexcept; -}; + // match any term + struct anything { + constexpr inline anything() noexcept {} + template + constexpr anything(term) noexcept; + }; -// match range of term A-B -template struct range { - constexpr inline range() noexcept { } - //template constexpr range(term) noexcept requires (A <= V) && (V <= B); - template > constexpr inline range(term) noexcept; -}; + // match range of term A-B + template + struct range { + constexpr inline range() noexcept {} + // template constexpr range(term) noexcept requires (A <= V) && + // (V <= B); + template > + constexpr inline range(term) noexcept; + }; #ifdef __EDG__ -template struct contains { - static constexpr bool value = ((Set == V) || ... || false); -}; + template + struct contains { + static constexpr bool value = ((Set == V) || ... || false); + }; #endif -// match terms defined in set -template struct set { - constexpr inline set() noexcept { } - #ifdef __EDG__ - template ::value>> constexpr inline set(term) noexcept; - #else - template > constexpr inline set(term) noexcept; - #endif -}; + // match terms defined in set + template + struct set { + constexpr inline set() noexcept {} +#ifdef __EDG__ + template ::value>> + constexpr inline set(term) noexcept; +#else + template > + constexpr inline set(term) noexcept; +#endif + }; -// match terms not defined in set -template struct neg_set { - constexpr inline neg_set() noexcept { } - - #ifdef __EDG__ - template ::value>> constexpr inline neg_set(term) noexcept; - #else - template > constexpr inline neg_set(term) noexcept; - #endif -}; + // match terms not defined in set + template + struct neg_set { + constexpr inline neg_set() noexcept {} -// AUGMENTED grammar which completes user-defined grammar for all other cases -template struct augment_grammar: public Grammar { - // start nonterminal is defined in parent type - using typename Grammar::_start; - - // grammar rules are inherited from Grammar parent type - using Grammar::rule; - - // term on stack and on input means pop_input; - template static constexpr auto rule(term, term) -> ctll::pop_input; - - // if the type on stack (range, set, neg_set, anything) is constructible from the terminal => pop_input - template static constexpr auto rule(Expected, term) -> std::enable_if_t>, ctll::pop_input>; - - // empty stack and empty input means we are accepting - static constexpr auto rule(empty_stack_symbol, epsilon) -> ctll::accept; - - // not matching anything else => reject - static constexpr auto rule(...) -> ctll::reject; - - // start stack is just a list; - using start_stack = list; -}; +#ifdef __EDG__ + template ::value>> + constexpr inline neg_set(term) noexcept; +#else + template > + constexpr inline neg_set(term) noexcept; +#endif + }; -} + // AUGMENTED grammar which completes user-defined grammar for all other cases + template + struct augment_grammar : public Grammar { + // start nonterminal is defined in parent type + using typename Grammar::_start; + + // grammar rules are inherited from Grammar parent type + using Grammar::rule; + + // term on stack and on input means pop_input; + template + static constexpr auto rule(term, term) -> ctll::pop_input; + + // if the type on stack (range, set, neg_set, anything) is constructible + // from the terminal => pop_input + template + static constexpr auto rule(Expected, term) + -> std::enable_if_t>, + ctll::pop_input>; + + // empty stack and empty input means we are accepting + static constexpr auto rule(empty_stack_symbol, epsilon) -> ctll::accept; + + // not matching anything else => reject + static constexpr auto rule(...) -> ctll::reject; + + // start stack is just a list; + using start_stack = list; + }; + +} // namespace ctll #endif @@ -724,29 +846,48 @@ template struct augment_grammar: public Grammar { #define CTLL__ACTIONS__HPP namespace ctll { - struct empty_subject { }; - - struct empty_actions { - // dummy operator so using Actions::operator() later will not give error - template static constexpr auto apply(Action, InputSymbol, Subject subject) { - return subject; - } - }; - - template struct identity: public Actions { - using Actions::apply; - // allow empty_subject to exists - template constexpr static auto apply(Action, term, empty_subject) -> empty_subject { return {}; } - template constexpr static auto apply(Action, epsilon, empty_subject) -> empty_subject { return {}; } - }; - - template struct ignore_unknown: public Actions { - using Actions::apply; - // allow flow thru unknown actions - template constexpr static auto apply(Action, term, Subject) -> Subject { return {}; } - template constexpr static auto apply(Action, epsilon, Subject) -> Subject { return {}; } - }; -} + struct empty_subject {}; + + struct empty_actions { + // dummy operator so using Actions::operator() later will not give error + template + static constexpr auto apply(Action, InputSymbol, Subject subject) { + return subject; + } + }; + + template + struct identity : public Actions { + using Actions::apply; + // allow empty_subject to exists + template + constexpr static auto apply(Action, + term, + empty_subject) -> empty_subject { + return {}; + } + template + constexpr static auto apply(Action, + epsilon, + empty_subject) -> empty_subject { + return {}; + } + }; + + template + struct ignore_unknown : public Actions { + using Actions::apply; + // allow flow thru unknown actions + template + constexpr static auto apply(Action, term, Subject) -> Subject { + return {}; + } + template + constexpr static auto apply(Action, epsilon, Subject) -> Subject { + return {}; + } + }; +} // namespace ctll #endif @@ -754,179 +895,256 @@ namespace ctll { namespace ctll { -enum class decision { - reject, - accept, - undecided -}; + enum class decision { reject, accept, undecided }; -struct placeholder { }; + struct placeholder {}; -template using index_placeholder = placeholder; + template + using index_placeholder = placeholder; #if CTLL_CNTTP_COMPILER_CHECK -template struct parser { // in c++20 + template + struct parser { // in c++20 #else -template struct parser { + template + struct parser { #endif - - #ifdef __GNUC__ // workaround to GCC bug - #if CTLL_CNTTP_COMPILER_CHECK - static constexpr auto _input = input; // c++20 mode - #else - static constexpr auto & _input = input; // c++17 mode - #endif - #else - static constexpr auto _input = input; // everyone else - #endif - using Actions = ctll::conditional, identity>; - using grammar = augment_grammar; - - template struct results { - - static constexpr bool is_correct = Decision == decision::accept; - - constexpr inline CTLL_FORCE_INLINE operator bool() const noexcept { - return is_correct; - } - - #ifdef __GNUC__ // workaround to GCC bug - #if CTLL_CNTTP_COMPILER_CHECK - static constexpr auto _input = input; // c++20 mode - #else - static constexpr auto & _input = input; // c++17 mode - #endif - #else - static constexpr auto _input = input; // everyone else - #endif - - using output_type = Subject; - static constexpr size_t position = Pos; - - constexpr auto operator+(placeholder) const noexcept { - if constexpr (Decision == decision::undecided) { - // parse for current char (RPos) with previous stack and subject :) - return parser::template decide({}, {}); - } else { - // if there is decision already => just push it to the end of fold expression - return *this; - } - } - }; - - template static constexpr auto get_current_term() noexcept { - if constexpr (Pos < input.size()) { - constexpr auto value = input[Pos]; - if constexpr (value <= static_cast((std::numeric_limits::max)())) { - return term(value)>{}; - } else { - return term{}; - } - - } else { - // return epsilon if we are past the input - return epsilon{}; - } - } - template static constexpr auto get_previous_term() noexcept { - if constexpr (Pos == 0) { - // there is no previous character on input if we are on start - return epsilon{}; - } else if constexpr ((Pos-1) < input.size()) { - constexpr auto value = input[Pos-1]; - if constexpr (value <= static_cast((std::numeric_limits::max)())) { - return term(value)>{}; - } else { - return term{}; - } - } else { - return epsilon{}; - } - } - // if rule is accept => return true and subject - template - static constexpr auto move(ctll::accept, Terminal, Stack, Subject) noexcept { - return typename parser::template results(); - } - // if rule is reject => return false and subject - template - static constexpr auto move(ctll::reject, Terminal, Stack, Subject) noexcept { - return typename parser::template results(); - } - // if rule is pop_input => move to next character - template - static constexpr auto move(ctll::pop_input, Terminal, Stack, Subject) noexcept { - return typename parser::template results(); - } - // if rule is string => push it to the front of stack - template - static constexpr auto move(push string, Terminal, Stack stack, Subject subject) noexcept { - return decide(push_front(string, stack), subject); - } - // if rule is epsilon (empty string) => continue - template - static constexpr auto move(epsilon, Terminal, Stack stack, Subject subject) noexcept { - return decide(stack, subject); - } - // if rule is string with current character at the beginning (term) => move to next character - // and push string without the character (quick LL(1)) - template - static constexpr auto move(push, Content...>, term, Stack stack, Subject) noexcept { - constexpr auto local_input = input; - return typename parser::template results(), stack)), Subject, decision::undecided>(); - } - // if rule is string with any character at the beginning (compatible with current term) => move to next character - // and push string without the character (quick LL(1)) - template - static constexpr auto move(push, term, Stack stack, Subject) noexcept { - constexpr auto local_input = input; - return typename parser::template results(), stack)), Subject, decision::undecided>(); - } - // decide if we need to take action or move - template static constexpr auto decide(Stack previous_stack, Subject previous_subject) noexcept { - // each call means we pop something from stack - auto top_symbol = decltype(ctll::front(previous_stack, empty_stack_symbol()))(); - // gcc pedantic warning - [[maybe_unused]] auto stack = decltype(ctll::pop_front(previous_stack))(); - - // in case top_symbol is action type (apply it on previous subject and get new one) - if constexpr (std::is_base_of_v) { - auto subject = Actions::apply(top_symbol, get_previous_term(), previous_subject); - - // in case that semantic action is error => reject input - if constexpr (std::is_same_v) { - return typename parser::template results(); - } else { - return decide(stack, subject); - } - } else { - // all other cases are ordinary for LL(1) parser - auto current_term = get_current_term(); - auto rule = decltype(grammar::rule(top_symbol,current_term))(); - return move(rule, current_term, stack, previous_subject); - } - } - - // trampolines with folded expression - template static constexpr auto trampoline_decide(Subject, std::index_sequence) noexcept { - // parse everything for first char and than for next and next ... - // Pos+1 is needed as we want to finish calculation with epsilons on stack - auto v = (decide<0, typename grammar::start_stack, Subject>({}, {}) + ... + index_placeholder()); - return v; - } - - template static constexpr auto trampoline_decide(Subject subject = {}) noexcept { - // there will be no recursion, just sequence long as the input - return trampoline_decide(subject, std::make_index_sequence()); - } - - template using output = decltype(trampoline_decide()); - template static inline constexpr bool correct_with = trampoline_decide(); +#ifdef __GNUC__ // workaround to GCC bug +#if CTLL_CNTTP_COMPILER_CHECK + static constexpr auto _input = input; // c++20 mode +#else + static constexpr auto& _input = input; // c++17 mode +#endif +#else + static constexpr auto _input = input; // everyone else +#endif -}; + using Actions = ctll::conditional, + identity>; + using grammar = augment_grammar; -} // end of ctll namespace + template + struct results { + static constexpr bool is_correct = Decision == decision::accept; + + constexpr inline CTLL_FORCE_INLINE operator bool() const noexcept { + return is_correct; + } + +#ifdef __GNUC__ // workaround to GCC bug +#if CTLL_CNTTP_COMPILER_CHECK + static constexpr auto _input = input; // c++20 mode +#else + static constexpr auto& _input = input; // c++17 mode +#endif +#else + static constexpr auto _input = input; // everyone else +#endif + + using output_type = Subject; + static constexpr size_t position = Pos; + + constexpr auto operator+(placeholder) const noexcept { + if constexpr (Decision == decision::undecided) { + // parse for current char (RPos) with previous stack and subject :) + return parser:: + template decide({}, {}); + } else { + // if there is decision already => just push it to the end of fold + // expression + return *this; + } + } + }; + + template + static constexpr auto get_current_term() noexcept { + if constexpr (Pos < input.size()) { + constexpr auto value = input[Pos]; + if constexpr (value <= static_cast( + (std::numeric_limits::max)())) { + return term(value)> {}; + } else { + return term {}; + } + + } else { + // return epsilon if we are past the input + return epsilon {}; + } + } + template + static constexpr auto get_previous_term() noexcept { + if constexpr (Pos == 0) { + // there is no previous character on input if we are on start + return epsilon {}; + } else if constexpr ((Pos - 1) < input.size()) { + constexpr auto value = input[Pos - 1]; + if constexpr (value <= static_cast( + (std::numeric_limits::max)())) { + return term(value)> {}; + } else { + return term {}; + } + } else { + return epsilon {}; + } + } + // if rule is accept => return true and subject + template + static constexpr auto move(ctll::accept, + Terminal, + Stack, + Subject) noexcept { + return typename parser:: + template results(); + } + // if rule is reject => return false and subject + template + static constexpr auto move(ctll::reject, + Terminal, + Stack, + Subject) noexcept { + return typename parser:: + template results(); + } + // if rule is pop_input => move to next character + template + static constexpr auto move(ctll::pop_input, + Terminal, + Stack, + Subject) noexcept { + return typename parser:: + template results(); + } + // if rule is string => push it to the front of stack + template + static constexpr auto move(push string, + Terminal, + Stack stack, + Subject subject) noexcept { + return decide(push_front(string, stack), subject); + } + // if rule is epsilon (empty string) => continue + template + static constexpr auto move(epsilon, + Terminal, + Stack stack, + Subject subject) noexcept { + return decide(stack, subject); + } + // if rule is string with current character at the beginning (term) => + // move to next character and push string without the character (quick + // LL(1)) + template + static constexpr auto move(push, Content...>, + term, + Stack stack, + Subject) noexcept { + constexpr auto local_input = input; + return typename parser:: + template results(), stack)), + Subject, decision::undecided>(); + } + // if rule is string with any character at the beginning (compatible with + // current term) => move to next character and push string without the + // character (quick LL(1)) + template + static constexpr auto move(push, + term, + Stack stack, + Subject) noexcept { + constexpr auto local_input = input; + return typename parser:: + template results(), stack)), + Subject, decision::undecided>(); + } + // decide if we need to take action or move + template + static constexpr auto decide(Stack previous_stack, + Subject previous_subject) noexcept { + // each call means we pop something from stack + auto top_symbol = + decltype(ctll::front(previous_stack, empty_stack_symbol()))(); + // gcc pedantic warning + [[maybe_unused]] auto stack = decltype(ctll::pop_front(previous_stack))(); + + // in case top_symbol is action type (apply it on previous subject and get + // new one) + if constexpr (std::is_base_of_v) { + auto subject = Actions::apply(top_symbol, get_previous_term(), + previous_subject); + + // in case that semantic action is error => reject input + if constexpr (std::is_same_v) { + return typename parser:: + template results(); + } else { + return decide(stack, subject); + } + } else { + // all other cases are ordinary for LL(1) parser + auto current_term = get_current_term(); + auto rule = decltype(grammar::rule(top_symbol, current_term))(); + return move(rule, current_term, stack, previous_subject); + } + } + + // trampolines with folded expression + template + static constexpr auto trampoline_decide( + Subject, + std::index_sequence) noexcept { + // parse everything for first char and than for next and next ... + // Pos+1 is needed as we want to finish calculation with epsilons on stack + auto v = (decide<0, typename grammar::start_stack, Subject>({}, {}) + + ... + index_placeholder()); + return v; + } + + template + static constexpr auto trampoline_decide(Subject subject = {}) noexcept { + // there will be no recursion, just sequence long as the input + return trampoline_decide(subject, + std::make_index_sequence()); + } + + template + using output = decltype(trampoline_decide()); + template + static inline constexpr bool correct_with = trampoline_decide(); + }; + +} // namespace ctll #endif @@ -942,447 +1160,2902 @@ template ', + '?', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '[', + '\\', + '0', + '\"', + ']', + '^', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '\x7B', + '|', + '\x7D', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>; + static constexpr auto rule(s, ctll::term<'\\'>) + -> ctll::push; + static constexpr auto rule(s, ctll::term<'['>) + -> ctll::push; + static constexpr auto rule(s, ctll::term<'\x28'>) + -> ctll::push; + static constexpr auto rule(s, ctll::term<'^'>) + -> ctll:: + push; + static constexpr auto rule(s, ctll::term<'$'>) + -> ctll:: + push; + static constexpr auto rule(s, + ctll::set<'!', + ',', + '/', + ':', + '<', + '0', + '-', + '=', + '>', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '\"', + ']', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) + -> ctll:: + push; + static constexpr auto rule(s, _others) + -> ctll:: + push; + static constexpr auto rule(s, ctll::term<'.'>) + -> ctll::push; + static constexpr auto rule(s, ctll::term<'|'>) + -> ctll::push; + static constexpr auto rule(s, ctll::epsilon) -> ctll::push; + static constexpr auto rule(s, + ctll::set<'\x29', '*', '+', '?', '\x7B', '\x7D'>) + -> ctll::reject; -// (q)LL1 function: - using _others = ctll::neg_set<'!','$','\x28','\x29','*','+',',','-','.','/',':','<','=','>','?','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','[','\\','0','\"',']','^','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','\x7B','|','\x7D','1','2','3','4','5','6','7','8','9'>; - static constexpr auto rule(s, ctll::term<'\\'>) -> ctll::push; - static constexpr auto rule(s, ctll::term<'['>) -> ctll::push; - static constexpr auto rule(s, ctll::term<'\x28'>) -> ctll::push; - static constexpr auto rule(s, ctll::term<'^'>) -> ctll::push; - static constexpr auto rule(s, ctll::term<'$'>) -> ctll::push; - static constexpr auto rule(s, ctll::set<'!',',','/',':','<','0','-','=','>','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','\"',']','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9'>) -> ctll::push; - static constexpr auto rule(s, _others) -> ctll::push; - static constexpr auto rule(s, ctll::term<'.'>) -> ctll::push; - static constexpr auto rule(s, ctll::term<'|'>) -> ctll::push; - static constexpr auto rule(s, ctll::epsilon) -> ctll::push; - static constexpr auto rule(s, ctll::set<'\x29','*','+','?','\x7B','\x7D'>) -> ctll::reject; + static constexpr auto rule(a, + ctll::term<'\\'>) -> ctll::push; + static constexpr auto rule(a, ctll::term<'['>) + -> ctll:: + push; + static constexpr auto rule(a, ctll::term<'\x28'>) + -> ctll::push; + static constexpr auto rule(a, + ctll::term<'^'>) -> ctll::push; + static constexpr auto rule(a, + ctll::term<'$'>) -> ctll::push; + static constexpr auto rule(a, + ctll::set<'!', + ',', + '/', + ':', + '<', + '0', + '-', + '=', + '>', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '\"', + ']', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) -> ctll::push; + static constexpr auto rule(a, _others) -> ctll::push; + static constexpr auto rule(a, ctll::term<'.'>) + -> ctll::push; + static constexpr auto rule(a, ctll::term<'\x29'>) + -> ctll::push; + static constexpr auto rule(a, ctll::epsilon) + -> ctll::push; + static constexpr auto rule(a, ctll::set<'*', '+', '?', '\x7B', '|', '\x7D'>) + -> ctll::reject; - static constexpr auto rule(a, ctll::term<'\\'>) -> ctll::push; - static constexpr auto rule(a, ctll::term<'['>) -> ctll::push; - static constexpr auto rule(a, ctll::term<'\x28'>) -> ctll::push; - static constexpr auto rule(a, ctll::term<'^'>) -> ctll::push; - static constexpr auto rule(a, ctll::term<'$'>) -> ctll::push; - static constexpr auto rule(a, ctll::set<'!',',','/',':','<','0','-','=','>','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','\"',']','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9'>) -> ctll::push; - static constexpr auto rule(a, _others) -> ctll::push; - static constexpr auto rule(a, ctll::term<'.'>) -> ctll::push; - static constexpr auto rule(a, ctll::term<'\x29'>) -> ctll::push; - static constexpr auto rule(a, ctll::epsilon) -> ctll::push; - static constexpr auto rule(a, ctll::set<'*','+','?','\x7B','|','\x7D'>) -> ctll::reject; + static constexpr auto rule(b, ctll::term<','>) + -> ctll::push; + static constexpr auto rule(b, ctll::term<'\x7D'>) + -> ctll::push; - static constexpr auto rule(b, ctll::term<','>) -> ctll::push; - static constexpr auto rule(b, ctll::term<'\x7D'>) -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'d'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'h'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'H'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'V'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'D'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'N'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'S'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'W'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'s'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'v'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'w'>) + -> ctll::push; + static constexpr auto rule( + backslash, + ctll::set<'1', '2', '3', '4', '5', '6', '7', '8', '9'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'g'>) + -> ctll::push, m>; + static constexpr auto rule(backslash, ctll::term<'p'>) + -> ctll::push, + property_name, + ctll::term<'\x7D'>, + make_property>; + static constexpr auto rule(backslash, ctll::term<'P'>) + -> ctll::push, + property_name, + ctll::term<'\x7D'>, + make_property_negative>; + static constexpr auto rule(backslash, ctll::term<'u'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'x'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'A'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'z'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'Z'>) + -> ctll::push; + static constexpr auto rule(backslash, + ctll::set<'$', + '\x28', + '\x29', + '*', + '+', + '-', + '.', + '/', + '<', + '>', + '?', + '[', + '\\', + '\"', + ']', + '^', + '\x7B', + '|', + '\x7D'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'a'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'e'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'f'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'n'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'0'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'r'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'t'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'B'>) + -> ctll::push; + static constexpr auto rule(backslash, ctll::term<'b'>) + -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'d'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'h'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'H'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'V'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'D'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'N'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'S'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'W'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'s'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'v'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'w'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::set<'1','2','3','4','5','6','7','8','9'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'g'>) -> ctll::push, m>; - static constexpr auto rule(backslash, ctll::term<'p'>) -> ctll::push, property_name, ctll::term<'\x7D'>, make_property>; - static constexpr auto rule(backslash, ctll::term<'P'>) -> ctll::push, property_name, ctll::term<'\x7D'>, make_property_negative>; - static constexpr auto rule(backslash, ctll::term<'u'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'x'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'A'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'z'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'Z'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::set<'$','\x28','\x29','*','+','-','.','/','<','>','?','[','\\','\"',']','^','\x7B','|','\x7D'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'a'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'e'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'f'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'n'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'0'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'r'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'t'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'B'>) -> ctll::push; - static constexpr auto rule(backslash, ctll::term<'b'>) -> ctll::push; + static constexpr auto rule(backslash_range, ctll::term<'u'>) + -> ctll::push; + static constexpr auto rule(backslash_range, ctll::term<'x'>) + -> ctll::push; + static constexpr auto rule(backslash_range, + ctll::set<'$', + '\x28', + '\x29', + '*', + '+', + '-', + '.', + '/', + '<', + '>', + '?', + '[', + '\\', + '\"', + ']', + '^', + '\x7B', + '|', + '\x7D'>) + -> ctll::push; + static constexpr auto rule(backslash_range, ctll::term<'a'>) + -> ctll::push; + static constexpr auto rule(backslash_range, ctll::term<'e'>) + -> ctll::push; + static constexpr auto rule(backslash_range, ctll::term<'f'>) + -> ctll::push; + static constexpr auto rule(backslash_range, ctll::term<'n'>) + -> ctll::push; + static constexpr auto rule(backslash_range, ctll::term<'0'>) + -> ctll::push; + static constexpr auto rule(backslash_range, ctll::term<'r'>) + -> ctll::push; + static constexpr auto rule(backslash_range, ctll::term<'t'>) + -> ctll::push; - static constexpr auto rule(backslash_range, ctll::term<'u'>) -> ctll::push; - static constexpr auto rule(backslash_range, ctll::term<'x'>) -> ctll::push; - static constexpr auto rule(backslash_range, ctll::set<'$','\x28','\x29','*','+','-','.','/','<','>','?','[','\\','\"',']','^','\x7B','|','\x7D'>) -> ctll::push; - static constexpr auto rule(backslash_range, ctll::term<'a'>) -> ctll::push; - static constexpr auto rule(backslash_range, ctll::term<'e'>) -> ctll::push; - static constexpr auto rule(backslash_range, ctll::term<'f'>) -> ctll::push; - static constexpr auto rule(backslash_range, ctll::term<'n'>) -> ctll::push; - static constexpr auto rule(backslash_range, ctll::term<'0'>) -> ctll::push; - static constexpr auto rule(backslash_range, ctll::term<'r'>) -> ctll::push; - static constexpr auto rule(backslash_range, ctll::term<'t'>) -> ctll::push; + static constexpr auto rule(block, ctll::term<'\\'>) + -> ctll::push>; + static constexpr auto rule(block, ctll::term<'['>) + -> ctll::push>; + static constexpr auto rule(block, ctll::term<'?'>) + -> ctll::push; + static constexpr auto rule(block, ctll::term<'\x28'>) + -> ctll::push>; + static constexpr auto rule(block, ctll::term<'^'>) + -> ctll::push>; + static constexpr auto rule(block, ctll::term<'$'>) + -> ctll::push>; + static constexpr auto rule(block, + ctll::set<'!', + ',', + '/', + ':', + '<', + '0', + '-', + '=', + '>', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '\"', + ']', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) + -> ctll::push>; + static constexpr auto rule(block, + _others) -> ctll::push>; + static constexpr auto rule(block, ctll::term<'.'>) + -> ctll::push>; + static constexpr auto rule(block, ctll::term<'|'>) + -> ctll::push>; + static constexpr auto rule(block, ctll::term<'\x29'>) + -> ctll::push; + static constexpr auto rule(block, ctll::set<'*', '+', '\x7B', '\x7D'>) + -> ctll::reject; - static constexpr auto rule(block, ctll::term<'\\'>) -> ctll::push>; - static constexpr auto rule(block, ctll::term<'['>) -> ctll::push>; - static constexpr auto rule(block, ctll::term<'?'>) -> ctll::push; - static constexpr auto rule(block, ctll::term<'\x28'>) -> ctll::push>; - static constexpr auto rule(block, ctll::term<'^'>) -> ctll::push>; - static constexpr auto rule(block, ctll::term<'$'>) -> ctll::push>; - static constexpr auto rule(block, ctll::set<'!',',','/',':','<','0','-','=','>','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','\"',']','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9'>) -> ctll::push>; - static constexpr auto rule(block, _others) -> ctll::push>; - static constexpr auto rule(block, ctll::term<'.'>) -> ctll::push>; - static constexpr auto rule(block, ctll::term<'|'>) -> ctll::push>; - static constexpr auto rule(block, ctll::term<'\x29'>) -> ctll::push; - static constexpr auto rule(block, ctll::set<'*','+','\x7B','\x7D'>) -> ctll::reject; + static constexpr auto rule(block_name2, + ctll::set<'>', '\x7D'>) -> ctll::epsilon; + static constexpr auto rule(block_name2, + ctll::set<'0', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) + -> ctll::push; - static constexpr auto rule(block_name2, ctll::set<'>','\x7D'>) -> ctll::epsilon; - static constexpr auto rule(block_name2, ctll::set<'0','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9'>) -> ctll::push; + static constexpr auto rule(c, + ctll::term<'['>) -> ctll::push, + i, + range, + set_start, + set2b, + set_make, + ctll::term<']'>>; + static constexpr auto rule(c, + ctll::term<'\\'>) -> ctll::push>; + static constexpr auto rule(c, + ctll::set<'!', + '0', + '$', + '\x28', + '\x29', + '*', + '+', + ',', + '.', + '/', + ':', + '<', + '=', + '>', + '?', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '\"', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '\x7B', + '|', + '\x7D', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) -> ctll::push>; + static constexpr auto rule(c, _others) -> ctll::push>; + static constexpr auto rule(c, ctll::term<'^'>) + -> ctll:: + push>; + static constexpr auto rule(c, ctll::set<'-', ']'>) -> ctll::reject; - static constexpr auto rule(c, ctll::term<'['>) -> ctll::push, i, range, set_start, set2b, set_make, ctll::term<']'>>; - static constexpr auto rule(c, ctll::term<'\\'>) -> ctll::push>; - static constexpr auto rule(c, ctll::set<'!','0','$','\x28','\x29','*','+',',','.','/',':','<','=','>','?','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','\"','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','\x7B','|','\x7D','1','2','3','4','5','6','7','8','9'>) -> ctll::push>; - static constexpr auto rule(c, _others) -> ctll::push>; - static constexpr auto rule(c, ctll::term<'^'>) -> ctll::push>; - static constexpr auto rule(c, ctll::set<'-',']'>) -> ctll::reject; + static constexpr auto rule(class_named_name, ctll::term<'x'>) + -> ctll::push, + ctll::term<'i'>, + ctll::term<'g'>, + ctll::term<'i'>, + ctll::term<'t'>, + class_named_xdigit>; + static constexpr auto rule(class_named_name, ctll::term<'d'>) + -> ctll::push, + ctll::term<'g'>, + ctll::term<'i'>, + ctll::term<'t'>, + class_named_digit>; + static constexpr auto rule(class_named_name, ctll::term<'b'>) + -> ctll::push, + ctll::term<'a'>, + ctll::term<'n'>, + ctll::term<'k'>, + class_named_blank>; + static constexpr auto rule(class_named_name, ctll::term<'c'>) + -> ctll::push, + ctll::term<'t'>, + ctll::term<'r'>, + ctll::term<'l'>, + class_named_cntrl>; + static constexpr auto rule(class_named_name, + ctll::term<'w'>) -> ctll::push, + ctll::term<'r'>, + ctll::term<'d'>, + class_named_word>; + static constexpr auto rule(class_named_name, ctll::term<'l'>) + -> ctll::push, + ctll::term<'w'>, + ctll::term<'e'>, + ctll::term<'r'>, + class_named_lower>; + static constexpr auto rule(class_named_name, ctll::term<'s'>) + -> ctll::push, + ctll::term<'a'>, + ctll::term<'c'>, + ctll::term<'e'>, + class_named_space>; + static constexpr auto rule(class_named_name, ctll::term<'u'>) + -> ctll::push, + ctll::term<'p'>, + ctll::term<'e'>, + ctll::term<'r'>, + class_named_upper>; + static constexpr auto rule(class_named_name, ctll::term<'g'>) + -> ctll::push, + ctll::term<'a'>, + ctll::term<'p'>, + ctll::term<'h'>, + class_named_graph>; + static constexpr auto rule(class_named_name, ctll::term<'a'>) + -> ctll::push; + static constexpr auto rule(class_named_name, ctll::term<'p'>) + -> ctll::push; - static constexpr auto rule(class_named_name, ctll::term<'x'>) -> ctll::push, ctll::term<'i'>, ctll::term<'g'>, ctll::term<'i'>, ctll::term<'t'>, class_named_xdigit>; - static constexpr auto rule(class_named_name, ctll::term<'d'>) -> ctll::push, ctll::term<'g'>, ctll::term<'i'>, ctll::term<'t'>, class_named_digit>; - static constexpr auto rule(class_named_name, ctll::term<'b'>) -> ctll::push, ctll::term<'a'>, ctll::term<'n'>, ctll::term<'k'>, class_named_blank>; - static constexpr auto rule(class_named_name, ctll::term<'c'>) -> ctll::push, ctll::term<'t'>, ctll::term<'r'>, ctll::term<'l'>, class_named_cntrl>; - static constexpr auto rule(class_named_name, ctll::term<'w'>) -> ctll::push, ctll::term<'r'>, ctll::term<'d'>, class_named_word>; - static constexpr auto rule(class_named_name, ctll::term<'l'>) -> ctll::push, ctll::term<'w'>, ctll::term<'e'>, ctll::term<'r'>, class_named_lower>; - static constexpr auto rule(class_named_name, ctll::term<'s'>) -> ctll::push, ctll::term<'a'>, ctll::term<'c'>, ctll::term<'e'>, class_named_space>; - static constexpr auto rule(class_named_name, ctll::term<'u'>) -> ctll::push, ctll::term<'p'>, ctll::term<'e'>, ctll::term<'r'>, class_named_upper>; - static constexpr auto rule(class_named_name, ctll::term<'g'>) -> ctll::push, ctll::term<'a'>, ctll::term<'p'>, ctll::term<'h'>, class_named_graph>; - static constexpr auto rule(class_named_name, ctll::term<'a'>) -> ctll::push; - static constexpr auto rule(class_named_name, ctll::term<'p'>) -> ctll::push; + static constexpr auto rule(content2, ctll::term<'\x29'>) -> ctll::epsilon; + static constexpr auto rule(content2, ctll::epsilon) -> ctll::epsilon; + static constexpr auto rule(content2, ctll::term<'|'>) + -> ctll::push; - static constexpr auto rule(content2, ctll::term<'\x29'>) -> ctll::epsilon; - static constexpr auto rule(content2, ctll::epsilon) -> ctll::epsilon; - static constexpr auto rule(content2, ctll::term<'|'>) -> ctll::push; + static constexpr auto rule(content, ctll::term<'\\'>) + -> ctll::push; + static constexpr auto rule(content, ctll::term<'['>) + -> ctll::push; + static constexpr auto rule(content, ctll::term<'\x28'>) + -> ctll::push; + static constexpr auto rule(content, ctll::term<'^'>) + -> ctll:: + push; + static constexpr auto rule(content, ctll::term<'$'>) + -> ctll:: + push; + static constexpr auto rule(content, + ctll::set<'!', + ',', + '/', + ':', + '<', + '0', + '-', + '=', + '>', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '\"', + ']', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) + -> ctll:: + push; + static constexpr auto rule(content, _others) + -> ctll:: + push; + static constexpr auto rule(content, ctll::term<'.'>) + -> ctll::push; + static constexpr auto rule( + content, + ctll::set<'\x29', '*', '+', '?', '\x7B', '|', '\x7D'>) -> ctll::reject; - static constexpr auto rule(content, ctll::term<'\\'>) -> ctll::push; - static constexpr auto rule(content, ctll::term<'['>) -> ctll::push; - static constexpr auto rule(content, ctll::term<'\x28'>) -> ctll::push; - static constexpr auto rule(content, ctll::term<'^'>) -> ctll::push; - static constexpr auto rule(content, ctll::term<'$'>) -> ctll::push; - static constexpr auto rule(content, ctll::set<'!',',','/',':','<','0','-','=','>','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','\"',']','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9'>) -> ctll::push; - static constexpr auto rule(content, _others) -> ctll::push; - static constexpr auto rule(content, ctll::term<'.'>) -> ctll::push; - static constexpr auto rule(content, ctll::set<'\x29','*','+','?','\x7B','|','\x7D'>) -> ctll::reject; + static constexpr auto rule(content_in_capture, ctll::term<'\\'>) + -> ctll::push; + static constexpr auto rule(content_in_capture, ctll::term<'['>) + -> ctll::push; + static constexpr auto rule(content_in_capture, ctll::term<'\x28'>) + -> ctll::push; + static constexpr auto rule(content_in_capture, ctll::term<'^'>) + -> ctll:: + push; + static constexpr auto rule(content_in_capture, ctll::term<'$'>) + -> ctll:: + push; + static constexpr auto rule(content_in_capture, + ctll::set<'!', + ',', + '/', + ':', + '<', + '0', + '-', + '=', + '>', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '\"', + ']', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) + -> ctll:: + push; + static constexpr auto rule(content_in_capture, _others) + -> ctll:: + push; + static constexpr auto rule(content_in_capture, ctll::term<'.'>) + -> ctll::push; + static constexpr auto rule(content_in_capture, ctll::term<'|'>) + -> ctll::push; + static constexpr auto rule(content_in_capture, + ctll::term<'\x29'>) -> ctll::push; + static constexpr auto rule(content_in_capture, + ctll::set<'*', '+', '?', '\x7B', '\x7D'>) + -> ctll::reject; - static constexpr auto rule(content_in_capture, ctll::term<'\\'>) -> ctll::push; - static constexpr auto rule(content_in_capture, ctll::term<'['>) -> ctll::push; - static constexpr auto rule(content_in_capture, ctll::term<'\x28'>) -> ctll::push; - static constexpr auto rule(content_in_capture, ctll::term<'^'>) -> ctll::push; - static constexpr auto rule(content_in_capture, ctll::term<'$'>) -> ctll::push; - static constexpr auto rule(content_in_capture, ctll::set<'!',',','/',':','<','0','-','=','>','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','\"',']','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9'>) -> ctll::push; - static constexpr auto rule(content_in_capture, _others) -> ctll::push; - static constexpr auto rule(content_in_capture, ctll::term<'.'>) -> ctll::push; - static constexpr auto rule(content_in_capture, ctll::term<'|'>) -> ctll::push; - static constexpr auto rule(content_in_capture, ctll::term<'\x29'>) -> ctll::push; - static constexpr auto rule(content_in_capture, ctll::set<'*','+','?','\x7B','\x7D'>) -> ctll::reject; + static constexpr auto rule(d, ctll::term<'i'>) + -> ctll::push; + static constexpr auto rule(d, ctll::term<'c'>) + -> ctll::push; + static constexpr auto rule(d, ctll::term<'m'>) + -> ctll::push; + static constexpr auto rule(d, ctll::term<'s'>) + -> ctll::push; + static constexpr auto rule(d, ctll::term<'<'>) + -> ctll::push; + static constexpr auto rule(d, ctll::term<':'>) + -> ctll::push>; + static constexpr auto rule(d, ctll::term<'>'>) + -> ctll::push>; + static constexpr auto rule(d, ctll::term<'!'>) + -> ctll::push>; + static constexpr auto rule(d, ctll::term<'='>) + -> ctll::push>; - static constexpr auto rule(d, ctll::term<'i'>) -> ctll::push; - static constexpr auto rule(d, ctll::term<'c'>) -> ctll::push; - static constexpr auto rule(d, ctll::term<'m'>) -> ctll::push; - static constexpr auto rule(d, ctll::term<'s'>) -> ctll::push; - static constexpr auto rule(d, ctll::term<'<'>) -> ctll::push; - static constexpr auto rule(d, ctll::term<':'>) -> ctll::push>; - static constexpr auto rule(d, ctll::term<'>'>) -> ctll::push>; - static constexpr auto rule(d, ctll::term<'!'>) -> ctll::push>; - static constexpr auto rule(d, ctll::term<'='>) -> ctll::push>; + static constexpr auto rule(e, ctll::term<'d'>) + -> ctll::push; + static constexpr auto rule(e, ctll::term<'h'>) + -> ctll::push; + static constexpr auto rule(e, ctll::term<'H'>) + -> ctll::push; + static constexpr auto rule(e, ctll::term<'V'>) + -> ctll::push; + static constexpr auto rule(e, ctll::term<'D'>) + -> ctll::push; + static constexpr auto rule(e, ctll::term<'N'>) + -> ctll::push; + static constexpr auto rule(e, ctll::term<'S'>) + -> ctll::push; + static constexpr auto rule(e, ctll::term<'W'>) + -> ctll::push; + static constexpr auto rule(e, ctll::term<'s'>) + -> ctll::push; + static constexpr auto rule(e, ctll::term<'v'>) + -> ctll::push; + static constexpr auto rule(e, ctll::term<'w'>) + -> ctll::push; + static constexpr auto rule(e, ctll::term<'p'>) + -> ctll::push, + property_name, + ctll::term<'\x7D'>, + make_property>; + static constexpr auto rule(e, ctll::term<'P'>) + -> ctll::push, + property_name, + ctll::term<'\x7D'>, + make_property_negative>; + static constexpr auto rule(e, ctll::term<'u'>) + -> ctll::push; + static constexpr auto rule(e, ctll::term<'x'>) + -> ctll::push; + static constexpr auto rule(e, + ctll::set<'$', + '\x28', + '\x29', + '*', + '+', + '-', + '.', + '/', + '<', + '>', + '?', + '[', + '\\', + '\"', + ']', + '^', + '\x7B', + '|', + '\x7D'>) + -> ctll::push; + static constexpr auto rule(e, ctll::term<'a'>) + -> ctll::push; + static constexpr auto rule(e, ctll::term<'e'>) + -> ctll::push; + static constexpr auto rule(e, ctll::term<'f'>) + -> ctll::push; + static constexpr auto rule(e, ctll::term<'n'>) + -> ctll::push; + static constexpr auto rule(e, ctll::term<'0'>) + -> ctll::push; + static constexpr auto rule(e, ctll::term<'r'>) + -> ctll::push; + static constexpr auto rule(e, ctll::term<'t'>) + -> ctll::push; - static constexpr auto rule(e, ctll::term<'d'>) -> ctll::push; - static constexpr auto rule(e, ctll::term<'h'>) -> ctll::push; - static constexpr auto rule(e, ctll::term<'H'>) -> ctll::push; - static constexpr auto rule(e, ctll::term<'V'>) -> ctll::push; - static constexpr auto rule(e, ctll::term<'D'>) -> ctll::push; - static constexpr auto rule(e, ctll::term<'N'>) -> ctll::push; - static constexpr auto rule(e, ctll::term<'S'>) -> ctll::push; - static constexpr auto rule(e, ctll::term<'W'>) -> ctll::push; - static constexpr auto rule(e, ctll::term<'s'>) -> ctll::push; - static constexpr auto rule(e, ctll::term<'v'>) -> ctll::push; - static constexpr auto rule(e, ctll::term<'w'>) -> ctll::push; - static constexpr auto rule(e, ctll::term<'p'>) -> ctll::push, property_name, ctll::term<'\x7D'>, make_property>; - static constexpr auto rule(e, ctll::term<'P'>) -> ctll::push, property_name, ctll::term<'\x7D'>, make_property_negative>; - static constexpr auto rule(e, ctll::term<'u'>) -> ctll::push; - static constexpr auto rule(e, ctll::term<'x'>) -> ctll::push; - static constexpr auto rule(e, ctll::set<'$','\x28','\x29','*','+','-','.','/','<','>','?','[','\\','\"',']','^','\x7B','|','\x7D'>) -> ctll::push; - static constexpr auto rule(e, ctll::term<'a'>) -> ctll::push; - static constexpr auto rule(e, ctll::term<'e'>) -> ctll::push; - static constexpr auto rule(e, ctll::term<'f'>) -> ctll::push; - static constexpr auto rule(e, ctll::term<'n'>) -> ctll::push; - static constexpr auto rule(e, ctll::term<'0'>) -> ctll::push; - static constexpr auto rule(e, ctll::term<'r'>) -> ctll::push; - static constexpr auto rule(e, ctll::term<'t'>) -> ctll::push; + static constexpr auto rule(f, ctll::term<'d'>) + -> ctll::push; + static constexpr auto rule(f, ctll::term<'h'>) + -> ctll::push; + static constexpr auto rule(f, ctll::term<'H'>) + -> ctll::push; + static constexpr auto rule(f, ctll::term<'V'>) + -> ctll::push; + static constexpr auto rule(f, ctll::term<'D'>) + -> ctll::push; + static constexpr auto rule(f, ctll::term<'N'>) + -> ctll::push; + static constexpr auto rule(f, ctll::term<'S'>) + -> ctll::push; + static constexpr auto rule(f, ctll::term<'W'>) + -> ctll::push; + static constexpr auto rule(f, ctll::term<'s'>) + -> ctll::push; + static constexpr auto rule(f, ctll::term<'v'>) + -> ctll::push; + static constexpr auto rule(f, ctll::term<'w'>) + -> ctll::push; + static constexpr auto rule(f, ctll::term<'p'>) + -> ctll::push, + property_name, + ctll::term<'\x7D'>, + make_property>; + static constexpr auto rule(f, ctll::term<'P'>) + -> ctll::push, + property_name, + ctll::term<'\x7D'>, + make_property_negative>; + static constexpr auto rule(f, ctll::term<'u'>) + -> ctll::push; + static constexpr auto rule(f, ctll::term<'x'>) + -> ctll::push; + static constexpr auto rule(f, + ctll::set<'$', + '\x28', + '\x29', + '*', + '+', + '-', + '.', + '/', + '<', + '>', + '?', + '[', + '\\', + '\"', + ']', + '^', + '\x7B', + '|', + '\x7D'>) + -> ctll::push; + static constexpr auto rule(f, ctll::term<'a'>) + -> ctll::push; + static constexpr auto rule(f, ctll::term<'e'>) + -> ctll::push; + static constexpr auto rule(f, ctll::term<'f'>) + -> ctll::push; + static constexpr auto rule(f, ctll::term<'n'>) + -> ctll::push; + static constexpr auto rule(f, ctll::term<'0'>) + -> ctll::push; + static constexpr auto rule(f, ctll::term<'r'>) + -> ctll::push; + static constexpr auto rule(f, ctll::term<'t'>) + -> ctll::push; - static constexpr auto rule(f, ctll::term<'d'>) -> ctll::push; - static constexpr auto rule(f, ctll::term<'h'>) -> ctll::push; - static constexpr auto rule(f, ctll::term<'H'>) -> ctll::push; - static constexpr auto rule(f, ctll::term<'V'>) -> ctll::push; - static constexpr auto rule(f, ctll::term<'D'>) -> ctll::push; - static constexpr auto rule(f, ctll::term<'N'>) -> ctll::push; - static constexpr auto rule(f, ctll::term<'S'>) -> ctll::push; - static constexpr auto rule(f, ctll::term<'W'>) -> ctll::push; - static constexpr auto rule(f, ctll::term<'s'>) -> ctll::push; - static constexpr auto rule(f, ctll::term<'v'>) -> ctll::push; - static constexpr auto rule(f, ctll::term<'w'>) -> ctll::push; - static constexpr auto rule(f, ctll::term<'p'>) -> ctll::push, property_name, ctll::term<'\x7D'>, make_property>; - static constexpr auto rule(f, ctll::term<'P'>) -> ctll::push, property_name, ctll::term<'\x7D'>, make_property_negative>; - static constexpr auto rule(f, ctll::term<'u'>) -> ctll::push; - static constexpr auto rule(f, ctll::term<'x'>) -> ctll::push; - static constexpr auto rule(f, ctll::set<'$','\x28','\x29','*','+','-','.','/','<','>','?','[','\\','\"',']','^','\x7B','|','\x7D'>) -> ctll::push; - static constexpr auto rule(f, ctll::term<'a'>) -> ctll::push; - static constexpr auto rule(f, ctll::term<'e'>) -> ctll::push; - static constexpr auto rule(f, ctll::term<'f'>) -> ctll::push; - static constexpr auto rule(f, ctll::term<'n'>) -> ctll::push; - static constexpr auto rule(f, ctll::term<'0'>) -> ctll::push; - static constexpr auto rule(f, ctll::term<'r'>) -> ctll::push; - static constexpr auto rule(f, ctll::term<'t'>) -> ctll::push; + static constexpr auto rule(g, ctll::term<'s'>) + -> ctll::push, + ctll::term<'i'>, + ctll::term<'i'>, + class_named_ascii>; + static constexpr auto rule(g, ctll::term<'l'>) + -> ctll::push; - static constexpr auto rule(g, ctll::term<'s'>) -> ctll::push, ctll::term<'i'>, ctll::term<'i'>, class_named_ascii>; - static constexpr auto rule(g, ctll::term<'l'>) -> ctll::push; + static constexpr auto rule(h, ctll::term<'r'>) + -> ctll::push, + ctll::term<'n'>, + ctll::term<'t'>, + class_named_print>; + static constexpr auto rule(h, ctll::term<'u'>) + -> ctll::push, + ctll::term<'c'>, + ctll::term<'t'>, + class_named_punct>; - static constexpr auto rule(h, ctll::term<'r'>) -> ctll::push, ctll::term<'n'>, ctll::term<'t'>, class_named_print>; - static constexpr auto rule(h, ctll::term<'u'>) -> ctll::push, ctll::term<'c'>, ctll::term<'t'>, class_named_punct>; + static constexpr auto rule(hexdec_repeat, + ctll::term<'\x7D'>) -> ctll::epsilon; + static constexpr auto rule(hexdec_repeat, + ctll::set<'0', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) + -> ctll::push; - static constexpr auto rule(hexdec_repeat, ctll::term<'\x7D'>) -> ctll::epsilon; - static constexpr auto rule(hexdec_repeat, ctll::set<'0','A','B','C','D','E','F','a','b','c','d','e','f','1','2','3','4','5','6','7','8','9'>) -> ctll::push; + static constexpr auto rule(i, ctll::term<'^'>) + -> ctll::push, + ctll::term<']'>>; + static constexpr auto rule(i, ctll::term<'x'>) + -> ctll::push, + ctll::term<'i'>, + ctll::term<'g'>, + ctll::term<'i'>, + ctll::term<'t'>, + class_named_xdigit, + ctll::term<':'>, + ctll::term<']'>>; + static constexpr auto rule(i, + ctll::term<'d'>) -> ctll::push, + ctll::term<'g'>, + ctll::term<'i'>, + ctll::term<'t'>, + class_named_digit, + ctll::term<':'>, + ctll::term<']'>>; + static constexpr auto rule(i, + ctll::term<'b'>) -> ctll::push, + ctll::term<'a'>, + ctll::term<'n'>, + ctll::term<'k'>, + class_named_blank, + ctll::term<':'>, + ctll::term<']'>>; + static constexpr auto rule(i, + ctll::term<'c'>) -> ctll::push, + ctll::term<'t'>, + ctll::term<'r'>, + ctll::term<'l'>, + class_named_cntrl, + ctll::term<':'>, + ctll::term<']'>>; + static constexpr auto rule(i, + ctll::term<'w'>) -> ctll::push, + ctll::term<'r'>, + ctll::term<'d'>, + class_named_word, + ctll::term<':'>, + ctll::term<']'>>; + static constexpr auto rule(i, + ctll::term<'l'>) -> ctll::push, + ctll::term<'w'>, + ctll::term<'e'>, + ctll::term<'r'>, + class_named_lower, + ctll::term<':'>, + ctll::term<']'>>; + static constexpr auto rule(i, + ctll::term<'s'>) -> ctll::push, + ctll::term<'a'>, + ctll::term<'c'>, + ctll::term<'e'>, + class_named_space, + ctll::term<':'>, + ctll::term<']'>>; + static constexpr auto rule(i, + ctll::term<'u'>) -> ctll::push, + ctll::term<'p'>, + ctll::term<'e'>, + ctll::term<'r'>, + class_named_upper, + ctll::term<':'>, + ctll::term<']'>>; + static constexpr auto rule(i, + ctll::term<'g'>) -> ctll::push, + ctll::term<'a'>, + ctll::term<'p'>, + ctll::term<'h'>, + class_named_graph, + ctll::term<':'>, + ctll::term<']'>>; + static constexpr auto rule(i, ctll::term<'a'>) + -> ctll::push, ctll::term<']'>>; + static constexpr auto rule(i, ctll::term<'p'>) + -> ctll::push, ctll::term<']'>>; - static constexpr auto rule(i, ctll::term<'^'>) -> ctll::push, ctll::term<']'>>; - static constexpr auto rule(i, ctll::term<'x'>) -> ctll::push, ctll::term<'i'>, ctll::term<'g'>, ctll::term<'i'>, ctll::term<'t'>, class_named_xdigit, ctll::term<':'>, ctll::term<']'>>; - static constexpr auto rule(i, ctll::term<'d'>) -> ctll::push, ctll::term<'g'>, ctll::term<'i'>, ctll::term<'t'>, class_named_digit, ctll::term<':'>, ctll::term<']'>>; - static constexpr auto rule(i, ctll::term<'b'>) -> ctll::push, ctll::term<'a'>, ctll::term<'n'>, ctll::term<'k'>, class_named_blank, ctll::term<':'>, ctll::term<']'>>; - static constexpr auto rule(i, ctll::term<'c'>) -> ctll::push, ctll::term<'t'>, ctll::term<'r'>, ctll::term<'l'>, class_named_cntrl, ctll::term<':'>, ctll::term<']'>>; - static constexpr auto rule(i, ctll::term<'w'>) -> ctll::push, ctll::term<'r'>, ctll::term<'d'>, class_named_word, ctll::term<':'>, ctll::term<']'>>; - static constexpr auto rule(i, ctll::term<'l'>) -> ctll::push, ctll::term<'w'>, ctll::term<'e'>, ctll::term<'r'>, class_named_lower, ctll::term<':'>, ctll::term<']'>>; - static constexpr auto rule(i, ctll::term<'s'>) -> ctll::push, ctll::term<'a'>, ctll::term<'c'>, ctll::term<'e'>, class_named_space, ctll::term<':'>, ctll::term<']'>>; - static constexpr auto rule(i, ctll::term<'u'>) -> ctll::push, ctll::term<'p'>, ctll::term<'e'>, ctll::term<'r'>, class_named_upper, ctll::term<':'>, ctll::term<']'>>; - static constexpr auto rule(i, ctll::term<'g'>) -> ctll::push, ctll::term<'a'>, ctll::term<'p'>, ctll::term<'h'>, class_named_graph, ctll::term<':'>, ctll::term<']'>>; - static constexpr auto rule(i, ctll::term<'a'>) -> ctll::push, ctll::term<']'>>; - static constexpr auto rule(i, ctll::term<'p'>) -> ctll::push, ctll::term<']'>>; + static constexpr auto rule(j, ctll::term<'\\'>) + -> ctll::push; + static constexpr auto rule(j, + ctll::set<'!', + '$', + '\x28', + '\x29', + '*', + '+', + ',', + '.', + '/', + ':', + '<', + '=', + '>', + '?', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '\"', + '^', + '0', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '\x7B', + '|', + '\x7D', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) + -> ctll::push; + static constexpr auto rule(j, _others) + -> ctll::push; + static constexpr auto rule(j, ctll::set<'-', '[', ']'>) -> ctll::reject; - static constexpr auto rule(j, ctll::term<'\\'>) -> ctll::push; - static constexpr auto rule(j, ctll::set<'!','$','\x28','\x29','*','+',',','.','/',':','<','=','>','?','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','\"','^','0','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','\x7B','|','\x7D','1','2','3','4','5','6','7','8','9'>) -> ctll::push; - static constexpr auto rule(j, _others) -> ctll::push; - static constexpr auto rule(j, ctll::set<'-','[',']'>) -> ctll::reject; + static constexpr auto rule(k, ctll::term<'\x7B'>) + -> ctll::push, + push_hexdec, + hexdec_repeat, + ctll::term<'\x7D'>, + finish_hexdec>; + static constexpr auto rule(k, + ctll::set<'0', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) -> ctll::push, + push_hexdec, + ctll::set<'0', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f'>, + push_hexdec, + ctll::set<'0', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f'>, + push_hexdec, + finish_hexdec>; - static constexpr auto rule(k, ctll::term<'\x7B'>) -> ctll::push, push_hexdec, hexdec_repeat, ctll::term<'\x7D'>, finish_hexdec>; - static constexpr auto rule(k, ctll::set<'0','A','B','C','D','E','F','a','b','c','d','e','f','1','2','3','4','5','6','7','8','9'>) -> ctll::push, push_hexdec, ctll::set<'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','a','b','c','d','e','f'>, push_hexdec, ctll::set<'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','a','b','c','d','e','f'>, push_hexdec, finish_hexdec>; + static constexpr auto rule(l, ctll::term<'\x7B'>) + -> ctll::push, + push_hexdec, + hexdec_repeat, + ctll::term<'\x7D'>, + finish_hexdec>; + static constexpr auto rule(l, + ctll::set<'0', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) -> ctll::push, + push_hexdec, + finish_hexdec>; - static constexpr auto rule(l, ctll::term<'\x7B'>) -> ctll::push, push_hexdec, hexdec_repeat, ctll::term<'\x7D'>, finish_hexdec>; - static constexpr auto rule(l, ctll::set<'0','A','B','C','D','E','F','a','b','c','d','e','f','1','2','3','4','5','6','7','8','9'>) -> ctll::push, push_hexdec, finish_hexdec>; + static constexpr auto rule( + m, + ctll::set<'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'>) + -> ctll::push, + make_back_reference>; + static constexpr auto rule(m, ctll::term<'-'>) + -> ctll::push, + make_relative_back_reference>; + static constexpr auto rule(m, + ctll::set<'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z'>) + -> ctll::push, + make_back_reference>; - static constexpr auto rule(m, ctll::set<'0','1','2','3','4','5','6','7','8','9'>) -> ctll::push, make_back_reference>; - static constexpr auto rule(m, ctll::term<'-'>) -> ctll::push, make_relative_back_reference>; - static constexpr auto rule(m, ctll::set<'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'>) -> ctll::push, make_back_reference>; + static constexpr auto rule(mod, + ctll::set<'!', + '$', + '\x28', + '\x29', + ',', + '-', + '.', + '/', + '0', + ':', + '<', + '=', + '>', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '[', + '\\', + '\"', + ']', + '^', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '|', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) -> ctll::epsilon; + static constexpr auto rule(mod, ctll::epsilon) -> ctll::epsilon; + static constexpr auto rule(mod, _others) -> ctll::epsilon; + static constexpr auto rule(mod, ctll::term<'?'>) + -> ctll::push; + static constexpr auto rule(mod, ctll::term<'+'>) + -> ctll::push; + static constexpr auto rule(mod, + ctll::set<'*', '\x7B', '\x7D'>) -> ctll::reject; - static constexpr auto rule(mod, ctll::set<'!','$','\x28','\x29',',','-','.','/','0',':','<','=','>','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','[','\\','\"',']','^','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','|','1','2','3','4','5','6','7','8','9'>) -> ctll::epsilon; - static constexpr auto rule(mod, ctll::epsilon) -> ctll::epsilon; - static constexpr auto rule(mod, _others) -> ctll::epsilon; - static constexpr auto rule(mod, ctll::term<'?'>) -> ctll::push; - static constexpr auto rule(mod, ctll::term<'+'>) -> ctll::push; - static constexpr auto rule(mod, ctll::set<'*','\x7B','\x7D'>) -> ctll::reject; + static constexpr auto rule(mode_switch2, ctll::term<'i'>) + -> ctll::push; + static constexpr auto rule(mode_switch2, ctll::term<'c'>) + -> ctll::push; + static constexpr auto rule(mode_switch2, ctll::term<'m'>) + -> ctll::push; + static constexpr auto rule(mode_switch2, ctll::term<'s'>) + -> ctll::push; + static constexpr auto rule(mode_switch2, ctll::term<'\x29'>) + -> ctll::push; - static constexpr auto rule(mode_switch2, ctll::term<'i'>) -> ctll::push; - static constexpr auto rule(mode_switch2, ctll::term<'c'>) -> ctll::push; - static constexpr auto rule(mode_switch2, ctll::term<'m'>) -> ctll::push; - static constexpr auto rule(mode_switch2, ctll::term<'s'>) -> ctll::push; - static constexpr auto rule(mode_switch2, ctll::term<'\x29'>) -> ctll::push; + static constexpr auto rule( + n, + ctll::set<'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'>) + -> ctll::push, + mod>; + static constexpr auto rule(n, ctll::term<'\x7D'>) + -> ctll::push; - static constexpr auto rule(n, ctll::set<'0','1','2','3','4','5','6','7','8','9'>) -> ctll::push, mod>; - static constexpr auto rule(n, ctll::term<'\x7D'>) -> ctll::push; + static constexpr auto rule(number2, + ctll::set<',', '\x7D'>) -> ctll::epsilon; + static constexpr auto rule( + number2, + ctll::set<'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'>) + -> ctll::push; - static constexpr auto rule(number2, ctll::set<',','\x7D'>) -> ctll::epsilon; - static constexpr auto rule(number2, ctll::set<'0','1','2','3','4','5','6','7','8','9'>) -> ctll::push; + static constexpr auto rule( + number, + ctll::set<'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'>) + -> ctll::push; - static constexpr auto rule(number, ctll::set<'0','1','2','3','4','5','6','7','8','9'>) -> ctll::push; + static constexpr auto rule(o, + ctll::set<'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z'>) + -> ctll::push'>, + content_in_capture, + make_capture_with_name, + ctll::term<'\x29'>>; + static constexpr auto rule(o, ctll::term<'!'>) + -> ctll::push>; + static constexpr auto rule(o, ctll::term<'='>) + -> ctll::push>; - static constexpr auto rule(o, ctll::set<'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'>) -> ctll::push'>, content_in_capture, make_capture_with_name, ctll::term<'\x29'>>; - static constexpr auto rule(o, ctll::term<'!'>) -> ctll::push>; - static constexpr auto rule(o, ctll::term<'='>) -> ctll::push>; + static constexpr auto rule(p, ctll::term<'p'>) + -> ctll::push, + ctll::term<'a'>, + class_named_alpha>; + static constexpr auto rule(p, ctll::term<'n'>) + -> ctll::push, + ctll::term<'m'>, + class_named_alnum>; - static constexpr auto rule(p, ctll::term<'p'>) -> ctll::push, ctll::term<'a'>, class_named_alpha>; - static constexpr auto rule(p, ctll::term<'n'>) -> ctll::push, ctll::term<'m'>, class_named_alnum>; + static constexpr auto rule(property_name2, + ctll::term<'\x7D'>) -> ctll::epsilon; + static constexpr auto rule(property_name2, ctll::term<'='>) + -> ctll::push; + static constexpr auto rule(property_name2, + ctll::set<'0', + '.', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) + -> ctll::push; - static constexpr auto rule(property_name2, ctll::term<'\x7D'>) -> ctll::epsilon; - static constexpr auto rule(property_name2, ctll::term<'='>) -> ctll::push; - static constexpr auto rule(property_name2, ctll::set<'0','.','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9'>) -> ctll::push; + static constexpr auto rule(property_name, + ctll::set<'0', + '.', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) + -> ctll::push; - static constexpr auto rule(property_name, ctll::set<'0','.','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9'>) -> ctll::push; + static constexpr auto rule(property_value2, + ctll::term<'\x7D'>) -> ctll::epsilon; + static constexpr auto rule(property_value2, + ctll::set<'0', + '.', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) + -> ctll::push; - static constexpr auto rule(property_value2, ctll::term<'\x7D'>) -> ctll::epsilon; - static constexpr auto rule(property_value2, ctll::set<'0','.','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9'>) -> ctll::push; + static constexpr auto rule(property_value, + ctll::set<'0', + '.', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) + -> ctll::push; - static constexpr auto rule(property_value, ctll::set<'0','.','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9'>) -> ctll::push; + static constexpr auto rule(range, + ctll::set<'!', + '$', + '\x28', + '\x29', + '*', + '+', + ',', + '.', + '/', + '0', + ':', + '<', + '=', + '>', + '?', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '[', + '\\', + '\"', + ']', + '^', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '\x7B', + '|', + '\x7D', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) -> ctll::epsilon; + static constexpr auto rule(range, ctll::epsilon) -> ctll::epsilon; + static constexpr auto rule(range, _others) -> ctll::epsilon; + static constexpr auto rule(range, ctll::term<'-'>) + -> ctll::push; - static constexpr auto rule(range, ctll::set<'!','$','\x28','\x29','*','+',',','.','/','0',':','<','=','>','?','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','[','\\','\"',']','^','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','\x7B','|','\x7D','1','2','3','4','5','6','7','8','9'>) -> ctll::epsilon; - static constexpr auto rule(range, ctll::epsilon) -> ctll::epsilon; - static constexpr auto rule(range, _others) -> ctll::epsilon; - static constexpr auto rule(range, ctll::term<'-'>) -> ctll::push; + static constexpr auto rule(repeat, + ctll::set<'!', + '$', + '\x28', + '\x29', + ',', + '-', + '.', + '/', + '0', + ':', + '<', + '=', + '>', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '[', + '\\', + '\"', + ']', + '^', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '|', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) -> ctll::epsilon; + static constexpr auto rule(repeat, ctll::epsilon) -> ctll::epsilon; + static constexpr auto rule(repeat, _others) -> ctll::epsilon; + static constexpr auto rule(repeat, ctll::term<'?'>) + -> ctll::push; + static constexpr auto rule(repeat, ctll::term<'\x7B'>) + -> ctll::push; + static constexpr auto rule(repeat, ctll::term<'+'>) + -> ctll::push; + static constexpr auto rule(repeat, ctll::term<'*'>) + -> ctll::push; + static constexpr auto rule(repeat, ctll::term<'\x7D'>) -> ctll::reject; - static constexpr auto rule(repeat, ctll::set<'!','$','\x28','\x29',',','-','.','/','0',':','<','=','>','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','[','\\','\"',']','^','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','|','1','2','3','4','5','6','7','8','9'>) -> ctll::epsilon; - static constexpr auto rule(repeat, ctll::epsilon) -> ctll::epsilon; - static constexpr auto rule(repeat, _others) -> ctll::epsilon; - static constexpr auto rule(repeat, ctll::term<'?'>) -> ctll::push; - static constexpr auto rule(repeat, ctll::term<'\x7B'>) -> ctll::push; - static constexpr auto rule(repeat, ctll::term<'+'>) -> ctll::push; - static constexpr auto rule(repeat, ctll::term<'*'>) -> ctll::push; - static constexpr auto rule(repeat, ctll::term<'\x7D'>) -> ctll::reject; + static constexpr auto rule(set2a, ctll::term<']'>) -> ctll::epsilon; + static constexpr auto rule(set2a, ctll::term<'['>) + -> ctll:: + push, i, range, set_start, set2b>; + static constexpr auto rule(set2a, ctll::term<'\\'>) + -> ctll::push; + static constexpr auto rule(set2a, + ctll::set<'!', + '$', + '\x28', + '\x29', + '*', + '+', + ',', + '.', + '/', + ':', + '<', + '=', + '>', + '?', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '\"', + '^', + '0', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '\x7B', + '|', + '\x7D', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) + -> ctll::push; + static constexpr auto rule(set2a, _others) + -> ctll::push; + static constexpr auto rule(set2a, ctll::term<'-'>) -> ctll::reject; - static constexpr auto rule(set2a, ctll::term<']'>) -> ctll::epsilon; - static constexpr auto rule(set2a, ctll::term<'['>) -> ctll::push, i, range, set_start, set2b>; - static constexpr auto rule(set2a, ctll::term<'\\'>) -> ctll::push; - static constexpr auto rule(set2a, ctll::set<'!','$','\x28','\x29','*','+',',','.','/',':','<','=','>','?','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','\"','^','0','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','\x7B','|','\x7D','1','2','3','4','5','6','7','8','9'>) -> ctll::push; - static constexpr auto rule(set2a, _others) -> ctll::push; - static constexpr auto rule(set2a, ctll::term<'-'>) -> ctll::reject; + static constexpr auto rule(set2b, ctll::term<']'>) -> ctll::epsilon; + static constexpr auto rule(set2b, ctll::term<'['>) + -> ctll:: + push, i, range, set_combine, set2b>; + static constexpr auto rule(set2b, ctll::term<'\\'>) + -> ctll::push; + static constexpr auto rule(set2b, + ctll::set<'!', + '$', + '\x28', + '\x29', + '*', + '+', + ',', + '.', + '/', + ':', + '<', + '=', + '>', + '?', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '\"', + '^', + '0', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '\x7B', + '|', + '\x7D', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) + -> ctll:: + push; + static constexpr auto rule(set2b, _others) + -> ctll:: + push; + static constexpr auto rule(set2b, ctll::term<'-'>) -> ctll::reject; - static constexpr auto rule(set2b, ctll::term<']'>) -> ctll::epsilon; - static constexpr auto rule(set2b, ctll::term<'['>) -> ctll::push, i, range, set_combine, set2b>; - static constexpr auto rule(set2b, ctll::term<'\\'>) -> ctll::push; - static constexpr auto rule(set2b, ctll::set<'!','$','\x28','\x29','*','+',',','.','/',':','<','=','>','?','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','\"','^','0','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','\x7B','|','\x7D','1','2','3','4','5','6','7','8','9'>) -> ctll::push; - static constexpr auto rule(set2b, _others) -> ctll::push; - static constexpr auto rule(set2b, ctll::term<'-'>) -> ctll::reject; + static constexpr auto rule(string2, + ctll::set<'\x29', '|'>) -> ctll::epsilon; + static constexpr auto rule(string2, ctll::epsilon) -> ctll::epsilon; + static constexpr auto rule(string2, ctll::term<'\\'>) + -> ctll:: + push; + static constexpr auto rule(string2, ctll::term<'['>) + -> ctll::push; + static constexpr auto rule(string2, ctll::term<'\x28'>) + -> ctll::push; + static constexpr auto rule(string2, + ctll::term<'^'>) -> ctll::push; + static constexpr auto rule(string2, + ctll::term<'$'>) -> ctll::push; + static constexpr auto rule(string2, + ctll::set<'!', + ',', + '/', + ':', + '<', + '0', + '-', + '=', + '>', + 'A', + 'B', + 'C', + 'D', + 'E', + 'F', + 'G', + 'H', + 'I', + 'J', + 'K', + 'L', + 'M', + 'N', + 'O', + 'P', + 'Q', + 'R', + 'S', + 'T', + 'U', + 'V', + 'W', + 'X', + 'Y', + 'Z', + '\"', + ']', + '_', + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'i', + 'j', + 'k', + 'l', + 'm', + 'n', + 'o', + 'p', + 'q', + 'r', + 's', + 't', + 'u', + 'v', + 'w', + 'x', + 'y', + 'z', + '1', + '2', + '3', + '4', + '5', + '6', + '7', + '8', + '9'>) -> ctll::push; + static constexpr auto rule(string2, _others) -> ctll::push; + static constexpr auto rule(string2, ctll::term<'.'>) + -> ctll::push; + static constexpr auto rule(string2, + ctll::set<'*', '+', '?', '\x7B', '\x7D'>) + -> ctll::reject; + }; - static constexpr auto rule(string2, ctll::set<'\x29','|'>) -> ctll::epsilon; - static constexpr auto rule(string2, ctll::epsilon) -> ctll::epsilon; - static constexpr auto rule(string2, ctll::term<'\\'>) -> ctll::push; - static constexpr auto rule(string2, ctll::term<'['>) -> ctll::push; - static constexpr auto rule(string2, ctll::term<'\x28'>) -> ctll::push; - static constexpr auto rule(string2, ctll::term<'^'>) -> ctll::push; - static constexpr auto rule(string2, ctll::term<'$'>) -> ctll::push; - static constexpr auto rule(string2, ctll::set<'!',',','/',':','<','0','-','=','>','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','\"',']','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','1','2','3','4','5','6','7','8','9'>) -> ctll::push; - static constexpr auto rule(string2, _others) -> ctll::push; - static constexpr auto rule(string2, ctll::term<'.'>) -> ctll::push; - static constexpr auto rule(string2, ctll::set<'*','+','?','\x7B','\x7D'>) -> ctll::reject; +} // namespace ctre -}; - -} - -#endif //CTRE__PCRE__HPP +#endif // CTRE__PCRE__HPP #ifndef CTRE__ROTATE__HPP #define CTRE__ROTATE__HPP @@ -1436,94 +4109,112 @@ struct pcre { namespace ctre { -struct singleline { }; -struct multiline { }; + struct singleline {}; + struct multiline {}; -struct case_sensitive { }; -struct case_insensitive { }; + struct case_sensitive {}; + struct case_insensitive {}; -using ci = case_insensitive; -using cs = case_sensitive; + using ci = case_insensitive; + using cs = case_sensitive; -template struct flag_list { }; + template + struct flag_list {}; -struct flags { - bool block_empty_match = false; - bool multiline = false; - bool case_insensitive = false; - - constexpr flags() = default; - constexpr flags(const flags &) = default; - constexpr flags(flags &&) = default; - - constexpr CTRE_FORCE_INLINE flags(ctre::singleline v) noexcept { set_flag(v); } - constexpr CTRE_FORCE_INLINE flags(ctre::multiline v) noexcept { set_flag(v); } - constexpr CTRE_FORCE_INLINE flags(ctre::case_sensitive v) noexcept { set_flag(v); } - constexpr CTRE_FORCE_INLINE flags(ctre::case_insensitive v) noexcept { set_flag(v); } - - - template constexpr CTRE_FORCE_INLINE flags(ctll::list) noexcept { - (this->set_flag(Args{}), ...); - } - - constexpr friend CTRE_FORCE_INLINE auto operator+(flags f, pcre::mode_case_insensitive) noexcept { - f.case_insensitive = true; - return f; - } - - constexpr friend CTRE_FORCE_INLINE auto operator+(flags f, pcre::mode_case_sensitive) noexcept { - f.case_insensitive = false; - return f; - } - - constexpr friend CTRE_FORCE_INLINE auto operator+(flags f, pcre::mode_singleline) noexcept { - f.multiline = false; - return f; - } - - constexpr friend CTRE_FORCE_INLINE auto operator+(flags f, pcre::mode_multiline) noexcept { - f.multiline = true; - return f; - } - - constexpr CTRE_FORCE_INLINE void set_flag(ctre::singleline) noexcept { - multiline = false; - } - - constexpr CTRE_FORCE_INLINE void set_flag(ctre::multiline) noexcept { - multiline = true; - } - - constexpr CTRE_FORCE_INLINE void set_flag(ctre::case_insensitive) noexcept { - case_insensitive = true; - } - - constexpr CTRE_FORCE_INLINE void set_flag(ctre::case_sensitive) noexcept { - case_insensitive = false; - } -}; + struct flags { + bool block_empty_match = false; + bool multiline = false; + bool case_insensitive = false; -constexpr CTRE_FORCE_INLINE auto not_empty_match(flags f) { - f.block_empty_match = true; - return f; -} + constexpr flags() = default; + constexpr flags(const flags&) = default; + constexpr flags(flags&&) = default; -constexpr CTRE_FORCE_INLINE auto consumed_something(flags f, bool condition = true) { - if (condition) f.block_empty_match = false; - return f; -} + constexpr CTRE_FORCE_INLINE flags(ctre::singleline v) noexcept { + set_flag(v); + } + constexpr CTRE_FORCE_INLINE flags(ctre::multiline v) noexcept { + set_flag(v); + } + constexpr CTRE_FORCE_INLINE flags(ctre::case_sensitive v) noexcept { + set_flag(v); + } + constexpr CTRE_FORCE_INLINE flags(ctre::case_insensitive v) noexcept { + set_flag(v); + } -constexpr CTRE_FORCE_INLINE bool cannot_be_empty_match(flags f) { - return f.block_empty_match; -} + template + constexpr CTRE_FORCE_INLINE flags(ctll::list) noexcept { + (this->set_flag(Args {}), ...); + } -constexpr CTRE_FORCE_INLINE bool multiline_mode(flags f) { - return f.multiline; -} + constexpr friend CTRE_FORCE_INLINE auto operator+( + flags f, + pcre::mode_case_insensitive) noexcept { + f.case_insensitive = true; + return f; + } -constexpr CTRE_FORCE_INLINE bool is_case_insensitive(flags f) { - return f.case_insensitive; -} + constexpr friend CTRE_FORCE_INLINE auto operator+( + flags f, + pcre::mode_case_sensitive) noexcept { + f.case_insensitive = false; + return f; + } + + constexpr friend CTRE_FORCE_INLINE auto operator+( + flags f, + pcre::mode_singleline) noexcept { + f.multiline = false; + return f; + } + + constexpr friend CTRE_FORCE_INLINE auto operator+( + flags f, + pcre::mode_multiline) noexcept { + f.multiline = true; + return f; + } + + constexpr CTRE_FORCE_INLINE void set_flag(ctre::singleline) noexcept { + multiline = false; + } + + constexpr CTRE_FORCE_INLINE void set_flag(ctre::multiline) noexcept { + multiline = true; + } + + constexpr CTRE_FORCE_INLINE void set_flag(ctre::case_insensitive) noexcept { + case_insensitive = true; + } + + constexpr CTRE_FORCE_INLINE void set_flag(ctre::case_sensitive) noexcept { + case_insensitive = false; + } + }; + + constexpr CTRE_FORCE_INLINE auto not_empty_match(flags f) { + f.block_empty_match = true; + return f; + } + + constexpr CTRE_FORCE_INLINE auto consumed_something(flags f, + bool condition = true) { + if (condition) f.block_empty_match = false; + return f; + } + + constexpr CTRE_FORCE_INLINE bool cannot_be_empty_match(flags f) { + return f.block_empty_match; + } + + constexpr CTRE_FORCE_INLINE bool multiline_mode(flags f) { + return f.multiline; + } + + constexpr CTRE_FORCE_INLINE bool is_case_insensitive(flags f) { + return f.case_insensitive; + } } // namespace ctre @@ -1531,206 +4222,305 @@ constexpr CTRE_FORCE_INLINE bool is_case_insensitive(flags f) { #include namespace ctre { - -// sfinae check for types here -template class MatchesCharacter { - template static auto test(CharT c) -> decltype(Y::match_char(c, std::declval()), std::true_type()); - template static auto test(...) -> std::false_type; -public: - template static inline constexpr bool value = decltype(test(std::declval()))(); -}; + // sfinae check for types here -template constexpr CTRE_FORCE_INLINE bool is_ascii_alpha(T v) { - return ((v >= static_cast('a') && v <= static_cast('z')) || (v >= static_cast('A') && v <= static_cast('Z'))); -} + template + class MatchesCharacter { + template + static auto test(CharT c) + -> decltype(Y::match_char(c, std::declval()), + std::true_type()); + template + static auto test(...) -> std::false_type; -template constexpr CTRE_FORCE_INLINE bool is_ascii_alpha_lowercase(T v) { - return (v >= static_cast('a')) && (v <= static_cast('z')); -} + public: + template + static inline constexpr bool value = + decltype(test(std::declval()))(); + }; -template constexpr CTRE_FORCE_INLINE bool is_ascii_alpha_uppercase(T v) { - return (v >= static_cast('A')) && v <= (static_cast('Z')); -} + template + constexpr CTRE_FORCE_INLINE bool is_ascii_alpha(T v) { + return ((v >= static_cast('a') && v <= static_cast('z')) || + (v >= static_cast('A') && v <= static_cast('Z'))); + } -template struct character { - template CTRE_FORCE_INLINE static constexpr bool match_char(CharT value, const flags & f) noexcept { - if constexpr (is_ascii_alpha(V)) { - if (is_case_insensitive(f)) { - if (value == (V ^ static_cast(0x20))) { - return true;// - } - } - } - return value == V; - } -}; + template + constexpr CTRE_FORCE_INLINE bool is_ascii_alpha_lowercase(T v) { + return (v >= static_cast('a')) && (v <= static_cast('z')); + } -template struct negative_set { - template CTRE_FORCE_INLINE static constexpr bool match_char(CharT value, const flags & f) noexcept { - return !(Content::match_char(value, f) || ... || false); - } -}; + template + constexpr CTRE_FORCE_INLINE bool is_ascii_alpha_uppercase(T v) { + return (v >= static_cast('A')) && v <= (static_cast('Z')); + } -template struct set { - template CTRE_FORCE_INLINE static constexpr bool match_char(CharT value, const flags & f) noexcept { - return (Content::match_char(value, f) || ... || false); - } -}; + template + struct character { + template + CTRE_FORCE_INLINE static constexpr bool match_char( + CharT value, + const flags& f) noexcept { + if constexpr (is_ascii_alpha(V)) { + if (is_case_insensitive(f)) { + if (value == (V ^ static_cast(0x20))) { + return true; // + } + } + } + return value == V; + } + }; -template struct enumeration : set...> { }; + template + struct negative_set { + template + CTRE_FORCE_INLINE static constexpr bool match_char( + CharT value, + const flags& f) noexcept { + return !(Content::match_char(value, f) || ... || false); + } + }; -template struct negate { - template CTRE_FORCE_INLINE static constexpr bool match_char(CharT value, const flags & f) noexcept { - return !(Content::match_char(value, f) || ... || false); - } -}; + template + struct set { + template + CTRE_FORCE_INLINE static constexpr bool match_char( + CharT value, + const flags& f) noexcept { + return (Content::match_char(value, f) || ... || false); + } + }; -template struct char_range { - template CTRE_FORCE_INLINE static constexpr bool match_char(CharT value, const flags & f) noexcept { - if constexpr (is_ascii_alpha_lowercase(A) && is_ascii_alpha_lowercase(B)) { - if (is_case_insensitive(f)) { - if (value >= (A ^ static_cast(0x20)) && value <= (B ^ static_cast(0x20))) { - return true;// - } - } - } else if constexpr (is_ascii_alpha_uppercase(A) && is_ascii_alpha_uppercase(B)) { - if (is_case_insensitive(f)) { - if (value >= (A ^ static_cast(0x20)) && value <= (B ^ static_cast(0x20))) { - return true;// - } - } - } - return (value >= A) && (value <= B); - } -}; -using word_chars = set, char_range<'a','z'>, char_range<'0','9'>, character<'_'> >; + template + struct enumeration : set...> {}; -using space_chars = enumeration<' ', '\t', '\n', '\v', '\f', '\r'>; + template + struct negate { + template + CTRE_FORCE_INLINE static constexpr bool match_char( + CharT value, + const flags& f) noexcept { + return !(Content::match_char(value, f) || ... || false); + } + }; -using vertical_space_chars = enumeration< - char{0x000A}, // Linefeed (LF) - char{0x000B}, // Vertical tab (VT) - char{0x000C}, // Form feed (FF) - char{0x000D}, // Carriage return (CR) - char32_t{0x0085}, // Next line (NEL) - char32_t{0x2028}, // Line separator - char32_t{0x2029} // Paragraph separator ->; + template + struct char_range { + template + CTRE_FORCE_INLINE static constexpr bool match_char( + CharT value, + const flags& f) noexcept { + if constexpr (is_ascii_alpha_lowercase(A) && + is_ascii_alpha_lowercase(B)) { + if (is_case_insensitive(f)) { + if (value >= (A ^ static_cast(0x20)) && + value <= (B ^ static_cast(0x20))) { + return true; // + } + } + } else if constexpr (is_ascii_alpha_uppercase(A) && + is_ascii_alpha_uppercase(B)) { + if (is_case_insensitive(f)) { + if (value >= (A ^ static_cast(0x20)) && + value <= (B ^ static_cast(0x20))) { + return true; // + } + } + } + return (value >= A) && (value <= B); + } + }; + using word_chars = set, + char_range<'a', 'z'>, + char_range<'0', '9'>, + character<'_'>>; -using horizontal_space_chars = enumeration< - char{0x0009}, // Horizontal tab (HT) - char{0x0020}, // Space - char32_t{0x00A0}, // Non-break space - char32_t{0x1680}, // Ogham space mark - char32_t{0x180E}, // Mongolian vowel separator - char32_t{0x2000}, // En quad - char32_t{0x2001}, // Em quad - char32_t{0x2002}, // En space - char32_t{0x2003}, // Em space - char32_t{0x2004}, // Three-per-em space - char32_t{0x2005}, // Four-per-em space - char32_t{0x2006}, // Six-per-em space - char32_t{0x2007}, // Figure space - char32_t{0x2008}, // Punctuation space - char32_t{0x2009}, // Thin space - char32_t{0x200A}, // Hair space - char32_t{0x202F}, // Narrow no-break space - char32_t{0x205F}, // Medium mathematical space - char32_t{0x3000} // Ideographic space ->; + using space_chars = enumeration<' ', '\t', '\n', '\v', '\f', '\r'>; -using alphanum_chars = set, char_range<'a','z'>, char_range<'0','9'> >; + using vertical_space_chars = + enumeration; -using alpha_chars = set, char_range<'a','z'> >; + using horizontal_space_chars = + enumeration; -using xdigit_chars = set, char_range<'a','f'>, char_range<'0','9'> >; + using alphanum_chars = + set, char_range<'a', 'z'>, char_range<'0', '9'>>; -using punct_chars - = enumeration<'!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', - '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', - '^', '_', '`', '{', '|', '}', '~'>; + using alpha_chars = set, char_range<'a', 'z'>>; -using digit_chars = char_range<'0','9'>; + using xdigit_chars = + set, char_range<'a', 'f'>, char_range<'0', '9'>>; -using ascii_chars = char_range<'\x00','\x7F'>; + using punct_chars = enumeration<'!', + '"', + '#', + '$', + '%', + '&', + '\'', + '(', + ')', + '*', + '+', + ',', + '-', + '.', + '/', + ':', + ';', + '<', + '=', + '>', + '?', + '@', + '[', + '\\', + ']', + '^', + '_', + '`', + '{', + '|', + '}', + '~'>; -} + using digit_chars = char_range<'0', '9'>; + + using ascii_chars = char_range<'\x00', '\x7F'>; + +} // namespace ctre #endif #include namespace ctre { - -// special helpers for matching -struct accept { }; -struct reject { }; -struct start_mark { }; -struct end_mark { }; -struct end_cycle_mark { }; -struct end_lookahead_mark { }; -struct end_lookbehind_mark { }; -template struct numeric_mark { }; -struct any { }; + // special helpers for matching + struct accept {}; + struct reject {}; + struct start_mark {}; + struct end_mark {}; + struct end_cycle_mark {}; + struct end_lookahead_mark {}; + struct end_lookbehind_mark {}; + template + struct numeric_mark {}; -// actual AST of regexp -template struct string { }; -template struct select { }; -template struct sequence { }; -struct empty { }; + struct any {}; -template struct repeat { }; -template using plus = repeat<1,0,Content...>; -template using star = repeat<0,0,Content...>; + // actual AST of regexp + template + struct string {}; + template + struct select {}; + template + struct sequence {}; + struct empty {}; -template struct lazy_repeat { }; -template using lazy_plus = lazy_repeat<1,0,Content...>; -template using lazy_star = lazy_repeat<0,0,Content...>; + template + struct repeat {}; + template + using plus = repeat<1, 0, Content...>; + template + using star = repeat<0, 0, Content...>; -template struct possessive_repeat { }; -template using possessive_plus = possessive_repeat<1,0,Content...>; -template using possessive_star = possessive_repeat<0,0,Content...>; + template + struct lazy_repeat {}; + template + using lazy_plus = lazy_repeat<1, 0, Content...>; + template + using lazy_star = lazy_repeat<0, 0, Content...>; -template using optional = repeat<0,1,Content...>; -template using lazy_optional = lazy_repeat<0,1,Content...>; -template using possessive_optional = possessive_repeat<0,1,Content...>; + template + struct possessive_repeat {}; + template + using possessive_plus = possessive_repeat<1, 0, Content...>; + template + using possessive_star = possessive_repeat<0, 0, Content...>; -template struct capture { }; + template + using optional = repeat<0, 1, Content...>; + template + using lazy_optional = lazy_repeat<0, 1, Content...>; + template + using possessive_optional = possessive_repeat<0, 1, Content...>; -template struct capture_with_name { }; + template + struct capture {}; -template struct back_reference { }; -template struct back_reference_with_name { }; + template + struct capture_with_name {}; -template struct look_start { }; + template + struct back_reference {}; + template + struct back_reference_with_name {}; -template struct lookahead_positive { }; -template struct lookahead_negative { }; + template + struct look_start {}; -template struct lookbehind_positive { }; -template struct lookbehind_negative { }; + template + struct lookahead_positive {}; + template + struct lookahead_negative {}; -struct atomic_start { }; + template + struct lookbehind_positive {}; + template + struct lookbehind_negative {}; -template struct atomic_group { }; + struct atomic_start {}; -template struct boundary { }; -template struct not_boundary { }; + template + struct atomic_group {}; -using word_boundary = boundary; -using not_word_boundary = not_boundary; + template + struct boundary {}; + template + struct not_boundary {}; -struct assert_subject_begin { }; -struct assert_subject_end { }; -struct assert_subject_end_line{ }; -struct assert_line_begin { }; -struct assert_line_end { }; + using word_boundary = boundary; + using not_word_boundary = not_boundary; -template struct mode_switch { }; + struct assert_subject_begin {}; + struct assert_subject_end {}; + struct assert_subject_end_line {}; + struct assert_line_begin {}; + struct assert_line_end {}; -} + template + struct mode_switch {}; + +} // namespace ctre #endif @@ -1743,339 +4533,428 @@ template struct mode_switch { }; #include -namespace uni -{ - enum class category; - enum class property; - enum class version : unsigned char; - enum class script ; - enum class block; +namespace uni { + enum class category; + enum class property; + enum class version : unsigned char; + enum class script; + enum class block; - struct script_extensions_view { - constexpr script_extensions_view(char32_t); + struct script_extensions_view { + constexpr script_extensions_view(char32_t); - struct sentinel {}; - struct iterator { + struct sentinel {}; + struct iterator { + constexpr iterator(char32_t c); + constexpr script operator*() const; - constexpr iterator(char32_t c); - constexpr script operator*() const; + constexpr iterator& operator++(int); - constexpr iterator& operator++(int); + constexpr iterator operator++(); - constexpr iterator operator++(); + constexpr bool operator==(sentinel) const; + constexpr bool operator!=(sentinel) const; - constexpr bool operator==(sentinel) const; - constexpr bool operator!=(sentinel) const; - - private: - char32_t m_c; - script m_script; - int idx = 1; - }; - - constexpr iterator begin() const; - constexpr sentinel end() const; - - private: - char32_t c; + private: + char32_t m_c; + script m_script; + int idx = 1; }; - struct numeric_value { + constexpr iterator begin() const; + constexpr sentinel end() const; - constexpr double value() const; - constexpr long long numerator() const; - constexpr int denominator() const; - constexpr bool is_valid() const; + private: + char32_t c; + }; - protected: - constexpr numeric_value() = default; - constexpr numeric_value(long long n, int16_t d); + struct numeric_value { + constexpr double value() const; + constexpr long long numerator() const; + constexpr int denominator() const; + constexpr bool is_valid() const; - long long _n = 0; - int16_t _d = 0; - friend constexpr numeric_value cp_numeric_value(char32_t cp); - }; + protected: + constexpr numeric_value() = default; + constexpr numeric_value(long long n, int16_t d); - constexpr category cp_category(char32_t cp); - constexpr script cp_script(char32_t cp); - constexpr script_extensions_view cp_script_extensions(char32_t cp); - constexpr version cp_age(char32_t cp); - constexpr block cp_block(char32_t cp); - constexpr bool cp_is_valid(char32_t cp); - constexpr bool cp_is_assigned(char32_t cp); - constexpr bool cp_is_ascii(char32_t cp); - constexpr numeric_value cp_numeric_value(char32_t cp); + long long _n = 0; + int16_t _d = 0; + friend constexpr numeric_value cp_numeric_value(char32_t cp); + }; - template