From: David Kastrup Date: Fri, 15 Nov 2013 16:58:55 +0000 (+0100) Subject: Let simple_music possibly return a pitch in \chordmode X-Git-Tag: release/2.19.0-1~145 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5e89d5c2d888a32c5798c5677e5edd33a7e7f2bc;p=lilypond.git Let simple_music possibly return a pitch in \chordmode --- diff --git a/lily/parser.yy b/lily/parser.yy index ecea711ac6..0b64957bf8 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -2549,13 +2549,19 @@ event_chord: } } %prec ':' | simple_chord_elements post_events { - SCM elts = ly_append2 ($1, scm_reverse_x ($2, SCM_EOL)); - - Input i; - /* why is this giving wrong start location? -ns - * i = @$; */ - i.set_location (@1, @2); - $$ = MAKE_SYNTAX ("event-chord", i, elts); + 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; @@ -3206,6 +3212,7 @@ simple_element: } ; +// Can return a single pitch rather than a list. simple_chord_elements: new_chord { if (!parser->lexer_->is_chord_state ()) @@ -3244,9 +3251,13 @@ lyric_element_music: } %prec ':' ; +// Can return a single pitch rather than a list. new_chord: - steno_tonic_pitch optional_notemode_duration { - $$ = make_chord_elements (@$, $1, $2, SCM_EOL); + steno_tonic_pitch maybe_notemode_duration { + if (SCM_UNBNDP ($2)) + $$ = $1; + else + $$ = make_chord_elements (@$, $1, $2, SCM_EOL); } | steno_tonic_pitch optional_notemode_duration chord_separator chord_items { SCM its = scm_reverse_x ($4, SCM_EOL);