diff options
author | Bad Diode <bd@badd10de.dev> | 2022-02-01 18:36:52 +0100 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2022-02-01 18:36:52 +0100 |
commit | ee1a5de91c875fb66724dc21c02333bfebe2a812 (patch) | |
tree | d3eaa226816d295bb9dc48a2aed27044832ec413 /src/string_view.c | |
parent | 3156265c7b2da8cc43fee996c0518ea274d39c8a (diff) | |
download | bdl-ee1a5de91c875fb66724dc21c02333bfebe2a812.tar.gz bdl-ee1a5de91c875fb66724dc21c02333bfebe2a812.zip |
Add new syntax to lexer and prepare refactor
Diffstat (limited to 'src/string_view.c')
-rw-r--r-- | src/string_view.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/string_view.c b/src/string_view.c index 8247bd4..4e9df5c 100644 --- a/src/string_view.c +++ b/src/string_view.c | |||
@@ -11,6 +11,15 @@ sv_next(StringView *sv) { | |||
11 | return c; | 11 | return c; |
12 | } | 12 | } |
13 | 13 | ||
14 | void | ||
15 | sv_rewind(StringView *sv) { | ||
16 | if (sv->start == 0) { | ||
17 | return; | ||
18 | } | ||
19 | sv->start--; | ||
20 | sv->n++; | ||
21 | } | ||
22 | |||
14 | char | 23 | char |
15 | sv_peek(const StringView *sv) { | 24 | sv_peek(const StringView *sv) { |
16 | if (sv->n == 0) { | 25 | if (sv->n == 0) { |