1 %{ // -*-Fundamental-*-
4 parser.yy -- Bison/C++ parser for mudela
6 source file of the GNU LilyPond music typesetter
8 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 Jan Nieuwenhuizen <janneke@gnu.org>
13 #include "lily-guile.hh"
14 #include "translation-property.hh"
17 #include "my-lily-lexer.hh"
18 #include "paper-def.hh"
19 #include "midi-def.hh"
21 #include "file-path.hh"
23 #include "dimensions.hh"
24 #include "identifier.hh"
25 #include "command-request.hh"
26 #include "musical-request.hh"
27 #include "my-lily-parser.hh"
28 #include "context-specced-music.hh"
29 #include "translator-group.hh"
31 #include "music-list.hh"
32 #include "change-translator.hh"
33 #include "file-results.hh"
35 #include "relative-music.hh"
36 #include "lyric-combine-music.hh"
37 #include "transposed-music.hh"
38 #include "time-scaled-music.hh"
39 #include "repeated-music.hh"
40 #include "mudela-version.hh"
41 #include "grace-music.hh"
42 #include "auto-change-music.hh"
43 #include "output-property.hh"
46 Mudela_version oldest_version ("1.3.4");
51 return t == 1 << intlog2(t);
55 print_mudela_versions (ostream &os)
57 os << _f ("Oldest supported input version: %s", oldest_version.str ())
61 // needed for bison.simple's malloc() and free()
68 #define YYERROR_VERBOSE 1
70 #define YYPARSE_PARAM my_lily_parser_l
71 #define YYLEX_PARAM my_lily_parser_l
72 #define THIS ((My_lily_parser *) my_lily_parser_l)
74 #define yyerror THIS->parser_error
75 #define ARRAY_SIZE(a,s) if (a.size () != s) THIS->parser_error (_f ("Expecting %d arguments", s))
81 Array<Musical_pitch> *pitch_arr;
82 Link_array<Request> *reqvec;
88 Music_list *music_list;
93 Music_output_def * outputdef;
94 Musical_pitch * pitch;
101 /* We use SCMs to do strings, because it saves us the trouble of
102 deleting them. Let's hope that a stack overflow doesnt trigger a move
103 of the parse stack onto the heap. */
107 Translator_group* trans;
113 yylex (YYSTYPE *s, void * v_l)
115 My_lily_parser *pars_l = (My_lily_parser*) v_l;
116 My_lily_lexer * lex_l = pars_l->lexer_p_;
118 lex_l->lexval_l = (void*) s;
119 return lex_l->yylex ();
127 /* tokens which are not keywords */
134 %token CHORDMODIFIERS
177 %token COMMANDSPANREQUEST
179 %token OUTPUTPROPERTY
188 %token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER
189 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET
191 %type <i> exclamations questions
193 %token <pitch> NOTENAME_PITCH
194 %token <pitch> TONICNAME_PITCH
195 %token <pitch> CHORDMODIFIER_PITCH
196 %token <id> DURATION_IDENTIFIER
197 %token <id> IDENTIFIER
198 %token <id> MUSIC_IDENTIFIER
199 %token <id> REQUEST_IDENTIFIER
200 %token <id> REAL_IDENTIFIER
201 %token <id> STRING_IDENTIFIER
202 %token <id> TRANS_IDENTIFIER
203 %token <id> INT_IDENTIFIER
204 %token <id> SCORE_IDENTIFIER
205 %token <id> MIDI_IDENTIFIER
206 %token <id> PAPER_IDENTIFIER
208 %token <scm> DURATION RESTNAME
214 %type <outputdef> output_def
215 %type <scope> mudela_header mudela_header_body
216 %type <request> open_request_parens close_request_parens open_request close_request
217 %type <request> request_with_dir request_that_take_dir verbose_request
218 %type <i> sub_quotes sup_quotes
219 %type <music> simple_element request_chord command_element Simple_music Composite_music
220 %type <music> Alternative_music Repeated_music
221 %type <i> tremolo_type
222 %type <i> int unsigned
224 %type <i> optional_modality
225 %type <id> identifier_init
226 %type <duration> steno_duration optional_notemode_duration
227 %type <duration> entered_notemode_duration explicit_duration
228 %type <intvec> int_list
229 %type <reqvec> pre_requests post_requests
230 %type <request> gen_text_def
231 %type <pitch> steno_musical_pitch musical_pitch absolute_musical_pitch
232 %type <pitch> steno_tonic_pitch
234 %type <pitch_arr> pitch_list chord_additions chord_subtractions chord_notes chord_step
236 %type <pitch> chord_note chord_inversion chord_bass
237 %type <midi> midi_block midi_body
238 %type <duration> duration_length
240 %type <scm> embedded_scm scalar
241 %type <music> Music Sequential_music Simultaneous_music Music_sequence
242 %type <music> relative_music re_rhythmed_music
243 %type <music> property_def translator_change
244 %type <music_list> Music_list
245 %type <paper> paper_block paper_def_body
246 %type <real> real real_with_dimension
247 %type <request> shorthand_command_req
248 %type <request> post_request
249 %type <request> command_req verbose_command_req
250 %type <request> extender_req
251 %type <request> hyphen_req
253 %type <score> score_block score_body
255 %type <trans> translator_spec_block translator_spec_body
256 %type <tempo> tempo_request
257 %type <scm> notenames_body notenames_block chordmodifiers_block
258 %type <scm> script_abbreviation
269 | mudela toplevel_expression {}
270 | mudela assignment { }
273 THIS->error_level_i_ =1;
279 THIS->lexer_p_->pitchname_tab_ = $1;
281 | chordmodifiers_block {
282 THIS->lexer_p_->chordmodifier_tab_ = $1;
285 delete header_global_p;
286 header_global_p = $1;
289 score_global_array.push ($1);
292 Identifier * id = new
293 Paper_def_identifier ($1, PAPER_IDENTIFIER);
294 THIS->lexer_p_->set_identifier ("$defaultpaper", id)
297 Identifier * id = new
298 Midi_def_identifier ($1, MIDI_IDENTIFIER);
299 THIS->lexer_p_->set_identifier ("$defaultmidi", id)
311 chordmodifiers_block:
312 CHORDMODIFIERS notenames_body { $$ = $2; }
317 NOTENAMES notenames_body { $$ = $2; }
324 int i = scm_ilength ($1);
326 SCM tab = scm_make_vector (gh_int2scm (i), SCM_EOL);
327 for (SCM s = $1; s != SCM_EOL; s = gh_cdr (s)) {
328 SCM pt = gh_cdar (s);
329 if (scm_ilength (pt) != 3)
330 THIS->parser_error ("Need three args");
331 scm_hashq_set_x (tab, gh_caar(s), pt);
341 THIS->lexer_p_-> scope_l_arr_.push ($$);
343 | mudela_header_body assignment semicolon {
349 HEADER '{' mudela_header_body '}' {
351 THIS->lexer_p_-> scope_l_arr_.pop ();
361 THIS->remember_spot ();
363 /* cont */ '=' identifier_init {
364 THIS->lexer_p_->set_identifier (ly_scm2string ($1), $4);
366 $4->set_spot (THIS->pop_spot ());
374 $$ = new Score_identifier ($1, SCORE_IDENTIFIER);
378 $$ = new Paper_def_identifier ($1, PAPER_IDENTIFIER);
381 $$ = new Midi_def_identifier ($1, MIDI_IDENTIFIER);
384 | translator_spec_block {
385 $$ = new Translator_group_identifier ($1, TRANS_IDENTIFIER);
388 $$ = new Music_identifier ($1, MUSIC_IDENTIFIER);
392 $$ = new Request_identifier ($1, REQUEST_IDENTIFIER);
394 | explicit_duration {
395 $$ = new Duration_identifier ($1, DURATION_IDENTIFIER);
398 $$ = new Real_identifier (new Real ($1), REAL_IDENTIFIER);
401 $$ = new String_identifier (new String (ly_scm2string ($1)), STRING_IDENTIFIER);
404 $$ = new int_identifier (new int ($1), INT_IDENTIFIER);
408 translator_spec_block:
409 TRANSLATOR '{' translator_spec_body '}'
415 translator_spec_body:
417 $$ = $1->access_content_Translator_group (true);
418 $$-> set_spot (THIS->here_input ());
420 | TYPE STRING semicolon {
421 Translator* t = get_translator_l (ly_scm2string ($2));
422 Translator_group * tg = dynamic_cast<Translator_group*> (t);
425 THIS->parser_error (_("Need a translator group for a context"));
427 tg = dynamic_cast<Translator_group*> (t->clone ());
428 tg->set_spot (THIS->here_input ());
431 | translator_spec_body STRING '=' embedded_scm {
432 Translator_group* tg = dynamic_cast<Translator_group*> ($$);
433 tg->set_property (ly_scm2string ($2), $4);
435 | translator_spec_body STRING '=' identifier_init semicolon {
437 String_identifier *s = dynamic_cast<String_identifier*> (id);
438 Real_identifier *r= dynamic_cast<Real_identifier*>(id);
439 int_identifier *i = dynamic_cast<int_identifier*> (id);
442 if (s) v = ly_str02scm (s->access_content_String (false)->ch_C());
443 if (i) v = gh_int2scm (*i->access_content_int (false));
444 if (r) v = gh_double2scm (*r->access_content_Real (false));
446 THIS->parser_error (_("Wrong type for property value"));
450 Translator_group* tg = dynamic_cast<Translator_group*> ($$);
452 tg->set_property (ly_scm2string ($2), v);
454 | translator_spec_body NAME STRING semicolon {
455 $$->type_str_ = ly_scm2string ($3);
457 | translator_spec_body CONSISTS STRING semicolon {
458 dynamic_cast<Translator_group*> ($$)-> set_element (ly_scm2string ($3), true);
460 | translator_spec_body CONSISTSEND STRING semicolon {
461 dynamic_cast<Translator_group*> ($$)-> set_element (ly_scm2string ($3), true);
463 | translator_spec_body ACCEPTS STRING semicolon {
464 dynamic_cast<Translator_group*> ($$)-> set_acceptor (ly_scm2string ($3), true);
466 | translator_spec_body REMOVE STRING semicolon {
467 dynamic_cast<Translator_group*> ($$)-> set_element (ly_scm2string ($3), false);
477 /*cont*/ '{' score_body '}' {
479 if (!$$->def_p_arr_.size ())
482 THIS->lexer_p_->lookup_identifier ("$defaultpaper");
483 $$->add_output (id ? id->access_content_Paper_def (true) : new Paper_def );
490 $$->set_spot (THIS->here_input ());
493 $$ = $1->access_content_Score (true);
495 | score_body mudela_header {
500 $2->warning (_ ("More than one music block"));
503 | score_body output_def {
525 PAPER '{' paper_def_body '}' {
527 THIS-> lexer_p_->scope_l_arr_.pop ();
534 Identifier *id = THIS->lexer_p_->lookup_identifier ("$defaultpaper");
535 Paper_def *p = id ? id->access_content_Paper_def (true) : new Paper_def;
536 THIS-> lexer_p_-> scope_l_arr_.push (p->scope_p_);
540 Paper_def *p = $1->access_content_Paper_def (true);
541 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
544 | paper_def_body int '=' FONT STRING { // ugh, what a syntax
545 Lookup * l = new Lookup;
546 l->font_name_ = ly_scm2string ($5);
547 $$->set_lookup ($2, l);
549 | paper_def_body assignment semicolon {
552 | paper_def_body SCM_T '=' SCM_T {
553 if (!gh_symbol_p ($2))
554 THIS->parser_error ("expect a symbol as lvalue");
556 $$->default_properties_.set ($2, $4);
558 | paper_def_body SCM_T '=' real semicolon {
559 if (!gh_symbol_p ($2))
560 THIS->parser_error ("expect a symbol as lvalue");
562 $$->default_properties_.set ($2, gh_double2scm ($4));
564 | paper_def_body translator_spec_block {
565 $$->assign_translator ($2);
567 | paper_def_body error {
596 | real_with_dimension
598 $$= *$1->access_content_Real (false);
600 | '-' real %prec UNARY_MINUS {
627 THIS-> lexer_p_-> scope_l_arr_.pop();
631 midi_body: /* empty */ {
632 Identifier *id = THIS->lexer_p_->lookup_identifier ("$defaultmidi");
634 ? id->access_content_Midi_def (true) : new Midi_def ;
637 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
640 Midi_def * p =$1-> access_content_Midi_def (true);
642 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
644 | midi_body assignment semicolon {
647 | midi_body translator_spec_block {
648 $$-> assign_translator ($2);
650 | midi_body tempo_request semicolon {
652 junk this ? there already is tempo stuff in
655 $$->set_tempo ($2->dur_.length_mom (), $2->metronome_i_);
664 TEMPO steno_duration '=' unsigned {
668 $$-> metronome_i_ = $4;
672 Music_list: /* empty */ {
674 $$->set_spot (THIS->here_input ());
693 | ALTERNATIVE Music_sequence {
695 $2->set_spot (THIS->here_input ());
703 REPEAT STRING unsigned Music Alternative_music
705 Music_sequence* m = dynamic_cast <Music_sequence*> ($5);
706 if (m && $3 < m->length_i ())
707 $5->warning (_ ("More alternatives than repeats. Junking excess alternatives."));
709 Repeated_music * r = new Repeated_music ($4, $3 >? 1, m);
711 r->type_ = ly_scm2string ($2);
712 r->fold_b_ = (r->type_ == "fold");
713 r->volta_fold_b_ = (r->type_ == "volta");
714 r->set_spot ($4->spot ());
718 Music_sequence: '{' Music_list '}' {
719 $$ = new Music_sequence ($2);
720 $$->set_spot ($2->spot ());
725 SEQUENTIAL '{' Music_list '}' {
726 $$ = new Sequential_music ($3);
727 $$->set_spot ($3->spot ());
729 | '{' Music_list '}' {
730 $$ = new Sequential_music ($2);
731 $$->set_spot ($2->spot ());
736 SIMULTANEOUS '{' Music_list '}'{
737 $$ = new Simultaneous_music ($3);
738 $$->set_spot ($3->spot ());
740 | '<' Music_list '>' {
741 $$ = new Simultaneous_music ($2);
742 $$->set_spot ($2->spot ());
747 request_chord { $$ = $1; }
748 | OUTPUTPROPERTY embedded_scm embedded_scm '=' embedded_scm {
750 if (!gh_symbol_p ($3))
752 THIS->parser_error (_("Second argument must be a symbol"));
754 /*hould check # args */
755 if (!gh_procedure_p (pred))
757 THIS->parser_error (_("First argument must be a procedure taking 1 argument"));
760 $$ = new Output_property (pred,$3, $5);
762 | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); }
765 | Simple_music '*' unsigned '/' unsigned {
767 $$->compress (Moment($3, $5 ));
769 | Simple_music '*' unsigned {
771 $$->compress (Moment ($3, 1));
777 CONTEXT STRING Music {
778 Context_specced_music *csm = new Context_specced_music ($3);
780 csm->translator_type_str_ = ly_scm2string ($2);
781 csm->translator_id_str_ = "";
786 | AUTOCHANGE STRING Music {
787 Auto_change_music * chm = new Auto_change_music (ly_scm2string ($2), $3);
790 chm->set_spot ($3->spot ());
793 $$ = new Grace_music ($2);
795 | CONTEXT STRING '=' STRING Music {
796 Context_specced_music *csm = new Context_specced_music ($5);
798 csm->translator_type_str_ = ly_scm2string ($2);
799 csm->translator_id_str_ = ly_scm2string ($4);
804 THIS->remember_spot ();
807 unsigned '/' unsigned Music
810 $$ = new Time_scaled_music ($3, $5, $6);
811 $$->set_spot (THIS->pop_spot ());
813 | Repeated_music { $$ = $1; }
814 | Simultaneous_music { $$ = $1; }
815 | Sequential_music { $$ = $1; }
816 | TRANSPOSE musical_pitch Music {
817 $$ = new Transposed_music ($3, *$2);
820 | TRANSPOSE steno_tonic_pitch Music {
821 $$ = new Transposed_music ($3, *$2);
825 { THIS->lexer_p_->push_note_state (); }
828 THIS->lexer_p_->pop_state ();
831 { THIS->lexer_p_->push_chord_state (); }
835 THIS->lexer_p_->pop_state ();
838 { THIS->lexer_p_->push_lyric_state (); }
842 THIS->lexer_p_->pop_state ();
844 | relative_music { $$ = $1; }
845 | re_rhythmed_music { $$ = $1; }
849 RELATIVE absolute_musical_pitch Music {
850 $$ = new Relative_octave_music ($3, *$2);
856 ADDLYRICS Music Music {
857 Lyric_combine_music * l = new Lyric_combine_music ($2, $3);
863 TRANSLATOR STRING '=' STRING {
864 Change_translator * t = new Change_translator;
865 t-> change_to_type_str_ = ly_scm2string ($2);
866 t-> change_to_id_str_ = ly_scm2string ($4);
869 $$->set_spot (THIS->here_input ());
874 PROPERTY STRING '.' STRING '=' scalar {
875 Translation_property *t = new Translation_property;
877 t->var_str_ = ly_scm2string ($4);
880 Context_specced_music *csm = new Context_specced_music (t);
882 $$->set_spot (THIS->here_input ());
884 csm-> translator_type_str_ = ly_scm2string ($2);
890 | int { $$ = gh_int2scm ($1); }
891 | embedded_scm { $$ = $1; }
896 pre_requests simple_element post_requests {
897 Music_sequence *l = dynamic_cast<Music_sequence*>($2);
899 for (int i=0; i < $1->size(); i++)
900 l->add_music ($1->elem(i));
901 for (int i=0; i < $3->size(); i++)
902 l->add_music ($3->elem(i));
905 programming_error ("Need Sequence to add music to");
914 $$ = new Request_chord;
915 $$-> set_spot (THIS->here_input ());
916 $1-> set_spot (THIS->here_input ());
917 ((Simultaneous_music*)$$) ->add_music ($1);//ugh
919 | PARTIAL duration_length ';' {
920 Translation_property * p = new Translation_property;
921 p->var_str_ = "measurePosition";
922 p->value_ = (new Moment (-$2->length_mom ()))->smobify_self ();
924 Context_specced_music * sp = new Context_specced_music (p);
926 sp-> translator_type_str_ = "Score";
931 shorthand_command_req
932 | verbose_command_req semicolon { $$ = $1; }
935 shorthand_command_req:
943 $$ = new Barcheck_req;
949 Span_req*b= new Span_req;
950 b->span_dir_ = START;
951 b->span_type_str_ = "beam";
956 if (!is_duration_b ($3))
957 THIS->parser_error (_f ("not a duration: %d", $3));
959 THIS->set_chord_tremolo ($3);
961 Chord_tremolo_req* a = new Chord_tremolo_req;
962 a->span_dir_ = START;
964 a->type_i_ = THIS->chord_tremolo_type_i_;
970 if (!THIS->chord_tremolo_type_i_)
972 Span_req*b= new Span_req;
974 b->span_type_str_ = "beam";
979 Chord_tremolo_req* a = new Chord_tremolo_req;
981 a->type_i_ = THIS->chord_tremolo_type_i_;
984 THIS->set_chord_tremolo (0);
989 $$ = new Breathing_sign_req;
997 $$ = new Bar_req (ly_scm2string ($2));
999 | COMMANDSPANREQUEST int STRING {
1000 Span_req * sp_p = new Span_req;
1001 sp_p-> span_dir_ = Direction($2);
1002 sp_p->span_type_str_ = ly_scm2string ($3);
1003 sp_p->set_spot (THIS->here_input ());
1007 Mark_req * m = new Mark_req;
1011 Mark_req *m = new Mark_req;
1012 m->mark_label_ = $2;
1017 Mark_req *m = new Mark_req;
1018 m->mark_label_ = gh_int2scm ($2);
1022 | TIME_T unsigned '/' unsigned {
1023 Time_signature_change_req *m = new Time_signature_change_req;
1029 Break_req * b = new Break_req;
1030 b->penalty_f_ = $2 / 100.0;
1031 b->set_spot (THIS->here_input ());
1034 | SKIP duration_length {
1035 Skip_req * skip_p = new Skip_req;
1036 skip_p->duration_ = *$2;
1044 $$ = new Clef_change_req (ly_scm2string ($2));
1048 Key_change_req *key_p= new Key_change_req;
1052 /* UGH. optional. */
1054 | KEY NOTENAME_PITCH optional_modality {
1055 Key_change_req *key_p= new Key_change_req;
1057 d.pitch_arr_.push (*$2);
1058 d.ordinary_key_b_ = true;
1061 key_p->key_ = new Key_def (d);
1065 | KEYSIGNATURE pitch_list {
1066 Key_change_req *key_p= new Key_change_req;
1069 d.ordinary_key_b_ = false;
1071 key_p->key_ = new Key_def(d);
1079 $$ = new Link_array<Request>;
1081 | post_requests post_request {
1082 $2->set_spot (THIS->here_input ());
1094 request_that_take_dir:
1097 | script_abbreviation {
1098 Identifier*i = THIS->lexer_p_->lookup_identifier ("dash-" + ly_scm2string ($1));
1099 Articulation_req *a = new Articulation_req;
1100 a->articulation_str_ = *i->access_content_String (false);
1106 script_dir request_that_take_dir {
1107 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1108 gs->dir_ = Direction ($1);
1110 $2->warning (_ ("Can't specify direction for this request"));
1116 REQUEST_IDENTIFIER {
1117 $$ = (Request*)$1->access_content_Request (true);
1118 $$->set_spot (THIS->here_input ());
1120 | TEXTSCRIPT STRING STRING {
1121 Text_script_req *ts_p = new Text_script_req;
1122 ts_p-> text_str_ = ly_scm2string ($2);
1123 ts_p-> style_str_ = ly_scm2string ($3);
1124 ts_p->set_spot (THIS->here_input ());
1128 | SPANREQUEST int STRING {
1129 Span_req * sp_p = new Span_req;
1130 sp_p-> span_dir_ = Direction($2);
1131 sp_p->span_type_str_ = ly_scm2string ($3);
1132 sp_p->set_spot (THIS->here_input ());
1136 Tremolo_req* a = new Tremolo_req;
1137 a->set_spot (THIS->here_input ());
1142 Articulation_req * a = new Articulation_req;
1143 a->articulation_str_ = ly_scm2string ($2);
1144 a->set_spot (THIS->here_input ());
1177 steno_musical_pitch:
1181 | NOTENAME_PITCH sup_quotes {
1183 $$->octave_i_ += $2;
1185 | NOTENAME_PITCH sub_quotes {
1187 $$->octave_i_ += - $2;
1195 | TONICNAME_PITCH sup_quotes {
1197 $$->octave_i_ += $2;
1199 | TONICNAME_PITCH sub_quotes {
1201 $$->octave_i_ += - $2;
1206 steno_musical_pitch {
1209 | MUSICAL_PITCH embedded_scm {
1210 int sz = scm_ilength ($2);
1212 THIS->parser_error (_f ("Expecting %d arguments", 3));
1213 $2 = gh_list (gh_int2scm (0), gh_int2scm (0), gh_int2scm (0), SCM_UNDEFINED);
1215 $$ = new Musical_pitch ($2);
1220 DURATION '{' int_list '}' {
1222 Array<int> &a = *$3;
1225 $$-> durlog_i_ = a[0];
1226 $$-> dots_i_ = a[1];
1234 if (!THIS->lexer_p_->lyric_state_b ())
1235 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1236 $$ = new Extender_req;
1242 if (!THIS->lexer_p_->lyric_state_b ())
1243 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1244 $$ = new Hyphen_req;
1249 close_request_parens {
1251 dynamic_cast<Span_req*> ($$)->span_dir_ = START;
1254 close_request_parens:
1256 Span_req* s= new Span_req;
1258 s->span_type_str_ = "slur";
1261 Span_req*s =new Span_req;
1263 s->span_type_str_ = "crescendo";
1266 Span_req*s =new Span_req;
1268 s->span_type_str_ = "decrescendo";
1274 open_request_parens {
1276 dynamic_cast<Span_req*> ($$)->span_dir_ = STOP;
1280 open_request_parens:
1282 Span_req *s = new Span_req;
1283 s->span_type_str_ = "crescendo";
1287 Span_req* s= new Span_req;
1289 s->span_type_str_ = "slur";
1295 Text_script_req *t = new Text_script_req;
1297 t->text_str_ = ly_scm2string ($1);
1299 $$->set_spot (THIS->here_input ());
1302 Text_script_req* t = new Text_script_req;
1304 t->text_str_ = to_str ($1);
1305 t->style_str_ = "finger";
1306 $$->set_spot (THIS->here_input ());
1310 script_abbreviation:
1312 $$ = gh_str02scm ("hat");
1315 $$ = gh_str02scm("plus");
1318 $$ = gh_str02scm ("dash");
1321 $$ = gh_str02scm ("bar");
1324 $$ = gh_str02scm ("larger");
1327 $$ = gh_str02scm ("dot");
1335 | '-' { $$ = CENTER; }
1340 $$ = new Link_array<Request>;
1342 | pre_requests open_request {
1347 absolute_musical_pitch:
1348 steno_musical_pitch {
1357 | duration_length '*' unsigned {
1358 $$->tuplet_iso_i_ *= $3;
1360 | duration_length '/' unsigned {
1361 $$->tuplet_type_i_ *= $3;
1365 entered_notemode_duration:
1367 THIS->set_last_duration ($1);
1371 optional_notemode_duration:
1373 $$ = new Duration (THIS->default_duration_);
1375 | entered_notemode_duration {
1383 if (!is_duration_b ($1))
1384 THIS->parser_error (_f ("not a duration: %d", $1));
1386 $$->durlog_i_ = intlog2 ($1);
1389 | DURATION_IDENTIFIER {
1390 $$ = $1->access_content_Duration (true);
1392 | steno_duration '.' {
1403 if (!is_duration_b ($2))
1404 THIS->parser_error (_f ("not a duration: %d", $2));
1411 musical_pitch exclamations questions optional_notemode_duration {
1412 if (!THIS->lexer_p_->note_state_b ())
1413 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1416 Note_req *n = new Note_req;
1423 if (THIS->chord_tremolo_type_i_)
1425 if (n->duration_.plet_b ())
1426 // urg, burp. what nonsense / silly implementation
1427 THIS->parser_error (_ ("can't put stem tremolo on tuplet"));
1429 n->duration_.set_plet (1, 2);
1431 n->cautionary_b_ = $3 % 2;
1432 n->forceacc_b_ = $2 % 2 || n->cautionary_b_;
1434 Simultaneous_music*v = new Request_chord;
1435 v->set_spot ($1->spot ());
1436 n->set_spot ($1->spot ());
1446 | RESTNAME optional_notemode_duration {
1447 Simultaneous_music* velt_p = new Request_chord;
1448 velt_p->set_spot (THIS->here_input());
1450 if (ly_scm2string ($1) =="s")
1452 Skip_req * skip_p = new Skip_req;
1453 skip_p->duration_ = *$2;
1455 skip_p->set_spot (THIS->here_input());
1456 velt_p->add_music (skip_p);
1460 Rest_req * rest_req_p = new Rest_req;
1461 rest_req_p->duration_ = *$2;
1462 rest_req_p->set_spot (THIS->here_input());
1464 velt_p->add_music (rest_req_p);
1470 | MEASURES optional_notemode_duration {
1471 Skip_req * sk = new Skip_req;
1472 sk->duration_ = *$2;
1473 Music_list * ms = new Music_list;
1474 Request_chord * rqc1 = new Request_chord;
1475 Request_chord * rqc2 = new Request_chord;
1476 Request_chord * rqc3 = new Request_chord;
1478 Span_req *sp1 = new Span_req;
1479 Span_req *sp2 = new Span_req;
1480 sp1-> span_dir_ = START;
1481 sp2-> span_dir_ = STOP;
1482 sp1->span_type_str_ = sp2->span_type_str_ = "rest";
1483 rqc1->add_music (sp1);
1484 rqc2->add_music (sk);
1485 rqc3->add_music (sp2);
1487 ms->add_music (rqc1);
1488 ms->add_music (rqc2);
1489 ms->add_music (rqc3);
1491 $$ = new Sequential_music (ms);
1493 | STRING optional_notemode_duration {
1494 if (!THIS->lexer_p_->lyric_state_b ())
1495 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1496 Simultaneous_music* velt_p = new Request_chord;
1498 Lyric_req* lreq_p = new Lyric_req;
1499 lreq_p ->text_str_ = ly_scm2string ($1);
1500 lreq_p->duration_ = *$2;
1501 lreq_p->set_spot (THIS->here_input());
1503 velt_p->add_music (lreq_p);
1510 if (!THIS->lexer_p_->chord_state_b ())
1511 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1517 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
1518 $$ = THIS->get_chord (*$1, $3, $4, $5, $6, *$2);
1523 $$ = new Array<Musical_pitch>;
1525 | CHORD_COLON chord_notes {
1534 | chord_notes '.' chord_step {
1542 $$ = new Array<Musical_pitch>;
1544 | CHORD_CARET chord_notes {
1554 | '/' steno_tonic_pitch {
1556 $$->set_spot (THIS->here_input ());
1564 | CHORD_BASS steno_tonic_pitch {
1566 $$->set_spot (THIS->here_input ());
1572 $$ = new Array<Musical_pitch>;
1575 | CHORDMODIFIER_PITCH {
1576 $$ = new Array<Musical_pitch>;
1579 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
1580 $$ = new Array<Musical_pitch>;
1588 $$ = new Musical_pitch;
1589 $$->notename_i_ = ($1 - 1) % 7;
1590 $$->octave_i_ = $1 > 7 ? 1 : 0;
1591 $$->accidental_i_ = 0;
1594 $$ = new Musical_pitch;
1595 $$->notename_i_ = ($1 - 1) % 7;
1596 $$->octave_i_ = $1 > 7 ? 1 : 0;
1597 $$->accidental_i_ = 1;
1599 | unsigned CHORD_MINUS {
1600 $$ = new Musical_pitch;
1601 $$->notename_i_ = ($1 - 1) % 7;
1602 $$->octave_i_ = $1 > 7 ? 1 : 0;
1603 $$->accidental_i_ = -1;
1611 $$ = new Array<Musical_pitch>;
1613 | pitch_list musical_pitch {
1646 $$ = *$1->access_content_int (false);
1655 | STRING_IDENTIFIER {
1656 $$ = ly_str02scm ($1->access_content_String (true)->ch_C ());
1658 | string '+' string {
1659 $$ = scm_string_append (scm_listify ($1, $3, SCM_UNDEFINED));
1666 | exclamations '!' { $$ ++; }
1671 | questions '?' { $$ ++; }
1681 My_lily_parser::set_yydebug (bool b)
1688 My_lily_parser::do_yyparse ()
1690 yyparse ((void*)this);