Skip to content

Conversation

smacker
Copy link
Owner

@smacker smacker commented Jan 10, 2022

See the issue: #57

@smacker smacker mentioned this pull request Jan 10, 2022
deequez added a commit to codepen/go-tree-sitter that referenced this pull request Jun 15, 2022
If an open source Tree-sitter parser is available, we can run `./vendor.sh download` to download the C code thats needed to add a grammar. 

I'm using [serenadeai/tree-sitter-scss](https://github.com/serenadeai/tree-sitter-scss) to add the SCSS grammar. 

# One time updates

The `vendor.sh` script is using features from the latest version of Bash. MacOS includes an older version of Bash so I updated my system to v5.

# Per Grammar

### Update vendor script

Add grammar:  name; version / tag of repo to download; files to download 
`["scss"]="v1.0.0;parser.c;scanner.c"`

Add repository
`["scss"]="serenadeai/tree-sitter-scss"`

### Download C code
From root of repo run:
`./vendor.sh download`

### Add Go binding
In new grammar directory add: 
- `binding.go`
- `binding_test.go`

Run your test to verify the new grammar works!

# References
- [Install Bash 5 on macOS](https://scriptingosx.com/2019/02/install-bash-5-on-macos/)
- [Creating parsers | Tree-sitter](https://tree-sitter.github.io/tree-sitter/creating-parsers)
- smacker#58
@smacker smacker mentioned this pull request Oct 11, 2022
deequez added a commit to codepen/go-tree-sitter that referenced this pull request Apr 13, 2023
If an open source Tree-sitter parser is available, we can run `./vendor.sh download` to download the C code thats needed to add a grammar.

I'm using [serenadeai/tree-sitter-scss](https://github.com/serenadeai/tree-sitter-scss) to add the SCSS grammar.

The `vendor.sh` script is using features from the latest version of Bash. MacOS includes an older version of Bash so I updated my system to v5.

Add grammar:  name; version / tag of repo to download; files to download
`["scss"]="v1.0.0;parser.c;scanner.c"`

Add repository
`["scss"]="serenadeai/tree-sitter-scss"`

From root of repo run:
`./vendor.sh download`

In new grammar directory add:
- `binding.go`
- `binding_test.go`

Run your test to verify the new grammar works!

- [Install Bash 5 on macOS](https://scriptingosx.com/2019/02/install-bash-5-on-macos/)
- [Creating parsers | Tree-sitter](https://tree-sitter.github.io/tree-sitter/creating-parsers)
- smacker#58
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