diff options
Diffstat (limited to 'src/scanner.h')
| -rw-r--r-- | src/scanner.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/scanner.h b/src/scanner.h new file mode 100644 index 0000000..22c2c41 --- /dev/null +++ b/src/scanner.h | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | // scanner.h | ||
| 2 | #ifndef INCLUDED_SCANNER_H | ||
| 3 | #define INCLUDED_SCANNER_H | ||
| 4 | |||
| 5 | #include <stdbool.h> | ||
| 6 | #include <stddef.h> | ||
| 7 | #include <stdint.h> | ||
| 8 | |||
| 9 | #include "string-view.h" | ||
| 10 | |||
| 11 | struct scanner { | ||
| 12 | const char *cursor; | ||
| 13 | const char *end; | ||
| 14 | }; | ||
| 15 | |||
| 16 | void scanner__init (struct scanner *, struct string_view); | ||
| 17 | void scanner__skip_until (struct scanner *, char); | ||
| 18 | void scanner__skip_over (struct scanner *, char); | ||
| 19 | void scanner__skip_until_one_of (struct scanner *, char *); | ||
| 20 | void scanner__skip_n (struct scanner *, size_t); | ||
| 21 | struct string_view scanner__get_until (struct scanner *, char); | ||
| 22 | struct string_view scanner__get_until_one_of (struct scanner *, char *); | ||
| 23 | struct string_view scanner__get_n (struct scanner *, size_t); | ||
| 24 | uint64_t scanner__get_uint64 (struct scanner *); | ||
| 25 | int64_t scanner__get_int64 (struct scanner *); | ||
| 26 | bool scanner__reached_end (struct scanner *); | ||
| 27 | |||
| 28 | #endif // INCLUDED_SCANNER_H | ||
| 29 | // scanner.h ends here | ||
