The Scala import/package reader in edges/semantic/jvm.rs is regex, and it is
now on its fifth patch: the import-regex fix (#179), the import a}.{B panic
(1.14.0), and three more in 1.15.0 — Scala 3 as renames, multi-line brace
imports, nested package blocks (#215). The multi-line fix counts braces with a
hard bound (joined < 32) so an unbalanced file cannot swallow the rest of
itself: an honest bound, but a bound is not a parse.
tree-sitter-scala is already a dependency (the fragmenter uses it) and answers
all three structurally through import_declaration and package_clause.
What makes this bigger than a swap, and why it was not done in the same pass as
the #209 / #213 / #207 cleanup: the edge layer reads fragment CONTENT with regex
for every one of the 30+ languages — no parse tree reaches it. Parsing inside an
edge builder would be the first of its kind, with a per-fragment parse cost and
its own corpus calibration. It is Q-class: edge sets move, so the baseline moves.
Shape when picked up:
- parse Scala fragments once, reuse the tree for imports, package and extends;
- keep the regex path as the fallback for content the parser rejects;
- gate on the full YAML corpus, and record the baseline delta either way.
Standing rule this issue exists to enforce: the SECOND patch on a hand-written
parser for a language that already has a grammar is the signal to move to the
grammar.
The Scala import/package reader in
edges/semantic/jvm.rsis regex, and it isnow on its fifth patch: the import-regex fix (#179), the
import a}.{Bpanic(1.14.0), and three more in 1.15.0 — Scala 3
asrenames, multi-line braceimports, nested package blocks (#215). The multi-line fix counts braces with a
hard bound (
joined < 32) so an unbalanced file cannot swallow the rest ofitself: an honest bound, but a bound is not a parse.
tree-sitter-scalais already a dependency (the fragmenter uses it) and answersall three structurally through
import_declarationandpackage_clause.What makes this bigger than a swap, and why it was not done in the same pass as
the #209 / #213 / #207 cleanup: the edge layer reads fragment CONTENT with regex
for every one of the 30+ languages — no parse tree reaches it. Parsing inside an
edge builder would be the first of its kind, with a per-fragment parse cost and
its own corpus calibration. It is Q-class: edge sets move, so the baseline moves.
Shape when picked up:
Standing rule this issue exists to enforce: the SECOND patch on a hand-written
parser for a language that already has a grammar is the signal to move to the
grammar.