Repository navigation
Description
Version
codebase-memory-mcp 0.11.0 (also 0.9.0)
Platform
macOS (Apple Silicon)
Install channel
GitHub release archive / install.sh / install.ps1
Binary variant
standard
What happened, and what did you expect?
When a top-level Haskell definition contains an escaped character literal ('\n') and the next definition's name has a prime (g'), the first definition's node extends over the second, and the second gets no node.
On pandoc (1539a541f, src/Text/Pandoc/Readers/Markdown.hs), spnl (line 159) ends with notFollowedBy (char '\n') and is followed by spnl'. The graph has spnl spanning lines 159-244. The 9 top-level functions in between have no node: spnl', indentSpaces, nonindentSpaces, skipNonindentSpaces, litChar, litBetween, litCharNoSpace, litBetweenNoSpace, inBalancedBrackets. All 11 CALLS edges out of spnl come from their bodies (lines 168-244), none from spnl's own.
Expected: one Function node per definition.
Reproduction
repro/M.hs:
module M where
f = '\n'
g' = 2
h = 3codebase-memory-mcp cli index_repository --repo-path repro --name repro
codebase-memory-mcp cli query_graph --project repro --query "MATCH (n) WHERE n.label = 'Function' RETURN n.name, n.start_line, n.end_line ORDER BY n.start_line"
Actual: f 3-5, h 7-7. g' has no node, and f ends on g''s line.
Expected: f 3-3, g' 5-5, h 7-7.
The parse tree is already wrong before extraction. With upstream's own release (tree-sitter-haskell 0.23.1 from PyPI, tree-sitter 0.25.2), without codebase-memory-mcp:
import tree_sitter as ts, tree_sitter_haskell as tsh
p = ts.Parser(ts.Language(tsh.language()))
t = p.parse(b"module M where\n\nf = '\\n'\n\ng' = 2\n\nh = 3\n")
print(t.root_node.has_error) # True; the bind for f ends on line 5On the grammar alone, '\t' and '\'' do the same; 'x', "\n", or another definition between f and g' do not.
THIRD_PARTY_NOTICES.md lists the vendored grammar at 7fa19f195803. Upstream's last release is v0.23.1 (2024-11-10), so a local scanner patch, as in #1232, may be the practical route.
Confirmations
- I searched existing issues and this is not a duplicate.
- My reproduction uses shareable code (a dummy snippet or a public OSS repository), not proprietary code.
Activity
DeusData commentedon Oct 19, 2026
Thank you for reducing the escaped-character/primed-name interaction and comparing it with the grammar alone. The swallowed definition and misattributed calls are clearly scoped. The appropriate grammar repair still needs verification.
DeusData commentedon Oct 25, 2026
Thank you for your patience. The escaped-character/primed-name grammar case and swallowed definitions still need maintainer verification. Sorry for the delay; I’ll follow up soon.
test(haskell): an escaped char literal must not swallow the next def (D…
fix(grammar): stop escaped Haskell char literals at the closing quote (…
Merge pull request #2547 from Zhuoxi2000/fix-haskell-escaped-char-swa…
DeusData commentedon Nov 17, 2026
Fixed on main in e6980cd (#2547): an escaped char literal followed by a primed name no longer swallows the next definition. Thanks for the report!