bug-lilypond
[Top][All Lists]
Advanced

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

Variable names of the form section.N.S core dump the parser


From: Trevor Bača
Subject: Variable names of the form section.N.S core dump the parser
Date: Tue, 24 May 2022 16:37:14 +0200

Hi,

The dot-chained variable names that became available in recent versions of
LilyPond are great, particularly because they allow numerals:

%%% EXAMPLE 1 %%%

\version "2.23.8"
movement.1.notes = { g'4 }
\new Staff { \movement.1.notes }

%%% END %%%

But LilyPond's parser errors when a variable is named like this:

%%% EXAMPLE 2 %%%

\version "2.23.8"
section.1.notes = { g'4 }
\new Staff { \section.1.notes }

%%% END %%%

GNU LilyPond 2.23.8 (running Guile 2.2)
Processing `test.ly'
Parsing...ERROR: In procedure ly:parse-file:
In procedure caar: Wrong type (expecting pair): #<Prob: Music C++:
Music((origin . #<location
/Users/trevor/lilypond-2.23.8/share/lilypond/2.23.8/ly/declarations-init.ly:77:11>))((display-methods
#<procedure method (expr)>) (name . SectionEvent) (types section-event
event)) >

The error appears to be very narrow.

Because this works ...

%%% EXAMPLE 3 %%%

\version "2.23.8"
section = { a'4 }
\new Staff { \section }

%%% END %%%

... and so does this ...

%%% EXAMPLE 4 %%%

\version "2.23.8"
section.1 = { b'4 }
\new Staff { \section.1 }

%%% END %%%

... which appears to mean that the error occurs only when a variable is
named in the form ...

   section.N.S

... with numeric N and string S.

The workaround is to use a different variable name, and so the issue is
probably low priority.

Trevor.

-- 
Trevor Bača
www.trevorbaca.com
soundcloud.com/trevorbaca


reply via email to

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