vtables, protocol

This commit is contained in:
agra
2026-02-24 06:20:38 +02:00
parent 0cc7b69441
commit 170e236764
16 changed files with 3032 additions and 294 deletions

View File

@@ -32,6 +32,10 @@ pub const Tag = enum {
kw_push, // push
kw_ufcs, // ufcs
kw_in, // in
kw_closure, // closure
kw_protocol, // protocol
kw_impl, // impl
kw_Self, // Self (in protocol declarations)
// Symbols
colon, // :
@@ -103,6 +107,7 @@ pub const Tag = enum {
hash_source, // #source (inside #import c { ... })
hash_define, // #define (inside #import c { ... })
hash_flags, // #flags (inside #import c { ... })
hash_inline, // #inline (protocol layout modifier)
triple_minus, // ---
// Special
@@ -169,7 +174,7 @@ pub const Tag = enum {
pub fn isTypeKeyword(tag: Tag) bool {
return switch (tag) {
.kw_f32, .kw_f64, .kw_Type => true,
.kw_f32, .kw_f64, .kw_Type, .kw_Self => true,
else => false,
};
}
@@ -215,6 +220,10 @@ pub const keywords = std.StaticStringMap(Tag).initComptime(.{
.{ "push", .kw_push },
.{ "ufcs", .kw_ufcs },
.{ "in", .kw_in },
.{ "closure", .kw_closure },
.{ "protocol", .kw_protocol },
.{ "impl", .kw_impl },
.{ "Self", .kw_Self },
});
pub fn getKeyword(bytes: []const u8) ?Tag {