aboutsummaryrefslogtreecommitdiff
path: root/src/list.zig
diff options
context:
space:
mode:
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" {