bug-lilypond
[Top][All Lists]
Advanced

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

Re: another convert-ly problem


From: Erik Sandberg
Subject: Re: another convert-ly problem
Date: Sat, 27 Mar 2004 13:14:49 +0100
User-agent: KMail/1.5.4

On Saturday 27 March 2004 00.39, Han-Wen Nienhuys wrote:
> address@hidden writes:
> > Really? Doing _nothing_ would actually be satisfactory.. The problem is
> > that one parenthesis is moving:
> > 1.8: a4_#'(italic "Simile") c
> > 1.9: a4_#'(italic "Simile" c)
> > so if you just would detect the #', you could assume that it would be
> > followed by a nonempty balanced parenthesis expression, which you just
> > could output as it is (hence the c wouldn't see that there's a
> > parenthesis before it, which I assume is the problem). Wouldn't that
> > work?
>
> Yes it would, but how would you parse a balanced parenthesis
> expression using regular expressions?

I know my automata theory, but when thinking about it once again, there is 
really a solution. (DON'T LAUGH! READ ON)

There are 318 pieces of music on Mutopia only, which were typeset with v1.8 
and earlier. In most cases, the "balanced parenthesis expressions" consist of 
one '(' and one ')'. So you could just have a special case for exps of depth 
1, which probably would fix >90% of the problems (it would actually fix 100% 
of my problems). Adding code for expressions of depth 2 would probably fix 
>99% of the problems, but this might also be overkill.

And perhaps the same thing applies to conversion of text markup:
In most cases there is not much nesting in markup (I have myself never used 
anything more complex than (italic "text")). So simple text markup could be 
converted correctly. My suggestion is the following algorithm (which AFAICS 
could be coded in regexps):
When you encounter "_#'(", Check if the parenthesis expression is too complex 
(i.e. before the next ')' there is a '(').
If not, then convert to the new format, i.e. "_#'( x y z )" turns into 
"_\markup {\x { y z } }"
Otherwise, keep the expression untouched.

(it might be worth supporting a nesting depth of 2 for the text markup 
conversion; this could happen fairly often).

I don't know what you think about this. But though it is a dirty hack, it 
_would_ help a lot. There is this concrete problem of converting 318 given 
files on Mutopia; it could be worth doing something dirty if it would lead to 
a big simplification of this process.

Erik





reply via email to

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