1 %{ // -*-Fundamental-*-
4 parser.yy -- Bison/C++ parser for mudela
6 source file of the GNU LilyPond music typesetter
8 (c) 1997 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 Jan Nieuwenhuizen <janneke@gnu.org>
13 #include "lily-guile.hh"
14 #include "notename-table.hh"
16 #include "translation-property.hh"
19 #include "my-lily-lexer.hh"
20 #include "paper-def.hh"
21 #include "midi-def.hh"
23 #include "file-path.hh"
26 #include "dimensions.hh"
27 #include "identifier.hh"
28 #include "command-request.hh"
29 #include "musical-request.hh"
30 #include "my-lily-parser.hh"
31 #include "context-specced-music.hh"
32 #include "translator-group.hh"
34 #include "music-list.hh"
35 #include "duration-convert.hh"
36 #include "change-translator.hh"
37 #include "file-results.hh"
39 #include "relative-music.hh"
40 #include "lyric-combine-music.hh"
41 #include "transposed-music.hh"
42 #include "time-scaled-music.hh"
43 #include "repeated-music.hh"
44 #include "mudela-version.hh"
45 #include "grace-music.hh"
48 Mudela_version oldest_version ("1.1.52");
53 print_mudela_versions (ostream &os)
55 os << "Oldest supported input version: " << oldest_version.str () << endl;
57 // needed for bison.simple's malloc() and free()
64 #define YYERROR_VERBOSE 1
66 #define YYPARSE_PARAM my_lily_parser_l
67 #define YYLEX_PARAM my_lily_parser_l
68 #define THIS ((My_lily_parser *) my_lily_parser_l)
70 #define yyerror THIS->parser_error
71 #define ARRAY_SIZE(a,s) if (a.size () != s) THIS->parser_error (_f("expecting %d arguments", s))
78 Array<Musical_pitch> *pitch_arr;
79 Link_array<Request> *reqvec;
80 Array<String> * strvec;
82 Notename_table *chordmodifiertab;
86 Music_list *music_list;
91 Music_output_def * outputdef;
92 Musical_pitch * pitch;
95 Notename_table *notenametab;
111 yylex (YYSTYPE *s, void * v_l)
113 My_lily_parser *pars_l = (My_lily_parser*) v_l;
114 My_lily_lexer * lex_l = pars_l->lexer_p_;
116 lex_l->lexval_l = (void*) s;
117 return lex_l->yylex ();
125 /* tokens which are not keywords */
133 %token CHORDMODIFIERS
187 %token E_EXCLAMATION E_SMALLER E_BIGGER E_CHAR CHORD_MINUS CHORD_CARET
189 %type <i> exclamations questions
191 %token <pitch> NOTENAME_PITCH
192 %token <pitch> TONICNAME_PITCH
193 %token <pitch> CHORDMODIFIER_PITCH
194 %token <id> DURATION_IDENTIFIER
195 %token <id> IDENTIFIER
196 %token <id> NOTENAME_TABLE_IDENTIFIER
197 %token <id> MUSIC_IDENTIFIER
198 %token <id> REQUEST_IDENTIFIER
199 %token <id> REAL_IDENTIFIER
200 %token <id> STRING_IDENTIFIER
201 %token <id> TRANS_IDENTIFIER
202 %token <id> INT_IDENTIFIER
203 %token <id> SCORE_IDENTIFIER
204 %token <id> MIDI_IDENTIFIER
205 %token <id> PAPER_IDENTIFIER
207 %token <string> DURATION RESTNAME
208 %token <string> STRING
212 %type <outputdef> output_def
213 %type <scope> mudela_header mudela_header_body
214 %type <request> open_request_parens close_request_parens open_request close_request
215 %type <request> request_with_dir request_that_take_dir verbose_request
216 %type <i> sub_quotes sup_quotes
217 %type <music> simple_element request_chord command_element Simple_music Composite_music
218 %type <music> Alternative_music Repeated_music
219 %type <i> abbrev_type
220 %type <i> int unsigned
222 %type <i> optional_modality
223 %type <id> identifier_init
224 %type <duration> steno_duration optional_notemode_duration
225 %type <duration> entered_notemode_duration explicit_duration
226 %type <intvec> int_list
227 %type <reqvec> pre_requests post_requests
228 %type <request> gen_text_def
229 %type <pitch> explicit_musical_pitch steno_musical_pitch musical_pitch absolute_musical_pitch
230 %type <pitch> steno_tonic_pitch
232 %type <pitch_arr> pitch_list
234 %type <pitch_arr> chord_additions chord_subtractions chord_notes chord_step
235 %type <pitch> chord_note chord_inversion
236 %type <midi> midi_block midi_body
237 %type <duration> duration_length
239 %type <scalar> scalar
240 %type <music> Music Sequential_music Simultaneous_music Music_sequence
241 %type <music> relative_music re_rhythmed_music
242 %type <music> property_def translator_change
243 %type <music_list> Music_list
244 %type <paper> paper_block paper_def_body
245 %type <real> real real_with_dimension
246 %type <request> abbrev_command_req
247 %type <request> post_request
248 %type <request> command_req verbose_command_req
249 %type <request> extender_req
250 %type <request> hyphen_req
251 %type <string> string
252 %type <score> score_block score_body
253 %type <realarr> real_array
255 %type <string> script_abbreviation
256 %type <trans> translator_spec_block translator_spec_body
257 %type <tempo> tempo_request
258 %type <notenametab> notenames_body notenames_block chordmodifiers_block
269 | mudela toplevel_expression {}
270 | mudela assignment { }
273 THIS->error_level_i_ =1;
279 THIS->lexer_p_->set_notename_table ($1);
281 | chordmodifiers_block {
282 THIS->lexer_p_->set_chordmodifier_table ($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)
306 SCMFILE STRING semicolon {
307 read_lily_scm_file (*$2);
310 | SCM_T STRING semicolon {
311 if (THIS->lexer_p_->main_input_b_ && safe_global_b)
312 error (_("Cannot evaluate Scheme in safe mode"));
313 gh_eval_str ($2->ch_l ());
318 chordmodifiers_block:
319 CHORDMODIFIERS '{' notenames_body '}' { $$ = $3; }
324 NOTENAMES '{' notenames_body '}' { $$ = $3; }
331 $$ = new Notename_table;
333 | NOTENAME_TABLE_IDENTIFIER {
334 $$ = $1-> access_content_Notename_table(true);
336 | notenames_body STRING '=' explicit_musical_pitch {
347 THIS->lexer_p_-> scope_l_arr_.push ($$);
349 | mudela_header_body assignment semicolon {
355 HEADER '{' mudela_header_body '}' {
357 THIS->lexer_p_-> scope_l_arr_.pop ();
367 THIS->remember_spot ();
369 /* cont */ '=' identifier_init {
370 THIS->lexer_p_->set_identifier (*$1, $4);
371 $4->init_b_ = THIS->init_parse_b_;
372 $4->set_spot (THIS->pop_spot ());
380 $$ = new Score_identifier ($1, SCORE_IDENTIFIER);
383 | chordmodifiers_block {
384 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
387 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
390 $$ = new Paper_def_identifier ($1, PAPER_IDENTIFIER);
393 $$ = new Midi_def_identifier ($1, MIDI_IDENTIFIER);
396 | translator_spec_block {
397 $$ = new Translator_identifier ($1, TRANS_IDENTIFIER);
400 $$ = new Music_identifier ($1, MUSIC_IDENTIFIER);
404 $$ = new Request_identifier ($1, REQUEST_IDENTIFIER);
406 | explicit_duration {
407 $$ = new Duration_identifier ($1, DURATION_IDENTIFIER);
410 $$ = new Real_identifier (new Real ($1), REAL_IDENTIFIER);
413 $$ = new String_identifier ($1, STRING_IDENTIFIER);
416 $$ = new int_identifier (new int ($1), INT_IDENTIFIER);
420 translator_spec_block:
421 TRANSLATOR '{' translator_spec_body '}'
427 translator_spec_body:
429 $$ = $1->access_content_Translator (true);
430 Translator_group * tg = dynamic_cast<Translator_group*> ($$);
432 THIS->parser_error (_("Need a translator group for a context"));
433 $$-> set_spot (THIS->here_input ());
435 | TYPE STRING semicolon {
436 Translator* t = get_translator_l (*$2);
437 Translator_group * tg = dynamic_cast<Translator_group*> (t);
440 THIS->parser_error (_("Need a translator group for a context"));
443 t->set_spot (THIS->here_input ());
447 | translator_spec_body STRING '=' identifier_init semicolon {
449 String_identifier *s = dynamic_cast<String_identifier*> (id);
450 Real_identifier *r= dynamic_cast<Real_identifier*>(id);
451 int_identifier *i = dynamic_cast<int_identifier*> (id);
454 if (s) str = *s->access_content_String (false);
455 if (i) str = to_str (*i->access_content_int (false));
456 if (r) str = to_str (*r->access_content_Real (false));
458 THIS->parser_error (_("Wrong type for property value"));
462 Translator_group* tg = dynamic_cast<Translator_group*> ($$);
464 THIS->parser_error (_("Need a translator group for a context"));
465 tg->set_property (*$2, str);
467 | translator_spec_body NAME STRING semicolon {
471 | translator_spec_body CONSISTS STRING semicolon {
472 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, true);
475 | translator_spec_body CONSISTSEND STRING semicolon {
476 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, true);
479 | translator_spec_body ACCEPTS STRING semicolon {
480 dynamic_cast<Translator_group*> ($$)-> set_acceptor (*$3, true);
483 | translator_spec_body REMOVE STRING semicolon {
484 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, false);
495 /*cont*/ '{' score_body '}' {
497 if (!$$->def_p_arr_.size ())
498 $$->add_output (THIS->default_paper_p ());
504 $$->set_spot (THIS->here_input ());
507 $$ = $1->access_content_Score (true);
509 | score_body mudela_header {
514 $2->warning (_ ("More than one music block"));
517 | score_body output_def {
539 PAPER '{' paper_def_body '}' {
541 THIS-> lexer_p_->scope_l_arr_.pop ();
548 Paper_def *p = THIS->default_paper_p ();
549 THIS-> lexer_p_-> scope_l_arr_.push (p->scope_p_);
553 Paper_def *p = $1->access_content_Paper_def (true);
554 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
557 | paper_def_body int '=' FONT STRING { // ugh, what a syntax
558 Lookup * l = new Lookup;
561 $$->set_lookup ($2, l);
563 | paper_def_body assignment semicolon {
566 | paper_def_body translator_spec_block {
567 $$->assign_translator ($2);
569 | paper_def_body SHAPE real_array semicolon {
574 warning ("Need even number of args for shape array");
576 for (int i=0; i < $3->size (); i+=2)
578 Real l = $3->elem (i);
579 $$->shape_int_a_.push (Interval (l,
580 l + $3->elem (i+1)));
584 | paper_def_body error {
610 | real_with_dimension
612 $$= *$1->access_content_Real (false);
614 | '-' real %prec UNARY_MINUS {
637 $$ = new Array<Real>;
641 $$ = new Array<Real>;
643 | real_array ',' real {
654 '{' midi_body '}' { $$ = $3; }
657 midi_body: /* empty */ {
658 $$ = THIS->default_midi_p ();
661 $$ = $1-> access_content_Midi_def (true);
663 | midi_body assignment semicolon {
666 | midi_body translator_spec_block {
667 $$-> assign_translator ($2);
669 | midi_body tempo_request semicolon {
670 $$->set_tempo ($2->dur_.length_mom (), $2->metronome_i_);
679 TEMPO steno_duration '=' unsigned {
683 $$-> metronome_i_ = $4;
687 Music_list: /* empty */ {
689 $$->set_spot (THIS->here_input ());
708 | ALTERNATIVE Music_sequence {
710 $2->set_spot (THIS->here_input ());
718 REPEAT STRING unsigned Music Alternative_music
720 Music_sequence* m = dynamic_cast <Music_sequence*> ($5);
721 if (m && $3 < m->length_i ())
722 $5->warning ("More alternatives than repeats. Junking excess alternatives.");
724 Repeated_music * r = new Repeated_music ($4, $3 >? 1, m);
726 r->fold_b_ = (*$2 == "fold");
727 r->volta_fold_b_ = (*$2 == "volta");
729 r->set_spot ($4->spot ());
733 Music_sequence: '{' Music_list '}' {
734 $$ = new Music_sequence ($2);
735 $$->set_spot ($2->spot ());
740 SEQUENTIAL '{' Music_list '}' {
741 $$ = new Sequential_music ($3);
742 $$->set_spot ($3->spot ());
744 | '{' Music_list '}' {
745 $$ = new Sequential_music ($2);
746 $$->set_spot ($2->spot ());
751 SIMULTANEOUS '{' Music_list '}'{
752 $$ = new Simultaneous_music ($3);
753 $$->set_spot ($3->spot ());
755 | '<' Music_list '>' {
756 $$ = new Simultaneous_music ($2);
757 $$->set_spot ($2->spot ());
762 request_chord { $$ = $1; }
763 | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); }
766 | Simple_music '*' unsigned '/' unsigned {
768 $$->compress (Moment($3, $5 ));
770 | Simple_music '*' unsigned {
772 $$->compress (Moment ($3, 1));
778 CONTEXT STRING Music {
779 Context_specced_music *csm = new Context_specced_music ($3);
781 csm->translator_type_str_ = *$2;
782 csm->translator_id_str_ = "";
788 $$ = new Grace_music ($2);
790 | CONTEXT STRING '=' STRING Music {
791 Context_specced_music *csm = new Context_specced_music ($5);
793 csm->translator_type_str_ = *$2;
794 csm->translator_id_str_ = *$4;
801 THIS->remember_spot ();
804 unsigned '/' unsigned Music
807 $$ = new Time_scaled_music ($3, $5, $6);
808 $$->set_spot (THIS->pop_spot ());
810 | Repeated_music { $$ = $1; }
811 | Simultaneous_music { $$ = $1; }
812 | Sequential_music { $$ = $1; }
813 | TRANSPOSE musical_pitch Music {
814 $$ = new Transposed_music ($3, *$2);
817 | TRANSPOSE steno_tonic_pitch Music {
818 $$ = new Transposed_music ($3, *$2);
822 { THIS->lexer_p_->push_note_state (); }
825 THIS->lexer_p_->pop_state ();
828 { THIS->lexer_p_->push_chord_state (); }
832 THIS->lexer_p_->pop_state ();
835 { THIS->lexer_p_->push_lyric_state (); }
839 THIS->lexer_p_->pop_state ();
841 | relative_music { $$ = $1; }
842 | re_rhythmed_music { $$ = $1; }
846 RELATIVE absolute_musical_pitch Music {
847 $$ = new Relative_octave_music ($3, *$2);
853 ADDLYRICS Music Music {
854 Lyric_combine_music * l = new Lyric_combine_music ($2, $3);
860 TRANSLATOR STRING '=' STRING {
861 Change_translator * t = new Change_translator;
862 t-> change_to_type_str_ = *$2;
863 t-> change_to_id_str_ = *$4;
866 $$->set_spot (THIS->here_input ());
873 PROPERTY STRING '.' STRING '=' scalar {
874 Translation_property *t = new Translation_property;
879 Context_specced_music *csm = new Context_specced_music (t);
881 $$->set_spot (THIS->here_input ());
883 csm-> translator_type_str_ = *$2;
892 string { $$ = new Scalar (*$1); delete $1; }
893 | int { $$ = new Scalar ($1); }
898 pre_requests simple_element post_requests {
899 Music_sequence *l = dynamic_cast<Music_sequence*>($2);
900 for (int i=0; i < $1->size(); i++)
901 l->add_music ($1->elem(i));
902 for (int i=0; i < $3->size(); i++)
903 l->add_music ($3->elem(i));
912 $$ = new Request_chord;
913 $$-> set_spot (THIS->here_input ());
914 $1-> set_spot (THIS->here_input ());
915 ((Simultaneous_music*)$$) ->add_music ($1);//ugh
921 | verbose_command_req semicolon { $$ = $1; }
932 $$ = new Barcheck_req;
938 Span_req*b= new Span_req;
939 b->span_dir_ = START;
940 b->span_type_str_ = "beam";
944 if (!Duration::duration_type_b ($3))
945 THIS->parser_error (_f ("not a duration: %d", $3));
947 THIS->parser_error (_ ("can't abbreviate"));
949 THIS->set_abbrev_beam ($3);
951 Chord_tremolo_req* a = new Chord_tremolo_req;
952 a->span_dir_ = START;
953 a->type_i_ = THIS->abbrev_beam_type_i_;
957 if (!THIS->abbrev_beam_type_i_)
959 Span_req*b= new Span_req;
961 b->span_type_str_ = "beam";
966 Chord_tremolo_req* a = new Chord_tremolo_req;
968 a->type_i_ = THIS->abbrev_beam_type_i_;
969 THIS->set_abbrev_beam (0);
974 $$ = new Breathing_sign_req;
981 $$ = new Bar_req (*$2);
985 $$ = new Mark_req (*$2);
989 $$ = new Mark_req (to_str ($2));
991 | TIME_T unsigned '/' unsigned {
992 Time_signature_change_req *m = new Time_signature_change_req;
998 Break_req * b = new Break_req;
1000 b-> set_spot (THIS->here_input ());
1003 | SKIP duration_length {
1004 Skip_req * skip_p = new Skip_req;
1005 skip_p->duration_ = *$2;
1012 | CADENZA unsigned {
1013 $$ = new Cadenza_req ($2);
1015 | PARTIAL duration_length {
1016 $$ = new Partial_measure_req ($2->length_mom ());
1020 $$ = new Clef_change_req (*$2);
1023 | KEY NOTENAME_PITCH optional_modality {
1024 Key_change_req *key_p= new Key_change_req;
1025 key_p->key_.pitch_arr_.push (*$2);
1026 key_p->key_.ordinary_key_b_ = true;
1027 key_p->key_.modality_i_ = $3;
1031 | KEYSIGNATURE pitch_list {
1032 Key_change_req *key_p= new Key_change_req;
1033 key_p->key_.pitch_arr_ = *$2;
1034 key_p->key_.ordinary_key_b_ = false;
1043 $$ = new Link_array<Request>;
1045 | post_requests post_request {
1046 $2->set_spot (THIS->here_input ());
1058 request_that_take_dir:
1061 | script_abbreviation {
1062 Identifier*i = THIS->lexer_p_->lookup_identifier ("dash-" + *$1);
1063 Articulation_req *a = new Articulation_req;
1064 a->articulation_str_ = *i->access_content_String (false);
1071 script_dir request_that_take_dir {
1072 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1073 gs->dir_ = Direction ($1);
1075 $2->warning ("Can't specify direction for this request");
1081 REQUEST_IDENTIFIER {
1082 $$ = (Request*)$1->access_content_Request (true);
1083 $$->set_spot (THIS->here_input ());
1085 | TEXTSCRIPT STRING STRING {
1086 Text_script_req *ts_p = new Text_script_req;
1087 ts_p-> text_str_ = *$2;
1088 ts_p-> style_str_ = *$3;
1089 ts_p->set_spot (THIS->here_input ());
1094 | SPANREQUEST int STRING {
1095 Span_req * sp_p = new Span_req;
1096 sp_p-> span_dir_ = Direction($2);
1097 sp_p->span_type_str_ = *$3;
1098 sp_p->set_spot (THIS->here_input ());
1102 Tremolo_req* a = new Tremolo_req;
1103 a->set_spot (THIS->here_input ());
1108 Articulation_req * a = new Articulation_req;
1109 a->articulation_str_ = *$2;
1110 a->set_spot (THIS->here_input ());
1143 steno_musical_pitch:
1147 | NOTENAME_PITCH sup_quotes {
1149 $$->octave_i_ += $2;
1151 | NOTENAME_PITCH sub_quotes {
1153 $$->octave_i_ += - $2;
1161 | TONICNAME_PITCH sup_quotes {
1163 $$->octave_i_ += $2;
1165 | TONICNAME_PITCH sub_quotes {
1167 $$->octave_i_ += - $2;
1171 explicit_musical_pitch:
1172 MUSICAL_PITCH '{' int_list '}' {/* ugh */
1173 Array<int> &a = *$3;
1175 $$ = new Musical_pitch;
1176 $$->octave_i_ = a[0];
1177 $$->notename_i_ = a[1];
1178 $$->accidental_i_ = a[2];
1184 steno_musical_pitch {
1186 THIS->set_last_pitch ($1);
1188 | explicit_musical_pitch {
1190 THIS->set_last_pitch ($1);
1195 DURATION '{' int_list '}' {
1197 Array<int> &a = *$3;
1200 $$-> durlog_i_ = a[0];
1201 $$-> dots_i_ = a[1];
1209 if (!THIS->lexer_p_->lyric_state_b ())
1210 THIS->parser_error (_ ("have to be in Lyric mode for lyrics"));
1211 $$ = new Extender_req;
1217 if (!THIS->lexer_p_->lyric_state_b ())
1218 THIS->parser_error (_ ("have to be in Lyric mode for lyrics"));
1219 $$ = new Hyphen_req;
1224 close_request_parens {
1226 dynamic_cast<Span_req*> ($$)->span_dir_ = START;
1229 close_request_parens:
1231 Span_req* s= new Span_req;
1233 s->span_type_str_ = "slur";
1236 Span_req*s =new Span_req;
1238 s->span_type_str_ = "crescendo";
1241 Span_req*s =new Span_req;
1243 s->span_type_str_ = "decrescendo";
1249 open_request_parens {
1251 dynamic_cast<Span_req*> ($$)->span_dir_ = STOP;
1255 open_request_parens:
1257 Span_req *s = new Span_req;
1258 s->span_type_str_ = "crescendo";
1262 Span_req* s= new Span_req;
1264 s->span_type_str_ = "slur";
1270 Text_script_req *t = new Text_script_req;
1274 $$->set_spot (THIS->here_input ());
1277 Text_script_req* t = new Text_script_req;
1279 t->text_str_ = to_str ($1);
1280 t->style_str_ = "finger";
1281 $$->set_spot (THIS->here_input ());
1285 script_abbreviation:
1287 $$ = new String ("hat");
1290 $$ = new String ("plus");
1293 $$ = new String ("dash");
1296 $$ = new String ("bar");
1299 $$ = new String ("larger");
1302 $$ = new String ("dot");
1310 | '-' { $$ = CENTER; }
1315 $$ = new Link_array<Request>;
1317 | pre_requests open_request {
1322 absolute_musical_pitch:
1323 steno_musical_pitch {
1332 | duration_length '*' unsigned {
1333 $$->plet_.iso_i_ *= $3;
1335 | duration_length '/' unsigned {
1336 $$->plet_.type_i_ *= $3;
1340 entered_notemode_duration:
1342 THIS->set_last_duration ($1);
1346 optional_notemode_duration:
1348 $$ = new Duration (THIS->default_duration_);
1350 | entered_notemode_duration {
1358 if (!Duration::duration_type_b ($1))
1359 THIS->parser_error (_f ("not a duration: %d", $1));
1361 $$->durlog_i_ = Duration_convert::i2_type ($1);
1364 | DURATION_IDENTIFIER {
1365 $$ = $1->access_content_Duration (true);
1367 | steno_duration '.' {
1378 if (!Duration::duration_type_b ($2))
1379 THIS->parser_error (_f ("not a duration: %d", $2));
1381 THIS->parser_error (_ ("can't abbreviate"));
1388 musical_pitch exclamations questions optional_notemode_duration {
1389 if (!THIS->lexer_p_->note_state_b ())
1390 THIS->parser_error (_ ("have to be in Note mode for notes"));
1393 Note_req *n = new Note_req;
1399 if (THIS->abbrev_beam_type_i_)
1401 if (n->duration_.plet_b ())
1402 THIS->parser_error (_ ("can't abbreviate tuplet"));
1404 n->duration_.set_plet (1, 2);
1406 n->cautionary_b_ = $3 % 2;
1407 n->forceacc_b_ = $2 % 2 || n->cautionary_b_;
1409 Simultaneous_music*v = new Request_chord;
1410 v->set_spot (THIS->here_input ());
1411 n->set_spot (THIS->here_input ());
1417 | RESTNAME optional_notemode_duration {
1418 $$ = THIS->get_rest_element (*$1, $2);
1419 delete $1; // delete notename
1421 | MEASURES optional_notemode_duration {
1422 Multi_measure_rest_req* m = new Multi_measure_rest_req;
1426 Simultaneous_music*velt_p = new Request_chord;
1427 velt_p->set_spot (THIS->here_input ());
1428 velt_p->add_music (m);
1431 | REPETITIONS optional_notemode_duration {
1432 Repetitions_req* r = new Repetitions_req;
1436 Simultaneous_music*velt_p = new Request_chord;
1437 velt_p->set_spot (THIS->here_input ());
1438 velt_p->add_music (r);
1441 | STRING optional_notemode_duration {
1442 if (!THIS->lexer_p_->lyric_state_b ())
1443 THIS->parser_error (_ ("have to be in Lyric mode for lyrics"));
1444 $$ = THIS->get_word_element (*$1, $2);
1448 if (!THIS->lexer_p_->chord_state_b ())
1449 THIS->parser_error (_ ("have to be in Chord mode for chords"));
1455 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion {
1456 $$ = THIS->get_chord (*$1, $3, $4, $5, *$2);
1461 $$ = new Array<Musical_pitch>;
1463 | CHORD_MINUS chord_notes {
1472 | chord_notes '.' chord_step {
1480 $$ = new Array<Musical_pitch>;
1482 | CHORD_CARET chord_notes {
1492 | '/' steno_tonic_pitch {
1499 $$ = new Array<Musical_pitch>;
1502 | CHORDMODIFIER_PITCH {
1503 $$ = new Array<Musical_pitch>;
1506 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
1507 $$ = new Array<Musical_pitch>;
1515 $$ = new Musical_pitch;
1516 $$->notename_i_ = ($1 - 1) % 7;
1517 $$->octave_i_ = $1 > 7 ? 1 : 0;
1518 $$->accidental_i_ = 0;
1521 $$ = new Musical_pitch;
1522 $$->notename_i_ = ($1 - 1) % 7;
1523 $$->octave_i_ = $1 > 7 ? 1 : 0;
1524 $$->accidental_i_ = 1;
1526 | unsigned CHORD_MINUS {
1527 $$ = new Musical_pitch;
1528 $$->notename_i_ = ($1 - 1) % 7;
1529 $$->octave_i_ = $1 > 7 ? 1 : 0;
1530 $$->accidental_i_ = -1;
1538 $$ = new Array<Musical_pitch>;
1540 | pitch_list musical_pitch {
1573 $$ = *$1->access_content_int (false);
1582 | STRING_IDENTIFIER {
1583 $$ = $1->access_content_String (true);
1585 | string '+' string {
1594 | exclamations '!' { $$ ++; }
1599 | questions '?' { $$ ++; }
1609 My_lily_parser::set_yydebug (bool b)
1616 My_lily_parser::do_yyparse ()
1618 yyparse ((void*)this);