Skip to content

fix(astquery): wire "mql" into the language resolver and parse gate - #836

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

zzet merged 1 commit into
zzet:mainfrom
davalillo:pr/mql-astquery-resolver

Conversation

@davalillo

Copy link
Copy Markdown
Contributor

Summary

DefaultLanguageResolver (internal/astquery/languages.go) had no case "mql", so search_ast with raw patterns over MQL targets compiled no query and returned 0 matches without error (the plan silently skips languages with a nil resolver, engine.go). The MQL grammar is a tree-sitter-cpp fork, so cpp patterns (call_expression, function_definition, …) match as-is once the binding is wired.

Changes

Additionally, parseGateLanguage (internal/mcp/parse_gate.go) did not know .mq4/.mq5/.mqh: the edit_file/write_file parse gate had no opinion on MQL edits and skipped syntax validation (fail-open). Same fix.

Testing

  • TestDefaultLanguageResolver_MQL — the resolver no longer returns nil
  • TestRawPattern_MQL_CallExpression / _AnyCallExpression / _FunctionDefinition — real raw patterns over an MQL5 fixture (ObjectSet-style calls)
  • TestParseGateLanguage extended (.mq5/.mq4/.mqh → mql) and clean/broken MQL cases in TestParseErrorCountGo
  • All tests pass (go test -race ./...)
  • Fix verified end-to-end on Ducibus (27 MQL files, ObjectSet in syr_mq4.mqh)

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

DefaultLanguageResolver had no "mql" case, so raw-pattern search_ast
runs over MQL targets compiled no query and returned 0 matches with no
error (the plan skips nil-resolver languages silently). The MQL grammar
is a tree-sitter-cpp fork, so cpp-shaped patterns match as-is once the
binding is wired.

Also teach parseGateLanguage about .mq4/.mq5/.mqh: the pre-write parse
gate previously had no opinion on MQL edits and skipped silently.

Fixes #5
@zzet
zzet merged commit 2324fa2 into zzet:main Oct 1, 2026
11 checks passed
@davalillo
davalillo deleted the pr/mql-astquery-resolver 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