lilypond-devel
[Top][All Lists]
Advanced

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

Re: Parse inline scheme using per-expression port (issue 557330043 by ad


From: David Kastrup
Subject: Re: Parse inline scheme using per-expression port (issue 557330043 by address@hidden)
Date: Mon, 10 Feb 2020 23:20:57 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Han-Wen Nienhuys <address@hidden> writes:

> On Mon, Feb 10, 2020 at 2:40 PM David Kastrup <address@hidden> wrote:
>
>>
>> > Short repro:
>> >
>> > fail-func =
>> > #(define-music-function (name)
>> >    (string?)
>> >   #{
>> >     \new Staff = #(string-append "bla" name) { c'4 }
>> >   #}
>> >   )
>> >
>> > \fail-func "bla"
>>
>> Still assuming that this is with your patch.  "Off-by-one" rings a bell
>> with me: could be related to port "lookahead", namely peek-char.  Though
>> this particular example does not appear to need it since the occurences
>> of # are all followed by a delimited thing: #( ... ) or #{ ... #}.  The
>> peekahead is more for things like #'bla and #7 so I don't really have an
>> idea how this could apply here.  Just throwing it out in case it could
>> prove related.
>>
>
> It has to do with the newline. If everything is on one line, it works. If
> you do
>
>  fail-func =
> #(define-music-function (name)
>    (string?)
>   #{
> #(string-append "bla" name)  #}
>   )
>
> The Scheme code registers the inner # at offset 2, even though it clearly
> is at byte 1 (byte 0 is the \n). Maybe something tries to insert a \r
> ?

Or maybe the file offset got advanced because Guile peeked ahead in
order to check whether there is an UTF-8 signature?  I forget what they
are called, basically zero-space characters.  Byte order mark?  I am not
saying that it is that, but I remember that Guile could do some pretty
funky things at opening even something like a string port.

-- 
David Kastrup
My replies have a tendency to cause friction.  To help mitigating
damage, feel free to forward problematic posts to me adding a subject
like "timeout 1d" (for a suggested timeout of 1 day) or "offensive".



reply via email to

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