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:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user