MCPcopy Create free account
hub / github.com/commonmark/cmark / take_while

Function take_while

src/inlines.c:259–270  ·  view source on GitHub ↗

Take characters while a predicate holds, and return a string.

Source from the content-addressed store, hash-verified

257
258// Take characters while a predicate holds, and return a string.
259static inline cmark_chunk take_while(subject *subj, int (*f)(int)) {
260 unsigned char c;
261 bufsize_t startpos = subj->pos;
262 bufsize_t len = 0;
263
264 while ((c = peek_char(subj)) && (*f)(c)) {
265 advance(subj);
266 len++;
267 }
268
269 return cmark_chunk_dup(&subj->input, startpos, len);
270}
271
272// Return the number of newlines in a given span of text in a subject. If
273// the number is greater than zero, also return the number of characters

Callers 1

handle_backticksFunction · 0.85

Calls 2

peek_charFunction · 0.85
cmark_chunk_dupFunction · 0.85

Tested by

no test coverage detected