]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.5.34
authorfred <fred>
Wed, 27 Mar 2002 02:05:52 +0000 (02:05 +0000)
committerfred <fred>
Wed, 27 Mar 2002 02:05:52 +0000 (02:05 +0000)
lily/my-lily-lexer.cc
lily/parser.yy
lily/translator-group.cc

index 658b052771340f1f1915d4505c375a7c0cdcaadb..767ebf54a2b9a34514609ccf297fe922b4e18bd1 100644 (file)
@@ -69,6 +69,7 @@ static Keyword_ent the_key_tab[]={
   {"outputproperty", OUTPUTPROPERTY},
   {"override", OVERRIDE},
   {"set", SET},
+  {"rest", REST},
   {"revert", REVERT},
   {"partial", PARTIAL},
   {"paper", PAPER},
index 4f3942169454d53111fd74a13ebe0de890c7b797..88e09abb57f0442ff10e6519ed17ef5b407701a6 100644 (file)
@@ -239,13 +239,14 @@ yylex (YYSTYPE *s,  void * v_l)
 %token TYPE
 %token UNSET
 %token CONTEXT
+%token REST
 
 /* escaped */
 %token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE E_TILDE
 %token E_BACKSLASH
 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET 
 
-%type <i>      exclamations questions dots
+%type <i>      exclamations questions dots optional_rest
 %type <i>      bass_number bass_mod
 %type <scm>    bass_figure figure_list figure_spec
 %token <i>     DIGIT
@@ -1034,7 +1035,7 @@ property_def:
                Music *t = new Music (SCM_EOL);
                t->set_mus_property ("iterator-ctor",
                        Push_property_iterator::constructor_cxx_function);
-               t->set_mus_property ("symbols", scm_string_to_symbol ($4));
+               t->set_mus_property ("symbol", scm_string_to_symbol ($4));
                t->set_mus_property ("pop-first", SCM_BOOL_T);
                t->set_mus_property ("grob-property", $6);
                t->set_mus_property ("grob-value", $8);
@@ -1050,7 +1051,7 @@ property_def:
                Music *t = new Music (SCM_EOL);
                t->set_mus_property ("iterator-ctor",
                        Push_property_iterator::constructor_cxx_function);
-               t->set_mus_property ("symbols", scm_string_to_symbol ($4));
+               t->set_mus_property ("symbol", scm_string_to_symbol ($4));
                t->set_mus_property ("grob-property", $6);
                t->set_mus_property ("grob-value", $8);
                Context_specced_music *csm = new Context_specced_music (SCM_EOL);
@@ -1066,7 +1067,7 @@ property_def:
                Music *t = new Music (SCM_EOL);
                t->set_mus_property ("iterator-ctor",
                        Pop_property_iterator::constructor_cxx_function);
-               t->set_mus_property ("symbols", scm_string_to_symbol ($4));
+               t->set_mus_property ("symbol", scm_string_to_symbol ($4));
                t->set_mus_property ("grob-property", $6);
 
                Context_specced_music *csm = new Context_specced_music (SCM_EOL);
@@ -1750,18 +1751,29 @@ figure_spec:
        }
        ;
 
+
+optional_rest:
+       /**/   { $$ = 0; }
+       | REST { $$ = 1; }
+       ;
+
 simple_element:
-       pitch exclamations questions optional_notemode_duration {
+       pitch exclamations questions optional_notemode_duration optional_rest {
 
                Input i = THIS->pop_spot ();
                if (!THIS->lexer_p_->note_state_b ())
                        THIS->parser_error (_ ("Have to be in Note mode for notes"));
 
-               Note_req *n = new Note_req;
+               Music *n = 0;
+               if ($5)
+                       n =  new Rest_req ;
+               else
+                       n =  new Note_req;
                
                n->set_mus_property ("pitch", $1);
                n->set_mus_property ("duration", $4);
 
+
                if ($3 % 2)
                        n->set_mus_property ("cautionary", SCM_BOOL_T);
                if ($2 % 2 || $3 % 2)
@@ -1769,7 +1781,7 @@ simple_element:
 
                Simultaneous_music*v = new Request_chord (SCM_EOL);
                v->set_mus_property ("elements", scm_list_n (n->self_scm (), SCM_UNDEFINED));
-               
+
                v->set_spot (i);
                n->set_spot (i);
                $$ = v;
index 90e0c70acc19cb00f23d4bf8e02655ddcb1a91c0..48384af09fef845392f862794aabd20f2c155487 100644 (file)
@@ -13,6 +13,7 @@
 #include "moment.hh"
 #include "scm-hash.hh"
 #include "translator-def.hh"
+#include "main.hh"
 
 Translator_group::Translator_group (Translator_group const&s)
   : Translator (s)
@@ -300,10 +301,14 @@ Translator_group::internal_get_property (SCM sym) const
   return val;
 }
 
-
 void
 Translator_group::internal_set_property (SCM sym, SCM val)
 {
+#ifndef NDEBUG
+  if (internal_type_checking_global_b)
+    assert (type_check_assignment (sym, val, ly_symbol2scm ("backend-type?")));
+#endif
+  
   properties_dict ()->set (sym, val);
 }
 
@@ -332,7 +337,7 @@ Translator_group::execute_single_pushpop_property (SCM prop, SCM eltprop, SCM va
 
          if (gh_pair_p (prev) || prev == SCM_EOL)
            {
-             bool ok = type_check_assignment (val, eltprop, ly_symbol2scm ("backend-type?"));
+             bool ok = type_check_assignment (eltprop, val, ly_symbol2scm ("backend-type?"));
              
              if (ok)
                {
@@ -442,3 +447,4 @@ add_trans_scm_funcs ()
 }
 
 ADD_SCM_INIT_FUNC (trans_scm, add_trans_scm_funcs);
+