]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/parser.yy
release commit
[lilypond.git] / lily / parser.yy
index 15b37c198892b0bad666200612c9250280916a69..9f0096c2f53c30ac82e661dfa4e007ccb494de1b 100644 (file)
@@ -283,7 +283,6 @@ yylex (YYSTYPE *s,  void * v)
 %token PAPER
 %token PARTCOMBINE
 %token PARTIAL
-%token PROPERTY
 %token RELATIVE
 %token REMOVE
 %token REPEAT
@@ -381,13 +380,13 @@ yylex (YYSTYPE *s,  void * v)
 %type <scm>  embedded_scm scalar
 %type <music>  Music Sequential_music Simultaneous_music 
 %type <music>  relative_music re_rhythmed_music 
-%type <music>  music_property_def context_change 
-%type <scm> Music_list
+%type <music>  music_property_def context_change
+%type <scm> context_prop_spec 
+%type <scm> Music_list 
 %type <scm> property_operation context_mod translator_mod optional_context_mod
 %type <outputdef>  music_output_def_body music_output_def_head
-%type <music> shorthand_command_req
 %type <music>  post_event tagged_post_event
-%type <music> command_req verbose_command_req
+%type <music> command_req 
 %type <music> string_number_event
 %type <scm>    string bare_number number_expression number_term number_factor 
 %type <score>  score_block score_body
@@ -578,8 +577,10 @@ translator_spec_body:
 
                for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p)) {
                        SCM tag = gh_caar (p);
+
+                       /* TODO: should make new tag "grob-definition" ? */
                        td->add_context_mod (scm_list_n (ly_symbol2scm ("assign"),
-                                                       tag, ly_cdar (p), SCM_UNDEFINED));
+                                                       tag, gh_cons (ly_cdar (p), SCM_EOL), SCM_UNDEFINED));
                }
        }
        | translator_spec_body context_mod {
@@ -678,6 +679,7 @@ music_output_def_body:
                
        }
        | music_output_def_head '{' MUSIC_OUTPUT_DEF_IDENTIFIER         {
+               scm_gc_unprotect_object ($1->self_scm ());
                Music_output_def * o =  unsmob_music_output_def ($3);
                $$ = o;
                THIS->lexer_->remove_scope ();
@@ -945,7 +947,6 @@ basic music objects too, since the meaning is different.
                        scm_gc_unprotect_object (startm->self_scm ());
                }
 
-       
                Music* seq = MY_MAKE_MUSIC("SequentialMusic");
                seq->set_mus_property ("elements", ms);
 
@@ -1128,21 +1129,17 @@ property_operation:
                $$ = scm_list_n (ly_symbol2scm ("assign"),
                        scm_string_to_symbol ($1), $3, SCM_UNDEFINED);
        }
-       | STRING UNSET {
+       | UNSET STRING {
                $$ = scm_list_n (ly_symbol2scm ("unset"),
-                       scm_string_to_symbol ($1), SCM_UNDEFINED);
+                       scm_string_to_symbol ($2), SCM_UNDEFINED);
        }
-       | STRING SET embedded_scm '=' embedded_scm {
-               $$ = scm_list_n (ly_symbol2scm ("poppush"),
-                       scm_string_to_symbol ($1), $3, $5, SCM_UNDEFINED);
-       }
-       | STRING OVERRIDE embedded_scm '=' embedded_scm {
+       | OVERRIDE STRING embedded_scm '=' embedded_scm {
                $$ = scm_list_n (ly_symbol2scm ("push"),
-                       scm_string_to_symbol ($1), $3, $5, SCM_UNDEFINED);
+                       scm_string_to_symbol ($2), $3, $5, SCM_UNDEFINED);
        }
-       | STRING REVERT embedded_scm {
+       | REVERT STRING embedded_scm {
                $$ = scm_list_n (ly_symbol2scm ("pop"),
-                       scm_string_to_symbol ($1), $3, SCM_UNDEFINED);
+                       scm_string_to_symbol ($2), $3, SCM_UNDEFINED);
        }
        ;
 
@@ -1167,27 +1164,54 @@ context_mod:
        }
        ;
 
