ADR-0024 Phase F (full) step 3: delete legacy parser modules
Removes the last consumers of `dsl::lexer`, `dsl::keyword`, and
`dsl::ident_slot`, then deletes the modules.
- `Theme::token_color(&TokenKind)` deleted along with its test;
`Theme::highlight_class_color(HighlightClass)` is the sole
highlight-colour mapper (the walker's `per_byte_class` feeds
it directly).
- `IdentSource` (`dsl::grammar`) absorbs the schema-list /
expected-label / round-trip semantics that previously lived
on `IdentSlot`. Adds `completes_from_schema`, `expected_label`,
and `from_expected_label` methods. The walker's
`Expectation::Ident { source }` and the schema-lookup request
on the database worker now share one enum.
- `SchemaCache::for_slot(IdentSlot)` → `for_source(IdentSource)`.
- `Database::list_names_for` and the `Request::ListNamesFor`
worker variant take `IdentSource`. Internal tables and column
/ relationship lookups dispatch on the same enum.
- `InvalidIdent.slot: IdentSlot` → `InvalidIdent.source: IdentSource`.
The `invalid_ident_at_cursor` rendering branch in
`input_render.rs::ambient_hint` updates accordingly.
- Completion's keyword filter (`Keyword::from_word`) becomes
"backticked items whose payload is all ASCII alphabetic" —
punct and digit literals still surface through their own
candidate sources (composite-literal, flag, schema-ident);
the alphabetic filter excludes them from the keyword bucket.
- `friendly::keys::tests::keyword_and_punct_have_complete_token_vocabulary`
is dropped. It cross-checked `Keyword::ALL` / `Punct::ALL`
against catalog entries; both enums are gone. The
`parse.token.keyword.*` / `parse.token.punct.*` catalog
entries themselves survive for one more commit (catalog
cleanup, ADR-0024 §cleanup-pass); the
`keys_validate_against_catalog` test still pins them.
- Modules deleted: `src/dsl/lexer.rs`, `src/dsl/keyword.rs`,
`src/dsl/ident_slot.rs`.
Tests: 806 passing, 0 failing, 1 ignored. The drop from 852
reflects the removed module-internal tests (~32 lexer, 7
keyword, 4 ident_slot, 1 theme token_color, 1 friendly keys
keyword/punct), and is the expected outcome.
Clippy clean with `nursery` lints + `-D warnings`.
This commit is contained in:
+10
-33
@@ -459,42 +459,19 @@ pub const KEYS_AND_PLACEHOLDERS: &[(&str, &[&str])] = &[
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::KEYS_AND_PLACEHOLDERS;
|
||||
use crate::dsl::keyword::{Keyword, Punct};
|
||||
use crate::friendly::format::catalog;
|
||||
use std::collections::HashSet;
|
||||
|
||||
/// Every `Keyword` variant must have a
|
||||
/// `parse.token.keyword.<name>` entry; every `Punct`
|
||||
/// variant must have a `parse.token.punct.<name>` entry.
|
||||
/// Catches the case where a keyword or punct is added to
|
||||
/// the macro but not to the catalog (ADR-0021 §7).
|
||||
#[test]
|
||||
fn keyword_and_punct_have_complete_token_vocabulary() {
|
||||
let declared: HashSet<&str> =
|
||||
KEYS_AND_PLACEHOLDERS.iter().map(|(k, _)| *k).collect();
|
||||
let mut missing: Vec<String> = Vec::new();
|
||||
for &(kw, _) in Keyword::ALL {
|
||||
let key = kw.catalog_token_key();
|
||||
if !declared.contains(key.as_str()) {
|
||||
missing.push(format!(
|
||||
"Keyword::{kw:?} ⇒ catalog key `{key}` not declared in keys.rs"
|
||||
));
|
||||
}
|
||||
}
|
||||
for &(p, _, _) in Punct::ALL {
|
||||
let key = p.catalog_token_key();
|
||||
if !declared.contains(key.as_str()) {
|
||||
missing.push(format!(
|
||||
"Punct::{p:?} ⇒ catalog key `{key}` not declared in keys.rs"
|
||||
));
|
||||
}
|
||||
}
|
||||
assert!(
|
||||
missing.is_empty(),
|
||||
"token vocabulary incomplete:\n {}",
|
||||
missing.join("\n "),
|
||||
);
|
||||
}
|
||||
// The pre-Phase-F `keyword_and_punct_have_complete_token_vocabulary`
|
||||
// test cross-checked the `Keyword` / `Punct` enums against
|
||||
// `parse.token.keyword.*` / `parse.token.punct.*` catalog
|
||||
// keys. With those enums deleted (ADR-0024 §migration Phase F)
|
||||
// and the walker rendering keyword wording via
|
||||
// `format!("`{word}`")`, the catalog entries survive only as
|
||||
// historic vocabulary; the `keys_validate_against_catalog`
|
||||
// test below still asserts every key in `KEYS_AND_PLACEHOLDERS`
|
||||
// resolves and vice versa, which keeps the catalog itself
|
||||
// honest. The dead entries collapse in ADR-0024 §cleanup-pass.
|
||||
|
||||
/// Walks `KEYS_AND_PLACEHOLDERS` and verifies every entry
|
||||
/// matches the catalog. ADR-0019 §8.6.
|
||||
|
||||
Reference in New Issue
Block a user