From c3c3c2202cf312842230f7316c69a89c28c60ce9 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Fri, 5 Dec 2025 03:20:38 -0300 Subject: codecrafters submit [skip ci] --- src/builtins.zig | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/builtins.zig') diff --git a/src/builtins.zig b/src/builtins.zig index 409b57d..2a1eed7 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -40,6 +40,15 @@ pub fn executeEcho(stdout: anytype, args: ?[]const u8) !void { } else if (in_quote and a[i] == quote_char) { in_quote = false; last_was_space = false; + } else if (in_quote and quote_char == '"' and a[i] == '\\' and i + 1 < a.len) { + const next = a[i + 1]; + if (next == '"' or next == '\\') { + i += 1; + _ = unquoted.append(std.heap.page_allocator, a[i]) catch {}; + } else { + _ = unquoted.append(std.heap.page_allocator, a[i]) catch {}; + } + last_was_space = false; } else if (!in_quote and a[i] == ' ') { if (!last_was_space) { _ = unquoted.append(std.heap.page_allocator, ' ') catch {}; -- cgit v1.2.3