aboutsummaryrefslogtreecommitdiff
path: root/src/paragraph.zig
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2026-04-24 17:40:33 +0200
committerAnhgelus Morhtuuzh <william@herges.fr>2026-04-24 17:40:33 +0200
commite7fa254387e450154f03b2d1bdef361a0adb80d1 (patch)
treefd655516c0f1e3d4925ede5d54d729a88507369b /src/paragraph.zig
parent263190b15ebcb1188df6fbc2bc90dca6e4ea5d8d (diff)
perf(lexer): do not alloc
Diffstat (limited to 'src/paragraph.zig')
-rw-r--r--src/paragraph.zig7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/paragraph.zig b/src/paragraph.zig
index 0382e5d..c8c6798 100644
--- a/src/paragraph.zig
+++ b/src/paragraph.zig
@@ -1,6 +1,6 @@
const std = @import("std");
const Allocator = std.mem.Allocator;
-const Lexed = @import("lexer/Lexed.zig");
+const Token = @import("lexer/Token.zig");
const Lexer = @import("lexer/Lexer.zig");
const Element = @import("dom/Element.zig");
const parser = @import("parser.zig");
@@ -10,7 +10,7 @@ const testing = @import("testing.zig");
const doTest = testing.do;
const doTestError = testing.doError;
-pub const Error = content.Error || link.Error || Lexer.Error;
+pub const Error = content.Error || link.Error || Lexer.Error || Allocator.Error;
pub fn parse(alloc: Allocator, l: *Lexer) Error!Element {
var el = try Element.init(alloc, .content, "p");
@@ -19,8 +19,7 @@ pub fn parse(alloc: Allocator, l: *Lexer) Error!Element {
switch (kind) {
// because nextKind returns only an hint for the next rune
.weak_delimiter => {
- var v = (try l.next(alloc)).?;
- defer v.deinit();
+ const v = l.next().?;
if (v.kind == .strong_delimiter) return el;
const next = l.nextKind() orelse return el;
switch (next) {