rust-abc-2
ABC Parser written in rust using PEG.
Usage
Add the package to your cargo dependencies.
[]
= "0.4"
Then you can use the PEG generated rules through the abc module.
use abc;
use *;
let parsed = tune_book.unwrap;
assert_eq!
Feature List
These are roughly taken in order from the abc standard.
- Comments
- Comment lines with preceding whitespace
- Info fields
- Inline fields
- Remarks
- Macros
- Redefining Symbols
- Multiple Voices
- Clefs and Transposition
- Field continuation
- Notes
- Pitch
- Accidentals
- Lengths
- Ties
- Broken Rhythm
- Splitting grace notes e.g. A{g}<A
- Rests
- Beams
- Bars
- First and second repeats
- Shortened e.g. |1 and :|2
- Variant Endings
- Slurs
- Grace Notes
- Tuplets
- Decorations
- Symbol Lines
- Chords and Unisons
- Annotations
- Chord Symbols
- Lyrics
- Multiple Voices
- Voice grouping shorthand syntax
- Text Strings
- Reserved characters
- Stylesheet Directives
- Dialects
- Spacers
History
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