[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Variable names of the form section.N.S core dump the parser
From: |
Jean Abou Samra |
Subject: |
Re: Variable names of the form section.N.S core dump the parser |
Date: |
Tue, 24 May 2022 16:40:55 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 |
Le 24/05/2022 à 16:37, Trevor Bača a écrit :
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.
Because there is now a command called \section, so this
is trying to set a key inside a music function, which is
not an alist ... This is unfortunate but unavoidable.
(Note that the error is not a core dump, just a regular Scheme
error. If you get a core dump, that means LilyPond crashed
more seriously, usually without much indication of what
happened, and it is normally a bug.)
Jean