authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-07-15 21:12:27-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-07-15 21:12:27-07:00
log89adf9cf5ccb613926ac30248df05e6d4c9455dc
tree65e43b72a92ac29b25193a92d55727536d2fbebe
parent797b2b01b237099923aeda5127b8e0c56e56f9ad

sync


2 files changed, 9 insertions(+), 9 deletions(-)

lib/std/zig.zig+4-4
......@@ -6,7 +6,7 @@ const std = @import("std.zig");
66const tokenizer = @import("zig/tokenizer.zig");
77const assert = std.debug.assert;
88const Allocator = std.mem.Allocator;
9const Writer = std.io.Writer;
9const Writer = std.Io.Writer;
1010
1111pub const ErrorBundle = @import("zig/ErrorBundle.zig");
1212pub const Server = @import("zig/Server.zig");
......@@ -426,7 +426,7 @@ pub const FormatId = struct {
426426 };
427427
428428 /// Print the string as a Zig identifier, escaping it with `@""` syntax if needed.
429 fn render(ctx: FormatId, writer: *std.io.Writer) std.io.Writer.Error!void {
429 fn render(ctx: FormatId, writer: *Writer) Writer.Error!void {
430430 const bytes = ctx.bytes;
431431 if (isValidId(bytes) and
432432 (ctx.flags.allow_primitive or !std.zig.isPrimitive(bytes)) and
......@@ -464,7 +464,7 @@ test fmtChar {
464464}
465465
466466/// Print the string as escaped contents of a double quoted string.
467pub fn stringEscape(bytes: []const u8, w: *std.io.Writer) std.io.Writer.Error!void {
467pub fn stringEscape(bytes: []const u8, w: *Writer) Writer.Error!void {
468468 for (bytes) |byte| switch (byte) {
469469 '\n' => try w.writeAll("\\n"),
470470 '\r' => try w.writeAll("\\r"),
......@@ -481,7 +481,7 @@ pub fn stringEscape(bytes: []const u8, w: *std.io.Writer) std.io.Writer.Error!vo
481481}
482482
483483/// Print the string as escaped contents of a single-quoted string.
484pub fn charEscape(bytes: []const u8, w: *std.io.Writer) std.io.Writer.Error!void {
484pub fn charEscape(bytes: []const u8, w: *Writer) Writer.Error!void {
485485 for (bytes) |byte| switch (byte) {
486486 '\n' => try w.writeAll("\\n"),
487487 '\r' => try w.writeAll("\\r"),
lib/std/zig/Ast.zig+5-5
......@@ -12,7 +12,7 @@ const Token = std.zig.Token;
1212const Ast = @This();
1313const Allocator = std.mem.Allocator;
1414const Parse = @import("Parse.zig");
15const Writer = std.io.Writer;
15const Writer = std.Io.Writer;
1616
1717/// Reference to externally-owned data.
1818source: [:0]const u8,
......@@ -205,8 +205,8 @@ pub fn parse(gpa: Allocator, source: [:0]const u8, mode: Mode) Allocator.Error!A
205205/// Caller owns the returned slice of bytes, allocated with `gpa`.
206206pub fn renderAlloc(tree: Ast, gpa: Allocator) error{OutOfMemory}![]u8 {
207207 var aw: std.io.Writer.Allocating = .init(gpa);
208 errdefer aw.deinit();
209 render(tree, gpa, &aw.interface, .{}) catch |err| switch (err) {
208 defer aw.deinit();
209 render(tree, gpa, &aw.writer, .{}) catch |err| switch (err) {
210210 error.WriteFailed => return error.OutOfMemory,
211211 };
212212 return aw.toOwnedSlice();
......@@ -214,8 +214,8 @@ pub fn renderAlloc(tree: Ast, gpa: Allocator) error{OutOfMemory}![]u8 {
214214
215215pub const Render = @import("Ast/Render.zig");
216216
217pub fn render(tree: Ast, gpa: Allocator, bw: *Writer, fixups: Render.Fixups) Render.Error!void {
218 return Render.tree(gpa, bw, tree, fixups);
217pub fn render(tree: Ast, gpa: Allocator, w: *Writer, fixups: Render.Fixups) Render.Error!void {
218 return Render.tree(gpa, w, tree, fixups);
219219}
220220
221221/// Returns an extra offset for column and byte offset of errors that