This commit is contained in:
2026-04-08 19:45:06 -05:00
parent 6514358e61
commit 3d1c458e0c

View File

@@ -51,21 +51,11 @@ uintptr_t spp_until(struct Stream s, const char *list);
// Returns current cursor position of the stream. // Returns current cursor position of the stream.
const char *spp_cursor(struct Stream s); const char *spp_cursor(struct Stream s);
``` // Pass a custom callback to parse a stream.
typedef bool (*parse)(struct Stream s, const char **start, ptrdiff_t *len);
uintptr_t spp_parse(struct Stream s, parse fn, const char *buf[], ptrdiff_t cnt[], uintptr_t cap );
## Tokenizing Words
```
while (!spp_eof(s)) {
spp_skip(s, WS);
const char *start = spp_cursor(s);
uintptr_t len = spp_until(s, WS);
if (len > 0) {
printf("Token: %.*s\n", (int)len, start);
}
}
``` ```
## Acknowledgments ## Acknowledgments