neurocyte / zat

zat is a syntax highlighting cat like utility using tree-sitter and with support for vscode themes
MIT License
33 stars 3 forks source link

PureScript and Haskell conflict #1

Closed postsolar closed 8 months ago

postsolar commented 8 months ago

The title refers to this: https://github.com/neurocyte/zat/blob/10de00d68414ef4729e69a2e779c891aa2273368/src/file_types.zig#L214-L219

Hi šŸ‘‹, I'm the maintainer of PureScript TS grammar. It started as a fork of Haskell's grammar and its C scanner was mostly left untouched (due to me not knowing C).

Indeed if I uncomment this filetype and try to build zat I'm getting:

ā””ā”€ install zat
   ā””ā”€ zig build-exe zat ReleaseSmall native 1 errors
error: ld.lld: duplicate symbol: state_new
    note: defined at scanner.c
    note:            /tmp/zat/zig-cache/o/2f3c88c48c0e525bd29533e3aac02ab0/scanner.o:(state_new) in archive /tmp/zat/zig-cache/o/ac7b81e2c1f5d0f85b023adfbed9accb/libtree-sitter.a
    note: defined at scanner.c
    note:            /tmp/zat/zig-cache/o/2b99987fca3759990739259e47c5877a/scanner.o:(.text+0x0) in archive /tmp/zat/zig-cache/o/ac7b81e2c1f5d0f85b023adfbed9accb/libtree-sitter.a

I would be very grateful if you could brief me on what is the issue and/or direct me towards what I could do on my end to resolve this incompatibility. I think I fixed it

postsolar commented 8 months ago

I think I fixed it in https://github.com/postsolar/tree-sitter-purescript/commit/08cdbb85eeaab317701bc797770a2c1a65e43ffe, it now works for me (I tested it by updating https://github.com/neurocyte/tree-sitter on my fork and building with this updated dependency).

So I believe if you update tree-sitter and its dep here it should work. I'll issue a follow-up PR to enable PureScript.

neurocyte commented 8 months ago

Good to know that the purescript/haskell conflict is resolved. I will merge your PR after updating.

Note that both haskell and purescript parsers apparently have sanitizer bugs so I will also disable the sanitizer in tree-sitter first. (zig enables it by default unlike clang)