Skip to content

fix(elide): register an "mql" body-elision spec - #835

Merged
zzet merged 1 commit into
zzet:mainfrom
davalillo:pr/mql-elide-spec
Oct 1, 2026
Merged

zzet merged 1 commit into
zzet:mainfrom
davalillo:pr/mql-elide-spec

Conversation

@davalillo

Copy link
Copy Markdown
Contributor

Summary

internal/elide/elide.go registered 16 languages in the specs map but not mql, and the package is fail-soft (ErrUnsupportedLang → original source, no error): compress_bodies returned MQL code fully expanded. In 20k+ line files (Ducibus MQL codebase) that is exactly where compression matters most.

Changes

The tree-sitter-mql5 grammar is a tree-sitter-cpp fork with identical function_definition / compound_statement node shapes, so the "mql" spec mirrors the "cpp" one (stubBrace, fieldFinder("body", "compound_statement")). One registry entry.

Testing

  • TestCompress_MQL — MQL5 fixture: signatures + doc-comments intact, bodies elided
  • TestCompress_MQL4Legacy — pre-600 MQL4 (C subset, Order* API)
  • TestCompress_MQL_SavesLines — compressed output is materially smaller than input
  • All tests pass (go test -race ./...)

Context: previously reviewed and merged in davalillo/gortex#10; complements the MQL extractor landed in #823.

compress_bodies returned MQL sources untouched: the specs map covered
16 languages but not mql, and the package is fail-soft
(ErrUnsupportedLang -> original source, no error). The tree-sitter-mql5
grammar is a tree-sitter-cpp fork with identical function_definition /
compound_statement shapes, so the spec mirrors cpp.

Fixes #6
@zzet
zzet merged commit ae304bd into zzet:main Oct 1, 2026
10 checks passed
@davalillo
davalillo deleted the pr/mql-elide-spec branch October 4, 2026 01: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.

2 participants