tree-sitter-chordpro
v0.5.0
Published
Tree-sitter grammar for ChordPro music notation files
Maintainers
Readme
tree-sitter-chordpro
A Tree-sitter grammar for
ChordPro music notation files (.cho,
.chordpro, .chopro).
Part of the ChordSketch project.
Supported Syntax
| Element | Example | Node type |
|---------|---------|-----------|
| Comments | # comment | comment |
| Directives | {title: Song Name} | directive (with directive_name, directive_value) |
| Delegate blocks | {start_of_abc}...{end_of_abc} | delegate_block (with block_start_directive, block_content, block_end_directive) |
| Chords | [Am], [G/B] | chord (with chord_name) |
| Lyrics | Amazing grace | lyrics |
Usage
In a Zed extension
Reference this grammar in your extension.toml:
[grammars.chordpro]
repository = "https://github.com/koedame/chordsketch"
rev = "COMMIT_HASH"
path = "packages/tree-sitter-chordpro"Development
# Generate the parser
npx tree-sitter generate
# Run tests
npx tree-sitter test
# Parse a file
npx tree-sitter parse example.cho
# Preview highlighting
npx tree-sitter highlight example.choLinks
- ChordSketch — main project
- ChordPro format — file format specification
- Issues — bug reports
License
MIT
