static Keyword_ent the_key_tab[] = {
- {"acciaccatura", ACCIACCATURA},
{"accepts", ACCEPTS},
- {"addlyrics", ADDLYRICS},
{"addquote", ADDQUOTE},
{"alias", ALIAS},
{"alternative", ALTERNATIVE},
- {"applycontext", APPLYCONTEXT},
- {"applyoutput", APPLYOUTPUT},
- {"appoggiatura", APPOGGIATURA},
- {"autochange", AUTOCHANGE},
{"bar", BAR},
{"book", BOOK},
- {"breathe", BREATHE},
{"change", CHANGE},
{"chords", CHORDS},
{"clef", CLEF},
{"drums", DRUMS},
{"description", DESCRIPTION},
{"figures",FIGURES},
- {"grace", GRACE},
{"grobdescriptions", GROBDESCRIPTIONS},
{"header", HEADER},
{"key", KEY},
{"once", ONCE},
{"override", OVERRIDE},
{"paper", PAPER},
- {"partcombine", PARTCOMBINE},
{"partial", PARTIAL},
{"quote", QUOTE},
{"relative", RELATIVE},
%pure_parser
%token ACCEPTS
-%token ADDLYRICS
%token ADDQUOTE
%token LYRICSTO
%token ALIAS
%token ALTERNATIVE
-%token APPLYCONTEXT
-%token APPLYOUTPUT
-%token AUTOCHANGE
%token BAR
%token BOOK
-%token BREATHE
%token CHANGE
%token CHORDMODIFIERS
%token CHORDS
%token EXTENDER
%token FIGURES FIGURE_OPEN FIGURE_CLOSE
%token FIGURE_BRACKET_CLOSE FIGURE_BRACKET_OPEN
-%token GRACE
-%token ACCIACCATURA
-%token APPOGGIATURA
%token GROBDESCRIPTIONS
%token HEADER
%token HYPHEN
%token ONCE
%token OVERRIDE SET REVERT
%token PAPER
-%token PARTCOMBINE
%token PARTIAL
%token QUOTE
%token RELATIVE
%token <scm> MARKUP_HEAD_SCM0_SCM1_SCM2
%token <scm> MARKUP_HEAD_SCM0_SCM1_MARKUP2
+%token <scm> MUSIC_FUNCTION
%token <scm> MUSIC_FUNCTION_SCM
%token <scm> MUSIC_FUNCTION_MUSIC
%token <scm> MUSIC_FUNCTION_SCM_MUSIC
%type <book> book_block book_body
%type <i> exclamations questions dots optional_rest
%type <i> bass_mod
-%type <scm> grace_head
%type <scm> oct_check
%type <scm> context_mod_list
%type <scm> lyric_element
Simple_music:
event_chord { $$ = $1; }
- | APPLYOUTPUT embedded_scm {
- if (!ly_input_procedure_p ($2))
- THIS->parser_error (_ ("\\applycontext takes function argument"));
- $$ = MY_MAKE_MUSIC ("ApplyOutputEvent");
- $$->set_property ("procedure", $2);
- $$->set_spot (THIS->here_input ());
- }
- | APPLYCONTEXT embedded_scm {
- if (!ly_input_procedure_p ($2))
- THIS->parser_error (_ ("\\applycontext takes function argument"));
- $$ = MY_MAKE_MUSIC ("ApplyContext");
- $$->set_property ("procedure", $2);
- $$->set_spot (THIS->here_input ());
- }
| MUSIC_IDENTIFIER {
$$ = unsmob_music ($1);
}
}
;
-grace_head:
- GRACE { $$ = scm_makfrom0str ("Grace"); }
- | ACCIACCATURA { $$ = scm_makfrom0str ("Acciaccatura"); }
- | APPOGGIATURA { $$ = scm_makfrom0str ("Appoggiatura"); }
- ;
-
context_mod_list:
/* */ { $$ = SCM_EOL; }
| context_mod_list context_mod {
;
Generic_prefix_music_scm:
- MUSIC_FUNCTION_SCM {
+ MUSIC_FUNCTION {
+ $$ = scm_list_2 ($1, make_input (THIS->here_input ()));
+ }
+ | MUSIC_FUNCTION_SCM {
THIS->push_spot ();
} embedded_scm {
$$ = scm_list_3 ($1, make_input (THIS->pop_spot ()), $3);
Generic_prefix_music {
$$ = $1;
}
- |AUTOCHANGE Music {
- SCM proc = ly_scheme_function ("make-autochange-music");
-
- SCM res = scm_call_1 (proc, $2->self_scm ());
- scm_gc_unprotect_object ($2->self_scm ());
- $$ = unsmob_music (res);
- scm_gc_protect_object (res);
- $$->set_spot (THIS->here_input ());
- }
- | PARTCOMBINE Music Music {
- SCM proc = ly_scheme_function ("make-part-combine-music");
-
- SCM res = scm_call_1 (proc, scm_listify ($2->self_scm (),
- $3->self_scm (), SCM_UNDEFINED));
- scm_gc_unprotect_object ($3->self_scm ());
- scm_gc_unprotect_object ($2->self_scm ());
- $$ = unsmob_music (res);
- scm_gc_protect_object (res);
- $$->set_spot (THIS->here_input ());
- }
- | grace_head Music {
-#if 1
- /*
- The other version is for easier debugging of
- Sequential_music_iterator in combination with grace notes.
- */
-
-/*
-
-TODO: should distinguish between both grace types in the
-basic music objects too, since the meaning is different.
-
-*/
-
- String start_str = "start" + ly_scm2string ($1) + "Music";
- String stop_str = "stop" + ly_scm2string ($1) + "Music";
-
- SCM start = THIS->lexer_->lookup_identifier (start_str);
- SCM stop = THIS->lexer_->lookup_identifier (stop_str);
-
- Music *startm = unsmob_music (start);
- Music *stopm = unsmob_music (stop);
-
- SCM ms = SCM_EOL;
- if (stopm) {
- stopm = stopm->clone ();
- ms = scm_cons (stopm->self_scm (), ms);
- scm_gc_unprotect_object (stopm->self_scm ());
- }
- ms = scm_cons ($2->self_scm (), ms);
- scm_gc_unprotect_object ($2->self_scm ());
- if (startm) {
- startm = startm->clone ();
- ms = scm_cons (startm->self_scm (), ms);
- scm_gc_unprotect_object (startm->self_scm ());
- }
-
- Music* seq = MY_MAKE_MUSIC ("SequentialMusic");
- seq->set_property ("elements", ms);
-
-
- $$ = MY_MAKE_MUSIC ("GraceMusic");
- $$->set_property ("element", seq->self_scm ());
- scm_gc_unprotect_object (seq->self_scm ());
-#else
- $$ = MY_MAKE_MUSIC ("GraceMusic");
- $$->set_property ("element", $2->self_scm ());
- scm_gc_unprotect_object ($2->self_scm ());
-#endif
- }
| CONTEXT simple_string '=' simple_string optional_context_mod Music {
$$ = context_spec_music ($2, $4, $6, $5);
;
re_rhythmed_music:
- ADDLYRICS Music Music {
- Music *m = MY_MAKE_MUSIC ("LyricCombineMusic");
- m->set_property ("elements", scm_listify ($2->self_scm (),
- $3->self_scm (), SCM_UNDEFINED));
- scm_gc_unprotect_object ($3->self_scm ());
- scm_gc_unprotect_object ($2->self_scm ());
- $$ = m;
- }
- | Grouped_music_list new_lyrics {
+ Grouped_music_list new_lyrics {
/* FIXME: should find out uniqueXXX name from music */
SCM name = $1->get_property ("context-id");
;
command_req:
- BREATHE {
- $$ = MY_MAKE_MUSIC ("BreathingSignEvent");
- }
- | E_TILDE {
+ E_TILDE {
$$ = MY_MAKE_MUSIC ("PesOrFlexaEvent");
}
| MARK DEFAULT {
-applymusic = #(ly:make-music-function
- (list procedure? ly:music?) ; signature
- (lambda (where func music) ; the function
- (func music)))
+\version "2.3.2"
-\version "2.3.1"
+#(defmacro-public def-music-function (args signature . body)
+ "Helper macro for `ly:make-music-function'.
+Syntax:
+ (def-music-function (location arg1 arg2 ...) (arg1-type? arg2-type? ...)
+ ...function body...)
+"
+ `(ly:make-music-function (list ,@signature)
+ (lambda (,@args)
+ ,@body)))
+applymusic = #(def-music-function (location func music) (procedure? ly:music?)
+ (func music))
+addlyrics = #(def-music-function (location music lyrics) (ly:music? ly:music?)
+ (make-music 'LyricCombineMusic 'elements (list music lyrics)))
+
+#(use-modules (srfi srfi-1))
+#(define-public (symbol-or-symbols? obj)
+ "Return #t iif obj is a symbol or a symbol list."
+ (or (symbol? obj)
+ (and (list? obj)
+ (null? (remove symbol? obj)))))
+
+%{
+%% \mytag #'foo { ... } ==> OK
+%% c-\mytag #'foo ^4 ==> KO
+mytag = #(def-music-function (location tagname music) (symbol-or-symbols? ly:music?)
+ (set! (ly:music-property music 'tags)
+ ((if (list? tagname) append cons) tagname (ly:music-property music 'tags)))
+ music)
+%}
+
+#(defmacro def-grace-function (start stop)
+ `(def-music-function (location music) (ly:music?)
+ (make-music 'GraceMusic
+ 'element (make-music 'SequentialMusic
+ 'elements (list (ly:music-deep-copy ,start)
+ music
+ (ly:music-deep-copy ,stop))))))
+grace = #(def-grace-function startGraceMusic stopGraceMusic)
+acciaccatura = #(def-grace-function startAcciaccaturaMusic stopAcciaccaturaMusic)
+appoggiatura = #(def-grace-function startAppoggiaturaMusic stopAppoggiaturaMusic)
+
+partcombine = #(def-music-function (location part1 part2) (ly:music? ly:music?)
+ (make-part-combine-music (list part1 part2)))
+
+autochange = #(def-music-function (location music) (ly:music?)
+ (make-autochange-music music))
+
+applycontext = #(def-music-function (location proc) (procedure?)
+ (make-music 'ApplyContext 'procedure proc))
+
+applyoutput = #(def-music-function (location proc) (procedure?)
+ (make-music 'ApplyOutputEvent 'procedure proc))
+
+breathe = #(def-music-function (location) ()
+ (make-music 'EventChord 'elements (list (make-music 'BreathingSignEvent))))
%{
remove these from the parser, and softcode here:
- * \addlyrics
* \tag
- * \appoggiatura, \acciaccatura, \grace
- * \partcombine
- * \autochange
- * \applycontext
- * \applyoutput
- * \breathe
-
with small syntax changes, we could also do