diff --git a/README.md b/README.md index 8dfd6f2..fd6da8a 100644 --- a/README.md +++ b/README.md @@ -51,21 +51,11 @@ uintptr_t spp_until(struct Stream s, const char *list); // Returns current cursor position of the stream. 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