https://github.com/vsce-toolroom/textmate-scope-selector-peg
Textmate scope selector implementation as a PEG (parser grammar) in Rust.
https://github.com/vsce-toolroom/textmate-scope-selector-peg
grammar peg rust textmate
Last synced: 5 months ago
JSON representation
Textmate scope selector implementation as a PEG (parser grammar) in Rust.
- Host: GitHub
- URL: https://github.com/vsce-toolroom/textmate-scope-selector-peg
- Owner: vsce-toolroom
- License: other
- Created: 2024-12-01T21:40:36.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-07T19:43:07.000Z (over 1 year ago)
- Last Synced: 2025-08-18T07:37:04.947Z (11 months ago)
- Topics: grammar, peg, rust, textmate
- Language: Rust
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# `textmate-scope-selector-peg`
Performant port of the Textmate scope selector parser from JavaScript to Rust.
The original parser grammar (PegJS) lives at [atom/first-mate](https://github.com/atom/first-mate).
## Performance
### `selector.matches`
The `rust-peg` parser was benchmarked for matching scopes against the following input:
- Selector: `source.matlab -comment -entity -support -string -variable -interpolation -source.shell`
- Match: `source.matlab meta.class.matlab meta.class.declaration.matlab entity.name.type.class.matlab`
The Rust crates parser produced speeds of $7.47ns/iter$, reduced from $31.8ns/iter$ in the `peggy` parser.
### `selector.get_prefix`
The `rust-peg` parser was benchmarked for prefix matching against the following input:
- Selector: `L:text.html.markdown - (comment, string, meta.paragraph.markdown, markup.*.block.markdown)`
- Match: `text.html.markdown meta.paragraph.markdown`
The Rust crate's parser produced speeds of $19.78ns/iter$.