diff --git a/src/Parser.zig b/src/Parser.zig index 60a4d8d5..c20b5793 100644 --- a/src/Parser.zig +++ b/src/Parser.zig @@ -433,10 +433,8 @@ const rules = [_]ParseRule{ .{ .prefix = null, .infix = null, .precedence = .None }, // While .{ .prefix = null, .infix = null, .precedence = .None }, // For .{ .prefix = null, .infix = null, .precedence = .None }, // ForEach - .{ .prefix = null, .infix = null, .precedence = .None }, // Switch .{ .prefix = null, .infix = null, .precedence = .None }, // Break .{ .prefix = null, .infix = null, .precedence = .None }, // Continue - .{ .prefix = null, .infix = null, .precedence = .None }, // Default .{ .prefix = null, .infix = null, .precedence = .None }, // In .{ .prefix = null, .infix = is, .precedence = .IsAs }, // Is .{ .prefix = literal, .infix = null, .precedence = .None }, // Integer @@ -513,7 +511,7 @@ pub fn init( imported: bool, flavor: RunFlavor, ) Self { - var self = Self{ + return .{ .gc = gc, .imports = imports, .script_imports = std.StringHashMap(LocalScriptImport).init(gc.allocator), @@ -524,13 +522,9 @@ pub fn init( .allocator = gc.allocator, .error_prefix = "Syntax", }, - .ffi = undefined, + .ffi = FFI.init(gc), .ast = Ast.init(gc.allocator), }; - - self.ffi = FFI.init(gc); - - return self; } pub fn deinit(self: *Self) void { @@ -747,13 +741,22 @@ fn synchronize(self: *Self) !void { .For, .ForEach, .Return, - .Switch, .Throw, .Break, .Continue, .Export, .Import, .Zdef, + .From, + .Var, + .Yield, + .Resume, + .Resolve, + .Protocol, + .Try, + .Static, + .Extern, + .Namespace, => return, else => {}, } diff --git a/src/Scanner.zig b/src/Scanner.zig index 3b2f72d6..e93f5c27 100644 --- a/src/Scanner.zig +++ b/src/Scanner.zig @@ -626,10 +626,8 @@ pub fn highlight(self: *Self, out: anytype, true_color: bool) void { .While, .For, .ForEach, - .Switch, .Break, .Continue, - .Default, .Const, .Fun, .In, diff --git a/src/Token.zig b/src/Token.zig index 8014e669..e1769b72 100644 --- a/src/Token.zig +++ b/src/Token.zig @@ -132,10 +132,8 @@ pub const Type = enum { While, // while For, // for ForEach, // foreach - Switch, // switch Break, // break Continue, // continue - Default, // default In, // in Is, // is IntegerValue, // 123 @@ -191,7 +189,6 @@ pub const keywords = std.StaticStringMap(Type).initComptime( .{ "catch", .Catch }, .{ "const", .Const }, .{ "continue", .Continue }, - .{ "default", .Default }, .{ "do", .Do }, .{ "else", .Else }, .{ "enum", .Enum }, @@ -224,7 +221,6 @@ pub const keywords = std.StaticStringMap(Type).initComptime( .{ "return", .Return }, .{ "static", .Static }, .{ "str", .Str }, - .{ "switch", .Switch }, .{ "test", .Test }, .{ "throw", .Throw }, .{ "true", .True },