Skip to content

Commit f96390f

Browse files
BrookJeyneskristoff-it
authored andcommitted
update to 0.14.0-dev
1 parent d776d0a commit f96390f

File tree

4 files changed

+39
-40
lines changed

4 files changed

+39
-40
lines changed

build.zig.zon

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
.version = "0.0.0",
44
.dependencies = .{
55
.@"known-folders" = .{
6-
.url = "https://github.com/ziglibs/known-folders/archive/0ad514dcfb7525e32ae349b9acc0a53976f3a9fa.tar.gz",
7-
.hash = "12209cde192558f8b3dc098ac2330fc2a14fdd211c5433afd33085af75caa9183147",
6+
.url = "git+https://github.com/ziglibs/known-folders#1cceeb70e77dec941a4178160ff6c8d05a74de6f",
7+
.hash = "12205f5e7505c96573f6fc5144592ec38942fb0a326d692f9cddc0c7dd38f9028f29",
88
},
99
.@"zig-lsp-kit" = .{
10-
// TODO revert to kristoff-it when https://github.com/kristoff-it/zig-lsp-kit/pull/1 is merged
11-
.url = "https://github.com/MFAshby/zig-lsp-kit/archive/1c07e3e3305f8dd6355735173321c344fc152d3e.tar.gz",
12-
.hash = "12204a4669fa6e8ebb1720e3581a24c1a7f538f2f4ee3ebc91a9e36285c89572d761",
10+
.url = "git+https://github.com/kristoff-it/zig-lsp-kit?ref=zig-0.14.0-dev#18afe25c77b541249af7a1944edc85dc13e8de10",
11+
.hash = "12205394c8d3976f001f6788f95205f5942921a8772e996bdd81a035b669c59118f2",
1312
},
1413
.yaml = .{
1514
.url = "https://github.com/kubkon/zig-yaml/archive/beddd5da24de91d430ca7028b00986f7745b13e9.tar.gz",

src/cli/logging.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub var log_file: ?std.fs.File = switch (builtin.target.os.tag) {
99

1010
pub fn logFn(
1111
comptime level: std.log.Level,
12-
comptime scope: @Type(.EnumLiteral),
12+
comptime scope: @Type(.enum_literal),
1313
comptime format: []const u8,
1414
args: anytype,
1515
) void {

src/ziggy/Parser.zig

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub fn parseValue(
9494
const info = @typeInfo(T);
9595

9696
switch (info) {
97-
.Pointer => |ptr| switch (ptr.size) {
97+
.pointer => |ptr| switch (ptr.size) {
9898
.Slice => switch (ptr.child) {
9999
u8 => return self.parseBytes(T, first_tok),
100100
else => return self.parseArray(T, first_tok),
@@ -108,28 +108,28 @@ pub fn parseValue(
108108
},
109109
else => @compileError("Unable to parse pointer to many / C: " ++ @typeName(T)),
110110
},
111-
.Bool => return self.parseBool(first_tok),
112-
.Int => return self.parseInt(T, first_tok),
113-
.Float => return self.parseFloat(T, first_tok),
114-
.Struct => {
111+
.bool => return self.parseBool(first_tok),
112+
.int => return self.parseInt(T, first_tok),
113+
.float => return self.parseFloat(T, first_tok),
114+
.@"struct" => {
115115
if (@hasDecl(T, "ziggy_options") and @hasDecl(T.ziggy_options, "parse")) {
116116
return T.ziggy_options.parse(self, first_tok);
117117
}
118118
return self.parseStruct(T, first_tok);
119119
},
120-
.Union => {
120+
.@"union" => {
121121
if (@hasDecl(T, "ziggy_options") and @hasDecl(T.ziggy_options, "parse")) {
122122
return T.ziggy_options.parse(self, first_tok);
123123
}
124124
return self.parseUnion(T, first_tok);
125125
},
126-
.Enum => {
126+
.@"enum" => {
127127
if (@hasDecl(T, "ziggy_options") and @hasDecl(T.ziggy_options, "parse")) {
128128
return T.ziggy_options.parse(self, first_tok);
129129
}
130130
return self.parseEnum(T, first_tok);
131131
},
132-
.Optional => |opt| {
132+
.optional => |opt| {
133133
if (first_tok.tag == .null) {
134134
return null;
135135
} else {
@@ -174,15 +174,15 @@ fn parseUnion(
174174
// When a top-level struct omits curlies, the first
175175
// token will be a dot. Is such case we don't want
176176
// to expect a closing right bracket.
177-
const info = @typeInfo(T).Union;
177+
const info = @typeInfo(T).@"union";
178178
comptime {
179179
if (info.tag_type == null) {
180180
@compileError("union '" ++ @typeName(T) ++ "' must be tagged");
181181
}
182182

183183
for (info.fields) |f| {
184184
switch (@typeInfo(f.type)) {
185-
.Struct => {},
185+
.@"struct" => {},
186186
else => {
187187
@compileError("all the cases of union '" ++ @typeName(T) ++ "' must be of struct type");
188188
},
@@ -220,7 +220,7 @@ fn parseStruct(
220220
// token will be a dot. Is such case we don't want
221221
// to expect a closing right bracket.
222222
const need_closing_rb = first_tok.tag != .dot;
223-
const info = @typeInfo(T).Struct;
223+
const info = @typeInfo(T).@"struct";
224224

225225
var tok = first_tok;
226226
if (tok.tag == .identifier) {
@@ -332,7 +332,7 @@ pub fn parseBool(self: *Parser, true_or_false: Token) !bool {
332332
}
333333

334334
pub fn parseInt(self: *Parser, comptime T: type, num: Token) !T {
335-
assert(@typeInfo(T) == .Int);
335+
assert(@typeInfo(T) == .int);
336336

337337
try self.must(num, .integer);
338338
return std.fmt.parseInt(T, num.loc.src(self.code), 10) catch {
@@ -341,7 +341,7 @@ pub fn parseInt(self: *Parser, comptime T: type, num: Token) !T {
341341
}
342342

343343
pub fn parseFloat(self: *Parser, comptime T: type, num: Token) !T {
344-
assert(@typeInfo(T) == .Float);
344+
assert(@typeInfo(T) == .float);
345345

346346
try self.must(num, .float);
347347
return std.fmt.parseFloat(T, num.loc.src(self.code)) catch {
@@ -382,7 +382,7 @@ pub fn parseBytes(self: *Parser, comptime T: type, token: Token) !T {
382382
}
383383

384384
fn parseArray(self: *Parser, comptime T: type, lsb: Token) !T {
385-
const info = @typeInfo(T).Pointer;
385+
const info = @typeInfo(T).pointer;
386386
assert(info.size == .Slice);
387387

388388
try self.must(lsb, .lsb);

src/ziggy/serializer.zig

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ pub fn stringifyInner(
4646
) @TypeOf(writer).Error!void {
4747
const T = @TypeOf(value);
4848
switch (@typeInfo(T)) {
49-
.Bool,
50-
.Float,
51-
.Int,
52-
.ComptimeFloat,
53-
.ComptimeInt,
49+
.bool,
50+
.float,
51+
.int,
52+
.comptime_float,
53+
.comptime_int,
5454
=> try writer.print("{}", .{value}),
5555

56-
.Pointer => |ptr| {
56+
.pointer => |ptr| {
5757
switch (ptr.size) {
5858
.Slice => {
5959
switch (ptr.child) {
@@ -77,39 +77,39 @@ pub fn stringifyInner(
7777
else => @compileError("Expected a slice or single pointer. Got a many/C pointer '" ++ @typeName(T) ++ "'"),
7878
}
7979
},
80-
.Array => |arr| switch (arr.child) {
80+
.array => |arr| switch (arr.child) {
8181
u8 => try escapeString(writer, &value, indent_level, opts.whitespace),
8282
else => try stringifyArray(writer, value, indent_level, depth, opts),
8383
},
8484

85-
.Null => try writer.writeAll("null"),
85+
.null => try writer.writeAll("null"),
8686

87-
.EnumLiteral => try writer.print("\"{s}\"", .{@tagName(value)}),
87+
.enum_literal => try writer.print("\"{s}\"", .{@tagName(value)}),
8888

89-
.Enum => {
89+
.@"enum" => {
9090
if (@hasDecl(T, "ziggy_options") and @hasDecl(T.ziggy_options, "stringify")) {
9191
try T.ziggy_options.stringify(value, opts, indent_level, depth, writer);
9292
} else {
9393
try writer.print("\"{s}\"", .{@tagName(value)});
9494
}
9595
},
9696

97-
.Struct => {
97+
.@"struct" => {
9898
if (@hasDecl(T, "ziggy_options") and @hasDecl(T.ziggy_options, "stringify")) {
9999
try T.ziggy_options.stringify(value, opts, indent_level, depth, writer);
100100
} else {
101101
try stringifyStruct(writer, value, indent_level, depth, opts);
102102
}
103103
},
104-
.Union => {
104+
.@"union" => {
105105
if (@hasDecl(T, "ziggy_options") and @hasDecl(T.ziggy_options, "stringify")) {
106106
try T.ziggy_options.stringify(value, opts, indent_level, depth, writer);
107107
} else {
108108
try stringifyUnion(writer, value, indent_level, depth, opts);
109109
}
110110
},
111111

112-
.Optional => {
112+
.optional => {
113113
if (value) |v| {
114114
try stringifyInner(v, opts, indent_level, depth, writer);
115115
} else {
@@ -177,13 +177,13 @@ fn stringifyStruct(writer: anytype, strct: anytype, indent_level: usize, depth:
177177
}
178178

179179
fn stringifyStructInner(writer: anytype, strct: anytype, indent_level: usize, depth: usize, opts: StringifyOptions) !bool {
180-
const T = @typeInfo(@TypeOf(strct)).Struct;
180+
const T = @typeInfo(@TypeOf(strct)).@"struct";
181181
const field_count = blk: {
182182
var c: usize = 0;
183183
if (opts.emit_null_fields) break :blk T.fields.len;
184184
inline for (T.fields) |field| {
185185
switch (@typeInfo(field.type)) {
186-
.Optional => if (@field(strct, field.name) != null) {
186+
.optional => if (@field(strct, field.name) != null) {
187187
c += 1;
188188
},
189189
else => c += 1,
@@ -194,7 +194,7 @@ fn stringifyStructInner(writer: anytype, strct: anytype, indent_level: usize, de
194194
if (T.fields.len > 0) {
195195
blk: {
196196
switch (@typeInfo(T.fields[0].type)) {
197-
.Optional => if (!opts.emit_null_fields and @field(strct, T.fields[0].name) == null) break :blk,
197+
.optional => if (!opts.emit_null_fields and @field(strct, T.fields[0].name) == null) break :blk,
198198
else => {},
199199
}
200200

@@ -214,7 +214,7 @@ fn stringifyStructInner(writer: anytype, strct: anytype, indent_level: usize, de
214214
inline for (T.fields[1..], 2..) |field, idx| {
215215
const name = field.name;
216216
const skip = switch (@typeInfo(field.type)) {
217-
.Optional => if (@field(strct, field.name) == null) !opts.emit_null_fields else false,
217+
.optional => if (@field(strct, field.name) == null) !opts.emit_null_fields else false,
218218
else => false,
219219
};
220220
if (!skip) {
@@ -236,7 +236,7 @@ fn stringifyStructInner(writer: anytype, strct: anytype, indent_level: usize, de
236236
}
237237

238238
fn stringifyUnion(writer: anytype, un: anytype, indent_level: usize, depth: usize, opts: StringifyOptions) !void {
239-
const T = @typeInfo(@TypeOf(un)).Union;
239+
const T = @typeInfo(@TypeOf(un)).@"union";
240240
if (T.tag_type == null) @compileError("Union '" ++ @typeName(@TypeOf(un)) ++ "' must be tagged!");
241241
var opts_ = opts;
242242
opts_.omit_top_level_curly = false;
@@ -246,7 +246,7 @@ fn stringifyUnion(writer: anytype, un: anytype, indent_level: usize, depth: usiz
246246
inline for (T.fields) |field| {
247247
if (std.mem.eql(u8, field.name, @tagName(at))) {
248248
switch (@typeInfo(field.type)) {
249-
.Struct => try stringifyInner(@field(un, field.name), opts_, indent_level, depth, writer),
249+
.@"struct" => try stringifyInner(@field(un, field.name), opts_, indent_level, depth, writer),
250250
else => {
251251
const value_field: std.builtin.Type.StructField = .{
252252
.name = "value",
@@ -255,7 +255,7 @@ fn stringifyUnion(writer: anytype, un: anytype, indent_level: usize, depth: usiz
255255
.is_comptime = false,
256256
.alignment = @alignOf(field.type),
257257
};
258-
const St = @Type(.{ .Struct = .{
258+
const St = @Type(.{ .@"struct" = .{
259259
.layout = .auto,
260260
.fields = &.{value_field},
261261
.decls = &.{},

0 commit comments

Comments
 (0)