§01 Lexer — capset keyword
Goal
Add capset to the lexer keyword table and emit TokenKind::Capset so the parser can dispatch on it.
Implementation Sketch
The lexer keyword table at compiler_repo/compiler/ori_lexer/src/keywords/mod.rs is a static match — adding capset is a one-line entry alongside siblings like extern, extension, def. The corresponding TokenKind::Capset variant is added to compiler_repo/compiler/ori_ir/src/token/kind.rs with the same derives as adjacent variants (Debug, Clone, Eq, PartialEq, Hash, serde — match the pattern of Extern / Extension / Def since they share the same declaration-keyword shape).
- Treat
capsetas a hard-reserved module-level declaration keyword per proposal §Design. - Do not route it through
soft_keyword_str(); identifier positions rejectcapset.
Implementation Items
Spec References
- Proposal:
compiler_repo/docs/ori_lang/proposals/approved/capset-proposal.md§Design + §Declaration. - Spec:
compiler_repo/docs/ori_lang/v2026/spec/20-capabilities.md §20.11. - Grammar:
compiler_repo/docs/ori_lang/v2026/spec/grammar.ebnfline 281 (capset_decl = "capset" identifier "=" identifier { "," identifier } ";" .).
Tests
Unit tests live in the lexer crate (sibling tests.rs); the spec test surface is owned by §05.
Intelligence Reconnaissance
Before implementation, run scripts/intel-query.sh callers TokenKind::Capset --repo ori (will return zero callers pre-implementation; rerun after to verify dispatch sites). Cross-language: scripts/intel-query.sh similar "alias_decl" --repo koka,rust,swift --limit 5 for prior-art patterns on transparent type/effect aliases.
01.0 Lexer — capset keyword
- Add
"capset" => Some(TokenKind::Capset)to the keyword table incompiler_repo/compiler/ori_lexer/src/keywords/mod.rs(alphabetical position; sibling reference:extern,extension). - Add
Capsetvariant toTokenKindenum incompiler_repo/compiler/ori_ir/src/token/kind.rs. Match the derives + ordering convention of adjacent declaration-keyword variants (Extern,Extension,Def). - Update any exhaustive-match consumers of
TokenKind. Runcargo cafter adding the variant; the compiler enumerates missing arms. - Verify reservation does not break existing programs:
cargo t -p ori_lexer(lexer crate tests) AND./test-all.sh(full corpus) green. - Rust Tests:
compiler_repo/compiler/ori_lexer/src/keywords/tests.rs(or sibling) — assertcapsetlexes asTokenKind::Capset, NOTTokenKind::Ident.