Files
sx/src/lexer.test.zig
agra 3c9ecd0b42 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).
2026-06-15 18:32:34 +03:00

15 lines
605 B
Zig

const std = @import("std");
const Lexer = @import("lexer.zig").Lexer;
const Tag = @import("token.zig").Tag;
// ASM stream Phase A.0: `asm` lexes as the dedicated `kw_asm` keyword, while
// `volatile` / `clobbers` deliberately stay plain identifiers (recognized
// contextually inside an `asm { … }` body, never reserved globally).
test "lex asm keyword; volatile/clobbers stay identifiers" {
var lex = Lexer.init("asm volatile clobbers");
const expected = [_]Tag{ .kw_asm, .identifier, .identifier };
for (expected) |exp| {
try std.testing.expectEqual(exp, lex.next().tag);
}
}