Compare commits
	
		
			No commits in common. "master" and "zig-latest" have entirely different histories.
		
	
	
		
			master
			...
			zig-latest
		
	
		
					 4 changed files with 14 additions and 14 deletions
				
			
		|  | @ -13,15 +13,15 @@ fn printIdent(ident: usize) void { | |||
|     } | ||||
| } | ||||
| 
 | ||||
| fn print(ident: usize, comptime fmt: []const u8, args: anytype) void { | ||||
| fn print(ident: usize, comptime fmt: []const u8, args: var) void { | ||||
|     printIdent(ident); | ||||
|     std.debug.warn(fmt, args); | ||||
| } | ||||
| 
 | ||||
| fn printBlock(ident: usize, block: anytype, endNewline: bool) void { | ||||
| fn printBlock(ident: usize, block: var, endNewline: bool) void { | ||||
|     std.debug.warn("(\n", .{}); | ||||
| 
 | ||||
|     for (block.items) |stmt| { | ||||
|     for (block.toSlice()) |stmt| { | ||||
|         printIdent(ident); | ||||
|         printStmt(ident, stmt); | ||||
|         std.debug.warn("\n", .{}); | ||||
|  | @ -56,7 +56,7 @@ pub fn printNode(node: *Node, ident: usize) void { | |||
|                 warn("(fn {} {} (", .{ name, ret_type }); | ||||
|             } | ||||
| 
 | ||||
|             for (decl.params.items) |param| { | ||||
|             for (decl.params.toSlice()) |param| { | ||||
|                 warn("({} {}) ", .{ param.name.lexeme, param.typ.lexeme }); | ||||
|             } | ||||
| 
 | ||||
|  | @ -67,7 +67,7 @@ pub fn printNode(node: *Node, ident: usize) void { | |||
|         .ConstDecl => |consts| { | ||||
|             print(ident, "(const (\n", .{}); | ||||
| 
 | ||||
|             for (consts.items) |const_decl| { | ||||
|             for (consts.toSlice()) |const_decl| { | ||||
|                 print(ident + 1, "({} ", .{ | ||||
|                     const_decl.name.lexeme, | ||||
|                 }); | ||||
|  | @ -82,7 +82,7 @@ pub fn printNode(node: *Node, ident: usize) void { | |||
|         .Enum => |decl| { | ||||
|             print(ident, "(enum {} (\n", .{decl.name.lexeme}); | ||||
| 
 | ||||
|             for (decl.fields.items) |field| { | ||||
|             for (decl.fields.toSlice()) |field| { | ||||
|                 print(ident + 1, "{}\n", .{ | ||||
|                     field.lexeme, | ||||
|                 }); | ||||
|  | @ -92,7 +92,7 @@ pub fn printNode(node: *Node, ident: usize) void { | |||
|         }, | ||||
| 
 | ||||
|         .Root => { | ||||
|             for (node.Root.items) |child| { | ||||
|             for (node.Root.toSlice()) |child| { | ||||
|                 printNode(child, ident + 1); | ||||
|             } | ||||
|         }, | ||||
|  | @ -105,7 +105,7 @@ pub fn printNode(node: *Node, ident: usize) void { | |||
| 
 | ||||
|         .Struct => |struc| { | ||||
|             print(ident, "(struct {} (\n", .{struc.name.lexeme}); | ||||
|             for (struc.fields.items) |field| { | ||||
|             for (struc.fields.toSlice()) |field| { | ||||
|                 printIdent(ident + 1); | ||||
|                 if (field.mutable) { | ||||
|                     std.debug.warn("(mut ", .{}); | ||||
|  | @ -157,7 +157,7 @@ pub fn printExpr(expr: *const Expr) void { | |||
|                 .Float => |val| std.debug.warn("{}", .{val}), | ||||
|                 .String => |val| std.debug.warn("'{}'", .{val}), | ||||
|                 .Array => |exprs| { | ||||
|                     parenthetize("array", exprs.items); | ||||
|                     parenthetize("array", exprs.toSlice()); | ||||
|                 }, | ||||
|                 else => |typ| std.debug.warn("UnknownLiteral-{}", .{typ}), | ||||
|             } | ||||
|  | @ -188,7 +188,7 @@ pub fn printExpr(expr: *const Expr) void { | |||
|             std.debug.warn("(", .{}); | ||||
|             printExpr(call.callee); | ||||
| 
 | ||||
|             for (call.arguments.items) |arg| { | ||||
|             for (call.arguments.toSlice()) |arg| { | ||||
|                 std.debug.warn(" ", .{}); | ||||
|                 printExpr(arg); | ||||
|             } | ||||
|  | @ -199,7 +199,7 @@ pub fn printExpr(expr: *const Expr) void { | |||
|         .Struct => |val| { | ||||
|             std.debug.warn("({} (", .{val.name.lexeme}); | ||||
| 
 | ||||
|             for (val.inits.items) |init| { | ||||
|             for (val.inits.toSlice()) |init| { | ||||
|                 std.debug.warn(" ({} ", .{init.field.lexeme}); | ||||
|                 printExpr(init.expr); | ||||
|                 std.debug.warn(")", .{}); | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ pub fn reportN(line: usize, message: []const u8) void { | |||
|     report(line, "", message); | ||||
| } | ||||
| 
 | ||||
| pub fn reportFmt(line: usize, comptime fmt: []const u8, args: anytype) void { | ||||
| pub fn reportFmt(line: usize, comptime fmt: []const u8, args: var) void { | ||||
|     std.debug.warn("[line {}] Error", .{line}); | ||||
|     std.debug.warn(fmt, args); | ||||
|     std.debug.warn("\n", .{}); | ||||
|  |  | |||
|  | @ -43,7 +43,7 @@ pub const Parser = struct { | |||
|         self.tokens.deinit(); | ||||
|     } | ||||
| 
 | ||||
|     fn doError(self: *Parser, comptime fmt: []const u8, args: anytype) void { | ||||
|     fn doError(self: *Parser, comptime fmt: []const u8, args: var) void { | ||||
|         self.hadError = true; | ||||
| 
 | ||||
|         std.debug.warn("parser error at line {}\n\t", .{self.scanner.line}); | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ pub const Runner = struct { | |||
|     allocator: *Allocator, | ||||
|     stdout: std.fs.File.OutStream, | ||||
| 
 | ||||
|     pub fn init(allocator: *Allocator, stdout: anytype) Runner { | ||||
|     pub fn init(allocator: *Allocator, stdout: var) Runner { | ||||
|         return .{ .allocator = allocator, .stdout = stdout }; | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue