Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for PureScript #708

Open
wants to merge 178 commits into
base: master
Choose a base branch
from

Conversation

bernhard-herzog
Copy link

This adds support for PureScript using the tree-sitter grammar suggested
in #674

The tree-sitter grammar for PureScript seems to have issues similar to
the Haskell, in that the nodes for a qualified identifier like
Data.Map do not include nodes for the periods. The code in this PR
uses the same workaround as for Haskell, i.e. the relevant nodes are
listed atom_nodes

postsolar and others added 30 commits November 8, 2023 20:33
Forgot to delete some fields after copying them elsewhere
Doing better than before
A complication here is that do/ado blocks are allowed to use `let` binders,
which in turn has ambiguous interpretation wrt `let in` expressions, so something like
```
ado
  let a = 1
  in a
```
becomes rather tricky. The solution is to remove `let in` expressions
from the list of options for a do/ado-block binder-indentation level statements.
They aren't allowed in PS itself, unless parenthesized. But this is buried
a bit deep inside a hierarchy of parsers so the code involves some duplication,
basically writing out almost the same thing twice, for do/ado blocks and for normal
notation. It still doesn't handle cases where `in` terminator is one the same line
with a `let` binder, so it will require some more fiddling.
Improve Applicative Do notation parsing
PureScript support has been recently added to Zed editor in zed-industries/zed#6911, updated the README accordingly
I suspect this is what causing issues for multiple projects attempting to use this grammar:

- neurocyte/zat#1

- zed-industries/zed#7543 (comment)

Don't know why it wasn't static in the first place (in the original Haskell grammar),
but I looked at what other grammars do and none export any functions other than those used by Tree-sitter.
As noted by @amaanq over Neovim tree-sitter Matrix channel, they're implied.
In recent TS versions they generate warnings.
Fixes warnings upon codegen.
* Update queries to 0.21.0

* Format remaining queries

* Run codegen on 0.21.0

* Fix missing scanner include for Go bindings

* Fix casing in `bindings/rust/lib.rs`
Those were not replaced automatically upon codegen with ts 0.21.0
…e18b0b2996a1281f7783e0d041d8b80'

git-subtree-dir: vendored_parsers/tree-sitter-purescript
git-subtree-mainline: e23b9fc
git-subtree-split: daf9b3e
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.

7 participants