lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parsing lyrics in a music function


From: Michael Ellis
Subject: Re: Parsing lyrics in a music function
Date: Thu, 15 Sep 2011 17:12:56 -0400



On Thu, Sep 15, 2011 at 4:46 PM, David Kastrup <address@hidden> wrote:
Michael Ellis <address@hidden> writes:

> Thanks, David.  I figured it must be a parsing issue so it's nice to
> have it clarified by someone knowledgable.   I like the
> ly:parser-parse-string idea.  Does that function return a music object
> if the parsing is successful?

No.  ly:parse-string-_expression_ does, so that would be the smarter idea.

> Would it work to have my \lacc function massage the string so that it
> becomes 
>
> "\lyricmode { This is a lyric line }" 
>
> and then call ly:parser-parse-string to return the result?

Yes.  With parser-parse-string, you'd do something like
"parseStringResult = \lyricmode { ... }" and then look up the parser
variable parseStringResult.  ly:parse-string-_expression_ is, of course,
much more suitable.

Did ly:parse-string-_expression_ go away in 2.14.1?  I get an undefined variable error if I try something like:

\version "2.14.1"
abc = #(define-music-function (parser loc) ()
    (ly:parse-string-_expression_ parser "{ a b c' }")
    )
\displayMusic \abc

> %lilypond %args "/Users/mellis/Desktop/AudioTranscriptions/parsertest.ly"
Processing `/Users/mellis/Desktop/AudioTranscriptions/parsertest.ly'
Parsing...ERROR: Unbound variable: ly:parse-string-_expression_

I don't get that error with other ly:parse-xxx  functions.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]