comparison th_regex.h @ 669:7493d4c9ff77

Add some regex flags, features to be implemented "some day".
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 28 Jan 2020 20:10:16 +0200
parents c5aa9ada1051
children 4ca6a3b30fe8
comparison
equal deleted inserted replaced
668:48e8820bc625 669:7493d4c9ff77
36 */ 36 */
37 typedef struct 37 typedef struct
38 { 38 {
39 th_llist_t node; ///< Internal linked list data 39 th_llist_t node; ///< Internal linked list data
40 40
41 int type; ///< Type of this match, TH_RE_MATCH_*
42
41 size_t start; ///< Start offset of the match sequence in @p haystack in @c th_char_t units. 43 size_t start; ///< Start offset of the match sequence in @p haystack in @c th_char_t units.
42 size_t len; ///< Length of the match sequence in @p haystack in @c th_char_t units. 44 size_t len; ///< Length of the match sequence in @p haystack in @c th_char_t units.
43 } th_regex_match_t; 45 } th_regex_match_t;
44 46
45 47
46 // Flags for th_regex_match() 48 /** @brief
47 // (not actually used or supported yet :D) 49 * Flags @c th_regex_match_t @c type field.
50 */
48 enum 51 enum
49 { 52 {
50 TH_REF_CASEFOLD = 0x0001, 53 TH_RE_MATCH_EXPR,
51 TH_REF_ANCHORED = 0x0002, 54 TH_RE_MATCH_SUBEXPR,
55 };
56
57
58 /** @brief
59 * Flags for th_regex_match(). NOTE! Not actually implemented or supported yet!
60 */
61 enum
62 {
63 TH_REF_CASEFOLD = 0x0001, ///< Use case-folding
64 TH_REF_ANCHORED = 0x0002, ///< Implicitly consider expression "anchored" even without explicit ^$
65 TH_REF_NEWLINE = 0x0004, ///< IF SET: Anchors will refer to line start/newline instead of string start/end
66 TH_REF_SUBMATCH = 0x0008, ///< Include sub-expression matches in results
52 }; 67 };
53 68
54 69
55 #ifdef TH_EXPERIMENTAL_REGEX_DEBUG 70 #ifdef TH_EXPERIMENTAL_REGEX_DEBUG
56 extern th_ioctx *th_dbg_fh; 71 extern th_ioctx *th_dbg_fh;