add scan_repeat_literal to scanner

This commit is contained in:
2025-12-07 18:11:34 +01:00
parent c0d6f53808
commit e3bfde5826
2 changed files with 9 additions and 0 deletions
+8
View File
@@ -76,6 +76,14 @@ bool scan_literal(scanner_t *s, const char *lit) {
return false;
}
int scan_repeat_literal(scanner_t *s, const char *lit) {
int n_repeats = 0;
while (scan_literal(s, lit)) {
n_repeats++;
}
return n_repeats;
}
bool scan_whitespace(scanner_t *s) {
const char *save = s->cur;
while (isspace((unsigned char)*s->cur)) s->cur++;