-music_property_def:
-       PROPERTY STRING '.' property_operation {
-               Music * t = property_op_to_music ($4);
-               Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
-
-               csm->set_mus_property ("element", t->self_scm ());
-               scm_gc_unprotect_object (t->self_scm ());
-
-               $$ = csm;
-               $$->set_spot (THIS->here_input ());
+context_prop_spec:
+       STRING  {
+               $$ = scm_list_n (ly_symbol2scm ("Bottom"), scm_string_to_symbol ($1), SCM_UNDEFINED);
+       }
+       | STRING '.' STRING {
+               $$ = scm_list_n (scm_string_to_symbol ($1), scm_string_to_symbol ($3), SCM_UNDEFINED);
+       }
+       ;
 
-               csm-> set_mus_property ("context-type", scm_string_to_symbol ($2));
+music_property_def:
+       OVERRIDE context_prop_spec embedded_scm '=' scalar {
+               $$ = property_op_to_music (scm_list_n (
+                       ly_symbol2scm ("poppush"),
+                       gh_cadr ($2),
+                       $3, $5, SCM_UNDEFINED));
+               $$= context_spec_music (gh_car ($2), SCM_UNDEFINED, $$, SCM_EOL);
+       }
+       | REVERT context_prop_spec embedded_scm {
+               $$ = property_op_to_music (scm_list_n (
+                       ly_symbol2scm ("pop"),
+                       gh_cadr ($2),
+                       $3, SCM_UNDEFINED));
+
+               $$= context_spec_music (gh_car ($2), SCM_UNDEFINED, $$, SCM_EOL);
+       }
+       | SET context_prop_spec '=' scalar {
+               $$ = property_op_to_music (scm_list_n (
+                       ly_symbol2scm ("assign"),
+                       gh_cadr ($2),
+                       $4, SCM_UNDEFINED));
+               $$= context_spec_music (gh_car ($2), SCM_UNDEFINED, $$, SCM_EOL);
+       }
+       | UNSET context_prop_spec {
+               $$ = property_op_to_music (scm_list_n (
+                       ly_symbol2scm ("unset"),
+                       gh_cadr ($2)));
+               $$= context_spec_music (gh_car ($2), SCM_UNDEFINED, $$, SCM_EOL);
        }
        | ONCE music_property_def {
-               $$ = $2;
                SCM e = $2->get_mus_property ("element");
-               unsmob_music (e)->set_mus_property ("once", SCM_BOOL_T);
+                unsmob_music (e)->set_mus_property ("once", SCM_BOOL_T);
+               $$ = $2;
+        
        }
        ;
 
 
+
 scalar:
         string          { $$ = $1; }
         | bare_int      { $$ = gh_int2scm ($1); }
@@ -1317,6 +1341,12 @@ command_element:
                $$-> set_spot (THIS->here_input ());
                $1-> set_spot (THIS->here_input ());
        }
+       | SKIP duration_length {
+               Music * skip = MY_MAKE_MUSIC("SkipMusic");
+               skip->set_mus_property ("duration", $2);
+
+               $$ = skip;
+       }
        | OCTAVE { THIS->push_spot (); }
          pitch {
                Music *l = MY_MAKE_MUSIC("RelativeOctaveCheck");
@@ -1406,31 +1436,16 @@ command_element:
        ;
 
 command_req:
-       shorthand_command_req   { $$ = $1; }
-       | verbose_command_req   { $$ = $1; }
-       ;
-
-shorthand_command_req:
        BREATHE {
                $$ = MY_MAKE_MUSIC("BreathingSignEvent");
        }
        | E_TILDE {
                $$ = MY_MAKE_MUSIC("PesOrFlexaEvent");
        }
-       ;
-
-verbose_command_req:
-       MARK DEFAULT  {
+       | MARK DEFAULT  {
                Music * m = MY_MAKE_MUSIC("MarkEvent");
                $$ = m;
        }
-       
-       | SKIP duration_length {
-               Music * skip = MY_MAKE_MUSIC("SkipEvent");
-               skip->set_mus_property ("duration", $2);
-
-               $$ = skip;
-       }
        | tempo_event {
                $$ = $1;
        }
@@ -2456,7 +2471,8 @@ context_spec_music (SCM type, SCM id, Music * m, SCM ops)
        csm->set_mus_property ("element", m->self_scm ());
        scm_gc_unprotect_object (m->self_scm ());
 
-       csm->set_mus_property ("context-type", scm_string_to_symbol (type));
+       csm->set_mus_property ("context-type",
+               gh_symbol_p (type) ? type : scm_string_to_symbol (type));
        csm->set_mus_property ("property-operations", ops);
 
        if (gh_string_p (id))