From 8b8b92e31703bf4a23683efff479793227ad39c1 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Mon, 2 Oct 2000 22:45:38 +0200 Subject: [PATCH] patch::: 1.3.92.jcn1 1.3.92.jcn2 =========== * Added some error messages for toplevel and stray string parse errors. * Don't start more than one slur at a time. * Set direction of Slur too in a2-engraver. --- CHANGES | 9 +++++++++ VERSION | 2 +- input/test/parse.ly | 3 +++ input/test/parse2.ly | 7 +++++++ input/test/parse3.ly | 7 +++++++ input/test/parse4.ly | 10 +++++++++ lily/a2-engraver.cc | 13 +++++++----- lily/my-lily-parser.cc | 2 +- lily/parser.yy | 38 ++++++++++++++++++++++++++++------- lily/slur-engraver.cc | 26 ++++++++++++++++++++++-- mutopia/Coriolan/fagotto-2.ly | 2 ++ 11 files changed, 103 insertions(+), 16 deletions(-) create mode 100644 input/test/parse.ly create mode 100644 input/test/parse2.ly create mode 100644 input/test/parse3.ly create mode 100644 input/test/parse4.ly diff --git a/CHANGES b/CHANGES index 5282a4ded3..06efe0291b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,12 @@ +1.3.92.jcn2 +=========== + +* Added some error messages for toplevel and stray string parse errors. + +* Don't start more than one slur at a time. + +* Set direction of Slur too in a2-engraver. + 1.3.91.uu1 ========== diff --git a/VERSION b/VERSION index 82c759db9c..9e33a40e75 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=92 -MY_PATCH_LEVEL= +MY_PATCH_LEVEL=jcn1 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/input/test/parse.ly b/input/test/parse.ly new file mode 100644 index 0000000000..fda93852c6 --- /dev/null +++ b/input/test/parse.ly @@ -0,0 +1,3 @@ +% Test parser error + +\score{ diff --git a/input/test/parse2.ly b/input/test/parse2.ly new file mode 100644 index 0000000000..41ef087e29 --- /dev/null +++ b/input/test/parse2.ly @@ -0,0 +1,7 @@ +% Test parser error + +foo = \notes{ + + +\score{ +} diff --git a/input/test/parse3.ly b/input/test/parse3.ly new file mode 100644 index 0000000000..3b401890be --- /dev/null +++ b/input/test/parse3.ly @@ -0,0 +1,7 @@ +% Test parser error + +foo = \notes{ + + +\score{ + diff --git a/input/test/parse4.ly b/input/test/parse4.ly new file mode 100644 index 0000000000..1194381dcb --- /dev/null +++ b/input/test/parse4.ly @@ -0,0 +1,10 @@ +% Test parser error + +foo = \notes{ +} + + +\score{ + burp +} + diff --git a/lily/a2-engraver.cc b/lily/a2-engraver.cc index 18d5bbb54b..88d86648c6 100644 --- a/lily/a2-engraver.cc +++ b/lily/a2-engraver.cc @@ -10,6 +10,7 @@ #include "item.hh" #include "note-head.hh" #include "stem.hh" +#include "slur.hh" #include "translator-group.hh" #include "side-position-interface.hh" #include "directional-element-interface.hh" @@ -126,10 +127,12 @@ A2_engraver::acknowledge_element (Score_element_info i) else if (unirhythm) state_ = UNIRHYTHM; - if (Stem::has_interface (i.elem_l_)) + if (Stem::has_interface (i.elem_l_) + || Slur::has_interface (i.elem_l_) + // || Text_item::has_interface (i.elem_l_) + //|| Crescendo::has_interface (i.elem_l_) + ) { - Item *stem_l = dynamic_cast (i.elem_l_); - /* Hmm. We must set dir when solo, in order to get the rests collided to the right position @@ -141,11 +144,11 @@ A2_engraver::acknowledge_element (Score_element_info i) { if (daddy_trans_l_->id_str_ == "one") { - stem_l->set_elt_property ("direction", gh_int2scm (1)); + i.elem_l_->set_elt_property ("direction", gh_int2scm (1)); } else if (daddy_trans_l_->id_str_ == "two") { - stem_l->set_elt_property ("direction", gh_int2scm (-1)); + i.elem_l_->set_elt_property ("direction", gh_int2scm (-1)); } } } diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc index faf2a68b86..7fe85f3dab 100644 --- a/lily/my-lily-parser.cc +++ b/lily/my-lily-parser.cc @@ -52,7 +52,7 @@ My_lily_parser::parse_file (String init, String s) if (!define_spot_array_.empty()) { - warning (_ ("Braces don't match")); + define_spot_array_.top ().warning (_ ("Braces don't match")); error_level_i_ = 1; } diff --git a/lily/parser.yy b/lily/parser.yy index 13fd818479..e02e0047eb 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -269,9 +269,13 @@ yylex (YYSTYPE *s, void * v_l) mudela: /* empty */ | mudela toplevel_expression {} | mudela assignment { } - | mudela error + | mudela error { + THIS->error_level_i_ = 1; + //THIS->parser_error (_ ("ly invalid")); + } | mudela INVALID { - THIS->error_level_i_ =1; + THIS->error_level_i_ = 1; + //THIS->parser_error (_ ("ly invalid")); } ; @@ -474,8 +478,10 @@ translator_spec_body: */ score_block: SCORE { + THIS->remember_spot (); } /*cont*/ '{' score_body '}' { + THIS->pop_spot (); $$ = $4; if (!$$->def_p_arr_.size ()) { @@ -484,6 +490,15 @@ score_block: $$->add_output (id ? id->access_content_Music_output_def (true) : new Paper_def ); } } +/* + | SCORE '{' score_body error { + $$ = $3 + $$->set_spot (THIS->here_input ()); + // THIS->here_input ().error ("SCORE INVALID"); + $$->error ("SCORE INVALID"); + THIS->parser_error (_f ("SCORE ERROR")); + } +*/ ; score_body: @@ -1378,16 +1393,25 @@ simple_element: $$ = new Sequential_music (ms); } - | STRING optional_notemode_duration { - if (!THIS->lexer_p_->lyric_state_b ()) - THIS->parser_error (_ ("Have to be in Lyric mode for lyrics")); + | STRING { + THIS->remember_spot (); + } + /* cont */ + optional_notemode_duration { + if (!THIS->lexer_p_->lyric_state_b ()) { + THIS->pop_spot ().error (_ ("Have to be in Lyric mode for lyrics")); + THIS->error_level_i_ = 1; + THIS->parser_error (_ ("Giving up")); + } + else + THIS->pop_spot (); Lyric_req* lreq_p = new Lyric_req; lreq_p ->text_str_ = ly_scm2string ($1); - lreq_p->duration_ = *$2; + lreq_p->duration_ = *$3; lreq_p->set_spot (THIS->here_input()); Simultaneous_music* velt_p = new Request_chord (gh_list (lreq_p->self_scm (), SCM_UNDEFINED)); - delete $2; // ugh + delete $3; // ugh $$= velt_p; } diff --git a/lily/slur-engraver.cc b/lily/slur-engraver.cc index 8fe4f5de85..b993e907f3 100644 --- a/lily/slur-engraver.cc +++ b/lily/slur-engraver.cc @@ -19,6 +19,7 @@ class Slur_engraver : public Engraver Link_array new_slur_req_l_arr_; Link_array slur_l_stack_; Link_array end_slur_l_arr_; + Moment last_start_; void set_melisma (bool); @@ -32,8 +33,14 @@ protected: public: VIRTUAL_COPY_CONS (Translator); + Slur_engraver (); }; +Slur_engraver::Slur_engraver () +{ + last_start_ = Moment (-1); +} + bool Slur_engraver::do_try_music (Music *req_l) { @@ -56,8 +63,23 @@ Slur_engraver::do_try_music (Music *req_l) } else if (sl->span_type_str_ == "slur") { - new_slur_req_l_arr_.push (sl); - return true; + /* + Let's not start more than one slur per moment. + */ + if (sl->span_dir_ == START) + { + if (now_mom () > last_start_) + { + new_slur_req_l_arr_.push (sl); + last_start_ = now_mom (); + return true; + } + } + else + { + new_slur_req_l_arr_.push (sl); + return true; + } } } return false; diff --git a/mutopia/Coriolan/fagotto-2.ly b/mutopia/Coriolan/fagotto-2.ly index c7c5f77070..4156cd812c 100644 --- a/mutopia/Coriolan/fagotto-2.ly +++ b/mutopia/Coriolan/fagotto-2.ly @@ -212,6 +212,8 @@ fagottoII = \notes \relative c { \!f'2\ff e| dis b~| b1\p| + \property VoiceCombineVoice.crescendoText = "cresc." + \property VoiceCombineVoice.crescendoSpanner = "dashed-line" a\<| g| f| -- 2.39.5