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>
17 * use of '-' in various places
23 #include "lily-guile.hh"
24 #include "notename-table.hh"
26 #include "translation-property.hh"
29 #include "my-lily-lexer.hh"
30 #include "paper-def.hh"
31 #include "midi-def.hh"
33 #include "file-path.hh"
36 #include "parseconstruct.hh"
37 #include "dimensions.hh"
38 #include "identifier.hh"
39 #include "command-request.hh"
40 #include "musical-request.hh"
41 #include "my-lily-parser.hh"
42 #include "context-specced-music.hh"
43 #include "translator-group.hh"
45 #include "music-list.hh"
46 #include "duration-convert.hh"
47 #include "change-translator.hh"
48 #include "file-results.hh"
49 #include "mudela-version.hh"
51 #include "relative-music.hh"
52 #include "re-rhythmed-music.hh"
53 #include "transposed-music.hh"
54 #include "time-scaled-music.hh"
55 #include "new-repeated-music.hh"
57 #include "grace-music.hh"
60 Mudela_version oldest_version ("1.1.52");
61 Mudela_version version ( MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL );
65 print_mudela_versions (ostream &os)
67 os << "Oldest supported input version: " << oldest_version.str () << endl;
69 // needed for bison.simple's malloc() and free()
76 #define YYERROR_VERBOSE 1
78 #define YYPARSE_PARAM my_lily_parser_l
79 #define YYLEX_PARAM my_lily_parser_l
80 #define THIS ((My_lily_parser *) my_lily_parser_l)
82 #define yyerror THIS->parser_error
83 #define ARRAY_SIZE(a,s) if (a.size () != s) THIS->parser_error (_f("expecting %d arguments", s))
89 Array<Interval>* intarr;
90 Array<Musical_pitch> *pitch_arr;
91 Link_array<Request> *reqvec;
92 Array<String> * strvec;
94 Notename_table *chordmodifiertab;
98 Music_list *music_list;
103 Music_output_def * outputdef;
104 Musical_pitch * pitch;
107 Notename_table *notenametab;
123 yylex (YYSTYPE *s, void * v_l)
125 My_lily_parser *pars_l = (My_lily_parser*) v_l;
126 My_lily_lexer * lex_l = pars_l->lexer_p_;
128 lex_l->lexval_l = (void*) s;
129 return lex_l->yylex ();
137 /* tokens which are not keywords */
145 %token CHORDMODIFIERS
196 %token E_EXCLAMATION E_SMALLER E_BIGGER E_CHAR
198 %type <i> exclamations questions
200 %token <pitch> NOTENAME_PITCH
201 %token <pitch> TONICNAME_PITCH
202 %token <pitch> CHORDMODIFIER_PITCH
203 %token <id> DURATION_IDENTIFIER
204 %token <id> IDENTIFIER
205 %token <id> NOTENAME_TABLE_IDENTIFIER
206 %token <id> MUSIC_IDENTIFIER
207 %token <id> REQUEST_IDENTIFIER
208 %token <id> REAL_IDENTIFIER
209 %token <id> STRING_IDENTIFIER
210 %token <id> TRANS_IDENTIFIER
211 %token <id> INT_IDENTIFIER
212 %token <id> SCORE_IDENTIFIER
213 %token <id> MIDI_IDENTIFIER
214 %token <id> PAPER_IDENTIFIER
216 %token <string> DURATION RESTNAME
217 %token <string> STRING
221 %type <outputdef> output_def
222 %type <scope> mudela_header mudela_header_body
223 %type <request> open_request_parens close_request_parens open_request close_request
224 %type <request> request_with_dir request_that_take_dir verbose_request
225 %type <i> sub_quotes sup_quotes
226 %type <music> simple_element request_chord command_element Simple_music Composite_music
227 %type <music> Alternative_music Repeated_music
228 %type <i> abbrev_type
229 %type <i> int unsigned
231 %type <i> optional_modality
232 %type <id> identifier_init
233 %type <duration> steno_duration optional_notemode_duration
234 %type <duration> entered_notemode_duration explicit_duration
235 %type <intvec> int_list
236 %type <reqvec> pre_requests post_requests
237 %type <request> gen_text_def
238 %type <pitch> explicit_musical_pitch steno_musical_pitch musical_pitch absolute_musical_pitch
239 %type <pitch> steno_tonic_pitch
241 %type <pitch_arr> pitch_list
243 %type <pitch_arr> chord_additions chord_subtractions chord_notes
244 %type <pitch> chord_addsub chord_note chord_inversion
245 %type <midi> midi_block midi_body
246 %type <duration> duration_length
248 %type <scalar> scalar
249 %type <music> Music Sequential_music Simultaneous_music Music_sequence
250 %type <music> relative_music re_rhythmed_music
251 %type <music> property_def translator_change
252 %type <music_list> Music_list
253 %type <paper> paper_block paper_def_body
254 %type <real> real_expression real real_with_dimension
255 %type <request> abbrev_command_req
256 %type <request> post_request
257 %type <request> command_req verbose_command_req
258 %type <request> extender_req
259 %type <request> hyphen_req
260 %type <string> string
261 %type <score> score_block score_body
262 %type <intarr> shape_array
264 %type <string> script_abbreviation
265 %type <trans> translator_spec_block translator_spec_body
266 %type <tempo> tempo_request
267 %type <notenametab> notenames_body notenames_block chordmodifiers_block
278 | mudela toplevel_expression {}
279 | mudela assignment { }
281 | mudela check_version { }
286 THIS->lexer_p_->set_notename_table ($1);
288 | chordmodifiers_block {
289 THIS->lexer_p_->set_chordmodifier_table ($1);
292 delete header_global_p;
293 header_global_p = $1;
296 score_global_array.push ($1);
299 Identifier * id = new
300 Paper_def_identifier ($1, PAPER_IDENTIFIER);
301 THIS->lexer_p_->set_identifier ("$defaultpaper", id)
304 Identifier * id = new
305 Midi_def_identifier ($1, MIDI_IDENTIFIER);
306 THIS->lexer_p_->set_identifier ("$defaultmidi", id)
313 SCMFILE STRING semicolon {
314 read_lily_scm_file (*$2);
317 | SCM_T STRING semicolon {
318 gh_eval_str ($2->ch_l ());
323 VERSION STRING semicolon {
324 Mudela_version ver (*$2);
325 if (!((ver >= oldest_version) && (ver <= version))) {
326 if (THIS->ignore_version_b_) {
327 THIS->here_input ().error (_f ("incorrect mudela version: %s (%s, %s)", ver.str (), oldest_version.str (), version.str ()));
329 THIS->fatal_error_i_ = 1;
330 THIS->parser_error (_f ("incorrect mudela version: %s (%s, %s)", ver.str (), oldest_version.str (), version.str ()));
337 chordmodifiers_block:
338 CHORDMODIFIERS '{' notenames_body '}' { $$ = $3; }
343 NOTENAMES '{' notenames_body '}' { $$ = $3; }
350 $$ = new Notename_table;
352 | NOTENAME_TABLE_IDENTIFIER {
353 $$ = $1-> access_content_Notename_table(true);
355 | notenames_body STRING '=' explicit_musical_pitch {
366 THIS->lexer_p_-> scope_l_arr_.push ($$);
368 | mudela_header_body assignment semicolon {
374 HEADER '{' mudela_header_body '}' {
376 THIS->lexer_p_-> scope_l_arr_.pop ();
386 THIS->remember_spot ();
388 /* cont */ '=' identifier_init {
389 THIS->lexer_p_->set_identifier (*$1, $4);
390 $4->init_b_ = THIS->init_parse_b_;
391 $4->set_spot (THIS->pop_spot ());
399 $$ = new Score_identifier ($1, SCORE_IDENTIFIER);
402 | chordmodifiers_block {
403 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
406 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
409 $$ = new Paper_def_identifier ($1, PAPER_IDENTIFIER);
412 $$ = new Midi_def_identifier ($1, MIDI_IDENTIFIER);
415 | translator_spec_block {
416 $$ = new Translator_identifier ($1, TRANS_IDENTIFIER);
419 $$ = new Music_identifier ($1, MUSIC_IDENTIFIER);
423 $$ = new Request_identifier ($1, REQUEST_IDENTIFIER);
425 | explicit_duration {
426 $$ = new Duration_identifier ($1, DURATION_IDENTIFIER);
429 $$ = new Real_identifier (new Real ($1), REAL_IDENTIFIER);
432 $$ = new String_identifier ($1, STRING_IDENTIFIER);
435 $$ = new int_identifier (new int ($1), INT_IDENTIFIER);
439 translator_spec_block:
440 TRANSLATOR '{' translator_spec_body '}'
446 translator_spec_body:
448 $$ = $1->access_content_Translator (true);
449 $$-> set_spot (THIS->here_input ());
451 | TYPE STRING semicolon {
452 Translator* t = get_translator_l (*$2);
453 Translator_group * tg = dynamic_cast<Translator_group*> (t);
456 THIS->parser_error (_("Need a translator group for a context"));
459 t->set_spot (THIS->here_input ());
463 | translator_spec_body STRING '=' identifier_init semicolon {
465 String_identifier *s = dynamic_cast<String_identifier*> (id);
466 Real_identifier *r= dynamic_cast<Real_identifier*>(id);
467 int_identifier *i = dynamic_cast<int_identifier*> (id);
470 if (s) str = *s->access_content_String (false);
471 if (i) str = to_str (*i->access_content_int (false));
472 if (r) str = to_str (*r->access_content_Real (false));
474 THIS->parser_error (_("Wrong type for property value"));
478 Translator_group * tr = dynamic_cast<Translator_group*>($$);
479 tr->set_property (*$2, str);
481 | translator_spec_body NAME STRING semicolon {
485 | translator_spec_body CONSISTS STRING semicolon {
486 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, true);
489 | translator_spec_body CONSISTSEND STRING semicolon {
490 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, true);
493 | translator_spec_body ACCEPTS STRING semicolon {
494 dynamic_cast<Translator_group*> ($$)-> set_acceptor (*$3, true);
497 | translator_spec_body REMOVE STRING semicolon {
498 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, false);
507 SCORE { THIS->remember_spot ();
509 /*cont*/ '{' score_body '}' {
511 $$->set_spot (THIS->pop_spot ());
512 if (!$$->def_p_arr_.size ())
513 $$->add_output (THIS->default_paper_p ());
522 $$ = $1->access_content_Score (true);
524 | score_body mudela_header {
529 $2->warning (_ ("More than one music block"));
532 | score_body output_def {
554 PAPER '{' paper_def_body '}' {
556 THIS-> lexer_p_->scope_l_arr_.pop ();
563 Paper_def *p = THIS->default_paper_p ();
564 THIS-> lexer_p_-> scope_l_arr_.push (p->scope_p_);
568 Paper_def *p = $1->access_content_Paper_def (true);
569 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
572 | paper_def_body int '=' FONT STRING { // ugh, what a syntax
573 Lookup * l = new Lookup;
576 $$->set_lookup ($2, l);
578 | paper_def_body assignment semicolon {
581 | paper_def_body translator_spec_block {
582 $$->assign_translator ($2);
584 | paper_def_body SHAPE '=' shape_array semicolon {
585 $$->shape_int_a_ = *$4;
588 | paper_def_body error {
595 real_expression { $$ = $1; }
618 | real_with_dimension
620 $$= *$1->access_content_Real (false);
622 | '-' real_expression %prec UNARY_MINUS {
625 | real_expression '*' real_expression {
628 | real_expression '/' real_expression {
631 | real_expression '+' real_expression {
634 | real_expression '-' real_expression {
637 | '(' real_expression ')' {
645 $$ = new Array<Interval>;
647 | shape_array real real {
648 $$->push(Interval($2, $2 + $3));
657 '{' midi_body '}' { $$ = $3; }
660 midi_body: /* empty */ {
661 $$ = THIS->default_midi_p ();
664 $$ = $1-> access_content_Midi_def (true);
666 | midi_body assignment semicolon {
669 | midi_body translator_spec_block {
670 $$-> assign_translator ($2);
672 | midi_body tempo_request semicolon {
673 $$->set_tempo ($2->dur_.length_mom (), $2->metronome_i_);
682 TEMPO steno_duration '=' unsigned {
686 $$-> metronome_i_ = $4;
690 Music_list: /* empty */ {
710 | ALTERNATIVE Music_sequence {
712 $2->set_spot (THIS->here_input ());
720 REPEAT STRING unsigned Music Alternative_music
722 Music_sequence* m = dynamic_cast <Music_sequence*> ($5);
723 if (m && $3 < m->length_i ())
724 $5->warning ("More alternatives than repeats. Junking excess alternatives.");
726 Repeated_music * r = new Repeated_music ($4, $3 >? 1, m);
728 r->fold_b_ = (*$2 == "fold");
729 r->semi_fold_b_ = (*$2 == "semi");
731 r->set_spot (THIS->here_input ());
736 Music_sequence: '{' Music_list '}' {
737 $$ = new Music_sequence ($2);
741 Sequential_music: '{' Music_list '}' {
742 $$ = new Sequential_music ($2);
746 Simultaneous_music: '<' Music_list '>' {
747 $$ = new Simultaneous_music ($2);
752 request_chord { $$ = $1; }
753 | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); }
756 | Simple_music '*' unsigned '/' unsigned {
758 $$ = new Time_scaled_music ($3, $5, $1);
760 | Simple_music '*' unsigned {
761 $$ = new Time_scaled_music ($3, 1, $1);
767 CONTEXT STRING Music {
768 Context_specced_music *csm = new Context_specced_music ($3);
770 csm->translator_type_str_ = *$2;
771 csm->translator_id_str_ = "";
777 $$ = new Grace_music ($2);
779 | CONTEXT STRING '=' STRING Music {
780 Context_specced_music *csm = new Context_specced_music ($5);
782 csm->translator_type_str_ = *$2;
783 csm->translator_id_str_ = *$4;
790 THIS->remember_spot ();
793 unsigned '/' unsigned Music
796 $$ = new Time_scaled_music ($3, $5, $6);
797 $$->set_spot (THIS->pop_spot ());
799 | Repeated_music { $$ = $1; }
800 | Simultaneous_music { $$ = $1; }
801 | Sequential_music { $$ = $1; }
802 | TRANSPOSE musical_pitch Music {
803 $$ = new Transposed_music ($3, *$2);
806 | TRANSPOSE steno_tonic_pitch Music {
807 $$ = new Transposed_music ($3, *$2);
811 { THIS->lexer_p_->push_note_state (); }
814 THIS->lexer_p_->pop_state ();
817 { THIS->lexer_p_->push_chord_state (); }
821 THIS->lexer_p_->pop_state ();
824 { THIS->lexer_p_->push_lyric_state (); }
828 THIS->lexer_p_->pop_state ();
830 | relative_music { $$ = $1; }
831 | re_rhythmed_music { $$ = $1; }
835 RELATIVE absolute_musical_pitch Music {
836 $$ = new Relative_octave_music ($3, *$2);
843 $$ = new Re_rhythmed_music ($3, $2);
848 TRANSLATOR STRING '=' STRING {
849 Change_translator * t = new Change_translator;
850 t-> change_to_type_str_ = *$2;
851 t-> change_to_id_str_ = *$4;
854 $$->set_spot (THIS->here_input ());
861 PROPERTY STRING '.' STRING '=' scalar {
862 Translation_property *t = new Translation_property;
867 Context_specced_music *csm = new Context_specced_music (t);
869 $$->set_spot (THIS->here_input ());
871 csm-> translator_type_str_ = *$2;
880 string { $$ = new Scalar (*$1); delete $1; }
881 | int { $$ = new Scalar ($1); }
886 pre_requests simple_element post_requests {
887 Music_sequence *l = dynamic_cast<Music_sequence*>($2);
888 for (int i=0; i < $1->size(); i++)
889 l->add_music ($1->elem(i));
890 for (int i=0; i < $3->size(); i++)
891 l->add_music ($3->elem(i));
900 $$ = new Request_chord;
901 $$-> set_spot (THIS->here_input ());
902 $1-> set_spot (THIS->here_input ());
903 ((Simultaneous_music*)$$) ->add_music ($1);//ugh
909 | verbose_command_req semicolon { $$ = $1; }
920 $$ = new Barcheck_req;
926 Span_req*b= new Span_req;
927 b->span_dir_ = START;
928 b->span_type_str_ = "beam";
932 Span_req*b= new Span_req;
934 b->span_type_str_ = "beam";
938 $$ = new Breathing_sign_req;
945 $$ = new Bar_req (*$2);
949 $$ = new Mark_req (*$2);
953 $$ = new Mark_req (to_str ($2));
955 | TIME_T unsigned '/' unsigned {
956 Time_signature_change_req *m = new Time_signature_change_req;
962 Break_req * b = new Break_req;
964 b-> set_spot (THIS->here_input ());
967 | SKIP duration_length {
968 Skip_req * skip_p = new Skip_req;
969 skip_p->duration_ = *$2;
977 $$ = new Cadenza_req ($2);
979 | PARTIAL duration_length {
980 $$ = new Partial_measure_req ($2->length_mom ());
984 $$ = new Clef_change_req (*$2);
987 | KEY NOTENAME_PITCH optional_modality {
988 Key_change_req *key_p= new Key_change_req;
989 key_p->key_.pitch_arr_.push (*$2);
990 key_p->key_.ordinary_key_b_ = true;
991 key_p->key_.modality_i_ = $3;
995 | KEYSIGNATURE pitch_list {
996 Key_change_req *key_p= new Key_change_req;
997 key_p->key_.pitch_arr_ = *$2;
998 key_p->key_.ordinary_key_b_ = false;
1007 $$ = new Link_array<Request>;
1009 | post_requests post_request {
1010 $2->set_spot (THIS->here_input ());
1022 request_that_take_dir:
1025 | script_abbreviation {
1026 Identifier*i = THIS->lexer_p_->lookup_identifier ("dash-" + *$1);
1027 Articulation_req *a = new Articulation_req;
1028 a->articulation_str_ = *i->access_content_String (false);
1035 script_dir request_that_take_dir {
1036 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1037 gs->dir_ = Direction ($1);
1039 $2->warning ("Can't specify direction for this request");
1045 REQUEST_IDENTIFIER {
1046 $$ = (Request*)$1->access_content_Request (true);
1047 $$->set_spot (THIS->here_input ());
1049 | TEXTSCRIPT STRING STRING {
1050 Text_script_req *ts_p = new Text_script_req;
1051 ts_p-> text_str_ = *$2;
1052 ts_p-> style_str_ = *$3;
1053 ts_p->set_spot (THIS->here_input ());
1058 | SPANREQUEST int STRING {
1059 Span_req * sp_p = new Span_req;
1060 sp_p-> span_dir_ = Direction($2);
1061 sp_p->span_type_str_ = *$3;
1062 sp_p->set_spot (THIS->here_input ());
1066 Tremolo_req* a = new Tremolo_req;
1067 a->set_spot (THIS->here_input ());
1072 Articulation_req * a = new Articulation_req;
1073 a->articulation_str_ = *$2;
1074 a->set_spot (THIS->here_input ());
1107 steno_musical_pitch:
1111 | NOTENAME_PITCH sup_quotes {
1113 $$->octave_i_ += $2;
1115 | NOTENAME_PITCH sub_quotes {
1117 $$->octave_i_ += - $2;
1125 | TONICNAME_PITCH sup_quotes {
1127 $$->octave_i_ += $2;
1129 | TONICNAME_PITCH sub_quotes {
1131 $$->octave_i_ += - $2;
1135 explicit_musical_pitch:
1136 MUSICAL_PITCH '{' int_list '}' {/* ugh */
1137 Array<int> &a = *$3;
1139 $$ = new Musical_pitch;
1140 $$->octave_i_ = a[0];
1141 $$->notename_i_ = a[1];
1142 $$->accidental_i_ = a[2];
1148 steno_musical_pitch {
1150 THIS->set_last_pitch ($1);
1152 | explicit_musical_pitch {
1154 THIS->set_last_pitch ($1);
1159 DURATION '{' int_list '}' {
1161 Array<int> &a = *$3;
1164 $$-> durlog_i_ = a[0];
1165 $$-> dots_i_ = a[1];
1173 if (!THIS->lexer_p_->lyric_state_b ())
1174 THIS->parser_error (_ ("have to be in Lyric mode for lyrics"));
1175 $$ = new Extender_req;
1181 if (!THIS->lexer_p_->lyric_state_b ())
1182 THIS->parser_error (_ ("have to be in Lyric mode for lyrics"));
1183 $$ = new Hyphen_req;
1188 close_request_parens {
1190 dynamic_cast<Span_req*> ($$)->span_dir_ = START;
1193 close_request_parens:
1195 Span_req* s= new Span_req;
1197 s->span_type_str_ = "slur";
1200 Span_req*s =new Span_req;
1202 s->span_type_str_ = "crescendo";
1205 Span_req*s =new Span_req;
1207 s->span_type_str_ = "decrescendo";
1213 open_request_parens {
1215 dynamic_cast<Span_req*> ($$)->span_dir_ = STOP;
1219 open_request_parens:
1221 Span_req *s = new Span_req;
1222 s->span_type_str_ = "crescendo";
1226 Span_req* s= new Span_req;
1228 s->span_type_str_ = "slur";
1234 Text_script_req *t = new Text_script_req;
1238 $$->set_spot (THIS->here_input ());
1241 Text_script_req* t = new Text_script_req;
1243 t->text_str_ = to_str ($1);
1244 t->style_str_ = "finger";
1245 $$->set_spot (THIS->here_input ());
1249 script_abbreviation:
1251 $$ = new String ("hat");
1254 $$ = new String ("plus");
1257 $$ = new String ("dash");
1260 $$ = new String ("bar");
1263 $$ = new String ("larger");
1266 $$ = new String ("dot");
1274 | '-' { $$ = CENTER; }
1279 $$ = new Link_array<Request>;
1281 | pre_requests open_request {
1286 absolute_musical_pitch:
1287 steno_musical_pitch {
1296 | duration_length '*' unsigned {
1297 $$->plet_.iso_i_ *= $3;
1299 | duration_length '/' unsigned {
1300 $$->plet_.type_i_ *= $3;
1304 entered_notemode_duration:
1306 THIS->set_last_duration ($1);
1310 optional_notemode_duration:
1312 $$ = new Duration (THIS->default_duration_);
1314 | entered_notemode_duration {
1322 if (!Duration::duration_type_b ($1))
1323 THIS->parser_error (_f ("not a duration: %d", $1));
1325 $$->durlog_i_ = Duration_convert::i2_type ($1);
1328 | DURATION_IDENTIFIER {
1329 $$ = $1->access_content_Duration (true);
1331 | steno_duration '.' {
1342 if (!Duration::duration_type_b ($2))
1343 THIS->parser_error (_f ("not a duration: %d", $2));
1345 THIS->parser_error (_ ("can't abbreviate"));
1352 musical_pitch exclamations questions optional_notemode_duration {
1353 if (!THIS->lexer_p_->note_state_b ())
1354 THIS->parser_error (_ ("have to be in Note mode for notes"));
1357 Note_req *n = new Note_req;
1363 n->cautionary_b_ = $3 % 2;
1364 n->forceacc_b_ = $2 % 2 || n->cautionary_b_;
1366 Simultaneous_music*v = new Request_chord;
1367 v->set_spot (THIS->here_input ());
1368 n->set_spot (THIS->here_input ());
1375 This rhythm option introduces a lot of shift/reduce conflicts;
1376 ie, for every optional_notemode_duration.
1377 However, we always want the default behaviour, which is to shift:
1378 if an optional_notemode_duration is allowed, a following duration
1379 is to be taken as this default duration. Thus
1383 are three notes, ie: c4 c8 c4.
1384 Parsing whitespace is a snaky thing to do.
1386 | entered_notemode_duration {
1387 if (!THIS->lexer_p_->note_state_b ())
1388 THIS->parser_error (_ ("have to be in Note mode for notes"));
1390 Note_req *n = new Note_req;
1392 n->pitch_ = THIS->default_pitch_;
1396 Simultaneous_music*v = new Request_chord;
1397 v->set_spot (THIS->here_input ());
1398 n->set_spot (THIS->here_input ());
1405 | RESTNAME optional_notemode_duration {
1406 $$ = THIS->get_rest_element (*$1, $2);
1407 delete $1; // delete notename
1409 | MEASURES optional_notemode_duration {
1410 Multi_measure_rest_req* m = new Multi_measure_rest_req;
1414 Simultaneous_music*velt_p = new Request_chord;
1415 velt_p->set_spot (THIS->here_input ());
1416 velt_p->add_music (m);
1419 | REPETITIONS optional_notemode_duration {
1420 Repetitions_req* r = new Repetitions_req;
1424 Simultaneous_music*velt_p = new Request_chord;
1425 velt_p->set_spot (THIS->here_input ());
1426 velt_p->add_music (r);
1429 | STRING optional_notemode_duration {
1430 if (!THIS->lexer_p_->lyric_state_b ())
1431 THIS->parser_error (_ ("have to be in Lyric mode for lyrics"));
1432 $$ = THIS->get_word_element (*$1, $2);
1436 if (!THIS->lexer_p_->chord_state_b ())
1437 THIS->parser_error (_ ("have to be in Chord mode for chords"));
1443 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion {
1444 $$ = THIS->get_chord (*$1, $3, $4, $5, *$2);
1449 $$ = new Array<Musical_pitch>;
1458 $$ = new Array<Musical_pitch>;
1461 | chord_notes '.' chord_addsub {
1469 $$ = new Array<Musical_pitch>;
1478 forevery : X : optional_X sucks. Devise a solution.
1484 | CHORDMODIFIER_PITCH
1491 | '/' steno_tonic_pitch {
1498 $$ = new Musical_pitch;
1499 $$->notename_i_ = ($1 - 1) % 7;
1500 $$->octave_i_ = $1 > 7 ? 1 : 0;
1501 $$->accidental_i_ = 0;
1504 $$ = new Musical_pitch;
1505 $$->notename_i_ = ($1 - 1) % 7;
1506 $$->octave_i_ = $1 > 7 ? 1 : 0;
1507 $$->accidental_i_ = 1;
1510 $$ = new Musical_pitch;
1511 $$->notename_i_ = ($1 - 1) % 7;
1512 $$->octave_i_ = $1 > 7 ? 1 : 0;
1513 $$->accidental_i_ = -1;
1521 $$ = new Array<Musical_pitch>;
1523 | pitch_list musical_pitch {
1555 $$ = *$1->access_content_int (false);
1564 | STRING_IDENTIFIER {
1565 $$ = $1->access_content_String (true);
1567 | string '+' string {
1576 | exclamations '!' { $$ ++; }
1581 | questions '?' { $$ ++; }
1591 My_lily_parser::set_yydebug (bool b)
1598 My_lily_parser::do_yyparse ()
1600 yyparse ((void*)this);