]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4798/4: Parser work for key lists including numbers
authorDavid Kastrup <dak@gnu.org>
Wed, 3 Feb 2016 18:38:29 +0000 (19:38 +0100)
committerDavid Kastrup <dak@gnu.org>
Sat, 19 Mar 2016 13:20:03 +0000 (14:20 +0100)
This admits key lists containing non-negative numbers into various
syntactic constructs previously using symbol lists.

lily/include/lily-imports.hh
lily/lily-imports.cc
lily/parser.yy

index 28f6e935622ff2bb37adb470fc162602beead3fa..97982895f50c851ef1b993c157956fdf9fb771b6 100644 (file)
@@ -65,6 +65,8 @@ namespace Lily {
   extern Variable hash_table_to_alist;
   extern Variable interpret_markup_list;
   extern Variable invalidate_alterations;
+  extern Variable key_p;
+  extern Variable key_list_p;
   extern Variable key_signature_interface_alteration_positions;
   extern Variable layout_extract_page_properties;
   extern Variable lilypond_main;
index a62216e0849988f632c98d50d502cf1b7fe23b6e..adc9124fb7dc948c613515dff9c2a585a9350987 100644 (file)
@@ -59,6 +59,8 @@ namespace Lily {
   Variable hash_table_to_alist ("hash-table->alist");
   Variable interpret_markup_list ("interpret-markup-list");
   Variable invalidate_alterations ("invalidate-alterations");
+  Variable key_p ("key?");
+  Variable key_list_p ("key-list?");
   Variable key_signature_interface_alteration_positions ("key-signature-interface::alteration-positions");
   Variable layout_extract_page_properties ("layout-extract-page-properties");
   Variable lilypond_main ("lilypond-main");
index 62cf8301e34fa54b03f656d0a31bfb49fcc72bc4..54de4727b5b75d8f16776198ee3e0d94bff6fcce 100644 (file)
@@ -1715,9 +1715,9 @@ symbol_list_rev:
 symbol_list_part:
        symbol_list_element
        {
-               $$ = try_string_variants (Lily::symbol_list_p, $1);
+               $$ = try_string_variants (Lily::key_list_p, $1);
                if (SCM_UNBNDP ($$)) {
-                       parser->parser_error (@1, _("not a symbol"));
+                       parser->parser_error (@1, _("not a key"));
                        $$ = SCM_EOL;
                } else
                        $$ = scm_reverse ($$);
@@ -1728,6 +1728,7 @@ symbol_list_part:
 symbol_list_element:
        STRING
        | embedded_scm_bare
+       | UNSIGNED
        ;
 
 
@@ -4049,8 +4050,7 @@ Lily_lexer::try_special_identifiers (SCM *destination, SCM sid)
                *destination = unsmob<Score> (sid)->clone ()->unprotect ();
                return SCM_IDENTIFIER;
        } else if (scm_is_pair (sid)
-                  && scm_is_pair (scm_car (sid))
-                  && scm_is_symbol (scm_caar (sid))) {
+                  && scm_is_true (Lily::key_list_p (sid))) {
                *destination = sid;
                return LOOKUP_IDENTIFIER;
        }
@@ -4123,7 +4123,7 @@ try_string_variants (SCM pred, SCM str)
        if (scm_is_true (scm_call_1 (pred, str)))
                return str;
        // a symbol may be interpreted as a list of symbols if it helps
-       if (scm_is_symbol (str)) {
+       if (scm_is_true (Lily::key_p (str))) {
                str = scm_list_1 (str);
                if (scm_is_true (scm_call_1 (pred, str)))
                        return str;