[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Less restrictive LilyPond identifiers?
From: |
Matthias Kilian |
Subject: |
Re: Less restrictive LilyPond identifiers? |
Date: |
Sun, 7 Mar 2004 20:19:44 +0100 |
User-agent: |
Mutt/1.3.28i |
On Sun, Mar 07, 2004 at 03:03:30PM +0100, Matthias Kilian wrote:
[Letters and digits in identifiers]
> If there's no other reason for disallowing digits than to keep
> parser/scanner, I could try to write a patch.
Quick hack alert! The patch below appears to work. However, it applies
only to scanner rules using NOTECOMMAND. And, of course, documentation
and emacs and vim configuration would have to be changed. I'd work on
documentation and vim configuration if this patch is accepted.
Ciao,
Kili
diff -x CVS -rNup ../lilypond-2.1.29/lily/lexer.ll ./lily/lexer.ll
--- ../lilypond-2.1.29/lily/lexer.ll 2004-02-24 21:00:57.000000000 +0100
+++ ./lily/lexer.ll 2004-03-07 18:25:38.000000000 +0100
@@ -112,12 +112,13 @@ SCM (* scm_parse_error_handler) (void *)
A [a-zA-Z]
AA {A}|_
N [0-9]
-AN {AA}|{N}
+AN {A}|{N}
+AAN {AA}|{N}
PUNCT [?!:'`]
ACCENT \\[`'"^]
NATIONAL [\001-\006\021-\027\031\036\200-\377]
TEX {AA}|-|{PUNCT}|{ACCENT}|{NATIONAL}
-WORD {A}{AN}*
+WORD {A}{AAN}*
ALPHAWORD {A}+
DIGIT {N}
UNSIGNED {N}+
@@ -130,7 +131,7 @@ WHITE [ \n\t\f\r]
HORIZONTALWHITE [ \t]
BLACK [^ \n\t\f\r]
RESTNAME [rs]
-NOTECOMMAND \\{A}+
+NOTECOMMAND \\{A}{AN}*
MARKUPCOMMAND \\({A}|[-_])+
LYRICS ({AA}|{TEX})[^0-9 \t\n\r\f]*
ESCAPED [nt\\'"]
diff -x CVS -rNup ../lilypond-2.1.29/lily/parser.yy ./lily/parser.yy
--- ../lilypond-2.1.29/lily/parser.yy 2004-02-26 22:59:50.000000000 +0100
+++ ./lily/parser.yy 2004-03-07 18:27:21.000000000 +0100
@@ -123,11 +123,10 @@ is_regular_identifier (SCM id)
String str = ly_scm2string (id);
char const *s = str.to_str0 () ;
- bool v = true;
- while (*s && v)
+ bool v = *s && isalpha(*s);
+ while (*++s && v)
{
- v = v && isalpha (*s);
- s++;
+ v = v && isalnum (*s);
}
return v;
}