feat(asm): Phase A.0 — add kw_asm keyword + lex test
`asm` now lexes as a dedicated `kw_asm` keyword (Token.Tag + keyword map entry).
`volatile` and `clobbers` stay out of the global keyword table — they are
recognized contextually only inside an `asm { … }` body (PLAN-ASM Deviation 4).
- token.zig: kw_asm tag + `.{ "asm", .kw_asm }` map entry.
- lsp/server.zig: classifyToken exhaustive switch gained the .kw_asm arm
(the new enum value forced coverage — intended tripwire).
- lexer.test.zig (new, wired into root.zig barrel): locks `asm`->kw_asm and
`volatile`/`clobbers`->identifier.
Lock commit (behavior-locking passing test). zig build test green (445 unit).
This commit is contained in:
@@ -45,6 +45,7 @@ pub const Tag = enum {
|
||||
kw_callconv, // callconv (calling convention annotation)
|
||||
kw_extern, // extern (import: external linkage, C ABI, no body)
|
||||
kw_export, // export (define + expose: external linkage, C ABI)
|
||||
kw_asm, // asm (inline assembly expression / global asm decl)
|
||||
|
||||
// Symbols
|
||||
colon, // :
|
||||
@@ -283,6 +284,9 @@ pub const keywords = std.StaticStringMap(Tag).initComptime(.{
|
||||
.{ "callconv", .kw_callconv },
|
||||
.{ "extern", .kw_extern },
|
||||
.{ "export", .kw_export },
|
||||
// `asm` is a real keyword; `volatile` / `clobbers` stay OUT of this table
|
||||
// (recognized contextually only inside an `asm { … }` body — see PLAN-ASM).
|
||||
.{ "asm", .kw_asm },
|
||||
});
|
||||
|
||||
pub fn getKeyword(bytes: []const u8) ?Tag {
|
||||
|
||||
Reference in New Issue
Block a user