Update config_gen.zig and regenerated master

This commit is contained in:
FalsePattern 2023-06-21 19:07:52 +02:00
parent 71b09a3ffe
commit c0439c646c
No known key found for this signature in database
GPG Key ID: FDF7126A9E124447
2 changed files with 43 additions and 45 deletions

View File

@ -271,13 +271,10 @@ fn generateVSCodeConfigFile(allocator: std.mem.Allocator, config: Config, path:
const default: ?std.json.Value = blk: { const default: ?std.json.Value = blk: {
if (option.@"enum" != null) break :blk .{ .string = option.default }; if (option.@"enum" != null) break :blk .{ .string = option.default };
var parser = std.json.Parser.init(allocator, .alloc_always); var value = try std.json.parseFromSlice(std.json.Value, allocator, option.default, .{});
defer parser.deinit();
var value = try parser.parse(option.default);
defer value.deinit(); defer value.deinit();
break :blk if (value.root != .null) value.root else null; break :blk if (value.value != .null) value.value else null;
}; };
configuration.putAssumeCapacityNoClobber(name, .{ configuration.putAssumeCapacityNoClobber(name, .{
@ -1050,8 +1047,9 @@ pub fn main() !void {
} }
} }
const config = try std.json.parseFromSlice(Config, gpa, @embedFile("config.json"), .{}); const config_json = try std.json.parseFromSlice(Config, gpa, @embedFile("config.json"), .{});
defer std.json.parseFree(Config, gpa, config); defer config_json.deinit();
const config = config_json.value;
try generateConfigFile(gpa, config, config_path); try generateConfigFile(gpa, config, config_path);
try generateSchemaFile(gpa, config, schema_path); try generateSchemaFile(gpa, config, schema_path);

View File

@ -150,7 +150,7 @@ pub const builtins = [_]Builtin{
\\ \\
\\Asserts that `@sizeOf(@TypeOf(value)) == @sizeOf(DestType)`. \\Asserts that `@sizeOf(@TypeOf(value)) == @sizeOf(DestType)`.
\\ \\
\\Asserts that `@typeInfo(DestType) != .Pointer`. Use `@ptrCast` or `@intToPtr` if you need this. \\Asserts that `@typeInfo(DestType) != .Pointer`. Use `@ptrCast` or `@ptrFromInt` if you need this.
\\ \\
\\Can be used for these things for example: \\Can be used for these things for example:
\\ \\
@ -178,9 +178,9 @@ pub const builtins = [_]Builtin{
}, },
}, },
.{ .{
.name = "@boolToInt", .name = "@intFromBool",
.signature = "@boolToInt(value: bool) u1", .signature = "@intFromBool(value: bool) u1",
.snippet = "@boolToInt(${1:value: bool})", .snippet = "@intFromBool(${1:value: bool})",
.documentation = .documentation =
\\Converts `true` to `@as(u1, 1)` and `false` to `@as(u1, 0)`. \\Converts `true` to `@as(u1, 1)` and `false` to `@as(u1, 0)`.
, ,
@ -669,9 +669,9 @@ pub const builtins = [_]Builtin{
}, },
}, },
.{ .{
.name = "@enumToInt", .name = "@intFromEnum",
.signature = "@enumToInt(enum_or_tagged_union: anytype) anytype", .signature = "@intFromEnum(enum_or_tagged_union: anytype) anytype",
.snippet = "@enumToInt(${1:enum_or_tagged_union: anytype})", .snippet = "@intFromEnum(${1:enum_or_tagged_union: anytype})",
.documentation = .documentation =
\\Converts an enumeration value into its integer tag type. When a tagged union is passed, the tag value is used as the enumeration value. \\Converts an enumeration value into its integer tag type. When a tagged union is passed, the tag value is used as the enumeration value.
\\ \\
@ -704,9 +704,9 @@ pub const builtins = [_]Builtin{
.arguments = &.{}, .arguments = &.{},
}, },
.{ .{
.name = "@errorToInt", .name = "@intFromError",
.signature = "@errorToInt(err: anytype) std.meta.Int(.unsigned, @sizeOf(anyerror) * 8)", .signature = "@intFromError(err: anytype) std.meta.Int(.unsigned, @sizeOf(anyerror) * 8)",
.snippet = "@errorToInt(${1:err: anytype})", .snippet = "@intFromError(${1:err: anytype})",
.documentation = .documentation =
\\Supports the following types: \\Supports the following types:
\\ \\
@ -854,9 +854,9 @@ pub const builtins = [_]Builtin{
}, },
}, },
.{ .{
.name = "@floatToInt", .name = "@intFromFloat",
.signature = "@floatToInt(comptime DestType: type, float: anytype) DestType", .signature = "@intFromFloat(comptime DestType: type, float: anytype) DestType",
.snippet = "@floatToInt(${1:comptime DestType: type}, ${2:float: anytype})", .snippet = "@intFromFloat(${1:comptime DestType: type}, ${2:float: anytype})",
.documentation = .documentation =
\\Converts the integer part of a floating point number to the destination type. \\Converts the integer part of a floating point number to the destination type.
\\ \\
@ -988,9 +988,9 @@ pub const builtins = [_]Builtin{
}, },
}, },
.{ .{
.name = "@intToEnum", .name = "@enumFromInt",
.signature = "@intToEnum(comptime DestType: type, integer: anytype) DestType", .signature = "@enumFromInt(comptime DestType: type, integer: anytype) DestType",
.snippet = "@intToEnum(${1:comptime DestType: type}, ${2:integer: anytype})", .snippet = "@enumFromInt(${1:comptime DestType: type}, ${2:integer: anytype})",
.documentation = .documentation =
\\Converts an integer into an [enum](https://ziglang.org/documentation/master/#enum) value. \\Converts an integer into an [enum](https://ziglang.org/documentation/master/#enum) value.
\\ \\
@ -1002,9 +1002,9 @@ pub const builtins = [_]Builtin{
}, },
}, },
.{ .{
.name = "@intToError", .name = "@errorFromInt",
.signature = "@intToError(value: std.meta.Int(.unsigned, @sizeOf(anyerror) * 8)) anyerror", .signature = "@errorFromInt(value: std.meta.Int(.unsigned, @sizeOf(anyerror) * 8)) anyerror",
.snippet = "@intToError(${1:value: std.meta.Int(.unsigned, @sizeOf(anyerror) * 8})", .snippet = "@errorFromInt(${1:value: std.meta.Int(.unsigned, @sizeOf(anyerror) * 8})",
.documentation = .documentation =
\\Converts from the integer representation of an error into [The Global Error Set](https://ziglang.org/documentation/master/#The-Global-Error-Set) type. \\Converts from the integer representation of an error into [The Global Error Set](https://ziglang.org/documentation/master/#The-Global-Error-Set) type.
\\ \\
@ -1017,11 +1017,11 @@ pub const builtins = [_]Builtin{
}, },
}, },
.{ .{
.name = "@intToFloat", .name = "@floatFromInt",
.signature = "@intToFloat(comptime DestType: type, int: anytype) DestType", .signature = "@floatFromInt(comptime DestType: type, int: anytype) DestType",
.snippet = "@intToFloat(${1:comptime DestType: type}, ${2:int: anytype})", .snippet = "@floatFromInt(${1:comptime DestType: type}, ${2:int: anytype})",
.documentation = .documentation =
\\Converts an integer to the closest floating point representation. To convert the other way, use [@floatToInt](https://ziglang.org/documentation/master/#floatToInt). This cast is always safe. \\Converts an integer to the closest floating point representation. To convert the other way, use [@intFromFloat](https://ziglang.org/documentation/master/#intFromFloat). This cast is always safe.
, ,
.arguments = &.{ .arguments = &.{
"comptime DestType: type", "comptime DestType: type",
@ -1029,11 +1029,11 @@ pub const builtins = [_]Builtin{
}, },
}, },
.{ .{
.name = "@intToPtr", .name = "@ptrFromInt",
.signature = "@intToPtr(comptime DestType: type, address: usize) DestType", .signature = "@ptrFromInt(comptime DestType: type, address: usize) DestType",
.snippet = "@intToPtr(${1:comptime DestType: type}, ${2:address: usize})", .snippet = "@ptrFromInt(${1:comptime DestType: type}, ${2:address: usize})",
.documentation = .documentation =
\\Converts an integer to a [pointer](https://ziglang.org/documentation/master/#Pointers). To convert the other way, use [@ptrToInt](https://ziglang.org/documentation/master/#ptrToInt). Casting an address of 0 to a destination type which in not [optional](https://ziglang.org/documentation/master/#Optional-Pointers) and does not have the `allowzero` attribute will result in a [Pointer Cast Invalid Null](https://ziglang.org/documentation/master/#Pointer-Cast-Invalid-Null) panic when runtime safety checks are enabled. \\Converts an integer to a [pointer](https://ziglang.org/documentation/master/#Pointers). To convert the other way, use [@intFromPtr](https://ziglang.org/documentation/master/#intFromPtr). Casting an address of 0 to a destination type which in not [optional](https://ziglang.org/documentation/master/#Optional-Pointers) and does not have the `allowzero` attribute will result in a [Pointer Cast Invalid Null](https://ziglang.org/documentation/master/#Pointer-Cast-Invalid-Null) panic when runtime safety checks are enabled.
\\ \\
\\If the destination pointer type does not allow address zero and `address` is zero, this invokes safety-checked [Undefined Behavior](https://ziglang.org/documentation/master/#Undefined-Behavior). \\If the destination pointer type does not allow address zero and `address` is zero, this invokes safety-checked [Undefined Behavior](https://ziglang.org/documentation/master/#Undefined-Behavior).
, ,
@ -1274,13 +1274,13 @@ pub const builtins = [_]Builtin{
}, },
}, },
.{ .{
.name = "@ptrToInt", .name = "@intFromPtr",
.signature = "@ptrToInt(value: anytype) usize", .signature = "@intFromPtr(value: anytype) usize",
.snippet = "@ptrToInt(${1:value: anytype})", .snippet = "@intFromPtr(${1:value: anytype})",
.documentation = .documentation =
\\Converts `value` to a `usize` which is the address of the pointer. `value` can be `*T` or `?*T`. \\Converts `value` to a `usize` which is the address of the pointer. `value` can be `*T` or `?*T`.
\\ \\
\\To convert the other way, use [@intToPtr](https://ziglang.org/documentation/master/#intToPtr) \\To convert the other way, use [@ptrFromInt](https://ziglang.org/documentation/master/#ptrFromInt)
, ,
.arguments = &.{ .arguments = &.{
"value: anytype", "value: anytype",
@ -1555,7 +1555,7 @@ pub const builtins = [_]Builtin{
\\test "vector @splat" { \\test "vector @splat" {
\\ const scalar: u32 = 5; \\ const scalar: u32 = 5;
\\ const result = @splat(4, scalar); \\ const result = @splat(4, scalar);
\\ comptime try expect(@TypeOf(result) == @Vector(4, u32)); \\ try comptime expect(@TypeOf(result) == @Vector(4, u32));
\\ try expect(std.mem.eql(u32, &@as([4]u32, result), &[_]u32{ 5, 5, 5, 5 })); \\ try expect(std.mem.eql(u32, &@as([4]u32, result), &[_]u32{ 5, 5, 5, 5 }));
\\} \\}
\\``` \\```
@ -1588,9 +1588,9 @@ pub const builtins = [_]Builtin{
\\ const value = @Vector(4, i32){ 1, -1, 1, -1 }; \\ const value = @Vector(4, i32){ 1, -1, 1, -1 };
\\ const result = value > @splat(4, @as(i32, 0)); \\ const result = value > @splat(4, @as(i32, 0));
\\ // result is { true, false, true, false }; \\ // result is { true, false, true, false };
\\ comptime try expect(@TypeOf(result) == @Vector(4, bool)); \\ try comptime expect(@TypeOf(result) == @Vector(4, bool));
\\ const is_all_true = @reduce(.And, result); \\ const is_all_true = @reduce(.And, result);
\\ comptime try expect(@TypeOf(is_all_true) == bool); \\ try comptime expect(@TypeOf(is_all_true) == bool);
\\ try expect(is_all_true == false); \\ try expect(is_all_true == false);
\\} \\}
\\``` \\```
@ -1642,7 +1642,7 @@ pub const builtins = [_]Builtin{
.signature = "@sin(value: anytype) @TypeOf(value)", .signature = "@sin(value: anytype) @TypeOf(value)",
.snippet = "@sin(${1:value: anytype})", .snippet = "@sin(${1:value: anytype})",
.documentation = .documentation =
\\Sine trigonometric function on a floating point number. Uses a dedicated hardware instruction when available. \\Sine trigonometric function on a floating point number in radians. Uses a dedicated hardware instruction when available.
\\ \\
\\Supports [Floats](https://ziglang.org/documentation/master/#Floats) and [Vectors](https://ziglang.org/documentation/master/#Vectors) of floats. \\Supports [Floats](https://ziglang.org/documentation/master/#Floats) and [Vectors](https://ziglang.org/documentation/master/#Vectors) of floats.
, ,
@ -1655,7 +1655,7 @@ pub const builtins = [_]Builtin{
.signature = "@cos(value: anytype) @TypeOf(value)", .signature = "@cos(value: anytype) @TypeOf(value)",
.snippet = "@cos(${1:value: anytype})", .snippet = "@cos(${1:value: anytype})",
.documentation = .documentation =
\\Cosine trigonometric function on a floating point number. Uses a dedicated hardware instruction when available. \\Cosine trigonometric function on a floating point number in radians. Uses a dedicated hardware instruction when available.
\\ \\
\\Supports [Floats](https://ziglang.org/documentation/master/#Floats) and [Vectors](https://ziglang.org/documentation/master/#Vectors) of floats. \\Supports [Floats](https://ziglang.org/documentation/master/#Floats) and [Vectors](https://ziglang.org/documentation/master/#Vectors) of floats.
, ,
@ -1668,7 +1668,7 @@ pub const builtins = [_]Builtin{
.signature = "@tan(value: anytype) @TypeOf(value)", .signature = "@tan(value: anytype) @TypeOf(value)",
.snippet = "@tan(${1:value: anytype})", .snippet = "@tan(${1:value: anytype})",
.documentation = .documentation =
\\Tangent trigonometric function on a floating point number. Uses a dedicated hardware instruction when available. \\Tangent trigonometric function on a floating point number in radians. Uses a dedicated hardware instruction when available.
\\ \\
\\Supports [Floats](https://ziglang.org/documentation/master/#Floats) and [Vectors](https://ziglang.org/documentation/master/#Vectors) of floats. \\Supports [Floats](https://ziglang.org/documentation/master/#Floats) and [Vectors](https://ziglang.org/documentation/master/#Vectors) of floats.
, ,
@ -1977,7 +1977,7 @@ pub const builtins = [_]Builtin{
\\test "no runtime side effects" { \\test "no runtime side effects" {
\\ var data: i32 = 0; \\ var data: i32 = 0;
\\ const T = @TypeOf(foo(i32, &data)); \\ const T = @TypeOf(foo(i32, &data));
\\ comptime try expect(T == i32); \\ try comptime expect(T == i32);
\\ try expect(data == 0); \\ try expect(data == 0);
\\} \\}
\\fn foo(comptime T: type, ptr: *T) T { \\fn foo(comptime T: type, ptr: *T) T {