Module abc_parser::abc [−][src]
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(None, vec![ Tune::new( TuneHeader::new(vec![ InfoField::new('X', "1".to_string()), InfoField::new('T', "Example".to_string()), InfoField::new('K', "D".to_string()) ]), 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![ InfoField::new('X', "1".to_string()), InfoField::new('T', "Example".to_string()), InfoField::new('K', "D".to_string()) ]), None ) )
Structs
ParseError |
Functions
bar | |
chord | |
ending | |
file_header | |
grace_notes | |
music_line | |
music_symbol | |
note | |
rest | |
tune | |
tune_body | |
tune_book | |
tune_header | |
tuplet |
Type Definitions
ParseResult |