From fa994cfb663250e32924bf7f9acaa4e8e56f36a6 Mon Sep 17 00:00:00 2001 From: "claude@clouddev1" Date: Fri, 15 May 2026 08:35:59 +0000 Subject: [PATCH] ADR-0024 Phase F (full) step 4: catalog token-keyword cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drops the 47 `parse.token.keyword.*` and 6 `parse.token.punct.*` catalog entries (and their `KEYS_AND_PLACEHOLDERS` declarations). Nothing consumes them: the walker renders keyword wording in `format!(\"`{word}`\")` directly, sourced from grammar-tree Word literals; punct wording surfaces the same way via `Expectation::Punct(ch)`. Structural-class labels (`parse.token.identifier`, `parse.token.number`, `parse.token.string_literal`, `parse.token.flag`, `parse.token.end_of_input`) and the lex-error wordings (`parse.token.error.{bad_flag,unknown_char, unterminated_string}`) stay. These are not derivable from the grammar tree and the walker's expected-set / validator paths still read them. `friendly::keys::tests::keys_validate_against_catalog` continues to assert catalog ↔ `KEYS_AND_PLACEHOLDERS` bidirectional coverage, so the trimmed declaration is pinned against the trimmed catalog. Tests: 806 passing, 0 failing, 1 ignored. Clippy clean. --- src/friendly/keys.rs | 66 ++++--------------------------- src/friendly/strings/en-US.yaml | 69 +++++---------------------------- 2 files changed, 17 insertions(+), 118 deletions(-) diff --git a/src/friendly/keys.rs b/src/friendly/keys.rs index 7fb3cb9..1448937 100644 --- a/src/friendly/keys.rs +++ b/src/friendly/keys.rs @@ -182,71 +182,21 @@ pub const KEYS_AND_PLACEHOLDERS: &[(&str, &[&str])] = &[ ("parse.usage.show_data", &[]), ("parse.usage.show_table", &[]), ("parse.usage.update", &[]), - // Single-token vocabulary (ADR-0021 §4). One per Keyword - // variant (declared by `Keyword::ALL`), one per Punct - // variant, one per token-class label, one per LexError - // kind. The per-Keyword and per-Punct entries are also - // validated against the enums by - // `keyword_and_punct_have_complete_token_vocabulary`. + // Single-token vocabulary (ADR-0021 §4). Phase F of + // ADR-0024 collapsed the per-keyword and per-punct catalog + // entries — the walker renders keyword wording verbatim via + // `format!("`{word}`")` rather than going through the catalog. + // What remains are the structural-class labels (identifier, + // number, string literal, flag, end of input) and the + // lex-error wordings, none of which are derivable from the + // grammar tree. ("parse.token.end_of_input", &[]), ("parse.token.error.bad_flag", &[]), ("parse.token.error.unknown_char", &["found"]), ("parse.token.error.unterminated_string", &[]), ("parse.token.flag", &[]), ("parse.token.identifier", &[]), - ("parse.token.keyword.action", &[]), - ("parse.token.keyword.add", &[]), - ("parse.token.keyword.advanced", &[]), - ("parse.token.keyword.as", &[]), - ("parse.token.keyword.cascade", &[]), - ("parse.token.keyword.change", &[]), - ("parse.token.keyword.column", &[]), - ("parse.token.keyword.create", &[]), - ("parse.token.keyword.data", &[]), - ("parse.token.keyword.delete", &[]), - ("parse.token.keyword.drop", &[]), - ("parse.token.keyword.export", &[]), - ("parse.token.keyword.false", &[]), - ("parse.token.keyword.from", &[]), - ("parse.token.keyword.help", &[]), - ("parse.token.keyword.import", &[]), - ("parse.token.keyword.in", &[]), - ("parse.token.keyword.insert", &[]), - ("parse.token.keyword.into", &[]), - ("parse.token.keyword.load", &[]), - ("parse.token.keyword.messages", &[]), - ("parse.token.keyword.mode", &[]), - ("parse.token.keyword.new", &[]), - ("parse.token.keyword.no", &[]), - ("parse.token.keyword.null", &[]), - ("parse.token.keyword.on", &[]), - ("parse.token.keyword.pk", &[]), - ("parse.token.keyword.quit", &[]), - ("parse.token.keyword.rebuild", &[]), - ("parse.token.keyword.relationship", &[]), - ("parse.token.keyword.rename", &[]), - ("parse.token.keyword.replay", &[]), - ("parse.token.keyword.restrict", &[]), - ("parse.token.keyword.save", &[]), - ("parse.token.keyword.set", &[]), - ("parse.token.keyword.short", &[]), - ("parse.token.keyword.show", &[]), - ("parse.token.keyword.simple", &[]), - ("parse.token.keyword.table", &[]), - ("parse.token.keyword.to", &[]), - ("parse.token.keyword.true", &[]), - ("parse.token.keyword.update", &[]), - ("parse.token.keyword.values", &[]), - ("parse.token.keyword.verbose", &[]), - ("parse.token.keyword.where", &[]), - ("parse.token.keyword.with", &[]), ("parse.token.number", &[]), - ("parse.token.punct.close_paren", &[]), - ("parse.token.punct.colon", &[]), - ("parse.token.punct.comma", &[]), - ("parse.token.punct.dot", &[]), - ("parse.token.punct.equals", &[]), - ("parse.token.punct.open_paren", &[]), ("parse.token.string_literal", &[]), // ---- Project lifecycle event notes ---- ("project.export_failed", &["error"]), diff --git a/src/friendly/strings/en-US.yaml b/src/friendly/strings/en-US.yaml index e084bd4..1bf9a0e 100644 --- a/src/friendly/strings/en-US.yaml +++ b/src/friendly/strings/en-US.yaml @@ -372,67 +372,16 @@ parse: import: "import [as ]" mode: "mode simple | mode advanced" messages: "messages | messages short | messages verbose" - # Single-token vocabulary the renderer uses to translate - # chumsky's expected-set patterns. One key per Keyword variant - # (validated against `Keyword::ALL`), one per Punct variant, - # one per token-class label, one per LexError kind. + # Single-token vocabulary (ADR-0021 §4, ADR-0024 §cleanup-pass). + # The per-keyword and per-punct entries collapsed when the + # walker became the source of truth — keyword wording is now + # produced verbatim as `` `` `` by the parse-error + # formatter, sourced from the grammar tree's Word literals. + # What remains here is structural-class labels (identifier / + # number / string literal / flag / end of input) and the + # lex-error wordings, none of which are derivable from the + # grammar. token: - keyword: - create: "`create`" - drop: "`drop`" - add: "`add`" - rename: "`rename`" - change: "`change`" - show: "`show`" - insert: "`insert`" - update: "`update`" - delete: "`delete`" - replay: "`replay`" - table: "`table`" - column: "`column`" - data: "`data`" - relationship: "`relationship`" - pk: "`pk`" - with: "`with`" - from: "`from`" - to: "`to`" - into: "`into`" - as: "`as`" - in: "`in`" - on: "`on`" - set: "`set`" - where: "`where`" - values: "`values`" - "null": "`null`" - "true": "`true`" - "false": "`false`" - cascade: "`cascade`" - restrict: "`restrict`" - action: "`action`" - "no": "`no`" - # App-lifecycle commands (per ADR-0003, surfaced through - # the parser to drive completion + usage templates). - quit: "`quit`" - help: "`help`" - rebuild: "`rebuild`" - save: "`save`" - new: "`new`" - load: "`load`" - export: "`export`" - import: "`import`" - mode: "`mode`" - messages: "`messages`" - simple: "`simple`" - advanced: "`advanced`" - short: "`short`" - verbose: "`verbose`" - punct: - colon: "`:`" - open_paren: "`(`" - close_paren: "`)`" - comma: "`,`" - equals: "`=`" - dot: "`.`" identifier: "identifier" number: "number" string_literal: "string literal"