aboutsummaryrefslogtreecommitdiff
path: root/src/list.zig
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2026-04-26 23:10:17 +0200
committerAnhgelus Morhtuuzh <william@herges.fr>2026-04-26 23:17:26 +0200
commitde948492e8b38a79d5db9c506c1b7b82e86c6b12 (patch)
tree122e4c004d37193c64d6b8b89d9a252f7e237cfa /src/list.zig
parentae6ee68d6f4ef79fef609b4d09b543fc06326e95 (diff)
feat(): support code block
Diffstat (limited to 'src/list.zig')
-rw-r--r--src/list.zig30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/list.zig b/src/list.zig
index b8c7458..0facef9 100644
--- a/src/list.zig
+++ b/src/list.zig
@@ -25,23 +25,19 @@ pub fn parseUnordored(alloc: Allocator, l: *Lexer) Error!Element {
}
fn parse(alloc: Allocator, content: *std.ArrayList(Element), l: *Lexer, comptime kind: Token.Kind) !void {
- while (l.peek()) |next| {
- switch (next.kind) {
- kind => {
- l.consume();
- continue;
- },
- .weak_delimiter => {
- l.consume();
- if (l.peek()) |it| if (it.kind != kind) return;
- continue;
- },
- .strong_delimiter => return,
- else => {
- try content.append(alloc, try paragraph.parseLine(alloc, l));
- },
- }
- }
+ while (l.peek()) |next| switch (next.kind) {
+ kind => {
+ l.consume();
+ continue;
+ },
+ .weak_delimiter => {
+ l.consume();
+ if (l.peek()) |it| if (it.kind != kind) return;
+ continue;
+ },
+ .strong_delimiter => return,
+ else => try content.append(alloc, try paragraph.parseLine(alloc, l)),
+ };
}
test "parse ordored list" {