New Filter start to work

Changing how condition are handle to create a tree of condition to only
parse once.

So far the basic work, need more testing.
This commit is contained in:
2024-10-27 19:55:07 +01:00
parent 5756e3a530
commit 334c738ac1
4 changed files with 300 additions and 160 deletions
+6
View File
@@ -72,11 +72,16 @@ pub const Token = struct {
pub const Tokenizer = struct {
buffer: [:0]const u8,
index: usize,
last_token: Token = undefined,
pub fn getTokenSlice(self: *Tokenizer, token: Token) []const u8 {
return self.buffer[token.loc.start..token.loc.end];
}
pub fn last(self: Tokenizer) Token {
return self.last_token;
}
pub fn init(buffer: [:0]const u8) Tokenizer {
// Skip the UTF-8 BOM if present.
return .{
@@ -364,6 +369,7 @@ pub const Tokenizer = struct {
}
result.loc.end = self.index;
self.last_token = result;
return result;
}
};