Reviewers: lemzwerg,
Message:
On 2013/03/16 19:19:57, lemzwerg wrote:
LGTM. The combination `\' `\n' `\(' is probably worth a comment in
the
contributors' manual.
If \( was defined, things would be so much easier: one would just put \(
in the first column. \ <newline> \n( is the best I could manage. Or
reformat in order to get the ( away from the starts of line.
Total nuisance.
Description:
Make a PostEvents container class for packaging several postevents
Previously it was not possible to assign multiple postevents to a
single variable or pass them as the result of an event function. This
patch wraps multiple events in such situations inside of a PostEvents
post-event and unwraps them when used again in the parser.
Defuse some open parens starting lines in strings in
define-music-types.scm
Those confuse Emacs' heuristics and make it harder to edit subsequent
Scheme.
Please review this at https://codereview.appspot.com/7742044/
Affected files:
M lily/parser.yy
M scm/define-music-types.scm
Index: lily/parser.yy
diff --git a/lily/parser.yy b/lily/parser.yy
index
478d05377540e10033d55fb569792645d35e3612..a02e4fc2f8b388cad3da3aeb32723e7df07c2a7b
100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -596,7 +596,26 @@ identifier_init:
| output_def
| context_def_spec_block
| music_assign
- | post_event_nofinger
+ | post_event_nofinger post_events
+ {
+ Music *m = unsmob_music ($1);
+
+ if (m->is_mus_type ("post-event-wrapper"))
+ $$ = scm_append
+ (scm_list_2 (m->get_property ("elements"),
+ scm_reverse_x ($2, SCM_EOL)));
+ else
+ $$ = scm_cons ($1, scm_reverse_x ($2, SCM_EOL));
+ if (scm_is_pair ($$)
+ && scm_is_null (scm_cdr ($$)))
+ $$ = scm_car ($$);
+ else
+ {
+ Music * m = MY_MAKE_MUSIC ("PostEvents", @$);
+ m->set_property ("elements", $$);
+ $$ = m->unprotect ();
+ }
+ }
| number_expression
| FRACTION
| string
@@ -2490,8 +2509,20 @@ post_events:
$$ = SCM_EOL;
}
| post_events post_event {
- unsmob_music ($2)->set_spot (@2);
- $$ = scm_cons ($2, $$);
+ Music *m = unsmob_music ($2);
+ $$ = $1;
+ if (m->is_mus_type ("post-event-wrapper"))
+ {
+ for (SCM p = m->get_property ("elements");
+ scm_is_pair (p);
+ p = scm_cdr (p))
+ {
+ $$ = scm_cons (scm_car (p), $$);
+ }
+ } else {
+ m->set_spot (@2);
+ $$ = scm_cons ($2, $$);
+ }
}
;
Index: scm/define-music-types.scm
diff --git a/scm/define-music-types.scm b/scm/define-music-types.scm
index
e7d121b411c210be1685e4b5e8362429ed7217e1..aadb447cca46fa3c27b3240590e85991334bacfc
100644
--- a/scm/define-music-types.scm
+++ b/scm/define-music-types.scm
@@ -72,10 +72,10 @@ Syntax: @w{@var{note}@code{-\\arpeggio}}")
(ArticulationEvent
. ((description . "Add an articulation marking to a note.
-Syntax: @var{note}@code{x}@code{y}, where @code{x} is a direction
-(@code{^} for up or @code{_} for down), or LilyPond's choice
-(no direction specified), and where @code{y} is an articulation
-(such as @w{@code{-.}}, @w{@code{->}}, @code{\\tenuto}, @code{\\downbow}).
+Syntax: @var{note}@code{x}@code{y}, where @code{x} is a direction\
+\n(@code{^} for up or @code{_} for down), or LilyPond's choice\
+\n(no direction specified), and where @code{y} is an articulation\
+\n(such as @w{@code{-.}}, @w{@code{->}}, @code{\\tenuto},
@code{\\downbow}).
See the Notation Reference for details.")
(types . (general-music post-event event articulation-event
script-event))
))
@@ -437,6 +437,12 @@ Syntax: @var{note}@code{\\(} and @var{note}@code{\\)}")
(types . (general-music post-event span-event event
phrasing-slur-event))
))
+ (PostEvents
+ . ((description . "Container for several postevents.
+
+This can be used to package several events into a single one. Should not
be seen outside of the parser.")
+ (types . (post-event post-event-wrapper))))
+
(PropertySet
. ((description . "Set a context property.
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel