lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A \score-lines markup list command for multi-lines embedded scores (


From: dak
Subject: Re: A \score-lines markup list command for multi-lines embedded scores (issue 21280043)
Date: Sun, 03 Nov 2013 09:34:56 +0000

Reviewers: lemzwerg,


https://codereview.appspot.com/21280043/diff/1/lily/lily-lexer.cc
File lily/lily-lexer.cc (right):

https://codereview.appspot.com/21280043/diff/1/lily/lily-lexer.cc#newcode79
lily/lily-lexer.cc:79: {"score-lines", SCORELINES},
On 2013/11/03 08:56:47, lemzwerg wrote:
If the dash in `score-lines' is problematic (and I agree it would be
better to
avoid it),

It isn't problematic.  It just seems out of place enough to require a
double-take.

why not change the keyword?  It has been introduced in a development
version, so I see no problems with that.

It hasn't actually been introduced at all yet.  Formally, there is a
\score-lines markup function, but one would not have used it except
possibly from Scheme, just like formally there is a \score markup
function.

`scorelines' would be OK with me, for
example.  Or maybe `scorelist', since we already have `markuplist'.

That's different.  Inside of markup we still have \*-lines commands
everywhere (for better or worse).  \markuplist is used _outside_ of
markups for generating markup lists. \*-lines are used _inside_ of
markup for generating markup lists.

No, all this is perfectly consistent.  It is also unproblematic to use
this kind of reserved word since issue 2702.

One could require writing \score-lines \score but that seems
unsymmetric with writing \score elsewhere.

It feels clunky, but it's definitely understandable, logical and
workable.  Which is more than issue 1334 achieved.

Description:
A \score-lines markup list command for multi-lines embedded scores

Originally requested as issue 1334.

Like the \score markup, \score-lines is not called through the normal
markup list command mechanisms as it would require something awkward
along the lines of

\score-lines ##{ \score { ... } #}

to get this through.  Instead, a reserved word \score-lines in the
parser will manually call the command with an embedded score, leading
to just

\score-lines { ... }

This is somewhat clumsy in several ways: it requires an additional
reserved identifier (no other reserved identifier contains a dash),
and it means that a score may occur in a file without an explicit
enclosing \score command.

Nevertheless, the previous semantics implemented as issue 1334 were
not tenable: particularly after issue 3270 had been passed, it was
close to impossible for the average user to come up with a way of
getting an actual markup list from a score.

Note that there are as of yet no user-level commands spacing a markup
list in a way similar to the spacing inside of a \score markup.

Please review this at https://codereview.appspot.com/21280043/

Affected files (+14, -20 lines):
  M lily/lily-lexer.cc
  M lily/parser.yy


Index: lily/lily-lexer.cc
diff --git a/lily/lily-lexer.cc b/lily/lily-lexer.cc
index c72ff8fc129eca056015f930b7a94c02d528902a..d5c6a95a3289314b4b531325f21e79b47deb5aaa 100644
--- a/lily/lily-lexer.cc
+++ b/lily/lily-lexer.cc
@@ -76,6 +76,7 @@ static Keyword_ent the_key_tab[]
   {"rest", REST},
   {"revert", REVERT},
   {"score", SCORE},
+  {"score-lines", SCORELINES},
   {"sequential", SEQUENTIAL},
   {"set", SET},
   {"simultaneous", SIMULTANEOUS},
Index: lily/parser.yy
diff --git a/lily/parser.yy b/lily/parser.yy
index ab09f537b2a8693f413c4121d9dcb82e13916d12..b3c3fe9145ec469b254445b660597bf43956fd94 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -269,6 +269,7 @@ int yylex (YYSTYPE *s, YYLTYPE *loc, Lily_parser *parser);
 %token REST "\\rest"
 %token REVERT "\\revert"
 %token SCORE "\\score"
+%token SCORELINES "\\score-lines"
 %token SEQUENTIAL "\\sequential"
 %token SET "\\set"
 %token SIMULTANEOUS "\\simultaneous"
@@ -3355,7 +3356,7 @@ full_markup:
        ;

 markup_top:
-       simple_markup_list {
+       markup_list {
                $$ = scm_list_2 (ly_lily_module_constant ("line-markup"),  $1);
        }
        | markup_head_1_list simple_markup
@@ -3383,7 +3384,7 @@ markup_scm:
        ;
                        

-simple_markup_list:
+markup_list:
        markup_composed_list {
                $$ = $1;
        }
@@ -3401,22 +3402,11 @@ markup_uncomposed_list:
        {
                $$ = $2;
        }
-       ;
-
-markup_list:
-       simple_markup_list
-       | markup_score
-       {
- $$ = scm_list_1 (scm_list_2 (ly_lily_module_constant ("score-lines-markup-list"), $1));
-       }
-       ;
-
-markup_score:
-       SCORE {
+       | SCORELINES {
                SCM nn = parser->lexer_->lookup_identifier ("pitchnames");
                parser->lexer_->push_note_state (nn);
        } '{' score_body '}' {
-               $$ = $4;
+ $$ = scm_list_1 (scm_list_2 (ly_lily_module_constant ("score-lines-markup-list"), $4));
                parser->lexer_->pop_state ();
        }
        ;
@@ -3439,7 +3429,7 @@ markup_braced_list_body:
        | markup_braced_list_body markup {
                $$ = scm_cons ($2, $1);
        }
-       | markup_braced_list_body simple_markup_list {
+       | markup_braced_list_body markup_list {
                $$ = scm_reverse_x ($2, $1);
        }
        ;
@@ -3488,6 +3478,13 @@ simple_markup:
        STRING {
                $$ = make_simple_markup ($1);
        }
+       | SCORE {
+               SCM nn = parser->lexer_->lookup_identifier ("pitchnames");
+               parser->lexer_->push_note_state (nn);
+       } '{' score_body '}' {
+               $$ = scm_list_2 (ly_lily_module_constant ("score-markup"), $4);
+               parser->lexer_->pop_state ();
+       }
        | MARKUP_FUNCTION markup_command_basic_arguments {
                $$ = scm_cons ($1, scm_reverse_x ($2, SCM_EOL));
        }
@@ -3495,10 +3492,6 @@ simple_markup:
        {
                $$ = $2;
        }
-       | markup_score
-       {
-               $$ = scm_list_2 (ly_lily_module_constant ("score-markup"), $1);
-       }
        ;

 markup:





reply via email to

[Prev in Thread] Current Thread [Next in Thread]