On Saturday 04 February 2006 14.43, Han-Wen Nienhuys wrote: > As #( .. ) is handled in the lexer, not the parser, I think they will > have to be done directly. > > BTW, looking at the parser, I see another option for deconstructing it > further. It might be possible to add lexer-mode switches to the > annotation of a music function. Then we could also soft-code the > definition of \lyrics, \lyricsto, \figures, etc.
I realise that this is a very cool idea. Perhaps it can be used to soft-code pitch functions (such as \transpose) as well? Could we also make Lily_lexer::lookup_identifier_symbol softcodable, in a similar way? This would solve lots of problems, and add support for local variables in a natural way (it would probably be easy to write a \let macro, for instance). It would also make it cleaner to create macros (\for, \lamda, etc). Hm... It might even be possible to use identifier lookup overrides to soft-code the entire macro concept: \relative could override the identifier lookup to a function which maps any function to a wrapper, that delays the function application until the end of the \relative call. This way, there would be no real point in postponing macro or function calls to after parsing; functions calls can simply be delayed whenever anyone wants to delay them. (we may still want to add explicit support for macros in the parser, in case the softcoded \relative hack becomes too hairy) -- Erik _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel