]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/parser.yy
fix tuplet example
[lilypond.git] / lily / parser.yy
index 0d42a60a18ea1663bc3a5f1bd260de0457ca208c..4bf3c9d191e98d5585404c45d16b2aa3858fb2ed 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  (c) 1997--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
                  Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
@@ -300,7 +300,7 @@ If we give names, Bison complains.
 %type <book> book_body
 
 %type <i> bare_unsigned
-%type <i> figured_bass_alteration
+%type <scm> figured_bass_alteration
 %type <i> dots
 %type <i> exclamations
 %type <i> optional_rest
@@ -410,6 +410,7 @@ If we give names, Bison complains.
 %type <scm> pitch_also_in_chords
 %type <scm> post_events
 %type <scm> property_operation
+%type <scm> property_path
 %type <scm> scalar
 %type <scm> script_abbreviation
 %type <scm> simple_chord_elements
@@ -1122,6 +1123,16 @@ context_change:
        }
        ;
 
+
+property_path:
+       embedded_scm {
+               $$ = scm_cons ($1, SCM_EOL);
+       }
+       | property_path embedded_scm {
+               $$ = scm_cons ($2, $1);
+       }
+       ;
+
 property_operation:
        STRING '=' scalar {
                $$ = scm_list_3 (ly_symbol2scm ("assign"),
@@ -1131,13 +1142,10 @@ property_operation:
                $$ = scm_list_2 (ly_symbol2scm ("unset"),
                        scm_string_to_symbol ($2));
        }
-       | OVERRIDE simple_string embedded_scm '=' embedded_scm {
-               $$ = scm_list_4 (ly_symbol2scm ("push"),
-                       scm_string_to_symbol ($2), $5, $3);
-       }
-       | OVERRIDE simple_string embedded_scm embedded_scm '=' embedded_scm {
-               $$ = scm_list_5 (ly_symbol2scm ("push"),
-                               scm_string_to_symbol ($2), $6, $4, $3);
+       | OVERRIDE simple_string property_path '=' embedded_scm {
+               $$ = scm_append (scm_list_2 (scm_list_3 (ly_symbol2scm ("push"),
+                                                       scm_string_to_symbol ($2), $5),
+                                            $3));
        }
        | REVERT simple_string embedded_scm {
                $$ = scm_list_3 (ly_symbol2scm ("pop"),
@@ -1183,17 +1191,12 @@ context_prop_spec:
        ;
 
 simple_music_property_def:
-       OVERRIDE context_prop_spec embedded_scm '=' scalar {
-               $$ = scm_list_5 (scm_car ($2),
-                       ly_symbol2scm ("OverrideProperty"),
-                       scm_cadr ($2),
-                       $5, $3);
-       }
-       | OVERRIDE context_prop_spec embedded_scm  embedded_scm '=' scalar {
-               $$ = scm_list_n (scm_car ($2),                  
-                       ly_symbol2scm ("OverrideProperty"),
-                       scm_cadr ($2),
-                       $6, $4, $3, SCM_UNDEFINED);
+       OVERRIDE context_prop_spec property_path '=' scalar {
+               $$ = scm_append (scm_list_2 (scm_list_n (scm_car ($2),                  
+                               ly_symbol2scm ("OverrideProperty"),
+                               scm_cadr ($2),
+                               $5, SCM_UNDEFINED),
+                               $3));
        }
        | REVERT context_prop_spec embedded_scm {
                $$ = scm_list_4 (scm_car ($2),
@@ -1824,9 +1827,9 @@ bass_number:
        ;
 
 figured_bass_alteration:
-       '-'     { $$ = -2; }
-       | '+'   { $$ = 2; }
-       | '!'   { $$ = 0; }
+       '-'     { $$ = ly_rational2scm (FLAT_ALTERATION); }
+       | '+'   { $$ = ly_rational2scm (SHARP_ALTERATION); }
+       | '!'   { $$ = scm_from_int (0); }
        ;
 
 bass_figure:
@@ -1851,11 +1854,11 @@ bass_figure:
        }
        | bass_figure figured_bass_alteration {
                Music *m = unsmob_music ($1);
-               if ($2) {
+               if (scm_to_double ($2)) {
                        SCM salter = m->get_property ("alteration");
-                       int alter = scm_is_number (salter) ? scm_to_int (salter) : 0;
+                       SCM alter = scm_is_number (salter) ? salter : scm_from_int (0);
                        m->set_property ("alteration",
-                               scm_from_int (alter + $2));
+                                        scm_sum (alter, $2));
                } else {
                        m->set_property ("alteration", scm_from_int (0));
                }