Crates.io | tree-sitter-stack-graphs-ruby |
lib.rs | tree-sitter-stack-graphs-ruby |
version | 0.0.1 |
source | src |
created_at | 2023-05-11 17:51:47.621489 |
updated_at | 2023-05-11 17:51:47.621489 |
description | Stack graphs definition for Ruby using tree-sitter-ruby |
homepage | |
repository | |
max_upload_size | |
id | 862325 |
size | 43,887 |
This project defines tree-sitter-stack-graphs rules for Ruby using the tree-sitter-ruby grammar.
To use this library, add the following to your Cargo.toml
:
[dependencies]
tree-sitter-stack-graphs-ruby = "0.0.1"
Check out our documentation for more details on how to use this library.
The command-line program for tree-sitter-stack-graphs-ruby
lets you do stack graph based analysis and lookup from the command line.
Install the program using cargo install
as follows:
$ cargo install --features cli tree-sitter-stack-graphs-ruby
$ tree-sitter-stack-graphs-ruby --help
The project is written in Rust, and requires a recent version installed. Rust can be installed and updated using rustup.
The project is organized as follows:
src/stack-graphs.tsg
.src/builtins.rb
and builtins.cfg
respectively.test
directory.Build the project by running:
$ cargo build
Run the tests as follows:
$ cargo test
The project consists of a library and a CLI. By default, running cargo
only applies to the library. To run cargo
commands on the CLI as well, add --features cli
or --all-features
.
Run the CLI from source as follows:
$ cargo run --features cli -- ARGS
Sources are formatted using the standard Rust formatted, which is applied by running:
$ cargo fmt
The stack graph rules are written in tree-sitter-graph. Checkout the examples, which contain self-contained TSG rules for specific language features. A VSCode extension is available that provides syntax highlighting for TSG files.
Parse and test a single file by executing the following commands:
$ cargo run --features cli -- parse FILES...
$ cargo run --features cli -- test TESTFILES...
Generate a visualization to debug failing tests by passing the -V
flag:
$ cargo run --features cli -- test -V TESTFILES...
To generate the visualization regardless of test outcome, execute:
$ cargo run --features cli -- test -V --output-mode=always TESTFILES...
Go to https://crates.io/crates/tree-sitter-stack-graphs for links to examples and documentation.