README
This commit is contained in:
16
README.md
16
README.md
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user