X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fparser.yy;h=640eb3881977c50694e3b3f2444c71e9e276c68c;hb=fd58a98a46a3def26b80a895f1f7b81c92590fc3;hp=88a815741b5afba58bcfe920b5070e320ddc89d0;hpb=06c2fe5b578c26a83ad7dcaa9371ee7f0d0ba05d;p=lilypond.git diff --git a/lily/parser.yy b/lily/parser.yy index 88a815741b..640eb38819 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -53,7 +53,6 @@ TODO: */ #include -#include #include #include @@ -83,7 +82,6 @@ TODO: #include "text-item.hh" #include "music-list.hh" - #define MY_MAKE_MUSIC(x) make_music_by_name (ly_symbol2scm (x)) @@ -163,10 +161,11 @@ SCM make_chord_step (int step, int alter) { if (step == 7) - alter--; + alter += FLAT; - /* ugh: fucks up above 13 */ - Pitch m(step > 7 ? 1 : 0,(step - 1) % 7, alter); + while(step < 0) + step += 7; + Pitch m((step -1) / 7 , (step - 1) % 7, alter); return m.smobbed_copy (); } @@ -428,7 +427,36 @@ toplevel_expression: THIS->input_file_->header_ = $1; } | score_block { - THIS->input_file_->scores_.push ($1); + Score * sc = $1; + + SCM head = ly_module_p (sc->header_) ? sc->header_ : THIS->input_file_->header_.to_SCM (); + + Path p = split_path (THIS->output_basename_); + int *c = &THIS->input_file_->score_count_; + if (*c) + { + p.base += "-" + to_string (*c); + } + + (*c)++; + SCM outname = scm_makfrom0str (p.to_string ().to_str0()); + + for (int i=0; i < sc->defs_.size (); i++) + default_rendering (sc->music_, sc->defs_[i]->self_scm(),head, outname); + + if (sc->defs_.empty ()) + { + Music_output_def *id = + unsmob_music_output_def (THIS->lexer_->lookup_identifier + ("$defaultpaper")); + + id = id ? id->clone () : new Paper_def; + + default_rendering (sc->music_, id->self_scm(), head, outname); + + scm_gc_unprotect_object (id->self_scm ()); + } + scm_gc_unprotect_object (sc->self_scm()); } | output_def { if (dynamic_cast ($1)) @@ -558,15 +586,16 @@ translator_spec_block: ; translator_spec_body: - TRANSLATOR_IDENTIFIER { + /**/ { + $$ = Translator_def::make_scm (); + unsmob_translator_def ($$)->set_spot (THIS->here_input ()); + } + | TRANSLATOR_IDENTIFIER { $$ = $1; unsmob_translator_def ($$)-> set_spot (THIS->here_input ()); } - | TYPE STRING { - $$ = Translator_def::make_scm (); - Translator_def*td = unsmob_translator_def ($$); - td->translator_group_type_ = $2; - td->set_spot (THIS->here_input ()); + | translator_spec_body TYPE STRING { + unsmob_translator_def ($$)->translator_group_type_ = $3; } | translator_spec_body DESCRIPTION string { unsmob_translator_def ($$)->description_ = $3; @@ -626,12 +655,7 @@ score_block: /*cont*/ '{' score_body '}' { THIS->pop_spot (); $$ = $4; - if (!$$->defs_.size ()) - { - Music_output_def *id = - unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper")); - $$->add_output (id ? id->clone () : new Paper_def ); - } + } ; @@ -660,7 +684,7 @@ score_body: $$->header_ = $2; } | score_body output_def { - $$->add_output ($2); + $$->defs_.push ($2); } | score_body error { @@ -2150,10 +2174,10 @@ step_number: $$ = make_chord_step ($1, 0); } | bare_unsigned '+' { - $$ = make_chord_step ($1, 1); + $$ = make_chord_step ($1, SHARP); } | bare_unsigned CHORD_MINUS { - $$ = make_chord_step ($1,-1); + $$ = make_chord_step ($1, FLAT); } ;