On Monday 19 June 2006 12:12, Han-Wen Nienhuys wrote:
> Paul Scott schreef:
> > This used to work in 2.8:
> >
> > \version "2.9.9"
> >
> > KeyG = \key g \major
> >
> > { \KeyG a'' b'' g'' a'' }
> >
> >
> > Have any keywords been added or something that would break this?
>
> Erik has done some work on the parser, which might be the cause.

The problem is the difference between MUSIC_IDENTIFIER and EVENT_IDENTIFIER. 
Right now, the latter can only be used for articulations, and after my parser 
cleanups, no event-chord is created around \key.

I'm not quite sure what the proper solution is. The attached patch solves the 
problem by renaming EVENT_IDENTIFIER to ARTICULATION_IDENTIFIER. The solution 
is easy and it works AFAICT, but it relies on music-classes, whose fate is 
uncertain. I did consider the following solutions as well:
1. Extend identifier-smob with type information (typically corresponding to 
the return value of try_special_idetifiers). I think this will only move the 
problem, because expressions like foo = #... must still be assigned a type 
correctly.
2. unify MUSIC_IDENTIFIER with EVENT_IDENTIFIER. This has one problem: someone 
will try 
foo = -.
{ c2\foo d2 }
which (AFAICT) will put the dot above the d2
3. Whenever a variable is assigned music, wrap it in a dummy sequential_music. 
Unclean.

-- 
Erik
Index: lily/parser.yy
===================================================================
RCS file: /sources/lilypond/lilypond/lily/parser.yy,v
retrieving revision 1.517
diff -u -r1.517 parser.yy
--- lily/parser.yy	13 Jun 2006 22:01:19 -0000	1.517
+++ lily/parser.yy	19 Jun 2006 22:04:17 -0000
@@ -262,7 +262,7 @@
 %token <scm> CONTEXT_DEF_IDENTIFIER
 %token <scm> DRUM_PITCH
 %token <scm> DURATION_IDENTIFIER
-%token <scm> EVENT_IDENTIFIER
+%token <scm> ARTICULATION_IDENTIFIER
 %token <scm> FRACTION
 %token <scm> LYRICS_STRING
 %token <scm> LYRIC_MARKUP_IDENTIFIER
@@ -1624,7 +1624,7 @@
 		m->set_spot (@$);
 		$$ = m->unprotect ();
 	}
-	| EVENT_IDENTIFIER	{
+	| ARTICULATION_IDENTIFIER	{
 		$$ = $1;
 	}
 	| tremolo_type  {
@@ -2392,10 +2392,10 @@
 		unsmob_music (*destination)->
 			set_property ("origin", make_input (last_input_));
 
-		bool is_event = scm_memq (ly_symbol2scm ("event"), mus->get_property ("types"))
+		bool is_articulation = scm_memq (ly_symbol2scm ("articulation-event"), mus->get_property ("types"))
 			!= SCM_BOOL_F;
 
-		return is_event ? EVENT_IDENTIFIER : MUSIC_IDENTIFIER;
+		return is_articulation ? ARTICULATION_IDENTIFIER : MUSIC_IDENTIFIER;
 	} else if (unsmob_duration (sid)) {
 		*destination = unsmob_duration (sid)->smobbed_copy ();
 		return DURATION_IDENTIFIER;
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to