Module abc

Module abc 

Source
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