| output_def
| context_def_spec_block
| music_assign
+ | pitch_or_music
| FRACTION
| string
| embedded_scm
// is still time to escape from notes mode.
music_or_context_def:
- music_arg
+ music_assign
| context_def_spec_block
;
}
;
-music: music_arg
+music: music_assign
| lyric_element_music
+ | pitch_or_music
+ {
+ $$ = make_music_from_simple (parser, @1, $1);
+ if (!unsmob_music ($$))
+ {
+ parser->parser_error (@1, _ ("music expected"));
+ $$ = MAKE_SYNTAX ("void-music", @$);
+ }
+ }
;
music_embedded:
}
;
-music_arg:
- simple_music
- {
- $$ = make_music_from_simple (parser, @1, $1);
- if (!unsmob_music ($$))
- {
- parser->parser_error (@1, _ ("music expected"));
- $$ = MAKE_SYNTAX ("void-music", @$);
- }
- }
- | composite_music %prec COMPOSITE
- ;
-
+// music_assign does not need to contain lyrics: there are no
+// assignments in lyricmode.
music_assign:
simple_music
| composite_music %prec COMPOSITE
{
$$ = check_scheme_arg (parser, @4, $4, $3, $2);
}
+ | function_arglist_nonbackup_reparse REPARSE pitch_or_music
+ {
+ if (scm_is_true (scm_call_1 ($2, $3)))
+ $$ = scm_cons ($3, $1);
+ else
+ $$ = check_scheme_arg (parser, @3,
+ make_music_from_simple
+ (parser, @3, $3),
+ $1, $2);
+ }
| function_arglist_nonbackup_reparse REPARSE duration_length
{
$$ = check_scheme_arg (parser, @3, $3, $1, $2);
else
MYREPARSE (@4, $2, SCM_ARG, $4);
}
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup pitch
+ {
+ $$ = $3;
+ if (scm_is_true
+ (scm_call_1
+ ($2, make_music_from_simple
+ (parser, @4, $4))))
+ MYREPARSE (@4, $2, PITCH_IDENTIFIER, $4);
+ else
+ MYREPARSE (@4, $2, SCM_ARG, $4);
+ }
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup steno_tonic_pitch
+ {
+ $$ = $3;
+ if (scm_is_true
+ (scm_call_1
+ ($2, make_music_from_simple
+ (parser, @4, $4))))
+ MYREPARSE (@4, $2, TONICNAME_PITCH, $4);
+ else
+ MYREPARSE (@4, $2, SCM_ARG, $4);
+ }
| EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup STRING
{
$$ = $3;
MYBACKUP (EVENT_IDENTIFIER, $4, @4);
}
}
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup pitch
+ {
+ if (scm_is_true
+ (scm_call_1
+ ($2, make_music_from_simple
+ (parser, @4, $4))))
+ {
+ $$ = $3;
+ MYREPARSE (@4, $2, PITCH_IDENTIFIER, $4);
+ } else if (scm_is_true (scm_call_1 ($2, $4)))
+ $$ = scm_cons ($4, $3);
+ else {
+ $$ = scm_cons (loc_on_music (@3, $1), $3);
+ MYBACKUP (PITCH_IDENTIFIER, $4, @4);
+ }
+ }
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup steno_tonic_pitch
+ {
+ if (scm_is_true
+ (scm_call_1
+ ($2, make_music_from_simple
+ (parser, @4, $4))))
+ {
+ $$ = $3;
+ MYREPARSE (@4, $2, TONICNAME_PITCH, $4);
+ } else if (scm_is_true (scm_call_1 ($2, $4)))
+ $$ = scm_cons ($4, $3);
+ else {
+ $$ = scm_cons (loc_on_music (@3, $1), $3);
+ MYBACKUP (TONICNAME_PITCH, $4, @4);
+ }
+ }
| EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup full_markup
{
if (scm_is_true (scm_call_1 ($2, $4)))
MYBACKUP (STRING, $4, @4);
}
}
- | function_arglist_backup REPARSE music_assign
+ | function_arglist_backup REPARSE pitch_or_music
{
if (scm_is_true (scm_call_1 ($2, $3)))
$$ = scm_cons ($3, $1);
$$ = check_scheme_arg (parser, @3,
$3, $1, $2);
}
+ | function_arglist_common_reparse REPARSE pitch_or_music
+ {
+ if (scm_is_true (scm_call_1 ($2, $3)))
+ $$ = scm_cons ($3, $1);
+ else
+ $$ = check_scheme_arg (parser, @3,
+ make_music_from_simple
+ (parser, @3, $3),
+ $1, $2);
+ }
| function_arglist_common_reparse REPARSE bare_number_common
{
$$ = check_scheme_arg (parser, @3,
// know the predicate to be false.
MYREPARSE (@3, $1, SCM_ARG, $3);
}
+ | EXPECT_SCM function_arglist_optional pitch
+ {
+ $$ = $2;
+ if (scm_is_true
+ (scm_call_1
+ ($1, make_music_from_simple
+ (parser, @3, $3))))
+ MYREPARSE (@3, $1, PITCH_IDENTIFIER, $3);
+ else
+ MYREPARSE (@3, $1, SCM_ARG, $3);
+ }
+ | EXPECT_SCM function_arglist_optional steno_tonic_pitch
+ {
+ $$ = $2;
+ if (scm_is_true
+ (scm_call_1
+ ($1, make_music_from_simple
+ (parser, @3, $3))))
+ MYREPARSE (@3, $1, TONICNAME_PITCH, $3);
+ else
+ MYREPARSE (@3, $1, SCM_ARG, $3);
+ }
| EXPECT_SCM function_arglist_optional STRING
{
$$ = $2;
scalar:
embedded_scm_arg
+ | pitch_or_music
| SCM_IDENTIFIER
| bare_number
// The following is a rather defensive variant of admitting
{
$$ = scm_difference ($2, SCM_UNDEFINED);
}
- | STRING
- | full_markup
+ | string
;
event_chord:
simple_element post_events {
// Let the rhythmic music iterator sort this mess out.
if (scm_is_pair ($2)) {
- $$ = make_music_from_simple (parser, @1, $1);
- if (unsmob_music ($$))
- unsmob_music ($$)->set_property ("articulations",
- scm_reverse_x ($2, SCM_EOL));
- else
- {
- parser->parser_error (@1, _("music expected"));
- $$ = MAKE_SYNTAX ("void-music", @1);
- }
+ unsmob_music ($$)->set_property ("articulations",
+ scm_reverse_x ($2, SCM_EOL));
}
} %prec ':'
- | simple_chord_elements post_events {
- if (scm_is_pair ($2)) {
- if (unsmob_pitch ($1))
- $1 = make_chord_elements (@1,
- $1,
- parser->default_duration_.smobbed_copy (),
- SCM_EOL);
-
- SCM elts = ly_append2 ($1, scm_reverse_x ($2, SCM_EOL));
-
- $$ = MAKE_SYNTAX ("event-chord", @1, elts);
- } else if (!unsmob_pitch ($1))
- $$ = MAKE_SYNTAX ("event-chord", @1, $1);
- // A mere pitch drops through.
- } %prec ':'
| CHORD_REPETITION optional_notemode_duration post_events {
Input i;
i.set_location (@1, @3);
| REST { $$ = SCM_BOOL_T; }
;
-simple_element:
- pitch exclamations questions octave_check maybe_notemode_duration optional_rest {
+pitch_or_music:
+ pitch exclamations questions octave_check maybe_notemode_duration optional_rest post_events {
if (!parser->lexer_->is_note_state ())
parser->parser_error (@1, _ ("have to be in Note mode for notes"));
if (!SCM_UNBNDP ($2)
|| !SCM_UNBNDP ($3)
|| scm_is_number ($4)
|| !SCM_UNBNDP ($5)
- || scm_is_true ($6))
+ || scm_is_true ($6)
+ || scm_is_pair ($7))
{
Music *n = 0;
if (scm_is_true ($6))
n->set_property ("cautionary", SCM_BOOL_T);
if (to_boolean ($2) || to_boolean ($3))
n->set_property ("force-accidental", SCM_BOOL_T);
-
+ if (scm_is_pair ($7))
+ n->set_property ("articulations",
+ scm_reverse_x ($7, SCM_EOL));
$$ = n->unprotect ();
}
- }
- | DRUM_PITCH optional_notemode_duration {
+ } %prec ':'
+ | simple_chord_elements post_events {
+ if (scm_is_pair ($2)) {
+ if (unsmob_pitch ($1))
+ $1 = make_chord_elements (@1,
+ $1,
+ parser->default_duration_.smobbed_copy (),
+ SCM_EOL);
+
+ SCM elts = ly_append2 ($1, scm_reverse_x ($2, SCM_EOL));
+
+ $$ = MAKE_SYNTAX ("event-chord", @1, elts);
+ } else if (!unsmob_pitch ($1))
+ $$ = MAKE_SYNTAX ("event-chord", @1, $1);
+ // A mere pitch drops through.
+ } %prec ':'
+ ;
+
+simple_element:
+ DRUM_PITCH optional_notemode_duration {
Music *n = MY_MAKE_MUSIC ("NoteEvent", @$);
n->set_property ("duration", $2);
n->set_property ("drum-type", $1);