aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-09-13 11:25:31 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-09-13 11:25:31 -0400
commitd332311e53a074eef77c61412ee59b5f5fdc3891 (patch)
tree7fd08ebf23634ef8fb76b1f59906a852d8faf5a9 /src/util.cpp
parente70c543bc4c097d7c3287feb0f233a13d4dc3829 (diff)
parente3f0ba4984f932cd3a9a99504d540b4cd8393364 (diff)
downloadzig-d332311e53a074eef77c61412ee59b5f5fdc3891.tar.gz
zig-d332311e53a074eef77c61412ee59b5f5fdc3891.zip
Merge branch 'kristate-cache-invalidformat-issue1510'
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 060d7f8fb5..192d74e766 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -79,6 +79,16 @@ Optional<Slice<uint8_t>> SplitIterator_next(SplitIterator *self) {
}
// Ported from std/mem.zig
+Slice<uint8_t> SplitIterator_rest(SplitIterator *self) {
+ // move to beginning of token
+ size_t index = self->index;
+ while (index < self->buffer.len && SplitIterator_isSplitByte(self, self->buffer.ptr[index])) {
+ index += 1;
+ }
+ return self->buffer.sliceFrom(index);
+}
+
+// Ported from std/mem.zig
SplitIterator memSplit(Slice<uint8_t> buffer, Slice<uint8_t> split_bytes) {
return SplitIterator{0, buffer, split_bytes};
}