]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/parser.yy
Merge branch 'lilypond/translation' of ssh://trettig@git.sv.gnu.org/srv/git/lilypond...
[lilypond.git] / lily / parser.yy
index 02f03dea92fd941e8a4646e24f94be083b360b72..59cbf58502275c853ff0f07e344f8e46d1dd635f 100644 (file)
@@ -182,6 +182,7 @@ void set_music_properties (Music *p, SCM a);
 %token LYRICSTO "\\lyricsto"
 %token MARK "\\mark"
 %token MARKUP "\\markup"
+%token MARKUPLINES "\\markuplines"
 %token MIDI "\\midi"
 %token NAME "\\name"
 %token NOTEMODE "\\notemode"
@@ -279,7 +280,13 @@ If we give names, Bison complains.
 %token <scm> MARKUP_HEAD_SCM0_MARKUP1
 %token <scm> MARKUP_HEAD_SCM0_SCM1
 %token <scm> MARKUP_HEAD_SCM0_SCM1_MARKUP2
+%token <scm> MARKUP_HEAD_SCM0_MARKUP1_MARKUP2
 %token <scm> MARKUP_HEAD_SCM0_SCM1_SCM2
+%token <scm> MARKUP_LIST_HEAD_EMPTY
+%token <scm> MARKUP_LIST_HEAD_LIST0
+%token <scm> MARKUP_LIST_HEAD_SCM0
+%token <scm> MARKUP_LIST_HEAD_SCM0_LIST1
+%token <scm> MARKUP_LIST_HEAD_SCM0_SCM1_LIST2
 %token <scm> MARKUP_IDENTIFIER
 %token <scm> MUSIC_FUNCTION
 %token <scm> MUSIC_IDENTIFIER
@@ -372,6 +379,7 @@ If we give names, Bison complains.
 %type <scm> figure_spec
 %type <scm> fraction
 %type <scm> full_markup
+%type <scm> full_markup_list
 %type <scm> function_scm_argument
 %type <scm> function_arglist
 %type <scm> function_arglist_music_last
@@ -386,6 +394,7 @@ If we give names, Bison complains.
 %type <scm> markup_braced_list
 %type <scm> markup_braced_list_body 
 %type <scm> markup_composed_list
+%type <scm> markup_command_list
 %type <scm> markup_head_1_item
 %type <scm> markup_head_1_list
 %type <scm> markup_list
@@ -410,6 +419,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 property_path_revved
 %type <scm> scalar
 %type <scm> script_abbreviation
 %type <scm> simple_chord_elements
@@ -476,6 +486,10 @@ toplevel_expression:
                scm_call_2 (proc, PARSER->self_scm (), music->self_scm ());
        }
        | full_markup {
+               SCM proc = PARSER->lexer_->lookup_identifier ("toplevel-text-handler");
+               scm_call_2 (proc, PARSER->self_scm (), scm_list_1 ($1));
+       }
+       | full_markup_list {
                SCM proc = PARSER->lexer_->lookup_identifier ("toplevel-text-handler");
                scm_call_2 (proc, PARSER->self_scm (), $1);
        }
