[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Variable names
From: |
Keith OHara |
Subject: |
Re: Variable names |
Date: |
Sat, 14 May 2011 18:47:44 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Richard Sabey <richardsabey <at> hotmail.co.uk> writes:
> Carl Sorensen wrote:
>> The core problem is -- how do you distinguish between a2 c (two notes)
>> and a2c (you want it to be a variable) - currently it will be two notes.
>
> I might have missed something here, but:
> in what circumstances can a pitch-name and a variable-name both be legal?
Adjusting the lexer rules a bit (similarly to what was posted years ago in
lilypond-devel) allows :
"violin1a" = { c d e }
\new Staff \violin1a
The quotes are required, so far, because the lexer breaks words at
top-level with the same rules as it uses inside music expressions.
The parser, which knows LilyPond syntax, updates the lexer state in
other situations, and could probably do so here. Doing so will require
care, especially if we continue to allow single-note music expressions:
violin1a = cis2_\downbow violin2a = \violin1a
I intend to look deeper, but encourage someone else to write an
enhancement request for the bug tracker.
Relevant to this mailing list, I found that I do *not* like to allow a number
at the *end* of a variable, because sometimes I type things like
\times2/3{
with no space, and suspect others have similar things in their old scores,
possibly with their custom-defined variables in place of \times.