Bracket Parser
A Rust library that uses tree-sitter to parse text and determine whether positions in the text are inside or outside brackets.
Features
- Detects positions inside or outside brackets (parentheses, square brackets, curly braces)
- Handles nested brackets correctly
- Simple API for checking the state at the end of a string or at any position
- Built on the robust tree-sitter parsing library
- Zero false positives - properly handles all edge cases
Installation
Add the following to your Cargo.toml
:
[]
= "0.1.0"
Usage
use ;
How It Works
The library uses tree-sitter to parse the input text into a syntax tree that recognizes bracketed expressions. It then traverses the tree to determine if a given position is inside or outside brackets.
Development
Code Quality
This project includes a script to check code quality. Run it before submitting changes:
The script performs the following checks:
- Code formatting with
cargo fmt
- Linting with
cargo clippy
- Running tests with
cargo test
- Documentation generation with
cargo doc
- Dependency checks with
cargo outdated
- Security vulnerability scanning with
cargo audit
(if installed)
To install additional tools:
# Install cargo-outdated
# Install cargo-audit
License
MIT