Skip to main content

Crate croma_core

Crate croma_core 

Source
Expand description

Croma core library: the ABC 2.1 parser, score model, and ABC <-> MusicXML conversion. The CLI, formatter, and language server call this library rather than reparsing ABC.

§Stability (1.x)

Within 1.x, the conversion entry points (abc_to_musicxml, export_musicxml, export_musicxml_with_options, parse_document, lower_score, write_musicxml, write_abc, and read_musicxml with the musicxml-reader feature) and the builder methods on the option types keep compiling. The public data types — the score model, syntax and parse trees, diagnostics, and the option structs’ fields — are not covered: a minor release may add struct fields and enum variants. Build options from Default plus the builder methods rather than struct literals, and give matches on croma enums a wildcard arm. 2.0 will mark these types #[non_exhaustive].

Re-exports§

pub use agent::AgentTopic;
pub use agent::agent_topics;
pub use agent::find_agent_topic;
pub use diagnostic::Diagnostic;
pub use diagnostic::RecoveryNote;
pub use diagnostic::Severity;
pub use diagnostic::Span;
pub use diagnostic::SpecReference;
pub use error::CromaError;
pub use error::Result;
pub use model::Accidental;
pub use model::AccidentalMark;
pub use model::AccidentalPolicy;
pub use model::AccidentalScope;
pub use model::BarlineKind;
pub use model::ChordEvent;
pub use model::ChordMemberEvent;
pub use model::Event;
pub use model::EventAttachments;
pub use model::Fraction;
pub use model::KeySignatureModel;
pub use model::Measure;
pub use model::MeasureId;
pub use model::MeterModel;
pub use model::NoteEvent;
pub use model::Part;
pub use model::Pitch;
pub use model::Rational;
pub use model::RestEvent;
pub use model::RestVisibility;
pub use model::Score;
pub use model::ScoreMetadata;
pub use model::Staff;
pub use model::StaffId;
pub use model::TimedEvent;
pub use model::TimedEventKind;
pub use model::Tune;
pub use model::TupletAttachment;
pub use model::TupletRole;
pub use model::Voice;
pub use options::AbcSpecVersion;
pub use options::DiagnosticOptions;
pub use options::ExportOptions;
pub use options::LowerOptions;
pub use options::MusicXmlWriteOptions;
pub use options::ParseMode;
pub use options::ParseOptions;
pub use options::TupletDisplay;
pub use parse::field::DecorationDelimiter;
pub use parse::field::FieldState;
pub use parse::field::LineBreakMode;
pub use parse::field::ParsedAbcFields;
pub use parse::field::ParsedField;
pub use parse::AbcDocument;
pub use parse::ParseReport;
pub use source::LineColumn;
pub use source::LineColumnSpan;
pub use source::LineEnding;
pub use source::SourceLine;
pub use source::SourceText;
pub use syntax::BarlineSyntax;
pub use syntax::LengthSyntax;
pub use syntax::MusicItem;
pub use syntax::MusicLine;
pub use syntax::MusicToken;
pub use syntax::MusicTokenKind;
pub use syntax::ParsedMusicDocument;
pub use syntax::ParsedTuneMusic;
pub use to_abc::AbcWriteOptions;
pub use to_abc::write_abc;

Modules§

agent
Agent help topics for croma’s non-standard ABC notations (the [I:croma-*] / %%croma-* carriers), plus the standard directives agents routinely misuse (%%score). Exposed as data so a library user gets the same knowledge the croma agent CLI prints, without taking on a JSON or serde dependency — croma-core stays zero-dependency.
diagnostic
error
model
musicxml
options
parse
source
syntax
Surface AST for ABC source.
to_abc
Canonical Score -> ABC writer (the reverse of the MusicXML writer).

Structs§

MusicXmlExport

Functions§

abc_to_musicxml
export_musicxml
export_musicxml_with_options
lower_score
parse_document
write_musicxml
write_musicxml_with_options
Write MusicXML with render-oriented engraving hints (beams, stems, tuplet display, …). MusicXmlWriteOptions::default reproduces write_musicxml byte-for-byte.