]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3401: Parser error with void function in music list
authorDavid Kastrup <dak@gnu.org>
Thu, 6 Jun 2013 13:36:48 +0000 (15:36 +0200)
committerDavid Kastrup <dak@gnu.org>
Wed, 12 Jun 2013 07:55:21 +0000 (09:55 +0200)
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

index cda631865443a1fe04b820d56b223f4658604094..40ccb3a20b495e19b90a1a33bd5526c38e0aac7a 100644 (file)
@@ -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;
                }
        }
        ;