From 965be3f44335981497d2fdc63226b990d56804bb Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Thu, 6 Jun 2013 15:36:48 +0200 Subject: [PATCH] Issue 3401: Parser error with void function in music list Problem code fixed: test = (symbol-list?)) { \test Symbol } This patch is sort of a so-so fix for the problem: for one thing, embedded_scm_closed should not have been able to end in a symbol list in the first place since parsing those requires lookahead for '.'. The grammar has now been changed to use embedded_scm, and just backs up in the case a scheme function/identifier returns a markup in lyrics mode (which can then be assembled with duration and post-events into a more complex music expression). If parsing the source for the markup required lookahead, the same error will be thrown. But that use case of Scheme functions in Lyrics mode for generating markups to be turned into lyric events is a lot more exotic than the one triggering this issue. The current fix at least results in predictable behavior outside of using Lyrics mode, and in particular for uses of define-void-function. --- lily/parser.yy | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lily/parser.yy b/lily/parser.yy index cda6318654..40ccb3a20b 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -1046,9 +1046,9 @@ music_embedded: $$ = SCM_UNSPECIFIED; } } - | music_embedded_backup BACKUP SCM_ARG + | music_embedded_backup { - $$ = $3; + $$ = $1; } | music_embedded_backup BACKUP lyric_element_music { @@ -1057,23 +1057,23 @@ music_embedded: ; music_embedded_backup: - embedded_scm_closed + embedded_scm { if (scm_is_eq ($1, SCM_UNSPECIFIED)) - MYBACKUP (SCM_ARG, $1, @1); + $$ = $1; else if (Music *m = unsmob_music ($1)) { if (m->is_mus_type ("post-event")) { parser->parser_error (@1, _ ("unexpected post-event")); - MYBACKUP (SCM_ARG, SCM_UNSPECIFIED, @1); + $$ = SCM_UNSPECIFIED; } else - MYBACKUP (SCM_ARG, $1, @1); + $$ = $1; } else if (parser->lexer_->is_lyric_state () && Text_interface::is_markup ($1)) MYBACKUP (LYRIC_ELEMENT, $1, @1); else { @$.warning (_ ("Ignoring non-music expression")); - MYBACKUP (SCM_ARG, SCM_UNSPECIFIED, @1); + $$ = $1; } } ; -- 2.39.5