diff options
| author | 2026-11-10 08:29:58 +0000 | |
|---|---|---|
| committer | 2026-11-10 08:33:56 +0000 | |
| commit | 776276d5c7e67356a880f3e31076d32cdc1c1882 (patch) | |
| tree | cbde131f3d46338adee9c67ac0f988295736bdd4 /src/scanner.h | |
| download | coursework-776276d5c7e67356a880f3e31076d32cdc1c1882.tar.gz | |
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 | ||
