[Top][All Lists]

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

Re: Syntax change proposal:

From: David Kastrup
Subject: Re: Syntax change proposal:
Date: Wed, 25 Jul 2012 08:01:44 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

Keith OHara <address@hidden> writes:

> David Kastrup <dak <at>> writes:
>> >>>> One really ugly problem is interpreting things like "4.".  Looks like a
>> >>>> duration, but then we have
>> >>>> input/regression/  line-width = 4.\cm
> The parser chooses among (too) many different modes ("start conditions") 
> telling the lexer what kind of input to expect in the current context.
> Floating-point numbers and note-durations appear in rather different 
> situations. If both are valid in the same lexer modes, then maybe you can 
> adjust the modes toward a smarter design.

The flexibility of #{ ... #} depends on not having too many modes.  It
would be nice if #{ 4 #} could be used for a duration, and #{ 4.0 \cm #}
for a dimension.  Of course, not being able to write #{ \text-width #}
because in music mode identifiers don't take hyphens does not exactly
help, but one could likely permit #{ \"text-width" #} or similar

Music/Scheme functions that process their arguments for the sake of
achieving some output can't switch modes nilly-willy.  In particular,
the parser's lookahead token needs to be scanned in the correct mode, so
mode-switching decisions can't rely on lookahead.  The more diverse the
variety of interpretations thrown at the lexer becomes, the harder it
becomes for humans and convert-ly to reliably interpret input.  If you
want to write a music function that can shift a note 2\mm to the

>> Well, let's see what the parser currently delivers in INITIAL mode.
>> .     character .
>> -.    REAL 0.0
>> -.0   REAL -0.0
>> -0.0  character - followed by 0.0
>> The semantics of -., for example, were introduced in 2.15.9 with
>> commit da949cdcede0ffb559e9e5e2adbae2088ba1f6d6
> I needed to interpret "\layout {indent = -.\mm}" without backing up in 
> order to obey the instructions for changing lexer.ll while fixing issue 804.
> I tested both interpretations, "staccato" or "0.0" (should have been -0.0)
> At the time, I did not foresee staccatos being valid in a \layout block.
> If you expect to restrict REAL to -?[0-9]+(\.[0.9]+)? then I suggest you
> switch back to interpreting \layout {indent = -.\mm } as a staccato before
> the next stable release, or raise a bug and I'll do so.

With the \mm, this would become a syntax error anyway.  Without it,
indeed likely a staccato.  Which does not make a lot of sense.  But
neither does -. as a shorthand for +0.0 when . is not a shorthand for
any number.

David Kastrup

reply via email to

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