Skip to main content

Module keywords

Module keywords 

Source
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§

KeywordInfo
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 ordinary Idents, so they are absent from both the lexer’s #[token]s and KEYWORDS). They are nonetheless reserved in type position: a type declaration 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 Ident and are deliberately absent from KEYWORDS (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 in bynk-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 at parser.rs). Unlike CONTEXTUAL_KEYWORDS these words are real #[token]s and are members of KEYWORDS (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 name is a compiler-known built-in type name. Used by the resolver to reject type <name> = … redeclarations.
is_reserved_contextual
True when word is a reserved contextual keyword — a reserved token expect_ident re-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 against RESERVED_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).