From e6759f7d913d28bfdac23b0c97fea0097ff06b4a Mon Sep 17 00:00:00 2001 From: Write Int <151211283+WriteNaN@users.noreply.github.com> Date: Thu, 2 May 2024 07:15:56 +0000 Subject: [PATCH 1/5] fix: zig 0.13.0-dev.46+3648d7df1 std.ComptimeStringMap -> std.StaticStringMap(T).initComptime() semver check switch should return a default value update README format to pass linting test --- README.md | 2 +- build.zig | 2 +- src/FFI.zig | 246 ++++++++++++++++++++-------------------- src/Parser.zig | 171 +++++++++++++--------------- src/Token.zig | 117 ++++++++++--------- src/ext/clap | 2 +- src/lib/buzz_os.zig | 2 + src/obj.zig | 268 ++++++++++++++++++++------------------------ 8 files changed, 379 insertions(+), 431 deletions(-) diff --git a/README.md b/README.md index 654062f0..aab8c058 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ A small/lightweight statically typed scripting language written in Zig ## How to build and install -_Latest zig version supported: 0.12.0-dev.3666+a2b834e8c_ +_Latest zig version supported: 0.13.0-dev.46+3648d7df1_ ### Requirements - Since this is built with Zig, you should be able to build buzz on a wide variety of architectures even though this has only been tested on x86/M1. diff --git a/build.zig b/build.zig index 6812c216..4082c3dc 100644 --- a/build.zig +++ b/build.zig @@ -96,7 +96,7 @@ fn getBuzzPrefix(b: *Build) []const u8 { pub fn build(b: *Build) !void { // Check minimum zig version const current_zig = builtin.zig_version; - const min_zig = std.SemanticVersion.parse("0.12.0-dev.3666+a2b834e8c") catch return; + const min_zig = std.SemanticVersion.parse("0.13.0-dev.46+3648d7df1") catch return; if (current_zig.order(min_zig).compare(.lt)) { @panic(b.fmt("Your Zig version v{} does not meet the minimum build requirement of v{}", .{ current_zig, min_zig })); } diff --git a/src/FFI.zig b/src/FFI.zig index 4a80f086..71be6136 100644 --- a/src/FFI.zig +++ b/src/FFI.zig @@ -12,168 +12,162 @@ const Reporter = @import("Reporter.zig"); const Self = @This(); -const basic_types = std.ComptimeStringMap( - o.ObjTypeDef, - .{ - .{ "u8", .{ .def_type = .Integer } }, - .{ "i8", .{ .def_type = .Integer } }, - .{ "u16", .{ .def_type = .Integer } }, - .{ "i16", .{ .def_type = .Integer } }, - .{ "i32", .{ .def_type = .Integer } }, +const basic_types = std.StaticStringMap(o.ObjTypeDef).initComptime(.{ + .{ "u8", .{ .def_type = .Integer } }, + .{ "i8", .{ .def_type = .Integer } }, + .{ "u16", .{ .def_type = .Integer } }, + .{ "i16", .{ .def_type = .Integer } }, + .{ "i32", .{ .def_type = .Integer } }, - // Could it be > 32bits one some systems? - .{ "c_int", .{ .def_type = .Integer } }, + // Could it be > 32bits one some systems? + .{ "c_int", .{ .def_type = .Integer } }, - .{ "c_uint", .{ .def_type = .Float } }, - .{ "u32", .{ .def_type = .Float } }, - .{ "i64", .{ .def_type = .Float } }, - .{ "f32", .{ .def_type = .Float } }, - .{ "f64", .{ .def_type = .Float } }, + .{ "c_uint", .{ .def_type = .Float } }, + .{ "u32", .{ .def_type = .Float } }, + .{ "i64", .{ .def_type = .Float } }, + .{ "f32", .{ .def_type = .Float } }, + .{ "f64", .{ .def_type = .Float } }, - .{ "u64", .{ .def_type = .UserData } }, - .{ "usize", .{ .def_type = .UserData } }, + .{ "u64", .{ .def_type = .UserData } }, + .{ "usize", .{ .def_type = .UserData } }, - .{ "bool", .{ .def_type = .Bool } }, + .{ "bool", .{ .def_type = .Bool } }, - .{ "void", .{ .def_type = .Void } }, - .{ "anyopaque", .{ .def_type = .Void } }, - }, -); + .{ "void", .{ .def_type = .Void } }, + .{ "anyopaque", .{ .def_type = .Void } }, +}); -const zig_basic_types = std.ComptimeStringMap( - ZigType, +const zig_basic_types = std.StaticStringMap(ZigType).initComptime(.{ .{ - .{ - "anyopaque", - ZigType{ - .Opaque = .{ - .decls = &[_]ZigType.Declaration{}, - }, + "anyopaque", + ZigType{ + .Opaque = .{ + .decls = &[_]ZigType.Declaration{}, }, }, - .{ - "c_int", - ZigType{ - .Int = .{ - .signedness = .signed, - .bits = 32, - }, + }, + .{ + "c_int", + ZigType{ + .Int = .{ + .signedness = .signed, + .bits = 32, }, }, - .{ - "c_uint", - ZigType{ - .Int = .{ - .signedness = .unsigned, - .bits = 32, - }, + }, + .{ + "c_uint", + ZigType{ + .Int = .{ + .signedness = .unsigned, + .bits = 32, }, }, - .{ - "u8", - ZigType{ - .Int = .{ - .signedness = .unsigned, - .bits = 8, - }, + }, + .{ + "u8", + ZigType{ + .Int = .{ + .signedness = .unsigned, + .bits = 8, }, }, - .{ - "i8", - ZigType{ - .Int = .{ - .signedness = .signed, - .bits = 8, - }, + }, + .{ + "i8", + ZigType{ + .Int = .{ + .signedness = .signed, + .bits = 8, }, }, - .{ - "u16", - ZigType{ - .Int = .{ - .signedness = .unsigned, - .bits = 16, - }, + }, + .{ + "u16", + ZigType{ + .Int = .{ + .signedness = .unsigned, + .bits = 16, }, }, - .{ - "i16", - ZigType{ - .Int = .{ - .signedness = .signed, - .bits = 16, - }, + }, + .{ + "i16", + ZigType{ + .Int = .{ + .signedness = .signed, + .bits = 16, }, }, - .{ - "u32", - ZigType{ - .Int = .{ - .signedness = .unsigned, - .bits = 32, - }, + }, + .{ + "u32", + ZigType{ + .Int = .{ + .signedness = .unsigned, + .bits = 32, }, }, - .{ - "i32", - ZigType{ - .Int = .{ - .signedness = .signed, - .bits = 32, - }, + }, + .{ + "i32", + ZigType{ + .Int = .{ + .signedness = .signed, + .bits = 32, }, }, - .{ - "u64", - ZigType{ - .Int = .{ - .signedness = .unsigned, - .bits = 64, - }, + }, + .{ + "u64", + ZigType{ + .Int = .{ + .signedness = .unsigned, + .bits = 64, }, }, - .{ - "i64", - ZigType{ - .Int = .{ - .signedness = .signed, - .bits = 64, - }, + }, + .{ + "i64", + ZigType{ + .Int = .{ + .signedness = .signed, + .bits = 64, }, }, - .{ - "usize", - ZigType{ - .Int = .{ - .signedness = .signed, - .bits = @bitSizeOf(usize), - }, + }, + .{ + "usize", + ZigType{ + .Int = .{ + .signedness = .signed, + .bits = @bitSizeOf(usize), }, }, + }, - .{ - "f32", - ZigType{ - .Float = .{ .bits = 32 }, - }, + .{ + "f32", + ZigType{ + .Float = .{ .bits = 32 }, }, - .{ - "f64", - ZigType{ - .Float = .{ .bits = 64 }, - }, + }, + .{ + "f64", + ZigType{ + .Float = .{ .bits = 64 }, }, + }, - .{ - "bool", - ZigType{ .Bool = {} }, - }, - .{ - "void", - ZigType{ .Void = {} }, - }, + .{ + "bool", + ZigType{ .Bool = {} }, + }, + .{ + "void", + ZigType{ .Void = {} }, }, -); +}); pub const Zdef = struct { name: []const u8, diff --git a/src/Parser.zig b/src/Parser.zig index caa0ff1b..e84a7365 100644 --- a/src/Parser.zig +++ b/src/Parser.zig @@ -18,114 +18,93 @@ const buzz_api = @import("lib/buzz_api.zig"); // In the wasm build, libraries are statically linked const std_lib = if (is_wasm) @import("lib/buzz_std.zig") else void; -const std_api = if (is_wasm) std.ComptimeStringMap( - buzz_api.NativeFn, - .{ - .{ "assert", &std_lib.assert }, - .{ "buzzPanic", &std_lib.buzzPanic }, - .{ "char", &std_lib.char }, - .{ "currentFiber", &std_lib.currentFiber }, - .{ "parseFloat", &std_lib.parseFloat }, - .{ "parseInt", &std_lib.parseInt }, - .{ "parseUd", &std_lib.parseUd }, - .{ "print", &std_lib.print }, - .{ "random", &std_lib.random }, - .{ "toFloat", &std_lib.toFloat }, - .{ "toInt", &std_lib.toInt }, - .{ "toUd", &std_lib.toUd }, - }, -) else void; +const std_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime(.{ + .{ "assert", &std_lib.assert }, + .{ "buzzPanic", &std_lib.buzzPanic }, + .{ "char", &std_lib.char }, + .{ "currentFiber", &std_lib.currentFiber }, + .{ "parseFloat", &std_lib.parseFloat }, + .{ "parseInt", &std_lib.parseInt }, + .{ "parseUd", &std_lib.parseUd }, + .{ "print", &std_lib.print }, + .{ "random", &std_lib.random }, + .{ "toFloat", &std_lib.toFloat }, + .{ "toInt", &std_lib.toInt }, + .{ "toUd", &std_lib.toUd }, +}) else void; const gc_lib = if (is_wasm) @import("lib/buzz_gc.zig") else void; -const gc_api = if (is_wasm) std.ComptimeStringMap( - buzz_api.NativeFn, - .{ - .{ "allocated", &gc_lib.allocated }, - .{ "collect", &gc_lib.collect }, - }, -) else void; +const gc_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime(.{ + .{ "allocated", &gc_lib.allocated }, + .{ "collect", &gc_lib.collect }, +}) else void; const math_lib = if (is_wasm) @import("lib/buzz_math.zig") else void; -const math_api = if (is_wasm) std.ComptimeStringMap( - buzz_api.NativeFn, - .{ - .{ "abs", &math_lib.abs }, - .{ "acos", &math_lib.acos }, - .{ "asin", &math_lib.asin }, - .{ "atan", &math_lib.atan }, - .{ "bzsqrt", &math_lib.bzsqrt }, - .{ "bzceil", &math_lib.bzceil }, - .{ "bzcos", &math_lib.bzcos }, - .{ "bzexp", &math_lib.bzexp }, - .{ "bzfloor", &math_lib.bzfloor }, - .{ "bzlog", &math_lib.bzlog }, - .{ "minFloat", &math_lib.minFloat }, - .{ "maxFloat", &math_lib.maxFloat }, - .{ "minInt", &math_lib.minInt }, - .{ "maxInt", &math_lib.maxInt }, - .{ "bzsin", &math_lib.bzsin }, - .{ "bztan", &math_lib.bztan }, - .{ "pow", &math_lib.pow }, - }, -) else void; +const math_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime(.{ + .{ "abs", &math_lib.abs }, + .{ "acos", &math_lib.acos }, + .{ "asin", &math_lib.asin }, + .{ "atan", &math_lib.atan }, + .{ "bzsqrt", &math_lib.bzsqrt }, + .{ "bzceil", &math_lib.bzceil }, + .{ "bzcos", &math_lib.bzcos }, + .{ "bzexp", &math_lib.bzexp }, + .{ "bzfloor", &math_lib.bzfloor }, + .{ "bzlog", &math_lib.bzlog }, + .{ "minFloat", &math_lib.minFloat }, + .{ "maxFloat", &math_lib.maxFloat }, + .{ "minInt", &math_lib.minInt }, + .{ "maxInt", &math_lib.maxInt }, + .{ "bzsin", &math_lib.bzsin }, + .{ "bztan", &math_lib.bztan }, + .{ "pow", &math_lib.pow }, +}) else void; const buffer_lib = if (is_wasm) @import("lib/buzz_buffer.zig") else void; -const buffer_api = if (is_wasm) std.ComptimeStringMap( - buzz_api.NativeFn, - .{ - .{ "BufferNew", &buffer_lib.BufferNew }, - .{ "BufferDeinit", &buffer_lib.BufferDeinit }, - .{ "BufferRead", &buffer_lib.BufferRead }, - .{ "BufferWrite", &buffer_lib.BufferWrite }, - .{ "BufferReadBoolean", &buffer_lib.BufferReadBoolean }, - .{ "BufferWriteBoolean", &buffer_lib.BufferWriteBoolean }, - .{ "BufferWriteInt", &buffer_lib.BufferWriteInt }, - .{ "BufferReadInt", &buffer_lib.BufferReadInt }, - .{ "BufferWriteUserData", &buffer_lib.BufferWriteUserData }, - .{ "BufferReadUserData", &buffer_lib.BufferReadUserData }, - .{ "BufferWriteFloat", &buffer_lib.BufferWriteFloat }, - .{ "BufferReadFloat", &buffer_lib.BufferReadFloat }, - .{ "BufferLen", &buffer_lib.BufferLen }, - .{ "BufferCursor", &buffer_lib.BufferCursor }, - .{ "BufferBuffer", &buffer_lib.BufferBuffer }, - .{ "BufferPtr", &buffer_lib.BufferPtr }, - .{ "BufferEmpty", &buffer_lib.BufferEmpty }, - .{ "BufferAt", &buffer_lib.BufferAt }, - .{ "BufferSetAt", &buffer_lib.BufferSetAt }, - .{ "BufferWriteZ", &buffer_lib.BufferWriteZ }, - .{ "BufferWriteZAt", &buffer_lib.BufferWriteZAt }, - .{ "BufferReadZ", &buffer_lib.BufferReadZ }, - .{ "BufferReadZAt", &buffer_lib.BufferReadZAt }, - .{ "BufferWriteStruct", &buffer_lib.BufferWriteStruct }, - .{ "BufferWriteStructAt", &buffer_lib.BufferWriteStructAt }, - .{ "BufferReadStruct", &buffer_lib.BufferReadStruct }, - .{ "BufferReadStructAt", &buffer_lib.BufferReadStructAt }, - }, -) else void; +const buffer_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime(.{ + .{ "BufferNew", &buffer_lib.BufferNew }, + .{ "BufferDeinit", &buffer_lib.BufferDeinit }, + .{ "BufferRead", &buffer_lib.BufferRead }, + .{ "BufferWrite", &buffer_lib.BufferWrite }, + .{ "BufferReadBoolean", &buffer_lib.BufferReadBoolean }, + .{ "BufferWriteBoolean", &buffer_lib.BufferWriteBoolean }, + .{ "BufferWriteInt", &buffer_lib.BufferWriteInt }, + .{ "BufferReadInt", &buffer_lib.BufferReadInt }, + .{ "BufferWriteUserData", &buffer_lib.BufferWriteUserData }, + .{ "BufferReadUserData", &buffer_lib.BufferReadUserData }, + .{ "BufferWriteFloat", &buffer_lib.BufferWriteFloat }, + .{ "BufferReadFloat", &buffer_lib.BufferReadFloat }, + .{ "BufferLen", &buffer_lib.BufferLen }, + .{ "BufferCursor", &buffer_lib.BufferCursor }, + .{ "BufferBuffer", &buffer_lib.BufferBuffer }, + .{ "BufferPtr", &buffer_lib.BufferPtr }, + .{ "BufferEmpty", &buffer_lib.BufferEmpty }, + .{ "BufferAt", &buffer_lib.BufferAt }, + .{ "BufferSetAt", &buffer_lib.BufferSetAt }, + .{ "BufferWriteZ", &buffer_lib.BufferWriteZ }, + .{ "BufferWriteZAt", &buffer_lib.BufferWriteZAt }, + .{ "BufferReadZ", &buffer_lib.BufferReadZ }, + .{ "BufferReadZAt", &buffer_lib.BufferReadZAt }, + .{ "BufferWriteStruct", &buffer_lib.BufferWriteStruct }, + .{ "BufferWriteStructAt", &buffer_lib.BufferWriteStructAt }, + .{ "BufferReadStruct", &buffer_lib.BufferReadStruct }, + .{ "BufferReadStructAt", &buffer_lib.BufferReadStructAt }, +}) else void; const debug_lib = if (is_wasm) @import("lib/buzz_debug.zig") else void; -const debug_api = if (is_wasm) std.ComptimeStringMap( - buzz_api.NativeFn, - .{ - .{ "dump", &debug_lib.dump }, - }, -) else void; +const debug_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime(.{ + .{ "dump", &debug_lib.dump }, +}) else void; const serialize_lib = if (is_wasm) @import("lib/buzz_serialize.zig") else void; -const serialize_api = if (is_wasm) std.ComptimeStringMap( - buzz_api.NativeFn, - .{ - .{ "serialize", &serialize_lib.serialize }, - }, -) else void; +const serialize_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime(.{ + .{ "serialize", &serialize_lib.serialize }, +}) else void; const crypto_lib = if (is_wasm) @import("lib/buzz_crypto.zig") else void; -const crypto_api = if (is_wasm) std.ComptimeStringMap( - buzz_api.NativeFn, - .{ - .{ "hash", &crypto_lib.hash }, - }, -) else void; +const crypto_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime(.{ + .{ "hash", &crypto_lib.hash }, +}) else void; // TODO: other libs diff --git a/src/Token.zig b/src/Token.zig index f1f155fc..6b7f5ab9 100644 --- a/src/Token.zig +++ b/src/Token.zig @@ -180,63 +180,60 @@ pub const Type = enum { Range, // range }; -pub const keywords = std.ComptimeStringMap( - Type, - .{ - .{ "and", .And }, - .{ "any", .Any }, - .{ "as", .As }, - .{ "bool", .Bool }, - .{ "break", .Break }, - .{ "catch", .Catch }, - .{ "const", .Const }, - .{ "continue", .Continue }, - .{ "default", .Default }, - .{ "do", .Do }, - .{ "else", .Else }, - .{ "enum", .Enum }, - .{ "export", .Export }, - .{ "extern", .Extern }, - .{ "false", .False }, - .{ "fib", .Fib }, - .{ "float", .Float }, - .{ "for", .For }, - .{ "foreach", .ForEach }, - .{ "from", .From }, - .{ "fun", .Fun }, - .{ "Function", .Function }, - .{ "if", .If }, - .{ "import", .Import }, - .{ "in", .In }, - .{ "int", .Int }, - .{ "is", .Is }, - .{ "namespace", .Namespace }, - .{ "null", .Null }, - .{ "obj", .Obj }, - .{ "object", .Object }, - .{ "or", .Or }, - .{ "out", .Out }, - .{ "pat", .Pat }, - .{ "protocol", .Protocol }, - .{ "range", .Range }, - .{ "resolve", .Resolve }, - .{ "resume", .Resume }, - .{ "return", .Return }, - .{ "static", .Static }, - .{ "str", .Str }, - .{ "switch", .Switch }, - .{ "test", .Test }, - .{ "throw", .Throw }, - .{ "true", .True }, - .{ "try", .Try }, - .{ "type", .Type }, - .{ "typeof", .TypeOf }, - .{ "ud", .Ud }, - .{ "until", .Until }, - .{ "var", .Var }, - .{ "void", .Void }, - .{ "while", .While }, - .{ "yield", .Yield }, - .{ "zdef", .Zdef }, - }, -); +pub const keywords = std.StaticStringMap(Type).initComptime(.{ + .{ "and", .And }, + .{ "any", .Any }, + .{ "as", .As }, + .{ "bool", .Bool }, + .{ "break", .Break }, + .{ "catch", .Catch }, + .{ "const", .Const }, + .{ "continue", .Continue }, + .{ "default", .Default }, + .{ "do", .Do }, + .{ "else", .Else }, + .{ "enum", .Enum }, + .{ "export", .Export }, + .{ "extern", .Extern }, + .{ "false", .False }, + .{ "fib", .Fib }, + .{ "float", .Float }, + .{ "for", .For }, + .{ "foreach", .ForEach }, + .{ "from", .From }, + .{ "fun", .Fun }, + .{ "Function", .Function }, + .{ "if", .If }, + .{ "import", .Import }, + .{ "in", .In }, + .{ "int", .Int }, + .{ "is", .Is }, + .{ "namespace", .Namespace }, + .{ "null", .Null }, + .{ "obj", .Obj }, + .{ "object", .Object }, + .{ "or", .Or }, + .{ "out", .Out }, + .{ "pat", .Pat }, + .{ "protocol", .Protocol }, + .{ "range", .Range }, + .{ "resolve", .Resolve }, + .{ "resume", .Resume }, + .{ "return", .Return }, + .{ "static", .Static }, + .{ "str", .Str }, + .{ "switch", .Switch }, + .{ "test", .Test }, + .{ "throw", .Throw }, + .{ "true", .True }, + .{ "try", .Try }, + .{ "type", .Type }, + .{ "typeof", .TypeOf }, + .{ "ud", .Ud }, + .{ "until", .Until }, + .{ "var", .Var }, + .{ "void", .Void }, + .{ "while", .While }, + .{ "yield", .Yield }, + .{ "zdef", .Zdef }, +}); diff --git a/src/ext/clap b/src/ext/clap index 8c98e640..1d413d9f 160000 --- a/src/ext/clap +++ b/src/ext/clap @@ -1 +1 @@ -Subproject commit 8c98e6404b22aafc0184e999d8f068b81cc22fa1 +Subproject commit 1d413d9ffcbd394904fa683ca975b5adbc19e615 diff --git a/src/lib/buzz_os.zig b/src/lib/buzz_os.zig index dcc33c62..6398a1bc 100644 --- a/src/lib/buzz_os.zig +++ b/src/lib/buzz_os.zig @@ -133,6 +133,8 @@ fn handleSpawnError(ctx: *api.NativeCtx, err: anytype) void { error.OutOfMemory => @panic("Out of memory"), error.Unexpected => ctx.vm.pushError("errors.UnexpectedError", null), + + else => ctx.vm.pushError("errors.UnexpectedError", null), } } diff --git a/src/obj.zig b/src/obj.zig index 9b946a7d..091cd197 100644 --- a/src/obj.zig +++ b/src/obj.zig @@ -542,23 +542,19 @@ pub const ObjFiber = struct { return obj.cast(Self, .Fiber); } - const members = std.ComptimeStringMap( - NativeFn, - .{ - .{ "over", buzz_builtin.fiber.over }, - .{ "cancel", buzz_builtin.fiber.cancel }, - .{ "isMain", buzz_builtin.fiber.isMain }, - }, - ); + const members = std.StaticStringMap(NativeFn).initComptime(.{ + .{ "over", buzz_builtin.fiber.over }, + .{ "cancel", buzz_builtin.fiber.cancel }, + .{ "isMain", buzz_builtin.fiber.isMain }, + }); - const members_typedef = std.ComptimeStringMap( + const members_typedef = std.StaticStringMap( []const u8, - .{ - .{ "over", "extern Function over() > bool" }, - .{ "cancel", "extern Function cancel() > void" }, - .{ "isMain", "extern Function isMain() > bool" }, - }, - ); + ).initComptime(.{ + .{ "over", "extern Function over() > bool" }, + .{ "cancel", "extern Function cancel() > void" }, + .{ "isMain", "extern Function isMain() > bool" }, + }); pub fn member(vm: *VM, method: *ObjString) !?*ObjNative { if (vm.gc.objfiber_members.get(method)) |umethod| { @@ -642,37 +638,31 @@ pub const ObjPattern = struct { return obj.cast(Self, .Pattern); } - const members = std.ComptimeStringMap( - NativeFn, - if (!is_wasm) - .{ - .{ "match", buzz_builtin.pattern.match }, - .{ "matchAll", buzz_builtin.pattern.matchAll }, - .{ "replace", buzz_builtin.pattern.replace }, - .{ "replaceAll", buzz_builtin.pattern.replaceAll }, - } - else - .{ - .{ "replace", buzz_builtin.pattern.replace }, - .{ "replaceAll", buzz_builtin.pattern.replaceAll }, - }, - ); + const members = std.StaticStringMap(NativeFn).initComptime(if (!is_wasm) + .{ + .{ "match", buzz_builtin.pattern.match }, + .{ "matchAll", buzz_builtin.pattern.matchAll }, + .{ "replace", buzz_builtin.pattern.replace }, + .{ "replaceAll", buzz_builtin.pattern.replaceAll }, + } + else + .{ + .{ "replace", buzz_builtin.pattern.replace }, + .{ "replaceAll", buzz_builtin.pattern.replaceAll }, + }); - const members_typedef = std.ComptimeStringMap( - []const u8, - if (!is_wasm) - .{ - .{ "match", "extern Function match(str subject) > [str]?" }, - .{ "matchAll", "extern Function matchAll(str subject) > [[str]]?" }, - .{ "replace", "extern Function replace(str subject, str with) > str" }, - .{ "replaceAll", "extern Function replaceAll(str subject, str with) > str" }, - } - else - .{ - .{ "replace", "extern Function replace(str subject, str with) > str" }, - .{ "replaceAll", "extern Function replaceAll(str subject, str with) > str" }, - }, - ); + const members_typedef = std.StaticStringMap([]const u8).initComptime(if (!is_wasm) + .{ + .{ "match", "extern Function match(str subject) > [str]?" }, + .{ "matchAll", "extern Function matchAll(str subject) > [[str]]?" }, + .{ "replace", "extern Function replace(str subject, str with) > str" }, + .{ "replaceAll", "extern Function replaceAll(str subject, str with) > str" }, + } + else + .{ + .{ "replace", "extern Function replace(str subject, str with) > str" }, + .{ "replaceAll", "extern Function replaceAll(str subject, str with) > str" }, + }); pub fn member(vm: *VM, method: *ObjString) !?*ObjNative { if (vm.gc.objpattern_members.get(method)) |umethod| { @@ -786,55 +776,51 @@ pub const ObjString = struct { } } - pub const members = std.ComptimeStringMap( - NativeFn, - .{ - .{ "len", buzz_builtin.str.len }, - .{ "utf8Len", buzz_builtin.str.utf8Len }, - .{ "utf8Valid", buzz_builtin.str.utf8Valid }, - .{ "utf8Codepoints", buzz_builtin.str.utf8Codepoints }, - .{ "trim", buzz_builtin.str.trim }, - .{ "byte", buzz_builtin.str.byte }, - .{ "indexOf", buzz_builtin.str.indexOf }, - .{ "split", buzz_builtin.str.split }, - .{ "sub", buzz_builtin.str.sub }, - .{ "startsWith", buzz_builtin.str.startsWith }, - .{ "endsWith", buzz_builtin.str.endsWith }, - .{ "replace", buzz_builtin.str.replace }, - .{ "repeat", buzz_builtin.str.repeat }, - .{ "encodeBase64", buzz_builtin.str.encodeBase64 }, - .{ "decodeBase64", buzz_builtin.str.decodeBase64 }, - .{ "upper", buzz_builtin.str.upper }, - .{ "lower", buzz_builtin.str.lower }, - .{ "hex", buzz_builtin.str.hex }, - .{ "bin", buzz_builtin.str.bin }, - }, - ); - - pub const members_typedef = std.ComptimeStringMap( + pub const members = std.StaticStringMap(NativeFn).initComptime(.{ + .{ "len", buzz_builtin.str.len }, + .{ "utf8Len", buzz_builtin.str.utf8Len }, + .{ "utf8Valid", buzz_builtin.str.utf8Valid }, + .{ "utf8Codepoints", buzz_builtin.str.utf8Codepoints }, + .{ "trim", buzz_builtin.str.trim }, + .{ "byte", buzz_builtin.str.byte }, + .{ "indexOf", buzz_builtin.str.indexOf }, + .{ "split", buzz_builtin.str.split }, + .{ "sub", buzz_builtin.str.sub }, + .{ "startsWith", buzz_builtin.str.startsWith }, + .{ "endsWith", buzz_builtin.str.endsWith }, + .{ "replace", buzz_builtin.str.replace }, + .{ "repeat", buzz_builtin.str.repeat }, + .{ "encodeBase64", buzz_builtin.str.encodeBase64 }, + .{ "decodeBase64", buzz_builtin.str.decodeBase64 }, + .{ "upper", buzz_builtin.str.upper }, + .{ "lower", buzz_builtin.str.lower }, + .{ "hex", buzz_builtin.str.hex }, + .{ "bin", buzz_builtin.str.bin }, + }); + + pub const members_typedef = std.StaticStringMap( []const u8, - .{ - .{ "len", "extern Function len() > int" }, - .{ "utf8Len", "extern Function utf8Len() > int" }, - .{ "utf8Valid", "extern Function utf8Valid() > bool" }, - .{ "utf8Codepoints", "extern Function utf8Codepoints() > [str]" }, - .{ "trim", "extern Function trim() > str" }, - .{ "byte", "extern Function byte(int at = 0) > int" }, - .{ "indexOf", "extern Function indexOf(str needle) > int?" }, - .{ "startsWith", "extern Function startsWith(str needle) > bool" }, - .{ "endsWith", "extern Function endsWith(str needle) > bool" }, - .{ "replace", "extern Function replace(str needle, str with) > str" }, - .{ "split", "extern Function split(str separator) > [str]" }, - .{ "sub", "extern Function sub(int start, int? len) > str" }, - .{ "repeat", "extern Function repeat(int n) > str" }, - .{ "encodeBase64", "extern Function encodeBase64() > str" }, - .{ "decodeBase64", "extern Function decodeBase64() > str" }, - .{ "upper", "extern Function upper() > str" }, - .{ "lower", "extern Function lower() > str" }, - .{ "hex", "extern Function hex() > str" }, - .{ "bin", "extern Function bin() > str" }, - }, - ); + ).initComptime(.{ + .{ "len", "extern Function len() > int" }, + .{ "utf8Len", "extern Function utf8Len() > int" }, + .{ "utf8Valid", "extern Function utf8Valid() > bool" }, + .{ "utf8Codepoints", "extern Function utf8Codepoints() > [str]" }, + .{ "trim", "extern Function trim() > str" }, + .{ "byte", "extern Function byte(int at = 0) > int" }, + .{ "indexOf", "extern Function indexOf(str needle) > int?" }, + .{ "startsWith", "extern Function startsWith(str needle) > bool" }, + .{ "endsWith", "extern Function endsWith(str needle) > bool" }, + .{ "replace", "extern Function replace(str needle, str with) > str" }, + .{ "split", "extern Function split(str separator) > [str]" }, + .{ "sub", "extern Function sub(int start, int? len) > str" }, + .{ "repeat", "extern Function repeat(int n) > str" }, + .{ "encodeBase64", "extern Function encodeBase64() > str" }, + .{ "decodeBase64", "extern Function decodeBase64() > str" }, + .{ "upper", "extern Function upper() > str" }, + .{ "lower", "extern Function lower() > str" }, + .{ "hex", "extern Function hex() > str" }, + .{ "bin", "extern Function bin() > str" }, + }); // TODO: find a way to return the same ObjNative pointer for the same type of Lists pub fn member(vm: *VM, method: *ObjString) !?*ObjNative { @@ -1605,27 +1591,26 @@ pub const ObjList = struct { return obj.cast(Self, .List); } - const members = std.ComptimeStringMap( + const members = std.StaticStringMap( NativeFn, - .{ - .{ "append", buzz_builtin.list.append }, - .{ "clone", buzz_builtin.list.clone }, - .{ "filter", buzz_builtin.list.filter }, - .{ "forEach", buzz_builtin.list.forEach }, - .{ "indexOf", buzz_builtin.list.indexOf }, - .{ "insert", buzz_builtin.list.insert }, - .{ "join", buzz_builtin.list.join }, - .{ "len", buzz_builtin.list.len }, - .{ "map", buzz_builtin.list.map }, - .{ "next", buzz_builtin.list.next }, - .{ "pop", buzz_builtin.list.pop }, - .{ "reduce", buzz_builtin.list.reduce }, - .{ "remove", buzz_builtin.list.remove }, - .{ "reverse", buzz_builtin.list.reverse }, - .{ "sort", buzz_builtin.list.sort }, - .{ "sub", buzz_builtin.list.sub }, - }, - ); + ).initComptime(.{ + .{ "append", buzz_builtin.list.append }, + .{ "clone", buzz_builtin.list.clone }, + .{ "filter", buzz_builtin.list.filter }, + .{ "forEach", buzz_builtin.list.forEach }, + .{ "indexOf", buzz_builtin.list.indexOf }, + .{ "insert", buzz_builtin.list.insert }, + .{ "join", buzz_builtin.list.join }, + .{ "len", buzz_builtin.list.len }, + .{ "map", buzz_builtin.list.map }, + .{ "next", buzz_builtin.list.next }, + .{ "pop", buzz_builtin.list.pop }, + .{ "reduce", buzz_builtin.list.reduce }, + .{ "remove", buzz_builtin.list.remove }, + .{ "reverse", buzz_builtin.list.reverse }, + .{ "sort", buzz_builtin.list.sort }, + .{ "sub", buzz_builtin.list.sub }, + }); // TODO: find a way to return the same ObjNative pointer for the same type of Lists pub fn member(self: *Self, vm: *VM, method: *ObjString) !?*ObjNative { @@ -2489,23 +2474,17 @@ pub const ObjRange = struct { return obj.cast(Self, .Range); } - const members = std.ComptimeStringMap( - NativeFn, - .{ - .{ "toList", buzz_builtin.range.toList }, - .{ "len", buzz_builtin.range.len }, - .{ "invert", buzz_builtin.range.invert }, - }, - ); + const members = std.StaticStringMap(NativeFn).initComptime(.{ + .{ "toList", buzz_builtin.range.toList }, + .{ "len", buzz_builtin.range.len }, + .{ "invert", buzz_builtin.range.invert }, + }); - const members_typedef = std.ComptimeStringMap( - []const u8, - .{ - .{ "toList", "extern Function toList() > [int]" }, - .{ "len", "extern Function len() > int" }, - .{ "invert", "extern Function invert() > range" }, - }, - ); + const members_typedef = std.StaticStringMap([]const u8).initComptime(.{ + .{ "toList", "extern Function toList() > [int]" }, + .{ "len", "extern Function len() > int" }, + .{ "invert", "extern Function invert() > range" }, + }); pub fn member(vm: *VM, method: *ObjString) !?*ObjNative { if (vm.gc.objrange_members.get(method)) |native| { @@ -2574,23 +2553,20 @@ pub const ObjMap = struct { try gc.markObjDirty(&self.obj); } - const members = std.ComptimeStringMap( - NativeFn, - .{ - .{ "clone", buzz_builtin.map.clone }, - .{ "diff", buzz_builtin.map.diff }, - .{ "filter", buzz_builtin.map.filter }, - .{ "forEach", buzz_builtin.map.forEach }, - .{ "intersect", buzz_builtin.map.intersect }, - .{ "keys", buzz_builtin.map.keys }, - .{ "map", buzz_builtin.map.map }, - .{ "reduce", buzz_builtin.map.reduce }, - .{ "remove", buzz_builtin.map.remove }, - .{ "size", buzz_builtin.map.size }, - .{ "sort", buzz_builtin.map.sort }, - .{ "values", buzz_builtin.map.values }, - }, - ); + const members = std.StaticStringMap(NativeFn).initComptime(.{ + .{ "clone", buzz_builtin.map.clone }, + .{ "diff", buzz_builtin.map.diff }, + .{ "filter", buzz_builtin.map.filter }, + .{ "forEach", buzz_builtin.map.forEach }, + .{ "intersect", buzz_builtin.map.intersect }, + .{ "keys", buzz_builtin.map.keys }, + .{ "map", buzz_builtin.map.map }, + .{ "reduce", buzz_builtin.map.reduce }, + .{ "remove", buzz_builtin.map.remove }, + .{ "size", buzz_builtin.map.size }, + .{ "sort", buzz_builtin.map.sort }, + .{ "values", buzz_builtin.map.values }, + }); pub fn member(self: *Self, vm: *VM, method: *ObjString) !?*ObjNative { if (self.methods.get(method)) |native| { From d12643db8a7aa8a23e0977a3096971ee2373bcf0 Mon Sep 17 00:00:00 2001 From: Write Int <151211283+WriteNaN@users.noreply.github.com> Date: Fri, 3 May 2024 08:22:13 +0000 Subject: [PATCH 2/5] fix: zig 0.13.0-dev.46+3648d7df1 default error --- src/lib/buzz_os.zig | 2 +- src/lib/errors.buzz | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/buzz_os.zig b/src/lib/buzz_os.zig index 6398a1bc..e94db525 100644 --- a/src/lib/buzz_os.zig +++ b/src/lib/buzz_os.zig @@ -134,7 +134,7 @@ fn handleSpawnError(ctx: *api.NativeCtx, err: anytype) void { error.OutOfMemory => @panic("Out of memory"), error.Unexpected => ctx.vm.pushError("errors.UnexpectedError", null), - else => ctx.vm.pushError("errors.UnexpectedError", null), + else => ctx.vm.pushError("errors.UnknownError", null) } } diff --git a/src/lib/errors.buzz b/src/lib/errors.buzz index c54fd587..6b16fc5f 100644 --- a/src/lib/errors.buzz +++ b/src/lib/errors.buzz @@ -128,4 +128,7 @@ export object UnderflowError { } export object UnexpectedError { str message = "UnexpectedError", +} +export object UnknownError { + str message = "UnknownError", } \ No newline at end of file From 200ebfd2dcf8f8e12c5caffa1d669ce0de734de0 Mon Sep 17 00:00:00 2001 From: Write Int <151211283+WriteNaN@users.noreply.github.com> Date: Fri, 3 May 2024 08:32:17 +0000 Subject: [PATCH 3/5] fix: zig 0.13.0-dev.46+3648d7df1 formatting --- src/FFI.zig | 244 ++++++++++++++++++++++++------------------------ src/Parser.zig | 164 ++++++++++++++++++--------------- src/Token.zig | 116 +++++++++++------------ src/obj.zig | 246 ++++++++++++++++++++++++++----------------------- 4 files changed, 404 insertions(+), 366 deletions(-) diff --git a/src/FFI.zig b/src/FFI.zig index 71be6136..a8bb5552 100644 --- a/src/FFI.zig +++ b/src/FFI.zig @@ -12,162 +12,166 @@ const Reporter = @import("Reporter.zig"); const Self = @This(); -const basic_types = std.StaticStringMap(o.ObjTypeDef).initComptime(.{ - .{ "u8", .{ .def_type = .Integer } }, - .{ "i8", .{ .def_type = .Integer } }, - .{ "u16", .{ .def_type = .Integer } }, - .{ "i16", .{ .def_type = .Integer } }, - .{ "i32", .{ .def_type = .Integer } }, +const basic_types = std.StaticStringMap(o.ObjTypeDef).initComptime( + .{ + .{ "u8", .{ .def_type = .Integer } }, + .{ "i8", .{ .def_type = .Integer } }, + .{ "u16", .{ .def_type = .Integer } }, + .{ "i16", .{ .def_type = .Integer } }, + .{ "i32", .{ .def_type = .Integer } }, - // Could it be > 32bits one some systems? - .{ "c_int", .{ .def_type = .Integer } }, + // Could it be > 32bits one some systems? + .{ "c_int", .{ .def_type = .Integer } }, - .{ "c_uint", .{ .def_type = .Float } }, - .{ "u32", .{ .def_type = .Float } }, - .{ "i64", .{ .def_type = .Float } }, - .{ "f32", .{ .def_type = .Float } }, - .{ "f64", .{ .def_type = .Float } }, + .{ "c_uint", .{ .def_type = .Float } }, + .{ "u32", .{ .def_type = .Float } }, + .{ "i64", .{ .def_type = .Float } }, + .{ "f32", .{ .def_type = .Float } }, + .{ "f64", .{ .def_type = .Float } }, - .{ "u64", .{ .def_type = .UserData } }, - .{ "usize", .{ .def_type = .UserData } }, + .{ "u64", .{ .def_type = .UserData } }, + .{ "usize", .{ .def_type = .UserData } }, - .{ "bool", .{ .def_type = .Bool } }, + .{ "bool", .{ .def_type = .Bool } }, - .{ "void", .{ .def_type = .Void } }, - .{ "anyopaque", .{ .def_type = .Void } }, -}); + .{ "void", .{ .def_type = .Void } }, + .{ "anyopaque", .{ .def_type = .Void } }, + }, +); -const zig_basic_types = std.StaticStringMap(ZigType).initComptime(.{ +const zig_basic_types = std.StaticStringMap(ZigType).initComptime( .{ - "anyopaque", - ZigType{ - .Opaque = .{ - .decls = &[_]ZigType.Declaration{}, + .{ + "anyopaque", + ZigType{ + .Opaque = .{ + .decls = &[_]ZigType.Declaration{}, + }, }, }, - }, - .{ - "c_int", - ZigType{ - .Int = .{ - .signedness = .signed, - .bits = 32, + .{ + "c_int", + ZigType{ + .Int = .{ + .signedness = .signed, + .bits = 32, + }, }, }, - }, - .{ - "c_uint", - ZigType{ - .Int = .{ - .signedness = .unsigned, - .bits = 32, + .{ + "c_uint", + ZigType{ + .Int = .{ + .signedness = .unsigned, + .bits = 32, + }, }, }, - }, - .{ - "u8", - ZigType{ - .Int = .{ - .signedness = .unsigned, - .bits = 8, + .{ + "u8", + ZigType{ + .Int = .{ + .signedness = .unsigned, + .bits = 8, + }, }, }, - }, - .{ - "i8", - ZigType{ - .Int = .{ - .signedness = .signed, - .bits = 8, + .{ + "i8", + ZigType{ + .Int = .{ + .signedness = .signed, + .bits = 8, + }, }, }, - }, - .{ - "u16", - ZigType{ - .Int = .{ - .signedness = .unsigned, - .bits = 16, + .{ + "u16", + ZigType{ + .Int = .{ + .signedness = .unsigned, + .bits = 16, + }, }, }, - }, - .{ - "i16", - ZigType{ - .Int = .{ - .signedness = .signed, - .bits = 16, + .{ + "i16", + ZigType{ + .Int = .{ + .signedness = .signed, + .bits = 16, + }, }, }, - }, - .{ - "u32", - ZigType{ - .Int = .{ - .signedness = .unsigned, - .bits = 32, + .{ + "u32", + ZigType{ + .Int = .{ + .signedness = .unsigned, + .bits = 32, + }, }, }, - }, - .{ - "i32", - ZigType{ - .Int = .{ - .signedness = .signed, - .bits = 32, + .{ + "i32", + ZigType{ + .Int = .{ + .signedness = .signed, + .bits = 32, + }, }, }, - }, - .{ - "u64", - ZigType{ - .Int = .{ - .signedness = .unsigned, - .bits = 64, + .{ + "u64", + ZigType{ + .Int = .{ + .signedness = .unsigned, + .bits = 64, + }, }, }, - }, - .{ - "i64", - ZigType{ - .Int = .{ - .signedness = .signed, - .bits = 64, + .{ + "i64", + ZigType{ + .Int = .{ + .signedness = .signed, + .bits = 64, + }, }, }, - }, - .{ - "usize", - ZigType{ - .Int = .{ - .signedness = .signed, - .bits = @bitSizeOf(usize), + .{ + "usize", + ZigType{ + .Int = .{ + .signedness = .signed, + .bits = @bitSizeOf(usize), + }, }, }, - }, - .{ - "f32", - ZigType{ - .Float = .{ .bits = 32 }, + .{ + "f32", + ZigType{ + .Float = .{ .bits = 32 }, + }, }, - }, - .{ - "f64", - ZigType{ - .Float = .{ .bits = 64 }, + .{ + "f64", + ZigType{ + .Float = .{ .bits = 64 }, + }, }, - }, - .{ - "bool", - ZigType{ .Bool = {} }, - }, - .{ - "void", - ZigType{ .Void = {} }, + .{ + "bool", + ZigType{ .Bool = {} }, + }, + .{ + "void", + ZigType{ .Void = {} }, + }, }, -}); +); pub const Zdef = struct { name: []const u8, diff --git a/src/Parser.zig b/src/Parser.zig index e84a7365..f7662852 100644 --- a/src/Parser.zig +++ b/src/Parser.zig @@ -18,93 +18,107 @@ const buzz_api = @import("lib/buzz_api.zig"); // In the wasm build, libraries are statically linked const std_lib = if (is_wasm) @import("lib/buzz_std.zig") else void; -const std_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime(.{ - .{ "assert", &std_lib.assert }, - .{ "buzzPanic", &std_lib.buzzPanic }, - .{ "char", &std_lib.char }, - .{ "currentFiber", &std_lib.currentFiber }, - .{ "parseFloat", &std_lib.parseFloat }, - .{ "parseInt", &std_lib.parseInt }, - .{ "parseUd", &std_lib.parseUd }, - .{ "print", &std_lib.print }, - .{ "random", &std_lib.random }, - .{ "toFloat", &std_lib.toFloat }, - .{ "toInt", &std_lib.toInt }, - .{ "toUd", &std_lib.toUd }, -}) else void; +const std_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime( + .{ + .{ "assert", &std_lib.assert }, + .{ "buzzPanic", &std_lib.buzzPanic }, + .{ "char", &std_lib.char }, + .{ "currentFiber", &std_lib.currentFiber }, + .{ "parseFloat", &std_lib.parseFloat }, + .{ "parseInt", &std_lib.parseInt }, + .{ "parseUd", &std_lib.parseUd }, + .{ "print", &std_lib.print }, + .{ "random", &std_lib.random }, + .{ "toFloat", &std_lib.toFloat }, + .{ "toInt", &std_lib.toInt }, + .{ "toUd", &std_lib.toUd }, + }, +) else void; const gc_lib = if (is_wasm) @import("lib/buzz_gc.zig") else void; -const gc_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime(.{ - .{ "allocated", &gc_lib.allocated }, - .{ "collect", &gc_lib.collect }, -}) else void; +const gc_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime( + .{ + .{ "allocated", &gc_lib.allocated }, + .{ "collect", &gc_lib.collect }, + }, +) else void; const math_lib = if (is_wasm) @import("lib/buzz_math.zig") else void; -const math_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime(.{ - .{ "abs", &math_lib.abs }, - .{ "acos", &math_lib.acos }, - .{ "asin", &math_lib.asin }, - .{ "atan", &math_lib.atan }, - .{ "bzsqrt", &math_lib.bzsqrt }, - .{ "bzceil", &math_lib.bzceil }, - .{ "bzcos", &math_lib.bzcos }, - .{ "bzexp", &math_lib.bzexp }, - .{ "bzfloor", &math_lib.bzfloor }, - .{ "bzlog", &math_lib.bzlog }, - .{ "minFloat", &math_lib.minFloat }, - .{ "maxFloat", &math_lib.maxFloat }, - .{ "minInt", &math_lib.minInt }, - .{ "maxInt", &math_lib.maxInt }, - .{ "bzsin", &math_lib.bzsin }, - .{ "bztan", &math_lib.bztan }, - .{ "pow", &math_lib.pow }, -}) else void; +const math_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime( + .{ + .{ "abs", &math_lib.abs }, + .{ "acos", &math_lib.acos }, + .{ "asin", &math_lib.asin }, + .{ "atan", &math_lib.atan }, + .{ "bzsqrt", &math_lib.bzsqrt }, + .{ "bzceil", &math_lib.bzceil }, + .{ "bzcos", &math_lib.bzcos }, + .{ "bzexp", &math_lib.bzexp }, + .{ "bzfloor", &math_lib.bzfloor }, + .{ "bzlog", &math_lib.bzlog }, + .{ "minFloat", &math_lib.minFloat }, + .{ "maxFloat", &math_lib.maxFloat }, + .{ "minInt", &math_lib.minInt }, + .{ "maxInt", &math_lib.maxInt }, + .{ "bzsin", &math_lib.bzsin }, + .{ "bztan", &math_lib.bztan }, + .{ "pow", &math_lib.pow }, + }, +) else void; const buffer_lib = if (is_wasm) @import("lib/buzz_buffer.zig") else void; -const buffer_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime(.{ - .{ "BufferNew", &buffer_lib.BufferNew }, - .{ "BufferDeinit", &buffer_lib.BufferDeinit }, - .{ "BufferRead", &buffer_lib.BufferRead }, - .{ "BufferWrite", &buffer_lib.BufferWrite }, - .{ "BufferReadBoolean", &buffer_lib.BufferReadBoolean }, - .{ "BufferWriteBoolean", &buffer_lib.BufferWriteBoolean }, - .{ "BufferWriteInt", &buffer_lib.BufferWriteInt }, - .{ "BufferReadInt", &buffer_lib.BufferReadInt }, - .{ "BufferWriteUserData", &buffer_lib.BufferWriteUserData }, - .{ "BufferReadUserData", &buffer_lib.BufferReadUserData }, - .{ "BufferWriteFloat", &buffer_lib.BufferWriteFloat }, - .{ "BufferReadFloat", &buffer_lib.BufferReadFloat }, - .{ "BufferLen", &buffer_lib.BufferLen }, - .{ "BufferCursor", &buffer_lib.BufferCursor }, - .{ "BufferBuffer", &buffer_lib.BufferBuffer }, - .{ "BufferPtr", &buffer_lib.BufferPtr }, - .{ "BufferEmpty", &buffer_lib.BufferEmpty }, - .{ "BufferAt", &buffer_lib.BufferAt }, - .{ "BufferSetAt", &buffer_lib.BufferSetAt }, - .{ "BufferWriteZ", &buffer_lib.BufferWriteZ }, - .{ "BufferWriteZAt", &buffer_lib.BufferWriteZAt }, - .{ "BufferReadZ", &buffer_lib.BufferReadZ }, - .{ "BufferReadZAt", &buffer_lib.BufferReadZAt }, - .{ "BufferWriteStruct", &buffer_lib.BufferWriteStruct }, - .{ "BufferWriteStructAt", &buffer_lib.BufferWriteStructAt }, - .{ "BufferReadStruct", &buffer_lib.BufferReadStruct }, - .{ "BufferReadStructAt", &buffer_lib.BufferReadStructAt }, -}) else void; +const buffer_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime( + .{ + .{ "BufferNew", &buffer_lib.BufferNew }, + .{ "BufferDeinit", &buffer_lib.BufferDeinit }, + .{ "BufferRead", &buffer_lib.BufferRead }, + .{ "BufferWrite", &buffer_lib.BufferWrite }, + .{ "BufferReadBoolean", &buffer_lib.BufferReadBoolean }, + .{ "BufferWriteBoolean", &buffer_lib.BufferWriteBoolean }, + .{ "BufferWriteInt", &buffer_lib.BufferWriteInt }, + .{ "BufferReadInt", &buffer_lib.BufferReadInt }, + .{ "BufferWriteUserData", &buffer_lib.BufferWriteUserData }, + .{ "BufferReadUserData", &buffer_lib.BufferReadUserData }, + .{ "BufferWriteFloat", &buffer_lib.BufferWriteFloat }, + .{ "BufferReadFloat", &buffer_lib.BufferReadFloat }, + .{ "BufferLen", &buffer_lib.BufferLen }, + .{ "BufferCursor", &buffer_lib.BufferCursor }, + .{ "BufferBuffer", &buffer_lib.BufferBuffer }, + .{ "BufferPtr", &buffer_lib.BufferPtr }, + .{ "BufferEmpty", &buffer_lib.BufferEmpty }, + .{ "BufferAt", &buffer_lib.BufferAt }, + .{ "BufferSetAt", &buffer_lib.BufferSetAt }, + .{ "BufferWriteZ", &buffer_lib.BufferWriteZ }, + .{ "BufferWriteZAt", &buffer_lib.BufferWriteZAt }, + .{ "BufferReadZ", &buffer_lib.BufferReadZ }, + .{ "BufferReadZAt", &buffer_lib.BufferReadZAt }, + .{ "BufferWriteStruct", &buffer_lib.BufferWriteStruct }, + .{ "BufferWriteStructAt", &buffer_lib.BufferWriteStructAt }, + .{ "BufferReadStruct", &buffer_lib.BufferReadStruct }, + .{ "BufferReadStructAt", &buffer_lib.BufferReadStructAt }, + }, +) else void; const debug_lib = if (is_wasm) @import("lib/buzz_debug.zig") else void; -const debug_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime(.{ - .{ "dump", &debug_lib.dump }, -}) else void; +const debug_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime( + .{ + .{ "dump", &debug_lib.dump }, + }, +) else void; const serialize_lib = if (is_wasm) @import("lib/buzz_serialize.zig") else void; -const serialize_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime(.{ - .{ "serialize", &serialize_lib.serialize }, -}) else void; +const serialize_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime( + .{ + .{ "serialize", &serialize_lib.serialize }, + }, +) else void; const crypto_lib = if (is_wasm) @import("lib/buzz_crypto.zig") else void; -const crypto_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime(.{ - .{ "hash", &crypto_lib.hash }, -}) else void; +const crypto_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime( + .{ + .{ "hash", &crypto_lib.hash }, + }, +) else void; // TODO: other libs diff --git a/src/Token.zig b/src/Token.zig index 6b7f5ab9..40b19c03 100644 --- a/src/Token.zig +++ b/src/Token.zig @@ -180,60 +180,62 @@ pub const Type = enum { Range, // range }; -pub const keywords = std.StaticStringMap(Type).initComptime(.{ - .{ "and", .And }, - .{ "any", .Any }, - .{ "as", .As }, - .{ "bool", .Bool }, - .{ "break", .Break }, - .{ "catch", .Catch }, - .{ "const", .Const }, - .{ "continue", .Continue }, - .{ "default", .Default }, - .{ "do", .Do }, - .{ "else", .Else }, - .{ "enum", .Enum }, - .{ "export", .Export }, - .{ "extern", .Extern }, - .{ "false", .False }, - .{ "fib", .Fib }, - .{ "float", .Float }, - .{ "for", .For }, - .{ "foreach", .ForEach }, - .{ "from", .From }, - .{ "fun", .Fun }, - .{ "Function", .Function }, - .{ "if", .If }, - .{ "import", .Import }, - .{ "in", .In }, - .{ "int", .Int }, - .{ "is", .Is }, - .{ "namespace", .Namespace }, - .{ "null", .Null }, - .{ "obj", .Obj }, - .{ "object", .Object }, - .{ "or", .Or }, - .{ "out", .Out }, - .{ "pat", .Pat }, - .{ "protocol", .Protocol }, - .{ "range", .Range }, - .{ "resolve", .Resolve }, - .{ "resume", .Resume }, - .{ "return", .Return }, - .{ "static", .Static }, - .{ "str", .Str }, - .{ "switch", .Switch }, - .{ "test", .Test }, - .{ "throw", .Throw }, - .{ "true", .True }, - .{ "try", .Try }, - .{ "type", .Type }, - .{ "typeof", .TypeOf }, - .{ "ud", .Ud }, - .{ "until", .Until }, - .{ "var", .Var }, - .{ "void", .Void }, - .{ "while", .While }, - .{ "yield", .Yield }, - .{ "zdef", .Zdef }, -}); +pub const keywords = std.StaticStringMap(Type).initComptime( + .{ + .{ "and", .And }, + .{ "any", .Any }, + .{ "as", .As }, + .{ "bool", .Bool }, + .{ "break", .Break }, + .{ "catch", .Catch }, + .{ "const", .Const }, + .{ "continue", .Continue }, + .{ "default", .Default }, + .{ "do", .Do }, + .{ "else", .Else }, + .{ "enum", .Enum }, + .{ "export", .Export }, + .{ "extern", .Extern }, + .{ "false", .False }, + .{ "fib", .Fib }, + .{ "float", .Float }, + .{ "for", .For }, + .{ "foreach", .ForEach }, + .{ "from", .From }, + .{ "fun", .Fun }, + .{ "Function", .Function }, + .{ "if", .If }, + .{ "import", .Import }, + .{ "in", .In }, + .{ "int", .Int }, + .{ "is", .Is }, + .{ "namespace", .Namespace }, + .{ "null", .Null }, + .{ "obj", .Obj }, + .{ "object", .Object }, + .{ "or", .Or }, + .{ "out", .Out }, + .{ "pat", .Pat }, + .{ "protocol", .Protocol }, + .{ "range", .Range }, + .{ "resolve", .Resolve }, + .{ "resume", .Resume }, + .{ "return", .Return }, + .{ "static", .Static }, + .{ "str", .Str }, + .{ "switch", .Switch }, + .{ "test", .Test }, + .{ "throw", .Throw }, + .{ "true", .True }, + .{ "try", .Try }, + .{ "type", .Type }, + .{ "typeof", .TypeOf }, + .{ "ud", .Ud }, + .{ "until", .Until }, + .{ "var", .Var }, + .{ "void", .Void }, + .{ "while", .While }, + .{ "yield", .Yield }, + .{ "zdef", .Zdef }, + }, +); diff --git a/src/obj.zig b/src/obj.zig index 091cd197..2bc8ed5e 100644 --- a/src/obj.zig +++ b/src/obj.zig @@ -542,11 +542,13 @@ pub const ObjFiber = struct { return obj.cast(Self, .Fiber); } - const members = std.StaticStringMap(NativeFn).initComptime(.{ - .{ "over", buzz_builtin.fiber.over }, - .{ "cancel", buzz_builtin.fiber.cancel }, - .{ "isMain", buzz_builtin.fiber.isMain }, - }); + const members = std.StaticStringMap(NativeFn).initComptime( + .{ + .{ "over", buzz_builtin.fiber.over }, + .{ "cancel", buzz_builtin.fiber.cancel }, + .{ "isMain", buzz_builtin.fiber.isMain }, + }, + ); const members_typedef = std.StaticStringMap( []const u8, @@ -638,31 +640,35 @@ pub const ObjPattern = struct { return obj.cast(Self, .Pattern); } - const members = std.StaticStringMap(NativeFn).initComptime(if (!is_wasm) - .{ - .{ "match", buzz_builtin.pattern.match }, - .{ "matchAll", buzz_builtin.pattern.matchAll }, - .{ "replace", buzz_builtin.pattern.replace }, - .{ "replaceAll", buzz_builtin.pattern.replaceAll }, - } - else - .{ - .{ "replace", buzz_builtin.pattern.replace }, - .{ "replaceAll", buzz_builtin.pattern.replaceAll }, - }); - - const members_typedef = std.StaticStringMap([]const u8).initComptime(if (!is_wasm) - .{ - .{ "match", "extern Function match(str subject) > [str]?" }, - .{ "matchAll", "extern Function matchAll(str subject) > [[str]]?" }, - .{ "replace", "extern Function replace(str subject, str with) > str" }, - .{ "replaceAll", "extern Function replaceAll(str subject, str with) > str" }, - } - else - .{ - .{ "replace", "extern Function replace(str subject, str with) > str" }, - .{ "replaceAll", "extern Function replaceAll(str subject, str with) > str" }, - }); + const members = std.StaticStringMap(NativeFn).initComptime( + if (!is_wasm) + .{ + .{ "match", buzz_builtin.pattern.match }, + .{ "matchAll", buzz_builtin.pattern.matchAll }, + .{ "replace", buzz_builtin.pattern.replace }, + .{ "replaceAll", buzz_builtin.pattern.replaceAll }, + } + else + .{ + .{ "replace", buzz_builtin.pattern.replace }, + .{ "replaceAll", buzz_builtin.pattern.replaceAll }, + }, + ); + + const members_typedef = std.StaticStringMap([]const u8).initComptime( + if (!is_wasm) + .{ + .{ "match", "extern Function match(str subject) > [str]?" }, + .{ "matchAll", "extern Function matchAll(str subject) > [[str]]?" }, + .{ "replace", "extern Function replace(str subject, str with) > str" }, + .{ "replaceAll", "extern Function replaceAll(str subject, str with) > str" }, + } + else + .{ + .{ "replace", "extern Function replace(str subject, str with) > str" }, + .{ "replaceAll", "extern Function replaceAll(str subject, str with) > str" }, + }, + ); pub fn member(vm: *VM, method: *ObjString) !?*ObjNative { if (vm.gc.objpattern_members.get(method)) |umethod| { @@ -776,51 +782,55 @@ pub const ObjString = struct { } } - pub const members = std.StaticStringMap(NativeFn).initComptime(.{ - .{ "len", buzz_builtin.str.len }, - .{ "utf8Len", buzz_builtin.str.utf8Len }, - .{ "utf8Valid", buzz_builtin.str.utf8Valid }, - .{ "utf8Codepoints", buzz_builtin.str.utf8Codepoints }, - .{ "trim", buzz_builtin.str.trim }, - .{ "byte", buzz_builtin.str.byte }, - .{ "indexOf", buzz_builtin.str.indexOf }, - .{ "split", buzz_builtin.str.split }, - .{ "sub", buzz_builtin.str.sub }, - .{ "startsWith", buzz_builtin.str.startsWith }, - .{ "endsWith", buzz_builtin.str.endsWith }, - .{ "replace", buzz_builtin.str.replace }, - .{ "repeat", buzz_builtin.str.repeat }, - .{ "encodeBase64", buzz_builtin.str.encodeBase64 }, - .{ "decodeBase64", buzz_builtin.str.decodeBase64 }, - .{ "upper", buzz_builtin.str.upper }, - .{ "lower", buzz_builtin.str.lower }, - .{ "hex", buzz_builtin.str.hex }, - .{ "bin", buzz_builtin.str.bin }, - }); + pub const members = std.StaticStringMap(NativeFn).initComptime( + .{ + .{ "len", buzz_builtin.str.len }, + .{ "utf8Len", buzz_builtin.str.utf8Len }, + .{ "utf8Valid", buzz_builtin.str.utf8Valid }, + .{ "utf8Codepoints", buzz_builtin.str.utf8Codepoints }, + .{ "trim", buzz_builtin.str.trim }, + .{ "byte", buzz_builtin.str.byte }, + .{ "indexOf", buzz_builtin.str.indexOf }, + .{ "split", buzz_builtin.str.split }, + .{ "sub", buzz_builtin.str.sub }, + .{ "startsWith", buzz_builtin.str.startsWith }, + .{ "endsWith", buzz_builtin.str.endsWith }, + .{ "replace", buzz_builtin.str.replace }, + .{ "repeat", buzz_builtin.str.repeat }, + .{ "encodeBase64", buzz_builtin.str.encodeBase64 }, + .{ "decodeBase64", buzz_builtin.str.decodeBase64 }, + .{ "upper", buzz_builtin.str.upper }, + .{ "lower", buzz_builtin.str.lower }, + .{ "hex", buzz_builtin.str.hex }, + .{ "bin", buzz_builtin.str.bin }, + }, + ); pub const members_typedef = std.StaticStringMap( []const u8, - ).initComptime(.{ - .{ "len", "extern Function len() > int" }, - .{ "utf8Len", "extern Function utf8Len() > int" }, - .{ "utf8Valid", "extern Function utf8Valid() > bool" }, - .{ "utf8Codepoints", "extern Function utf8Codepoints() > [str]" }, - .{ "trim", "extern Function trim() > str" }, - .{ "byte", "extern Function byte(int at = 0) > int" }, - .{ "indexOf", "extern Function indexOf(str needle) > int?" }, - .{ "startsWith", "extern Function startsWith(str needle) > bool" }, - .{ "endsWith", "extern Function endsWith(str needle) > bool" }, - .{ "replace", "extern Function replace(str needle, str with) > str" }, - .{ "split", "extern Function split(str separator) > [str]" }, - .{ "sub", "extern Function sub(int start, int? len) > str" }, - .{ "repeat", "extern Function repeat(int n) > str" }, - .{ "encodeBase64", "extern Function encodeBase64() > str" }, - .{ "decodeBase64", "extern Function decodeBase64() > str" }, - .{ "upper", "extern Function upper() > str" }, - .{ "lower", "extern Function lower() > str" }, - .{ "hex", "extern Function hex() > str" }, - .{ "bin", "extern Function bin() > str" }, - }); + ).initComptime( + .{ + .{ "len", "extern Function len() > int" }, + .{ "utf8Len", "extern Function utf8Len() > int" }, + .{ "utf8Valid", "extern Function utf8Valid() > bool" }, + .{ "utf8Codepoints", "extern Function utf8Codepoints() > [str]" }, + .{ "trim", "extern Function trim() > str" }, + .{ "byte", "extern Function byte(int at = 0) > int" }, + .{ "indexOf", "extern Function indexOf(str needle) > int?" }, + .{ "startsWith", "extern Function startsWith(str needle) > bool" }, + .{ "endsWith", "extern Function endsWith(str needle) > bool" }, + .{ "replace", "extern Function replace(str needle, str with) > str" }, + .{ "split", "extern Function split(str separator) > [str]" }, + .{ "sub", "extern Function sub(int start, int? len) > str" }, + .{ "repeat", "extern Function repeat(int n) > str" }, + .{ "encodeBase64", "extern Function encodeBase64() > str" }, + .{ "decodeBase64", "extern Function decodeBase64() > str" }, + .{ "upper", "extern Function upper() > str" }, + .{ "lower", "extern Function lower() > str" }, + .{ "hex", "extern Function hex() > str" }, + .{ "bin", "extern Function bin() > str" }, + }, + ); // TODO: find a way to return the same ObjNative pointer for the same type of Lists pub fn member(vm: *VM, method: *ObjString) !?*ObjNative { @@ -1593,24 +1603,26 @@ pub const ObjList = struct { const members = std.StaticStringMap( NativeFn, - ).initComptime(.{ - .{ "append", buzz_builtin.list.append }, - .{ "clone", buzz_builtin.list.clone }, - .{ "filter", buzz_builtin.list.filter }, - .{ "forEach", buzz_builtin.list.forEach }, - .{ "indexOf", buzz_builtin.list.indexOf }, - .{ "insert", buzz_builtin.list.insert }, - .{ "join", buzz_builtin.list.join }, - .{ "len", buzz_builtin.list.len }, - .{ "map", buzz_builtin.list.map }, - .{ "next", buzz_builtin.list.next }, - .{ "pop", buzz_builtin.list.pop }, - .{ "reduce", buzz_builtin.list.reduce }, - .{ "remove", buzz_builtin.list.remove }, - .{ "reverse", buzz_builtin.list.reverse }, - .{ "sort", buzz_builtin.list.sort }, - .{ "sub", buzz_builtin.list.sub }, - }); + ).initComptime( + .{ + .{ "append", buzz_builtin.list.append }, + .{ "clone", buzz_builtin.list.clone }, + .{ "filter", buzz_builtin.list.filter }, + .{ "forEach", buzz_builtin.list.forEach }, + .{ "indexOf", buzz_builtin.list.indexOf }, + .{ "insert", buzz_builtin.list.insert }, + .{ "join", buzz_builtin.list.join }, + .{ "len", buzz_builtin.list.len }, + .{ "map", buzz_builtin.list.map }, + .{ "next", buzz_builtin.list.next }, + .{ "pop", buzz_builtin.list.pop }, + .{ "reduce", buzz_builtin.list.reduce }, + .{ "remove", buzz_builtin.list.remove }, + .{ "reverse", buzz_builtin.list.reverse }, + .{ "sort", buzz_builtin.list.sort }, + .{ "sub", buzz_builtin.list.sub }, + }, + ); // TODO: find a way to return the same ObjNative pointer for the same type of Lists pub fn member(self: *Self, vm: *VM, method: *ObjString) !?*ObjNative { @@ -2474,17 +2486,21 @@ pub const ObjRange = struct { return obj.cast(Self, .Range); } - const members = std.StaticStringMap(NativeFn).initComptime(.{ - .{ "toList", buzz_builtin.range.toList }, - .{ "len", buzz_builtin.range.len }, - .{ "invert", buzz_builtin.range.invert }, - }); + const members = std.StaticStringMap(NativeFn).initComptime( + .{ + .{ "toList", buzz_builtin.range.toList }, + .{ "len", buzz_builtin.range.len }, + .{ "invert", buzz_builtin.range.invert }, + }, + ); - const members_typedef = std.StaticStringMap([]const u8).initComptime(.{ - .{ "toList", "extern Function toList() > [int]" }, - .{ "len", "extern Function len() > int" }, - .{ "invert", "extern Function invert() > range" }, - }); + const members_typedef = std.StaticStringMap([]const u8).initComptime( + .{ + .{ "toList", "extern Function toList() > [int]" }, + .{ "len", "extern Function len() > int" }, + .{ "invert", "extern Function invert() > range" }, + }, + ); pub fn member(vm: *VM, method: *ObjString) !?*ObjNative { if (vm.gc.objrange_members.get(method)) |native| { @@ -2553,20 +2569,22 @@ pub const ObjMap = struct { try gc.markObjDirty(&self.obj); } - const members = std.StaticStringMap(NativeFn).initComptime(.{ - .{ "clone", buzz_builtin.map.clone }, - .{ "diff", buzz_builtin.map.diff }, - .{ "filter", buzz_builtin.map.filter }, - .{ "forEach", buzz_builtin.map.forEach }, - .{ "intersect", buzz_builtin.map.intersect }, - .{ "keys", buzz_builtin.map.keys }, - .{ "map", buzz_builtin.map.map }, - .{ "reduce", buzz_builtin.map.reduce }, - .{ "remove", buzz_builtin.map.remove }, - .{ "size", buzz_builtin.map.size }, - .{ "sort", buzz_builtin.map.sort }, - .{ "values", buzz_builtin.map.values }, - }); + const members = std.StaticStringMap(NativeFn).initComptime( + .{ + .{ "clone", buzz_builtin.map.clone }, + .{ "diff", buzz_builtin.map.diff }, + .{ "filter", buzz_builtin.map.filter }, + .{ "forEach", buzz_builtin.map.forEach }, + .{ "intersect", buzz_builtin.map.intersect }, + .{ "keys", buzz_builtin.map.keys }, + .{ "map", buzz_builtin.map.map }, + .{ "reduce", buzz_builtin.map.reduce }, + .{ "remove", buzz_builtin.map.remove }, + .{ "size", buzz_builtin.map.size }, + .{ "sort", buzz_builtin.map.sort }, + .{ "values", buzz_builtin.map.values }, + }, + ); pub fn member(self: *Self, vm: *VM, method: *ObjString) !?*ObjNative { if (self.methods.get(method)) |native| { From adad357eaf4ffafa8ce564d4d7b6898c4ff7bd9f Mon Sep 17 00:00:00 2001 From: Write Int <151211283+WriteNaN@users.noreply.github.com> Date: Fri, 3 May 2024 09:10:49 +0000 Subject: [PATCH 4/5] fix: zig 0.13.0-dev.46+3648d7df1 InvalidBatchScriptArg --- src/lib/buzz_os.zig | 3 +-- src/lib/errors.buzz | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/lib/buzz_os.zig b/src/lib/buzz_os.zig index e94db525..708166ed 100644 --- a/src/lib/buzz_os.zig +++ b/src/lib/buzz_os.zig @@ -114,6 +114,7 @@ fn handleSpawnError(ctx: *api.NativeCtx, err: anytype) void { error.NameTooLong, error.NoDevice, error.NotDir, + error.InvalidBatchScriptArg, error.ProcessFdQuotaExceeded, error.SymLinkLoop, error.SystemFdQuotaExceeded, @@ -133,8 +134,6 @@ fn handleSpawnError(ctx: *api.NativeCtx, err: anytype) void { error.OutOfMemory => @panic("Out of memory"), error.Unexpected => ctx.vm.pushError("errors.UnexpectedError", null), - - else => ctx.vm.pushError("errors.UnknownError", null) } } diff --git a/src/lib/errors.buzz b/src/lib/errors.buzz index 6b16fc5f..c54fd587 100644 --- a/src/lib/errors.buzz +++ b/src/lib/errors.buzz @@ -128,7 +128,4 @@ export object UnderflowError { } export object UnexpectedError { str message = "UnexpectedError", -} -export object UnknownError { - str message = "UnknownError", } \ No newline at end of file From 1e5a4b3e85dc878d27b7486e4f17fac8b1c0b071 Mon Sep 17 00:00:00 2001 From: Write Int <151211283+WriteNaN@users.noreply.github.com> Date: Fri, 3 May 2024 14:26:47 +0000 Subject: [PATCH 5/5] fix: zig 0.13.0-dev.46+3648d7df1 add error to buzz --- src/lib/errors.buzz | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/errors.buzz b/src/lib/errors.buzz index c54fd587..c7be9af0 100644 --- a/src/lib/errors.buzz +++ b/src/lib/errors.buzz @@ -10,6 +10,7 @@ export enum FileSystemError { FileLocksNotSupported, FileNotFound, FileSystem, + InvalidBatchScriptArg, FileTooBig, InputOutput, InvalidHandle,