| Crates.io | npezza93-tree-sitter-haskell |
| lib.rs | npezza93-tree-sitter-haskell |
| version | 0.15.1 |
| created_at | 2023-09-29 02:15:40.927864+00 |
| updated_at | 2024-04-18 14:12:31.002231+00 |
| description | haskell grammar for the tree-sitter parsing library |
| homepage | |
| repository | https://github.com/tree-sitter/tree-sitter-haskell |
| max_upload_size | |
| id | 986956 |
| size | 25,951,441 |
Haskell grammar for tree-sitter.
When installing the grammar from source, be sure to include the scanner in the source files:
lua <<EOF
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.haskell = {
install_info = {
url = "~/path/to/tree-sitter-haskell",
files = {"src/parser.c", "src/scanner.c", "src/unicode.h"}
}
}
EOF
These extensions are supported ✅, unsupported ❌ or not applicable because they don't involve parsing ➖️:
Preprocessor #elif and #else directives cannot be handled correctly, since the parser state would have to be
manually reset to what it was at the #if.
As a workaround, the code blocks in the alternative branches are parsed as part of the directives.
NondecreasingIndentation is not supported (yet?).
doA strange edge case is when an infix operator follows an expression statement of a do block with an indent of less or equal the do's layout column:
f = do
readSomething
>>= doSomething
The >>= causes the do's layout to be terminated, resulting in an AST similar to
f = (do readSomething) >>= doSomething
This is checked heuristically, probably unreliably.
Requires: tree-sitter(-cli)
These are stored in ./tests/corpus/
$ tree-sitter test
Requires: bc
This will print the percentage of the codebase parsed, and the time taken
$ ./script/parse-examples # this clones all repos
$ ./script/parse-example <example> # where <example> is a project under ./examples/
To get an extra-verbose scanner, unoptimized, with debug symbols:
$ CFLAGS='-DDEBUG' make debug.so
$ cp debug.so $HOME/.cache/tree-sitter/lib/haskell.so # So `tree-sitter-cli` uses our binary
$ tree-sitter test
$ ./script/parse-example <example>
If you want to debug the scanner with gdb, you can
b tree_sitter_haskell_external_scanner_scan with tree-sitter test.
Requires: graphviz
$ tree-sitter parse -D test/Basic.hs # Produces log.html