diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a1364df7..a1a69e74 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,7 +6,7 @@ on: jobs: test-macos: - runs-on: macos-latest + runs-on: macos-14 steps: - name: Install homebrew run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 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..a8bb5552 100644 --- a/src/FFI.zig +++ b/src/FFI.zig @@ -12,8 +12,7 @@ const Reporter = @import("Reporter.zig"); const Self = @This(); -const basic_types = std.ComptimeStringMap( - o.ObjTypeDef, +const basic_types = std.StaticStringMap(o.ObjTypeDef).initComptime( .{ .{ "u8", .{ .def_type = .Integer } }, .{ "i8", .{ .def_type = .Integer } }, @@ -40,8 +39,7 @@ const basic_types = std.ComptimeStringMap( }, ); -const zig_basic_types = std.ComptimeStringMap( - ZigType, +const zig_basic_types = std.StaticStringMap(ZigType).initComptime( .{ .{ "anyopaque", diff --git a/src/Parser.zig b/src/Parser.zig index caa0ff1b..f7662852 100644 --- a/src/Parser.zig +++ b/src/Parser.zig @@ -18,8 +18,7 @@ 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, +const std_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime( .{ .{ "assert", &std_lib.assert }, .{ "buzzPanic", &std_lib.buzzPanic }, @@ -37,8 +36,7 @@ const std_api = if (is_wasm) std.ComptimeStringMap( ) 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, +const gc_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime( .{ .{ "allocated", &gc_lib.allocated }, .{ "collect", &gc_lib.collect }, @@ -46,8 +44,7 @@ const gc_api = if (is_wasm) std.ComptimeStringMap( ) 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, +const math_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime( .{ .{ "abs", &math_lib.abs }, .{ "acos", &math_lib.acos }, @@ -70,8 +67,7 @@ const math_api = if (is_wasm) std.ComptimeStringMap( ) 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, +const buffer_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime( .{ .{ "BufferNew", &buffer_lib.BufferNew }, .{ "BufferDeinit", &buffer_lib.BufferDeinit }, @@ -104,24 +100,21 @@ const buffer_api = if (is_wasm) std.ComptimeStringMap( ) 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, +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, +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, +const crypto_api = if (is_wasm) std.StaticStringMap(buzz_api.NativeFn).initComptime( .{ .{ "hash", &crypto_lib.hash }, }, diff --git a/src/Token.zig b/src/Token.zig index f1f155fc..40b19c03 100644 --- a/src/Token.zig +++ b/src/Token.zig @@ -180,8 +180,7 @@ pub const Type = enum { Range, // range }; -pub const keywords = std.ComptimeStringMap( - Type, +pub const keywords = std.StaticStringMap(Type).initComptime( .{ .{ "and", .And }, .{ "any", .Any }, 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..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, 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, diff --git a/src/obj.zig b/src/obj.zig index 9b946a7d..2bc8ed5e 100644 --- a/src/obj.zig +++ b/src/obj.zig @@ -542,8 +542,7 @@ pub const ObjFiber = struct { return obj.cast(Self, .Fiber); } - const members = std.ComptimeStringMap( - NativeFn, + const members = std.StaticStringMap(NativeFn).initComptime( .{ .{ "over", buzz_builtin.fiber.over }, .{ "cancel", buzz_builtin.fiber.cancel }, @@ -551,14 +550,13 @@ pub const ObjFiber = struct { }, ); - 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,8 +640,7 @@ pub const ObjPattern = struct { return obj.cast(Self, .Pattern); } - const members = std.ComptimeStringMap( - NativeFn, + const members = std.StaticStringMap(NativeFn).initComptime( if (!is_wasm) .{ .{ "match", buzz_builtin.pattern.match }, @@ -658,8 +655,7 @@ pub const ObjPattern = struct { }, ); - const members_typedef = std.ComptimeStringMap( - []const u8, + const members_typedef = std.StaticStringMap([]const u8).initComptime( if (!is_wasm) .{ .{ "match", "extern Function match(str subject) > [str]?" }, @@ -786,8 +782,7 @@ pub const ObjString = struct { } } - pub const members = std.ComptimeStringMap( - NativeFn, + pub const members = std.StaticStringMap(NativeFn).initComptime( .{ .{ "len", buzz_builtin.str.len }, .{ "utf8Len", buzz_builtin.str.utf8Len }, @@ -811,8 +806,9 @@ pub const ObjString = struct { }, ); - pub const members_typedef = std.ComptimeStringMap( + pub const members_typedef = std.StaticStringMap( []const u8, + ).initComptime( .{ .{ "len", "extern Function len() > int" }, .{ "utf8Len", "extern Function utf8Len() > int" }, @@ -1605,8 +1601,9 @@ pub const ObjList = struct { return obj.cast(Self, .List); } - const members = std.ComptimeStringMap( + const members = std.StaticStringMap( NativeFn, + ).initComptime( .{ .{ "append", buzz_builtin.list.append }, .{ "clone", buzz_builtin.list.clone }, @@ -2489,8 +2486,7 @@ pub const ObjRange = struct { return obj.cast(Self, .Range); } - const members = std.ComptimeStringMap( - NativeFn, + const members = std.StaticStringMap(NativeFn).initComptime( .{ .{ "toList", buzz_builtin.range.toList }, .{ "len", buzz_builtin.range.len }, @@ -2498,8 +2494,7 @@ pub const ObjRange = struct { }, ); - const members_typedef = std.ComptimeStringMap( - []const u8, + const members_typedef = std.StaticStringMap([]const u8).initComptime( .{ .{ "toList", "extern Function toList() > [int]" }, .{ "len", "extern Function len() > int" }, @@ -2574,8 +2569,7 @@ pub const ObjMap = struct { try gc.markObjDirty(&self.obj); } - const members = std.ComptimeStringMap( - NativeFn, + const members = std.StaticStringMap(NativeFn).initComptime( .{ .{ "clone", buzz_builtin.map.clone }, .{ "diff", buzz_builtin.map.diff },