diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2026-04-24 20:37:53 +0200 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2026-04-24 20:43:27 +0200 |
| commit | 22c7aa339407042682eef78f7d1ae1398e1d9b79 (patch) | |
| tree | a7ba615e5a98e32c53e9144e042e6f6a9f3c89d2 /src/parser.zig | |
| parent | e7fa254387e450154f03b2d1bdef361a0adb80d1 (diff) | |
perf(lexer): replace nextKind by peek
Diffstat (limited to 'src/parser.zig')
| -rw-r--r-- | src/parser.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/parser.zig b/src/parser.zig index 90f16fb..07722d8 100644 --- a/src/parser.zig +++ b/src/parser.zig @@ -29,15 +29,15 @@ fn gen(parent: Allocator, l: *Lexer) Error![]const u8 { var elements = try std.ArrayList(Element).initCapacity(alloc, 2); - while (l.nextKind()) |it| { - try elements.append(alloc, switch (it) { + base: while (l.peek()) |it| { + try elements.append(alloc, switch (it.kind) { // block paragraph .literal, .bold, .italic, .code, .link => try paragraph.parse(alloc, l), // other blocks .title => try title.parse(alloc, l), .weak_delimiter, .strong_delimiter => { - _ = l.next(); - continue; + l.consume(); + continue :base; }, else => return Error.FeatureNotSupported, }); |
