Skip to content

Dictionary join=, split=, _name lines; bare entries load (#433 #434 #426 #417) (4.2.30) - #786

Merged
ddehilster merged 2 commits into
masterfrom
feature/dict-shape-433
Oct 15, 2026
Merged

ddehilster merged 2 commits into
masterfrom
feature/dict-shape-433

Conversation

@ddehilster

Copy link
Copy Markdown
Member

Four dictionary-tokenizer (dicttok) issues. The syntax follows the choices made in review.

#433: bare entries (bug). I couldn't reproduce the issue's original symptoms on master: hot - rod s=hotrod gives _hotrod, HOT-3 doesn't match, and \- works for unknown words. The real bug was different. A .dict line with no = (license plate) was a "missing equal sign" error, readDict stopped there, and every entry after it was dropped. The error only went to cgerr, so nothing looked wrong. Now:

  • a line with no attributes is an entry, and a multi-word one is a _phrase;
  • any bad line is reported and skipped, and the rest of the file is read.

#434: join=1. hot - rod join=1 turns HOT-ROD into one token HOTROD, spanning the same text. Whitespace and punctuation are dropped. The token is then looked up itself, so hotrod s=vehicle builds _vehicle over it.

#426: split="words".

  • licenseplate split="license plate" replaces the token with adjacent tokens license (its own offsets 42-48) and plate (49-53).
  • If the words don't spell the token (weathervconditions), each word spans the whole token.
  • Split runs before join and phrases, so the pieces can match weather conditions s=weather.
  • Pieces aren't split again.

#417: _name lines. _bridge type=location kind=generic puts those attributes on every _bridge the dictionary builds. An entry's own attributes win: viaduct s=bridge kind=raised gives kind=raised.

Implementation: lite/dicttok.cpp. It adds splitToken, joinPhrase, makeLitTok (a literal-flagged token, as makeliteral makes) and replaceRange. The attribute loop moves from findAttrs into applyAttrs, and join/split aren't copied onto nodes as attributes. The readDict/parseDictLine change is in cs/libconsh/cg.cpp.

Impact on existing dictionaries: I scanned 110 .dict files across analyzers, visualtext-files and package-analyzers. Three have a stray bare word on their last line. It now loads as a plain word, and nothing came after it to lose.

Tests:

  • New fixture tests/dict-shape, with CI steps on Windows and Linux. The input is one line so the offsets hold on CRLF checkouts.
  • Local: 45/46 CI steps pass. The compiled-bridge step needs $GITHUB_WORKSPACE and always fails locally.
  • Full English Test: unchanged.
  • 20 analyzers × 21 inputs against 4.2.18: 0 differences.
  • The compiled analyzer gives the same output as the interpreter.

Docs: VisualText/visualtext-files PR to follow. Batched: don't tag yet.

🤖 Generated with Claude Code

ddehilster and others added 2 commits October 14, 2026 22:35
 #417) (4.2.30)

- #433: a .dict line with no attributes ("license plate") was a "missing
  equal sign" error that ended the read of the file, silently dropping
  every entry after it. It is now an entry (a phrase becomes _phrase), and
  any bad line is reported in cgerr.log and skipped.
- #434: join=1 turns a phrase into one token of its words ("HOT-ROD" ->
  HOTROD), which is then looked up in turn.
- #426: split="license plate" replaces a token with those words, with
  their own offsets when they spell the token.
- #417: a "_bridge type=location" line puts attributes on every _bridge
  node the dictionary builds; an entry's own attributes win.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant