diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2026-04-18 19:25:54 +0200 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2026-04-18 19:25:54 +0200 |
| commit | 9b47b7ee8b80bf427116b4d2cf42e6f3c9d8be62 (patch) | |
| tree | 70e12c0a4bb869957d2e06ef482bb856c5a0d4f4 /src/paragraph.zig | |
| parent | fec006aaa5ee3683457ebfc2ba1755b077e14c79 (diff) | |
feat(ast): parse title
Diffstat (limited to 'src/paragraph.zig')
| -rw-r--r-- | src/paragraph.zig | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/paragraph.zig b/src/paragraph.zig index 75651f4..86d074b 100644 --- a/src/paragraph.zig +++ b/src/paragraph.zig @@ -1,12 +1,13 @@ const std = @import("std"); +const Allocator = std.mem.Allocator; const Lexed = @import("lexer/Lexed.zig"); const Lexer = @import("lexer/Lexer.zig"); const Element = @import("dom/Element.zig"); -const Allocator = std.mem.Allocator; -const ast = @import("ast.zig"); -const Error = ast.Error; +const parser = @import("parser.zig"); + +pub const Error = error{UnclosedModifier} || Lexer.Error; -pub fn parseParagraph(alloc: Allocator, l: *Lexer) Error!Element { +pub fn parse(alloc: Allocator, l: *Lexer) Error!Element { var el = try Element.init(alloc, .content, "p"); while (l.nextKind()) |kind| { switch (kind) { @@ -38,7 +39,7 @@ pub fn parseContent(alloc: Allocator, l: *Lexer) Error!Element { .bold => try content.appendContent(try parseModifier(alloc, l, .bold, "b")), .italic => try content.appendContent(try parseModifier(alloc, l, .italic, "em")), .code => try content.appendContent(try parseModifier(alloc, l, .code, "code")), - else => return Error.InvalidSequence, + else => unreachable, } return content; } |
