From b0d46fc70caa2d29330ba0fb8102d36515c97b9f Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Sat, 29 Oct 2011 20:26:32 +0200 Subject: [PATCH] parser.yy et al: make \mark a musicfunction. --- lily/lily-lexer.cc | 1 - lily/parser.yy | 8 -------- ly/music-functions-init.ly | 16 ++++++++++++++++ scm/ly-syntax-constructors.scm | 14 -------------- 4 files changed, 16 insertions(+), 23 deletions(-) diff --git a/lily/lily-lexer.cc b/lily/lily-lexer.cc index 4a0ef0eb16..be76d90bd7 100644 --- a/lily/lily-lexer.cc +++ b/lily/lily-lexer.cc @@ -64,7 +64,6 @@ static Keyword_ent the_key_tab[] {"lyricmode", LYRICMODE}, {"lyrics", LYRICS}, {"lyricsto", LYRICSTO}, - {"mark", MARK}, {"markup", MARKUP}, {"markuplist", MARKUPLIST}, {"midi", MIDI}, diff --git a/lily/parser.yy b/lily/parser.yy index f7e938d5f3..fbb65f106d 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -240,7 +240,6 @@ void set_music_properties (Music *p, SCM a); %token LYRICMODE "\\lyricmode" %token LYRICS "\\lyrics" %token LYRICSTO "\\lyricsto" -%token MARK "\\mark" %token MARKUP "\\markup" %token MARKUPLIST "\\markuplist" %token MIDI "\\midi" @@ -1994,19 +1993,12 @@ command_element: $$ = MAKE_SYNTAX ("bar-check", @$); } - | MARK scalar { - $$ = MAKE_SYNTAX ("make-mark-set", @$, $2); - } ; command_event: E_TILDE { $$ = MY_MAKE_MUSIC ("PesOrFlexaEvent", @$)->unprotect (); } - | MARK DEFAULT { - Music *m = MY_MAKE_MUSIC ("MarkEvent", @$); - $$ = m->unprotect (); - } | tempo_event { $$ = $1; } diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index 84eabb3b5c..a3bfebec82 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -560,6 +560,22 @@ inversion = transpose from @var{around} to @var{to}.") (music-invert around to music)) +mark = +#(define-music-function + (parser location label) ((scheme? '())) + "Make the music for the \\mark command." + (let* ((set (and (integer? label) + (context-spec-music (make-property-set 'rehearsalMark label) + 'Score))) + (ev (make-music 'MarkEvent + 'origin location))) + + (if set + (make-sequential-music (list set ev)) + (begin + (set! (ly:music-property ev 'label) label) + ev)))) + musicMap = #(define-music-function (parser location proc mus) (procedure? ly:music?) (_i "Apply @var{proc} to @var{mus} and all of the music it contains.") diff --git a/scm/ly-syntax-constructors.scm b/scm/ly-syntax-constructors.scm index ebc40267af..dbb466b9a0 100644 --- a/scm/ly-syntax-constructors.scm +++ b/scm/ly-syntax-constructors.scm @@ -246,17 +246,3 @@ into a @code{MultiMeasureTextEvent}." 'origin loc))) addlyrics-list))) (make-simultaneous-music (cons voice lyricstos)))) - -(define-ly-syntax (make-mark-set parser location label) - "Make the music for the \\mark command." - (let* ((set (and (integer? label) - (context-spec-music (make-property-set 'rehearsalMark label) - 'Score))) - (ev (make-music 'MarkEvent - 'origin location))) - - (if set - (make-sequential-music (list set ev)) - (begin - (set! (ly:music-property ev 'label) label) - ev)))) -- 2.39.5