refactor(ffi-linkage)!: Phase 9.0 — delete the hash_foreign token (src is foreign-free)

Per user directive (total purge): remove the hash_foreign token entirely rather than
keep it for a friendly deprecation message. Deleted: the token enum (token.zig), the
lexer keyword entry + directive-list mention + lex test (lexer.zig), the 4 parser
rejection sites + 2 lookahead clauses + the runtime-class prefix #foreign peek arm
(parser.zig), and the lsp completion arm (server.zig). '#foreign' now lexes as an
invalid '#' token → a generic 'expected ;' parse error (no migration hint — the
accepted UX cost of zero-foreign). Deleted examples/1176-diagnostics-foreign-removed
(its purpose, the friendly rejection, no longer exists).

src/ now contains ZERO 'foreign' (case-insensitive). Suite green (645 corpus / 443
unit, 0 failed). Remaining for the 9.4 gate: issues/*.md prose + example filenames.
This commit is contained in:
agra
2026-06-15 10:59:59 +03:00
parent 811a280517
commit dfae690b31
8 changed files with 10 additions and 67 deletions

View File

@@ -69,7 +69,7 @@ pub const Lexer = struct {
}
// Directives: #import, #insert, #run, #builtin, #foreign, #library, #string
// Directives: #import, #insert, #run, #builtin, #library, #string
if (c == '#') {
// #string needs special handling (heredoc)
const str_kw = "#string";
@@ -88,7 +88,6 @@ pub const Lexer = struct {
.{ "#run", Tag.hash_run },
.{ "#builtin", Tag.hash_builtin },
.{ "#compiler", Tag.hash_compiler },
.{ "#foreign", Tag.hash_foreign },
.{ "#library", Tag.hash_library },
.{ "#framework", Tag.hash_framework },
.{ "#using", Tag.hash_using },
@@ -623,15 +622,6 @@ test "lex hash_insert" {
try std.testing.expectEqual(Tag.invalid, lex2.next().tag);
}
test "lex hash_foreign" {
var lex = Lexer.init("#foreign");
try std.testing.expectEqual(Tag.hash_foreign, lex.next().tag);
try std.testing.expectEqual(Tag.eof, lex.next().tag);
var lex2 = Lexer.init("#foreignx");
try std.testing.expectEqual(Tag.invalid, lex2.next().tag);
}
test "lex hash_library" {
var lex = Lexer.init("#library \"raylib\"");
try std.testing.expectEqual(Tag.hash_library, lex.next().tag);