lilypond-devel
[Top][All Lists]
Advanced

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

Re: convert: properly escape some single-backslashes. (issue2401042)


From: Carl Sorensen
Subject: Re: convert: properly escape some single-backslashes. (issue2401042)
Date: Tue, 12 Oct 2010 22:04:29 -0600



On 10/12/10 9:28 PM, "Graham Percival" <address@hidden> wrote:

> On Tue, Oct 12, 2010 at 05:17:44PM +0100, Phil Holmes wrote:
>> <address@hidden> wrote in message
>> news:address@hidden
>>> On 2010/10/11 18:18:37, dak wrote:
>>>> python/convertrules.py:2992: _ ("\\RemoveEmpty*StaffContext -> \*Staff
>>>> \\RemoveEmptyStaves"))
>>>> Any particular reason that \*Staff does not get the backslash doubled
>>> as well?
>>> 
>>> The reason was that I didn't know what \* did -- I'm guessing it has a
>>> special meaning in regex -- so I thought I should leave it alone.
>> 
>> * has a special meaning in a regex - repeat the preceding class zero
>> or more times - so it has to be escaped with a backslash in a regex.
> 
> Thanks!
> 
> So that's a good reason to avoid writing \\*Staff -- we don't want
> a literal \ in the output, and we do want a literal *Staff.

Actually, I think in this case we *do* want a literal \ in the output, and a
literal *Staff.

IIUC, this is *not* a regex, it's a (human-readable) description of the
changes to be made.  It should read:

\RemoveEmpty*StaffContext -> \*Staff \RemoveEmptyStaves

The * is meant to be a substitute for nothing, Tab, Drum, Choir, Piano,
Rhythmic, etc.  It's supposed to be like an argument to the ls command.

Doubling up the backslash should make it work properly, I think.

Thanks,

Carl




reply via email to

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