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");...@@ -6,7 +6,7 @@ const std = @import("std.zig");
6const tokenizer = @import("zig/tokenizer.zig");6const tokenizer = @import("zig/tokenizer.zig");
7const assert = std.debug.assert;7const assert = std.debug.assert;
8const Allocator = std.mem.Allocator;8const Allocator = std.mem.Allocator;
9const Writer = std.io.Writer;9const Writer = std.Io.Writer;
1010
11pub const ErrorBundle = @import("zig/ErrorBundle.zig");11pub const ErrorBundle = @import("zig/ErrorBundle.zig");
12pub const Server = @import("zig/Server.zig");12pub const Server = @import("zig/Server.zig");
...@@ -426,7 +426,7 @@ pub const FormatId = struct {...@@ -426,7 +426,7 @@ pub const FormatId = struct {
426 };426 };
427427
428 /// Print the string as a Zig identifier, escaping it with `@""` syntax if needed.428 /// 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 {
430 const bytes = ctx.bytes;430 const bytes = ctx.bytes;
431 if (isValidId(bytes) and431 if (isValidId(bytes) and
432 (ctx.flags.allow_primitive or !std.zig.isPrimitive(bytes)) and432 (ctx.flags.allow_primitive or !std.zig.isPrimitive(bytes)) and
...@@ -464,7 +464,7 @@ test fmtChar {...@@ -464,7 +464,7 @@ test fmtChar {
464}464}
465465
466/// Print the string as escaped contents of a double quoted string.466/// 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 {
468 for (bytes) |byte| switch (byte) {468 for (bytes) |byte| switch (byte) {
469 '\n' => try w.writeAll("\\n"),469 '\n' => try w.writeAll("\\n"),
470 '\r' => try w.writeAll("\\r"),470 '\r' => try w.writeAll("\\r"),
...@@ -481,7 +481,7 @@ pub fn stringEscape(bytes: []const u8, w: *std.io.Writer) std.io.Writer.Error!vo...@@ -481,7 +481,7 @@ pub fn stringEscape(bytes: []const u8, w: *std.io.Writer) std.io.Writer.Error!vo
481}481}
482482
483/// Print the string as escaped contents of a single-quoted string.483/// 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 {
485 for (bytes) |byte| switch (byte) {485 for (bytes) |byte| switch (byte) {
486 '\n' => try w.writeAll("\\n"),486 '\n' => try w.writeAll("\\n"),
487 '\r' => try w.writeAll("\\r"),487 '\r' => try w.writeAll("\\r"),
lib/std/zig/Ast.zig+5-5
...@@ -12,7 +12,7 @@ const Token = std.zig.Token;...@@ -12,7 +12,7 @@ const Token = std.zig.Token;
12const Ast = @This();12const Ast = @This();
13const Allocator = std.mem.Allocator;13const Allocator = std.mem.Allocator;
14const Parse = @import("Parse.zig");14const Parse = @import("Parse.zig");
15const Writer = std.io.Writer;15const Writer = std.Io.Writer;
1616
17/// Reference to externally-owned data.17/// Reference to externally-owned data.
18source: [:0]const u8,18source: [:0]const u8,
...@@ -205,8 +205,8 @@ pub fn parse(gpa: Allocator, source: [:0]const u8, mode: Mode) Allocator.Error!A...@@ -205,8 +205,8 @@ pub fn parse(gpa: Allocator, source: [:0]const u8, mode: Mode) Allocator.Error!A
205/// Caller owns the returned slice of bytes, allocated with `gpa`.205/// Caller owns the returned slice of bytes, allocated with `gpa`.
206pub fn renderAlloc(tree: Ast, gpa: Allocator) error{OutOfMemory}![]u8 {206pub fn renderAlloc(tree: Ast, gpa: Allocator) error{OutOfMemory}![]u8 {
207 var aw: std.io.Writer.Allocating = .init(gpa);207 var aw: std.io.Writer.Allocating = .init(gpa);
208 errdefer aw.deinit();208 defer aw.deinit();
209 render(tree, gpa, &aw.interface, .{}) catch |err| switch (err) {209 render(tree, gpa, &aw.writer, .{}) catch |err| switch (err) {
210 error.WriteFailed => return error.OutOfMemory,210 error.WriteFailed => return error.OutOfMemory,
211 };211 };
212 return aw.toOwnedSlice();212 return aw.toOwnedSlice();
...@@ -214,8 +214,8 @@ pub fn renderAlloc(tree: Ast, gpa: Allocator) error{OutOfMemory}![]u8 {...@@ -214,8 +214,8 @@ pub fn renderAlloc(tree: Ast, gpa: Allocator) error{OutOfMemory}![]u8 {
214214
215pub const Render = @import("Ast/Render.zig");215pub const Render = @import("Ast/Render.zig");
216216
217pub fn render(tree: Ast, gpa: Allocator, bw: *Writer, fixups: Render.Fixups) Render.Error!void {217pub fn render(tree: Ast, gpa: Allocator, w: *Writer, fixups: Render.Fixups) Render.Error!void {
218 return Render.tree(gpa, bw, tree, fixups);218 return Render.tree(gpa, w, tree, fixups);
219}219}
220220
221/// Returns an extra offset for column and byte offset of errors that221/// Returns an extra offset for column and byte offset of errors that