| Crates.io | abc-parser |
| lib.rs | abc-parser |
| version | 0.4.0 |
| created_at | 2018-08-20 20:49:51.706531+00 |
| updated_at | 2025-12-29 05:13:40.420793+00 |
| description | An ABC music notation parser. Turns ABC text into Rust data structures and back. |
| homepage | |
| repository | https://gitlab.com/Askaholic/rust-abc-2 |
| max_upload_size | |
| id | 80476 |
| size | 126,692 |
ABC Parser written in rust using PEG.
Add the package to your cargo dependencies.
[dependencies]
abc-parser = "0.4"
Then you can use the PEG generated rules through the abc module.
use abc_parser::abc;
use abc_parser::datatypes::*;
let parsed = abc::tune_book("X:1\nT:Example\nK:D\n").unwrap();
assert_eq!(
parsed,
TuneBook::new(
vec![],
None,
vec![Tune::new(
TuneHeader::new(vec![
HeaderLine::Field(InfoField::new('X', "1".to_string()), None),
HeaderLine::Field(InfoField::new('T', "Example".to_string()), None),
HeaderLine::Field(InfoField::new('K', "D".to_string()), None)
]),
None
)]
)
)
These are roughly taken in order from the abc standard.
The first version was an attempt to write the parser by hand, but using PEG is much more maintainable. The older repo is here: https://gitlab.com/Askaholic/rust-abc