MCPcopy Create free account
hub / github.com/danihek/hellwal / hell_parser_status_t hell_parser_delim

Function hell_parser_status_t hell_parser_delim

hell_parser.h:164–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162}
163
164HELL_DEF hell_parser_status_t hell_parser_delim(hell_parser_t *parser, char delim, unsigned count)
165{
166 if (!parser)
167 return HELL_PARSER_ERROR;
168
169 count = (count == 0) ? 1 : count; /* Default count to 1 if 0 */
170 size_t matched = 0; /* Tracks consecutive delimiter matches */
171
172 while (!hell_parser_eof(parser))
173 {
174 char current;
175 if (hell_parser_next(parser, &current) != HELL_PARSER_OK)
176 break;
177
178 if (current == delim)
179 {
180 matched++;
181 if (matched == count)
182 return HELL_PARSER_OK;
183 }
184 else
185 matched = 0;
186 }
187 return HELL_PARSER_ERROR;
188}
189
190/* Get content inside delim [count] times, if count is 0 it defaults to 1.
191 * For example, for '%' with count 2, it triggers on "%%" in the text.

Callers

nothing calls this directly

Calls 1

hell_parser_eofFunction · 0.85

Tested by

no test coverage detected