lilypond-devel
[Top][All Lists]
Advanced

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

Re: Let ', ' separate symbol lists like '.' does (issue 290490043 by add


From: dak
Subject: Re: Let ', ' separate symbol lists like '.' does (issue 290490043 by address@hidden)
Date: Tue, 08 Mar 2016 18:17:58 +0000

Reviewers: lemzwerg, simon.albrecht,

Message:
On 2016/03/08 17:52:09, simon.albrecht wrote:
I also like the idea.
Should this get a regtest?

Best, Simon

It certainly should get both regtest and documentation and Changes
entry.  However, it will presumably also fit together with pending
documentation for tags.  And I'm also working on other related changes
so I'm somewhat unsure about the total scope.

So if someone wants to take this from here (or propose tests/docs to
include), he's certainly welcome to do so.

Description:
Let ',' separate symbol lists like '.' does

While the dotted list syntax is natural for hierarchical paths like for
\override and \revert, it is less natural in cases that may now be
written as

    \keepWithTag violin,flute,oboe { c''' }

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

Affected files (+23, -1 lines):
  M lily/parser.yy


Index: lily/parser.yy
diff --git a/lily/parser.yy b/lily/parser.yy
index 3e7625f45f8cafbbe578bfa803e2d2a4819bedbe..29ecf1c3222f88e4d8a7b6325486d24c098fa605 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -654,6 +654,11 @@ assignment:
                parser->lexer_->set_identifier (path, $5);
                 $$ = SCM_UNSPECIFIED;
        }
+       | assignment_id ',' property_path '=' identifier_init {
+               SCM path = scm_cons (scm_string_to_symbol ($1), $3);
+               parser->lexer_->set_identifier (path, $5);
+                $$ = SCM_UNSPECIFIED;
+       }
        ;


@@ -1673,6 +1678,10 @@ symbol_list_arg:
        {
                $$ = scm_append (scm_list_2 ($1, scm_reverse_x ($3, SCM_EOL)));
        }
+       | SYMBOL_LIST ',' symbol_list_rev
+       {
+               $$ = scm_append (scm_list_2 ($1, scm_reverse_x ($3, SCM_EOL)));
+       }
        ;

 symbol_list_rev:
@@ -1681,6 +1690,10 @@ symbol_list_rev:
        {
                $$ = scm_append_x (scm_list_2 ($3, $1));
        }
+       | symbol_list_rev ',' symbol_list_part
+       {
+               $$ = scm_append_x (scm_list_2 ($3, $1));
+       }
        ;

 // symbol_list_part delivers elements in reverse copy.
@@ -2621,6 +2634,10 @@ revert_arg_part:
        {
                $$ = scm_append_x (scm_list_2 ($5, $3));
        }
+       | revert_arg_backup BACKUP SCM_ARG ',' symbol_list_part
+       {
+               $$ = scm_append_x (scm_list_2 ($5, $3));
+       }
        | revert_arg_backup BACKUP SCM_ARG symbol_list_part
        {
                $$ = scm_append_x (scm_list_2 ($4, $3));
@@ -4103,6 +4120,10 @@ try_string_variants (SCM pred, SCM str)

        str = scm_string_split (str, SCM_MAKE_CHAR ('.'));
        for (SCM p = str; scm_is_pair (p); p = scm_cdr (p))
+               scm_set_car_x (p, scm_string_split (scm_car (p),
+                                                   SCM_MAKE_CHAR (',')));
+       str = scm_append_x (str);
+       for (SCM p = str; scm_is_pair (p); p = scm_cdr (p))
                scm_set_car_x (p, scm_string_to_symbol (scm_car (p)));

        // Let's attempt the symbol list interpretation first.
@@ -4140,7 +4161,8 @@ is_regular_identifier (SCM id, bool multiple)
              || (c >= 'A' && c <= 'Z')
              || c > 0x7f)
                  middle = true;
-         else if (middle && (c == '-' || c == '_' || (multiple && c == '.')))
+         else if (middle && (c == '-' || c == '_' || (multiple &&
+                                                      (c == '.' || c == ','))))
                  middle = false;
          else
                  return false;





reply via email to

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