aboutsummaryrefslogtreecommitdiff
path: root/src/title.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/title.zig')
-rw-r--r--src/title.zig10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/title.zig b/src/title.zig
index 352460f..c7845c6 100644
--- a/src/title.zig
+++ b/src/title.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 paragraph = @import("paragraph.zig");
@@ -11,9 +11,8 @@ const doTestError = testing.doError;
pub const Error = error{InvalidTitleContent} || paragraph.Error || Lexer.Error;
pub fn parse(alloc: Allocator, l: *Lexer) Error!Element {
- var v = (try l.next(alloc)).?;
- defer v.deinit();
- var el = try Element.init(alloc, .content, switch (v.content.items.len) {
+ const v = l.next().?;
+ var el = try Element.init(alloc, .content, switch (v.content.len) {
1 => "h1",
2 => "h2",
3 => "h3",
@@ -27,8 +26,7 @@ pub fn parse(alloc: Allocator, l: *Lexer) Error!Element {
paragraph.Error.IllegalPlacement => return Error.InvalidTitleContent,
else => return err,
});
- var next = (try l.next(alloc)) orelse return el;
- defer next.deinit();
+ var next = l.next() orelse return el;
if (!next.kind.isDelimiter()) return Error.InvalidTitleContent;
return el;
}