Skip to content

feat: alias vocabulary — qualified refs, imports, captures, non_word_boundary - #9

Merged
ronaldtse merged 2 commits into
mainfrom
feat/alias-vocabulary
Sep 29, 2026
Merged

ronaldtse merged 2 commits into
mainfrom
feat/alias-vocabulary

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Completes the alias handling the Ruby corpus vocabulary needs (companion: interscript-ruby grammar/generator side lands alongside):

  • Qualified alias refs map.<dep-alias>.<name> — parser captures the dotted form; the converter resolves the target via dep aliases, parses the dependency's source (memoized per target), and renders the alias in pattern, expression, and replacement positions.
  • Imported (alias-less) dependencies merge their aliases into scope — lazy resolution through the dependency table; targets resolving to map files are parsed, legacy libraries keep the _library_aliases harvest.
  • capture(...) as an expression term (one paren nesting level) so capture-bearing aliases compose in patterns; ref(N) in a from position is a regex backreference.
  • non_word_boundary primitive (expr tokenizer + pattern table; the dead non_boundary name removed).
  • Pattern-side multi-char sets stay alternations — any(['hello','Hello']) collapsed to a char class in _regex_of (the _render_item twin was fixed in fix: any() in results picks the first alternative; multi-char sets stay alternations #8).
  • Seed ordering — the import-alias seed ran before the per-doc context reset and was silently wiped.

Suite: 35 passed / 1 xpassed (with INTERSCRIPT_MAPS_PATH). Via the Ruby bridge: dsl_stage Python legs down to 1 (the extended-engine fallback — Ruby callbacks can't cross the runtime boundary; needs a design decision, tracked separately).

…boundary

Completes the alias handling the Ruby corpus vocabulary needs:

- Qualified alias refs (map.<dep-alias>.<name>): the parser captures
  the dotted form; the converter resolves the target through dep
  aliases, parses the dependency map's source (memoized), and renders
  the alias in pattern, expression, and replacement positions.
- Imported (alias-less) dependencies merge their aliases into scope —
  resolved lazily through the same dependency table; targets that
  resolve to a map file are parsed, legacy libraries keep the
  library-alias harvest.
- capture(...) becomes an expression term (one paren nesting),
  so capture-bearing aliases compose in patterns; ref(N) in a from
  position is a regex backreference.
- non_word_boundary joins the primitives (expr tokenizer + pattern
  table); the old 'non_boundary' name is gone.
- Multi-char string sets stay alternations in the PATTERN renderer
  too — any(['hello','Hello']) was collapsing to a char class.
- The import seed runs after the per-doc context reset (the seed was
  silently wiped by the reset that followed it).
The dep-map fixture must exist on the load path the test creates, not
the developer's machine.
@ronaldtse
ronaldtse merged commit a17beb2 into main Sep 29, 2026
6 checks passed
@ronaldtse
ronaldtse deleted the feat/alias-vocabulary branch September 29, 2026 12:49
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