Expand description
Registry of reserved keywords.
Single source of truth for the keyword list in
site/src/content/docs/book/reference/keywords.md, generated by
render_markdown. The test
tests/keywords_reference.rs asserts this table matches exactly the
alphabetic #[token("…")] keywords declared in lexer.rs, so the two
cannot drift.
Structs§
- Keyword
Info - One reserved keyword and a one-line description of its role.
Constants§
- BUILTIN_
TYPE_ NAMES - Built-in type names — compiler-known type constructors the parser dispatches
on by identifier text in
parser/types.rs, outside the keyword/token system entirely (they are lexed as ordinaryIdents, so they are absent from both the lexer’s#[token]s andKEYWORDS). They are nonetheless reserved in type position: atypedeclaration may not reuse one of these names (bynk.resolve.reserved_builtin_type), because the parser would otherwise intercept every later reference and the user’s alias would be silently shadowed or fail incoherently. - CONTEXTUAL_
KEYWORDS - Contextual keywords — words that read as keywords in one position but stay
usable as ordinary identifiers elsewhere, so they are lexed as
Identand are deliberately absent fromKEYWORDS(which is drift-guarded to equal the lexer’s reserved#[token]s). Editor surfaces still owe them a hover and a doc — the mechanical floor over this table lives inbynk-lsp/tests/editor_coverage.rs, mirroring the reserved-keyword tooth (ADR 0156 / ADR 0161). - KEYWORDS
- Every reserved keyword, sorted.
- RESERVED_
CONTEXTUAL - The reserved lexer tokens the parser deliberately re-admits as identifiers
outside their one keyword position (
expect_ident, ADR-tracked atparser.rs). UnlikeCONTEXTUAL_KEYWORDSthese words are real#[token]s and are members ofKEYWORDS(so the lexer↔registry drift guard sees them) — they simply are not rejected in identifier position. The keyword reference renders them as a distinct tier so the page no longer claims, falsely, that every listed word is unusable as an identifier.
Functions§
- is_
builtin_ type_ name - True when
nameis a compiler-known built-in type name. Used by the resolver to rejecttype <name> = …redeclarations. - is_
reserved_ contextual - True when
wordis a reserved contextual keyword — a reserved tokenexpect_identre-admits as an identifier. Because each of these words lexes only to its own dedicated token, matching on the source text is equivalent to matching the token kind, but keeps the exemption single-sourced againstRESERVED_CONTEXTUAL. - render_
markdown - Render the keyword reference page — three tiers, each with prose that is true of that tier (the page used to make one blanket claim that was false of two of them).