MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / regex_skip_bracket

Function regex_skip_bracket

src/foundation/compat_regex.c:87–108  ·  view source on GitHub ↗

Skip the bracket expression opening at p[i] == '['. Returns the index just * past its closing ']', or the end of the string when it is unterminated. * Nothing inside is an operator: `[]a]`, `[^]a]` and `[[:alpha:]]` are each * one atom, and a brace inside brackets never opens an interval. */

Source from the content-addressed store, hash-verified

85 * Nothing inside is an operator: `[]a]`, `[^]a]` and `[[:alpha:]]` are each
86 * one atom, and a brace inside brackets never opens an interval. */
87static size_t regex_skip_bracket(const char *p, size_t i) {
88 size_t j = i + 1;
89 if (p[j] == '^') {
90 j++;
91 }
92 if (p[j] == ']') {
93 j++;
94 }
95 while (p[j] && p[j] != ']') {
96 if (p[j] == '[' && (p[j + 1] == ':' || p[j + 1] == '=' || p[j + 1] == '.')) {
97 char close = p[j + 1];
98 size_t k = j + 2;
99 while (p[k] && !(p[k] == close && p[k + 1] == ']')) {
100 k++;
101 }
102 j = p[k] ? k + 2 : k;
103 } else {
104 j++;
105 }
106 }
107 return p[j] ? j + 1 : j;
108}
109
110static bool regex_parse_digits(const char *p, size_t *i, uint64_t *value) {
111 bool any = false;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected