-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[move] moves tree sitter 1/N (#20968)
## Description Moves code from @tzakian's [repository](https://github.com/tzakian/tree-sitter-move) over Changes: license, contributors ## Test plan --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] gRPC: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK:
- Loading branch information
Showing
99 changed files
with
105,995 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
build | ||
*.log | ||
package-lock.json | ||
target |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[package] | ||
name = "tree-sitter-move" | ||
description = "move grammar for the tree-sitter parsing library" | ||
version = "0.0.1" | ||
keywords = ["incremental", "parsing", "move"] | ||
categories = ["parsing", "text-editors"] | ||
repository = "https://github.com/tree-sitter/tree-sitter-move" | ||
edition = "2018" | ||
license = "MIT" | ||
|
||
build = "bindings/rust/build.rs" | ||
include = [ | ||
"bindings/rust/*", | ||
"grammar.js", | ||
"queries/*", | ||
"src/*", | ||
] | ||
|
||
[lib] | ||
path = "bindings/rust/lib.rs" | ||
|
||
[dependencies] | ||
tree-sitter = "~0.20.10" | ||
|
||
[build-dependencies] | ||
cc = "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Tim Zakian | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
--------------------------------------------------------------------------- | ||
|
||
MIT License | ||
|
||
Copyright (c) 2020 nonsense0202 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Tree Sitter for Move | ||
|
||
This is a WIP implementation of tree sitter for Move. | ||
|
||
## Current Status | ||
|
||
It should be able to parse all valid Move code (although no guarantees are made at the moment on this). | ||
|
||
More work should probably done in terms of laying out the CST better, although it's not the worst as it stands right now. | ||
|
||
## Running Examples | ||
|
||
This requires you installing the tree-sitter CLI | ||
|
||
``` | ||
cargo install tree-sitter-cli | ||
``` | ||
|
||
You can then run this on all the tests with | ||
|
||
``` | ||
tree-sitter parse -q -t tests/*.move | ||
``` | ||
|
||
An example of what the output CST would look like would be the following (NB: this is using tree sitter to highlight the Move code as well). | ||
|
||
![Screenshot](./tree_sitter.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"targets": [ | ||
{ | ||
"target_name": "tree_sitter_move_binding", | ||
"dependencies": [ | ||
"<!(node -p \"require('node-addon-api').targets\"):node_addon_api_except", | ||
], | ||
"include_dirs": [ | ||
"src", | ||
], | ||
"sources": [ | ||
"bindings/node/binding.cc", | ||
"src/parser.c", | ||
# NOTE: if your language has an external scanner, add it here. | ||
], | ||
"conditions": [ | ||
["OS!='win'", { | ||
"cflags_c": [ | ||
"-std=c11", | ||
], | ||
}, { # OS == "win" | ||
"cflags_c": [ | ||
"/std:c11", | ||
"/utf-8", | ||
], | ||
}], | ||
], | ||
} | ||
] | ||
} |
Oops, something went wrong.