]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/parser.yy
input/regression/bookparts.ly fails at PDF conversion stage
[lilypond.git] / lily / parser.yy
index 9da363df933d208053348e40223a98e6ea359a6e..a166aee8e538f87b5ac002ffec5f6b95e72f9cc2 100644 (file)
@@ -116,7 +116,6 @@ FIXME:
 #include <cctype>
 #include <cstdlib>
 #include <cstdio>
-using namespace std;
 
 #include "book.hh"
 #include "context-def.hh"
@@ -141,7 +140,7 @@ using namespace std;
 #include "lily-imports.hh"
 
 void
-Lily_parser::parser_error (Input const *i, Lily_parser *parser, SCM *, const string &s)
+Lily_parser::parser_error (Input const *i, Lily_parser *parser, SCM *, const std::string &s)
 {
        parser->parser_error (*i, s);
 }
@@ -223,6 +222,7 @@ SCM get_next_unique_lyrics_context_id ();
 #define _(x) gettext (x)
 #endif
 
+using std::string;
 
 static Music *make_music_with_input (SCM name, Input where);
 SCM check_scheme_arg (Lily_parser *parser, Input loc,
@@ -699,8 +699,7 @@ identifier_init_nonumber:
        | partial_function ETC
        {
                $$ = MAKE_SYNTAX (partial_music_function, @$,
-                                 scm_reverse_x (scm_car ($1), SCM_EOL),
-                                 scm_reverse_x (scm_cdr ($1), SCM_EOL));
+                                 scm_reverse_x ($1, SCM_EOL));
        }
        ;
 
@@ -708,45 +707,79 @@ identifier_init_nonumber:
 partial_function:
        MUSIC_FUNCTION function_arglist_partial
        {
-               $$ = scm_cons (scm_list_1 ($1), scm_list_1 ($2));
+               $$ = scm_acons ($1, $2, SCM_EOL);
        }
        | EVENT_FUNCTION function_arglist_partial
        {
-               $$ = scm_cons (scm_list_1 ($1), scm_list_1 ($2));
+               $$ = scm_acons ($1, $2, SCM_EOL);
        }
        | SCM_FUNCTION function_arglist_partial
        {
-               $$ = scm_cons (scm_list_1 ($1), scm_list_1 ($2));
+               $$ = scm_acons ($1, $2, SCM_EOL);
+       }
+       | OVERRIDE grob_prop_path '='
+       {
+               if (SCM_UNBNDP ($2))
+                       $$ = scm_list_1 (SCM_BOOL_F);
+               else
+                       $$ = scm_cons
+                               (scm_list_3 (Syntax::property_override_function,
+                                            scm_cdr ($2), scm_car ($2)),
+                                SCM_EOL);
+       }
+       | SET context_prop_spec '='
+       {
+               if (SCM_UNBNDP ($2))
+                       $$ = scm_list_1 (SCM_BOOL_F);
+               else
+                       $$ = scm_cons
+                               (scm_list_3 (Syntax::property_set_function,
+                                            scm_cadr ($2), scm_car ($2)),
+                                SCM_EOL);
        }
        | MUSIC_FUNCTION EXPECT_SCM function_arglist_optional partial_function
        {
-               $$ = scm_cons (scm_cons ($1, scm_car ($4)),
-                              scm_cons ($3, scm_cdr ($4)));
+               $$ = scm_acons ($1, $3, $4);
        }
        | EVENT_FUNCTION EXPECT_SCM function_arglist_optional partial_function
        {
-               $$ = scm_cons (scm_cons ($1, scm_car ($4)),
-                              scm_cons ($3, scm_cdr ($4)));
+               $$ = scm_acons ($1, $3, $4);
        }
        | SCM_FUNCTION EXPECT_SCM function_arglist_optional partial_function
        {
-               $$ = scm_cons (scm_cons ($1, scm_car ($4)),
-                              scm_cons ($3, scm_cdr ($4)));
+               $$ = scm_acons ($1, $3, $4);
+       }
+       | OVERRIDE grob_prop_path '=' partial_function
+       {
+               if (SCM_UNBNDP ($2))
+                       $$ = scm_list_1 (SCM_BOOL_F);
+               else
+                       $$ = scm_cons
+                               (scm_list_3 (Syntax::property_override_function,
+                                            scm_cdr ($2), scm_car ($2)),
+                                $4);
+       }
+       | SET context_prop_spec '=' partial_function
+       {
+               if (SCM_UNBNDP ($2))
+                       $$ = scm_list_1 (SCM_BOOL_F);
+               else
+                       $$ = scm_cons
+                               (scm_list_3 (Syntax::property_set_function,
+                                            scm_cadr ($2), scm_car ($2)),
+                                $4);
        }
        | MUSIC_FUNCTION EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup partial_function
        {
-               $$ = scm_cons (scm_cons ($1, scm_car ($5)),
-                              scm_cons ($4, scm_cdr ($5)));
+               $$ = scm_acons ($1, $4, $5);
        }
        | EVENT_FUNCTION EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup partial_function
        {
-               $$ = scm_cons (scm_cons ($1, scm_car ($5)),
-                              scm_cons ($4, scm_cdr ($5)));
+               $$ = scm_acons ($1, $4, $5);
        }
        | SCM_FUNCTION EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup partial_function
        {
-               $$ = scm_cons (scm_cons ($1, scm_car ($5)),
-                              scm_cons ($4, scm_cdr ($5)));
+               $$ = scm_acons ($1, $4, $5);
        }
        ;
 
