Guidedog मैनुअल 1.0.0-beta.16
भाषा
इस पृष्ठ पर
Guidedog / दस्तावेज़ 1.0.0-beta.16

gd_lilypond

Reads notation into a music model. Never runs Scheme, external programs or file I/O. Includes are lexical and require an explicit caller-supplied policy callback.

Re-exports

pub use gd_score::Error
pub use gd_score::ErrorKind
pub use gd_score::FileId
pub use gd_score::Severity
pub use gd_score::Span

Structs

pub struct gd_lilypond::Command

One command in the versioned Guidedog notation profile.

Fields

pub name: &'static str

Name without its backslash.

pub phase: u8

GDS phase that introduces the construct, or zero for refused commands.

pub status: CommandStatus

Explicit current support status.

pub struct gd_lilypond::Failed

A failed parse or interpretation that keeps enough source to place its diagnostic.

Fields

pub error: Error

The first fatal problem.

pub files: SourceFiles

Every file read before the failure.

Trait Implementations

impl std::fmt::Display for Failed
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result
impl std::error::Error for Failed
pub struct gd_lilypond::SourceFile

Retained input text. The name is resolved by the adapter, not by this library.

Fields

pub name: String

Display and dependency identity.

pub text: String

Original UTF-8 text, before tokenization.

pub struct gd_lilypond::SourceFiles

Sources indexed by FileId; file zero is the directive’s supplied source.

Fields

pub files: Vec<SourceFile>

Files in first-read order, including files that caused an error.

Implementations

impl SourceFiles
pub fn file(&self, id: FileId) -> Option<&SourceFile>

Borrows one file, returning None for an unknown identifier.

pub struct gd_lilypond::Limits

Bounds for one load, including includes, variable expansion and repeats.

Fields

pub source_bytes: usize

Source bytes, charging repeated includes each time.

pub depth: usize

Recursive syntax and expansion depth.

pub files: usize

Included source files, excluding the main source.

pub work: usize

Token and syntax-node visits, including expansions.

pub events: usize

Rhythmic and notation events after expansion.

pub memory_bytes: usize

Conservative allocation allowance for expanded notation, including copied text.

Trait Implementations

impl Default for Limits
fn default() -> Self
pub struct gd_lilypond::Expr

A syntax node in a flat arena. Children own indices, never recursive boxes.

Fields

pub kind: ExprKind

Grouping or atomic notation.

pub span: Span

Original source range.

pub struct gd_lilypond::Syntax

Parsed input and its original files. It contains no engraving decisions.

Fields

pub nodes: Vec<Expr>

Nodes addressed by SyntaxId.

pub roots: Vec<SyntaxId>

Top-level expressions in lexical order.

pub files: SourceFiles

Original file text retained for reports.

Implementations

impl Syntax
pub fn node(&self, id: SyntaxId) -> Option<&Expr>

Borrows a node, returning None for an invalid identifier.

pub struct gd_lilypond::SyntaxId(pub u32)

An index into the syntax arena.

pub struct gd_lilypond::Token

A notation token with no inferred musical meaning.

Fields

pub kind: TokenKind

Lexical category and owned spelling.

pub span: Span

Exact byte location in a retained file.

pub struct gd_lilypond::IncludeRequest<'a>

An include name and the file in which it appeared.

Fields

pub from: FileId

File whose directory is the first search location.

pub name: &'a str

Name written in the include command.

pub struct gd_lilypond::IncludedFile

Source text returned by a confined caller-supplied include reader.

Fields

pub name: String

Resolved name retained in diagnostics and dependency tracking.

pub text: String

UTF-8 file contents.

pub struct gd_lilypond::IncludeRefusal

A caller’s refusal to read an included file.

Fields

pub message: String

Why the path could not be read.

pub hint: String

How to make the include valid.

pub struct gd_lilypond::Options<'a>

Reader bounds and explicit file policy. The default refuses filesystem includes.

Fields

pub limits: Limits

Finite resource bounds.

pub include: Option<&'a mut Include<'a>>

Caller-owned include reader, borrowed only during parsing.

pub reserve: Option<&'a dyn Fn(usize) -> bool>

Reserves the complete conservative reader allowance before expansion.

Trait Implementations

impl fmt::Debug for Options<'_>
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
pub struct gd_lilypond::Loaded

A successful load, including retained files and nonfatal diagnostics.

Fields

pub score: gd_score::Score

Reader-independent music model.

pub files: SourceFiles

All files read, indexed by FileId.

pub warnings: Vec<Error>

Failed bar checks, ignored metadata and unused lyrics.

Enums

pub enum gd_lilypond::CommandStatus

The explicitly implemented, planned or refused status of a notation command.

Variants

Implemented

Fully read and interpreted by the current implementation.

Planned

Listed in the GDS, but not yet implemented; always diagnosed as unsupported.

Ignored

Metadata accepted without producing marks.

Refused

Engraver programming or constructs outside the profile.

pub enum gd_lilypond::ExprKind

Structural grouping before pitch, duration or context interpretation.

Variants

Atom(TokenKind)

An ungrouped token.

Sequence(Vec<SyntaxId>)

A brace-delimited sequence.

Simultaneous(Vec<SyntaxId>)

A double-angle-delimited simultaneous expression.

Chord(Vec<SyntaxId>)

A single-angle-delimited chord.

pub enum gd_lilypond::TokenKind

Lexical categories; numeric values are checked during interpretation.

Variants

Word(String)

A note name, identifier or metadata word.

Number(String)

Digits, without sign or punctuation.

Text(String)

A decoded quoted string.

Command(String)

A backslash command, without its initial backslash.

Symbol(char)

A single punctuation character, including octave marks and Scheme introducers.

SimultaneousStart

A pair of opening angle brackets.

SimultaneousEnd

A pair of closing angle brackets.

Functions

pub fn gd_lilypond::command(name: &str) -> Option<&'static Command>

Borrows a command descriptor, or returns None for a spelling outside the table.

pub fn gd_lilypond::error_report(error: &Error, files: &SourceFiles) -> gd_report::Report

Borrows a shared diagnostic and retained source to create an owned report. Missing file identifiers produce an unplaced report rather than a panic.

pub fn gd_lilypond::interpret_syntax(syntax: &Syntax, limits: &Limits) -> Result<Loaded, Failed>

Interprets a borrowed syntax arena under explicit expansion and event bounds. Returns a separate score and retained source, or the first placed diagnostic.

pub fn gd_lilypond::parse_lilypond(source: &str, name: &str, options: &mut Options<'_>) -> Result<Syntax, Failed>

Parses borrowed notation into a bounded syntax arena without interpreting music. Includes use the explicit callback; failures retain every source read so far.

pub fn gd_lilypond::load_score(source: &str, name: &str, options: &mut Options<'_>) -> Result<Loaded, Failed>

Parses and interprets borrowed source under the supplied bounds and include policy. Returns an owned score or a diagnostic with all files read before the failure.

Type Aliases

pub type gd_lilypond::Include<'a> = dyn FnMut(IncludeRequest<'_>) -> Result<IncludedFile, IncludeRefusal> + 'a

Decides a lexical include. Called synchronously; never stored after a load.

Constants

pub const gd_lilypond::COMMANDS: &[Command]

Known commands in a stable order, shared by diagnostics and profile tests.