Expand description
Module generated by rust_peg
Each function corresponds to a rule in the grammar and can be called with an input string to begin parsing that type of ABC object.
§Examples
Usually you will want to parse whole ABC files in which case you will want to use
abc::tune_book.
use abc_parser::datatypes::*;
use abc_parser::abc;
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
)
])
)If you know that you will only be parsing one tune you can use abc::tune.
use abc_parser::datatypes::*;
use abc_parser::abc;
let parsed = abc::tune("X:1\nT:Example\nK:D\n").unwrap();
assert_eq!(
parsed,
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
)
)Functions§
- annotation
- bar
- beam
- broken_
rhythm - broken_
rhythm_ target - chord
- chord_
inner_ symbol - ending
- ending_
identifier - ending_
number - file_
header - grace_
notes - grace_
notes_ inner_ symbol - ignored_
line - inline_
field_ line - lyric_
line - lyric_
line_ symbol - music_
line - music_
space - music_
symbol - note
- note_
lowercase - note_
uppercase - placement
- reserved
- rest
- slur
- spacer
- symbol_
alignment - symbol_
line - symbol_
line_ symbol - tune
- tune_
body - tune_
book - tune_
header - tune_
line - tuplet