]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 2928: parser.yy: get rid of SCORE_IDENTIFIER token
authorDavid Kastrup <dak@gnu.org>
Thu, 25 Oct 2012 21:51:19 +0000 (23:51 +0200)
committerDavid Kastrup <dak@gnu.org>
Wed, 31 Oct 2012 05:09:35 +0000 (06:09 +0100)
This allows Scheme functions returning a score to be used as a score body
inside of \score { ... }.

lily/parser.yy

index ac5f83075f81e5b6ef185259b55f64558fd8283b..eb8f8cbcc9c57ec85166ab5ad73011152699b90c 100644 (file)
@@ -379,7 +379,6 @@ If we give names, Bison complains.
 %token SCM_FUNCTION
 %token SCM_IDENTIFIER
 %token SCM_TOKEN
-%token SCORE_IDENTIFIER
 %token STRING
 %token SYMBOL_LIST
 %token TONICNAME_PITCH
@@ -830,8 +829,16 @@ score_body:
 
                unsmob_score ($$)->origin ()->set_spot (@$);
        }
-       | SCORE_IDENTIFIER {
+       | embedded_scm_active {
+               Score *score;
+               if (unsmob_score ($1))
+                       score = new Score (*unsmob_score ($1));
+               else {
+                       score = new Score;
+                       parser->parser_error (@1, _("score expected"));
+               }
                unsmob_score ($$)->origin ()->set_spot (@$);
+               $$ = score->unprotect ();
        }
        | score_body
        {
@@ -3485,12 +3492,6 @@ Lily_lexer::try_special_identifiers (SCM *destination, SCM sid)
                 *destination = unsmob_context_mod (sid)->smobbed_copy ();
 
                 return CONTEXT_MOD_IDENTIFIER;
-       } else if (unsmob_score (sid)) {
-               Score *score = new Score (*unsmob_score (sid));
-               *destination = score->self_scm ();
-
-               score->unprotect ();
-               return SCORE_IDENTIFIER;
        } else if (Music *mus = unsmob_music (sid)) {
                mus = mus->clone ();
                *destination = mus->self_scm ();