Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arthurweinmann/treesitter-simple-cli
Just a very simple way of parsing and printing the code CST with tree-sitter.
https://github.com/arthurweinmann/treesitter-simple-cli
json normal tree-sitter xml
Last synced: 5 days ago
JSON representation
Just a very simple way of parsing and printing the code CST with tree-sitter.
- Host: GitHub
- URL: https://github.com/arthurweinmann/treesitter-simple-cli
- Owner: arthurweinmann
- Created: 2023-07-25T16:17:10.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-25T18:26:13.000Z (over 1 year ago)
- Last Synced: 2024-05-02T04:20:25.316Z (7 months ago)
- Topics: json, normal, tree-sitter, xml
- Language: Rust
- Homepage:
- Size: 183 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simpler Tree-Sitter CLI to just print the CST
Just a very simple way of parsing and printing the code CST with tree-sitter.
You may use the compiled binary from the releases section of this repository or compile it yourself.
# Build from source
Clone this repository and run `make`. The cli binary is then located in the generated `build` repository.
# Example
For example, in this repository after running `make`:
For help, run:
```bash
arthur@pop-os:$ ./build/treesittercli helpUsage:
```For a full example of a normal output, see [./example_output/example.txt](./example_output/example.txt)
```bash
arthur@pop-os:$ ./build/treesittercli rust ./src/main.rs(source_file [0, 0] - [209, 0]
(inner_attribute_item [0, 0] - [0, 64]
(attribute [0, 3] - [0, 63]
(identifier [0, 3] - [0, 11])
arguments: (token_tree [0, 11] - [0, 63]
(identifier [0, 12] - [0, 28])
(identifier [0, 30] - [0, 35])
(token_tree [0, 35] - [0, 62]
(identifier [0, 36] - [0, 45])
(identifier [0, 47] - [0, 61])))))[...]
```For a full example of an xml output, see [./example_output/example.xml](./example_output/example.xml)
```bash
arthur@pop-os:$ ./build/treesittercli rust ./src/main.rs xml#![
cfg_attr(
debug_assertionsallow
(
dead_code[...]
```For a full example of an xml output, see [./example_output/example.json](./example_output/example.json)
```bash
arthur@pop-os:$ ./build/treesittercli rust ./src/main.rs json{
"children": [
{
"children": [
{
"children": [],
"end": {
"column": 1,
"row": 0
},
"kind": "#",
"start": {
"column": 0,
"row": 0
},
"value": "#"
},
{
"children": [],
"end": {
"column": 2,
"row": 0
},
"kind": "!",
"start": {
"column": 1,
"row": 0
},
"value": "!"[...]
```