@@ -1490,11 +1523,19 @@ context_prefix:
        ;
 
 new_lyrics:
-       ADDLYRICS lyric_mode_music {
-               $$ = scm_list_1 ($2);
+       ADDLYRICS optional_context_mod lyric_mode_music {
+               Context_mod *ctxmod = unsmob<Context_mod> ($2);
+               SCM mods = SCM_EOL;
+               if (ctxmod)
+                       mods = ctxmod->get_mods ();
+               $$ = scm_acons ($3, mods, SCM_EOL);
        }
-       | new_lyrics ADDLYRICS lyric_mode_music {
-               $$ = scm_cons ($3, $1);
+       | new_lyrics ADDLYRICS optional_context_mod lyric_mode_music {
+               Context_mod *ctxmod = unsmob<Context_mod> ($3);
+               SCM mods = SCM_EOL;
+               if (ctxmod)
+                       mods = ctxmod->get_mods ();
+               $$ = scm_acons ($4, mods, $1);
        }
        ;
 
@@ -2646,29 +2687,21 @@ music_property_def:
        OVERRIDE grob_prop_path '=' scalar {
                if (SCM_UNBNDP ($2))
                        $$ = MAKE_SYNTAX (void_music, @$);
-               else {
-                       $$ = MAKE_SYNTAX (property_operation, @$,
+               else
+                       $$ = MAKE_SYNTAX (property_override, @$,
                                          scm_car ($2),
-                                         ly_symbol2scm ("OverrideProperty"),
-                                         scm_cadr ($2),
-                                         $4,
-                                         scm_cddr ($2));
-               }
+                                         scm_cdr ($2),
+                                         $4);
        }
        | REVERT simple_revert_context revert_arg {
-               $$ = MAKE_SYNTAX (property_operation, @$,
-                                 $2,
-                                 ly_symbol2scm ("RevertProperty"),
-                                 scm_car ($3),
-                                 scm_cdr ($3));
+               $$ = MAKE_SYNTAX (property_revert, @$, $2, $3);
        }
        | SET context_prop_spec '=' scalar {
                if (SCM_UNBNDP ($2))
                        $$ = MAKE_SYNTAX (void_music, @$);
                else
-                       $$ = MAKE_SYNTAX (property_operation, @$,
+                       $$ = MAKE_SYNTAX (property_set, @$,
                                          scm_car ($2),
-                                         ly_symbol2scm ("PropertySet"),
                                          scm_cadr ($2),
                                          $4);
        }
@@ -2676,9 +2709,8 @@ music_property_def:
                if (SCM_UNBNDP ($2))
                        $$ = MAKE_SYNTAX (void_music, @$);
                else
-                       $$ = MAKE_SYNTAX (property_operation, @$,
+                       $$ = MAKE_SYNTAX (property_unset, @$,
                                          scm_car ($2),
-                                         ly_symbol2scm ("PropertyUnset"),
                                          scm_cadr ($2));
        }
        ;
@@ -4063,14 +4095,12 @@ make_duration (SCM d, int dots)
 SCM
 make_chord_step (SCM step_scm, Rational alter)
 {
-        int step = scm_to_int (step_scm);
+       Pitch m (0, scm_to_int (step_scm) - 1, alter);
 
-       if (step == 7)
-               alter += FLAT_ALTERATION;
+       // Notename/octave are normalized
+       if (m.get_notename () == 6)
+               m = m.transposed (Pitch (0, 0, FLAT_ALTERATION));
 
-       while (step < 0)
-               step += 7;
-       Pitch m ((step -1) / 7, (step - 1) % 7, alter);
        return m.smobbed_copy ();
 }