1 // Copyright (c) 2018-2020 Dr. Colin Hirsch and Daniel Frey
2 // Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/
3 
4 #ifndef TAO_PEGTL_CONTRIB_ICU_UTF8_HPP
5 #define TAO_PEGTL_CONTRIB_ICU_UTF8_HPP
6 
7 #include "internal.hpp"
8 
9 #include "../../config.hpp"
10 #include "../../utf8.hpp"
11 
12 #include "../../internal/peek_utf8.hpp"
13 
14 namespace TAO_PEGTL_NAMESPACE::utf8::icu
15 {
16    template< UProperty P, bool V = true >
17    struct binary_property
18       : internal::icu::binary_property< internal::peek_utf8, P, V >
19    {};
20 
21    template< UProperty P, int V >
22    struct property_value
23       : internal::icu::property_value< internal::peek_utf8, P, V >
24    {};
25 
26    // clang-format off
27    struct alphabetic : binary_property< UCHAR_ALPHABETIC > {};
28    struct ascii_hex_digit : binary_property< UCHAR_ASCII_HEX_DIGIT > {};
29    struct bidi_control : binary_property< UCHAR_BIDI_CONTROL > {};
30    struct bidi_mirrored : binary_property< UCHAR_BIDI_MIRRORED > {};
31    struct case_sensitive : binary_property< UCHAR_CASE_SENSITIVE > {};
32    struct dash : binary_property< UCHAR_DASH > {};
33    struct default_ignorable_code_point : binary_property< UCHAR_DEFAULT_IGNORABLE_CODE_POINT > {};
34    struct deprecated : binary_property< UCHAR_DEPRECATED > {};
35    struct diacritic : binary_property< UCHAR_DIACRITIC > {};
36    struct extender : binary_property< UCHAR_EXTENDER > {};
37    struct full_composition_exclusion : binary_property< UCHAR_FULL_COMPOSITION_EXCLUSION > {};
38    struct grapheme_base : binary_property< UCHAR_GRAPHEME_BASE > {};
39    struct grapheme_extend : binary_property< UCHAR_GRAPHEME_EXTEND > {};
40    struct grapheme_link : binary_property< UCHAR_GRAPHEME_LINK > {};
41    struct hex_digit : binary_property< UCHAR_HEX_DIGIT > {};
42    struct hyphen : binary_property< UCHAR_HYPHEN > {};
43    struct id_continue : binary_property< UCHAR_ID_CONTINUE > {};
44    struct id_start : binary_property< UCHAR_ID_START > {};
45    struct ideographic : binary_property< UCHAR_IDEOGRAPHIC > {};
46    struct ids_binary_operator : binary_property< UCHAR_IDS_BINARY_OPERATOR > {};
47    struct ids_trinary_operator : binary_property< UCHAR_IDS_TRINARY_OPERATOR > {};
48    struct join_control : binary_property< UCHAR_JOIN_CONTROL > {};
49    struct logical_order_exception : binary_property< UCHAR_LOGICAL_ORDER_EXCEPTION > {};
50    struct lowercase : binary_property< UCHAR_LOWERCASE > {};
51    struct math : binary_property< UCHAR_MATH > {};
52    struct nfc_inert : binary_property< UCHAR_NFC_INERT > {};
53    struct nfd_inert : binary_property< UCHAR_NFD_INERT > {};
54    struct nfkc_inert : binary_property< UCHAR_NFKC_INERT > {};
55    struct nfkd_inert : binary_property< UCHAR_NFKD_INERT > {};
56    struct noncharacter_code_point : binary_property< UCHAR_NONCHARACTER_CODE_POINT > {};
57    struct pattern_syntax : binary_property< UCHAR_PATTERN_SYNTAX > {};
58    struct pattern_white_space : binary_property< UCHAR_PATTERN_WHITE_SPACE > {};
59    struct posix_alnum : binary_property< UCHAR_POSIX_ALNUM > {};
60    struct posix_blank : binary_property< UCHAR_POSIX_BLANK > {};
61    struct posix_graph : binary_property< UCHAR_POSIX_GRAPH > {};
62    struct posix_print : binary_property< UCHAR_POSIX_PRINT > {};
63    struct posix_xdigit : binary_property< UCHAR_POSIX_XDIGIT > {};
64    struct quotation_mark : binary_property< UCHAR_QUOTATION_MARK > {};
65    struct radical : binary_property< UCHAR_RADICAL > {};
66    struct s_term : binary_property< UCHAR_S_TERM > {};
67    struct segment_starter : binary_property< UCHAR_SEGMENT_STARTER > {};
68    struct soft_dotted : binary_property< UCHAR_SOFT_DOTTED > {};
69    struct terminal_punctuation : binary_property< UCHAR_TERMINAL_PUNCTUATION > {};
70    struct unified_ideograph : binary_property< UCHAR_UNIFIED_IDEOGRAPH > {};
71    struct uppercase : binary_property< UCHAR_UPPERCASE > {};
72    struct variation_selector : binary_property< UCHAR_VARIATION_SELECTOR > {};
73    struct white_space : binary_property< UCHAR_WHITE_SPACE > {};
74    struct xid_continue : binary_property< UCHAR_XID_CONTINUE > {};
75    struct xid_start : binary_property< UCHAR_XID_START > {};
76 
77    template< UCharDirection V > struct bidi_class : property_value< UCHAR_BIDI_CLASS, V > {};
78    template< UBlockCode V > struct block : property_value< UCHAR_BLOCK, V > {};
79    template< UDecompositionType V > struct decomposition_type : property_value< UCHAR_DECOMPOSITION_TYPE, V > {};
80    template< UEastAsianWidth V > struct east_asian_width : property_value< UCHAR_EAST_ASIAN_WIDTH, V > {};
81    template< UCharCategory V > struct general_category : property_value< UCHAR_GENERAL_CATEGORY, V > {};
82    template< UGraphemeClusterBreak V > struct grapheme_cluster_break : property_value< UCHAR_GRAPHEME_CLUSTER_BREAK, V > {};
83    template< UHangulSyllableType V > struct hangul_syllable_type : property_value< UCHAR_HANGUL_SYLLABLE_TYPE, V > {};
84    template< UJoiningGroup V > struct joining_group : property_value< UCHAR_JOINING_GROUP, V > {};
85    template< UJoiningType V > struct joining_type : property_value< UCHAR_JOINING_TYPE, V > {};
86    template< ULineBreak V > struct line_break : property_value< UCHAR_LINE_BREAK, V > {};
87    // UNormalizationCheckResult requires an additional header <unicode/unorm2.h>:
88    // template< UNormalizationCheckResult V > struct nfc_quick_check : property_value< UCHAR_NFC_QUICK_CHECK, V > {};
89    // template< UNormalizationCheckResult V > struct nfd_quick_check : property_value< UCHAR_NFD_QUICK_CHECK, V > {};
90    // template< UNormalizationCheckResult V > struct nfkc_quick_check : property_value< UCHAR_NFKC_QUICK_CHECK, V > {};
91    // template< UNormalizationCheckResult V > struct nfkd_quick_check : property_value< UCHAR_NFKD_QUICK_CHECK, V > {};
92    template< UNumericType V > struct numeric_type : property_value< UCHAR_NUMERIC_TYPE, V > {};
93    template< USentenceBreak V > struct sentence_break : property_value< UCHAR_SENTENCE_BREAK, V > {};
94    template< UWordBreakValues V > struct word_break : property_value< UCHAR_WORD_BREAK, V > {};
95 
96    template< std::uint8_t V > struct canonical_combining_class : property_value< UCHAR_CANONICAL_COMBINING_CLASS, V > {};
97    template< std::uint8_t V > struct lead_canonical_combining_class : property_value< UCHAR_LEAD_CANONICAL_COMBINING_CLASS, V > {};
98    template< std::uint8_t V > struct trail_canonical_combining_class : property_value< UCHAR_TRAIL_CANONICAL_COMBINING_CLASS, V > {};
99    // clang-format on
100 
101 }  // namespace TAO_PEGTL_NAMESPACE::utf8::icu
102 
103 #endif
104