@@ -650,12 +664,23 @@ book_body:
                $2->unprotect ();
        }
        | book_body score_block {
-               SCM s = $2->self_scm ();
-               $$->add_score (s);
-               $2->unprotect();
+               Score *score = $2;
+               SCM proc = PARSER->lexer_->lookup_identifier ("book-score-handler");
+               scm_call_2 (proc, $$->self_scm (), score->self_scm ());
+               score->unprotect ();
+       }
+       | book_body composite_music {
+               Music *music = unsmob_music ($2);
+               SCM proc = PARSER->lexer_->lookup_identifier ("book-music-handler");
+               scm_call_3 (proc, PARSER->self_scm (), $$->self_scm (), music->self_scm ());
        }
        | book_body full_markup {
-               $$->add_score ($2);
+               SCM proc = PARSER->lexer_->lookup_identifier ("book-text-handler");
+               scm_call_2 (proc, $$->self_scm (), scm_list_1 ($2));
+       }
+       | book_body full_markup_list {
+               SCM proc = PARSER->lexer_->lookup_identifier ("book-text-handler");
+               scm_call_2 (proc, $$->self_scm (), $2);
        }
        | book_body lilypond_header {
                $$->header_ = $2;
@@ -695,7 +720,7 @@ score_body:
                $$->user_key_ = ly_scm2string ($2);
        }
        | score_body lilypond_header    {
-               $$->header_ = $2;
+               $$->set_header ($2);
        }
        | score_body output_def {
                if ($2->lookup_variable (ly_symbol2scm ("is-paper")) == SCM_BOOL_T)
@@ -795,8 +820,20 @@ output_def_body:
 
 tempo_event:
        TEMPO steno_duration '=' bare_unsigned  {
-               $$ = MAKE_SYNTAX ("tempo", @$, $2, scm_int2num ($4));
-       }                               
+               $$ = MAKE_SYNTAX ("tempo", @$, SCM_BOOL_F, $2, scm_int2num ($4));
+       }
+       | TEMPO string steno_duration '=' bare_unsigned {
+               $$ = MAKE_SYNTAX ("tempo", @$, make_simple_markup($2), $3, scm_int2num ($5));
+       }
+       | TEMPO full_markup steno_duration '=' bare_unsigned    {
+               $$ = MAKE_SYNTAX ("tempo", @$, $2, $3, scm_int2num ($5));
+       }
+       | TEMPO string {
+               $$ = MAKE_SYNTAX ("tempoText", @$, make_simple_markup($2) );
+       }
+       | TEMPO full_markup {
+               $$ = MAKE_SYNTAX ("tempoText", @$, $2 );
+       }
        ;
 
 /*
@@ -1122,6 +1159,22 @@ context_change:
        }
        ;
 
+
+property_path_revved:
+       embedded_scm {
+               $$ = scm_cons ($1, SCM_EOL);
+       }
+       | property_path_revved embedded_scm {
+               $$ = scm_cons ($2, $1);
+       }
+       ;
+
+property_path:
+       property_path_revved  {
+               $$ = scm_reverse_x ($1, SCM_EOL);
+       } 
+       ;
+
 property_operation:
        STRING '=' scalar {
                $$ = scm_list_3 (ly_symbol2scm ("assign"),
@@ -1131,13 +1184,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 +1233,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),
@@ -1874,6 +1919,10 @@ bass_figure:
                        {
                        m->set_property ("no-continuation", SCM_BOOL_T);
                        }
+               else if ($2 == ly_symbol2scm ("backslash"))
+                       {
+                       m->set_property ("augmented-slash", SCM_BOOL_T);
+                       }
        }
        ;
 
@@ -1888,6 +1937,9 @@ figured_bass_modification:
        | '/'           {
                $$ = ly_symbol2scm ("slash");
        }
+       | E_BACKSLASH {
+               $$ = ly_symbol2scm ("backslash");
+       }
        ;
 
 br_bass_figure:
@@ -2169,6 +2221,15 @@ lyric_markup:
        }
        ;
 
+full_markup_list:
+       MARKUPLINES
+               { PARSER->lexer_->push_markup_state (); }
+       markup_list {
+               $$ = $3;
+               PARSER->lexer_->pop_state ();
+       }
+       ;
+
 full_markup:
        MARKUP_IDENTIFIER {
                $$ = $1;
@@ -2200,6 +2261,9 @@ markup_list:
        | markup_braced_list {
                $$ = $1;
        }
+       | markup_command_list {
+               $$ = scm_list_1 ($1);
+       }
        ;
 
 markup_composed_list:
@@ -2225,6 +2289,24 @@ markup_braced_list_body:
        }
        ;
 
+markup_command_list:
+       MARKUP_LIST_HEAD_EMPTY  {
+               $$ = scm_list_1 ($1);
+       }
+       | MARKUP_LIST_HEAD_LIST0 markup_list    {
+               $$ = scm_list_2 ($1, $2);
+       }
+       | MARKUP_LIST_HEAD_SCM0 embedded_scm    {
+               $$ = scm_list_2 ($1, $2);
+       }
+       | MARKUP_LIST_HEAD_SCM0_LIST1 embedded_scm markup_list  {
+               $$ = scm_list_3 ($1, $2, $3);
+       }
+       | MARKUP_LIST_HEAD_SCM0_SCM1_LIST2 embedded_scm embedded_scm markup_list        {
+               $$ = scm_list_4 ($1, $2, $3, $4);
+       }
+       ;
+
 markup_head_1_item:
        MARKUP_HEAD_MARKUP0     {
                $$ = scm_list_1 ($1);
@@ -2277,6 +2359,9 @@ simple_markup:
        | MARKUP_HEAD_SCM0_SCM1 embedded_scm embedded_scm {
                $$ = scm_list_3 ($1, $2, $3);
        }
+       | MARKUP_HEAD_SCM0_MARKUP1_MARKUP2 embedded_scm markup markup {
+               $$ = scm_list_4 ($1, $2, $3, $4);
+       }
        | MARKUP_HEAD_EMPTY {
                $$ = scm_list_1 ($1);
        }