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