From 104f8ef82725596731fcf65a3e75b67ae4f16db2 Mon Sep 17 00:00:00 2001 From: David Gonzalez Martin Date: Thu, 25 Apr 2024 21:44:19 -0600 Subject: [PATCH] Better support Windows in the lexer --- bootstrap/frontend/lexer.zig | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bootstrap/frontend/lexer.zig b/bootstrap/frontend/lexer.zig index 420b967..be805d2 100644 --- a/bootstrap/frontend/lexer.zig +++ b/bootstrap/frontend/lexer.zig @@ -496,6 +496,7 @@ pub fn analyze(text: []const u8, token_buffer: *Token.Buffer) !Result { const start_ch = text[start_i]; switch (start_ch) { + '\r' => index += 1, '\n' => { index += 1; line_index += 1; @@ -583,7 +584,14 @@ pub fn analyze(text: []const u8, token_buffer: *Token.Buffer) !Result { else => unreachable, } }, - else => unreachable, + else => { + var ch_array : [64]u8 = undefined; + try Compilation.write(.panic, "TODO char: 0x"); + const ch_fmt = library.format_int(&ch_array, start_ch, 16, false); + try Compilation.write(.panic, ch_fmt); + try Compilation.write(.panic, "\n"); + std.posix.exit(0); + }, } }