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 << _f ("Oldest supported input version: %s", oldest_version.str ())
58 // needed for bison.simple's malloc() and free()
65 #define YYERROR_VERBOSE 1
67 #define YYPARSE_PARAM my_lily_parser_l
68 #define YYLEX_PARAM my_lily_parser_l
69 #define THIS ((My_lily_parser *) my_lily_parser_l)
71 #define yyerror THIS->parser_error
72 #define ARRAY_SIZE(a,s) if (a.size () != s) THIS->parser_error (_f ("Expecting %d arguments", s))
79 Array<Musical_pitch> *pitch_arr;
80 Link_array<Request> *reqvec;
81 Array<String> * strvec;
83 Notename_table *chordmodifiertab;
87 Music_list *music_list;
92 Music_output_def * outputdef;
93 Musical_pitch * pitch;
96 Notename_table *notenametab;
112 yylex (YYSTYPE *s, void * v_l)
114 My_lily_parser *pars_l = (My_lily_parser*) v_l;
115 My_lily_lexer * lex_l = pars_l->lexer_p_;
117 lex_l->lexval_l = (void*) s;
118 return lex_l->yylex ();
126 /* tokens which are not keywords */
134 %token CHORDMODIFIERS
188 %token E_EXCLAMATION E_SMALLER E_BIGGER E_CHAR CHORD_MINUS CHORD_CARET
190 %type <i> exclamations questions
192 %token <pitch> NOTENAME_PITCH
193 %token <pitch> TONICNAME_PITCH
194 %token <pitch> CHORDMODIFIER_PITCH
195 %token <id> DURATION_IDENTIFIER
196 %token <id> IDENTIFIER
197 %token <id> NOTENAME_TABLE_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 <string> DURATION RESTNAME
209 %token <string> STRING
213 %type <outputdef> output_def
214 %type <scope> mudela_header mudela_header_body
215 %type <request> open_request_parens close_request_parens open_request close_request
216 %type <request> request_with_dir request_that_take_dir verbose_request
217 %type <i> sub_quotes sup_quotes
218 %type <music> simple_element request_chord command_element Simple_music Composite_music
219 %type <music> Alternative_music Repeated_music
220 %type <i> abbrev_type
221 %type <i> int unsigned
223 %type <i> optional_modality
224 %type <id> identifier_init
225 %type <duration> steno_duration optional_notemode_duration
226 %type <duration> entered_notemode_duration explicit_duration
227 %type <intvec> int_list
228 %type <reqvec> pre_requests post_requests
229 %type <request> gen_text_def
230 %type <pitch> explicit_musical_pitch steno_musical_pitch musical_pitch absolute_musical_pitch
231 %type <pitch> steno_tonic_pitch
233 %type <pitch_arr> pitch_list
235 %type <pitch_arr> chord_additions chord_subtractions chord_notes chord_step
236 %type <pitch> chord_note chord_inversion
237 %type <midi> midi_block midi_body
238 %type <duration> duration_length
240 %type <scalar> 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> abbrev_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
252 %type <string> string
253 %type <score> score_block score_body
254 %type <realarr> real_array
256 %type <string> script_abbreviation
257 %type <trans> translator_spec_block translator_spec_body
258 %type <tempo> tempo_request
259 %type <notenametab> notenames_body notenames_block chordmodifiers_block
270 | mudela toplevel_expression {}
271 | mudela assignment { }
274 THIS->error_level_i_ =1;
280 THIS->lexer_p_->set_notename_table ($1);
282 | chordmodifiers_block {
283 THIS->lexer_p_->set_chordmodifier_table ($1);
286 delete header_global_p;
287 header_global_p = $1;
290 score_global_array.push ($1);
293 Identifier * id = new
294 Paper_def_identifier ($1, PAPER_IDENTIFIER);
295 THIS->lexer_p_->set_identifier ("$defaultpaper", id)
298 Identifier * id = new
299 Midi_def_identifier ($1, MIDI_IDENTIFIER);
300 THIS->lexer_p_->set_identifier ("$defaultmidi", id)
307 SCMFILE STRING semicolon {
308 read_lily_scm_file (*$2);
311 | SCM_T STRING semicolon {
312 if (THIS->lexer_p_->main_input_b_ && safe_global_b)
313 error (_("Can't evaluate Scheme in safe mode"));
314 gh_eval_str ($2->ch_l ());
319 chordmodifiers_block:
320 CHORDMODIFIERS '{' notenames_body '}' { $$ = $3; }
325 NOTENAMES '{' notenames_body '}' { $$ = $3; }
332 $$ = new Notename_table;
334 | NOTENAME_TABLE_IDENTIFIER {
335 $$ = $1-> access_content_Notename_table(true);
337 | notenames_body STRING '=' explicit_musical_pitch {
348 THIS->lexer_p_-> scope_l_arr_.push ($$);
350 | mudela_header_body assignment semicolon {
356 HEADER '{' mudela_header_body '}' {
358 THIS->lexer_p_-> scope_l_arr_.pop ();
368 THIS->remember_spot ();
370 /* cont */ '=' identifier_init {
371 THIS->lexer_p_->set_identifier (*$1, $4);
372 $4->init_b_ = THIS->init_parse_b_;
373 $4->set_spot (THIS->pop_spot ());
381 $$ = new Score_identifier ($1, SCORE_IDENTIFIER);
384 | chordmodifiers_block {
385 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
388 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
391 $$ = new Paper_def_identifier ($1, PAPER_IDENTIFIER);
394 $$ = new Midi_def_identifier ($1, MIDI_IDENTIFIER);
397 | translator_spec_block {
398 $$ = new Translator_identifier ($1, TRANS_IDENTIFIER);
401 $$ = new Music_identifier ($1, MUSIC_IDENTIFIER);
405 $$ = new Request_identifier ($1, REQUEST_IDENTIFIER);
407 | explicit_duration {
408 $$ = new Duration_identifier ($1, DURATION_IDENTIFIER);
411 $$ = new Real_identifier (new Real ($1), REAL_IDENTIFIER);
414 $$ = new String_identifier ($1, STRING_IDENTIFIER);
417 $$ = new int_identifier (new int ($1), INT_IDENTIFIER);
421 translator_spec_block:
422 TRANSLATOR '{' translator_spec_body '}'
428 translator_spec_body:
430 $$ = $1->access_content_Translator (true);
431 Translator_group * tg = dynamic_cast<Translator_group*> ($$);
433 THIS->parser_error (_("Need a translator group for a context"));
434 $$-> set_spot (THIS->here_input ());
436 | TYPE STRING semicolon {
437 Translator* t = get_translator_l (*$2);
438 Translator_group * tg = dynamic_cast<Translator_group*> (t);
441 THIS->parser_error (_("Need a translator group for a context"));
444 t->set_spot (THIS->here_input ());
448 | translator_spec_body STRING '=' identifier_init semicolon {
450 String_identifier *s = dynamic_cast<String_identifier*> (id);
451 Real_identifier *r= dynamic_cast<Real_identifier*>(id);
452 int_identifier *i = dynamic_cast<int_identifier*> (id);
455 if (s) str = *s->access_content_String (false);
456 if (i) str = to_str (*i->access_content_int (false));
457 if (r) str = to_str (*r->access_content_Real (false));
459 THIS->parser_error (_("Wrong type for property value"));
463 Translator_group* tg = dynamic_cast<Translator_group*> ($$);
465 THIS->parser_error (_("Need a translator group for a context"));
466 tg->set_property (*$2, str);
468 | translator_spec_body NAME STRING semicolon {
472 | translator_spec_body CONSISTS STRING semicolon {
473 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, true);
476 | translator_spec_body CONSISTSEND STRING semicolon {
477 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, true);
480 | translator_spec_body ACCEPTS STRING semicolon {
481 dynamic_cast<Translator_group*> ($$)-> set_acceptor (*$3, true);
484 | translator_spec_body REMOVE STRING semicolon {
485 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, false);
496 /*cont*/ '{' score_body '}' {
498 if (!$$->def_p_arr_.size ())
499 $$->add_output (THIS->default_paper_p ());
505 $$->set_spot (THIS->here_input ());
508 $$ = $1->access_content_Score (true);
510 | score_body mudela_header {
515 $2->warning (_ ("More than one music block"));
518 | score_body output_def {
540 PAPER '{' paper_def_body '}' {
542 THIS-> lexer_p_->scope_l_arr_.pop ();
549 Paper_def *p = THIS->default_paper_p ();
550 THIS-> lexer_p_-> scope_l_arr_.push (p->scope_p_);
554 Paper_def *p = $1->access_content_Paper_def (true);
555 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
558 | paper_def_body int '=' FONT STRING { // ugh, what a syntax
559 Lookup * l = new Lookup;
562 $$->set_lookup ($2, l);
564 | paper_def_body assignment semicolon {
567 | paper_def_body translator_spec_block {
568 $$->assign_translator ($2);
570 | paper_def_body SHAPE real_array semicolon {
575 warning (_ ("Need even number of args for shape array"));
577 for (int i=0; i < $3->size (); i+=2)
579 Real l = $3->elem (i);
580 $$->shape_int_a_.push (Interval (l,
581 l + $3->elem (i+1)));
585 | paper_def_body error {
611 | real_with_dimension
613 $$= *$1->access_content_Real (false);
615 | '-' real %prec UNARY_MINUS {
638 $$ = new Array<Real>;
642 $$ = new Array<Real>;
644 | real_array ',' real {
655 '{' midi_body '}' { $$ = $3; }
658 midi_body: /* empty */ {
659 $$ = THIS->default_midi_p ();
662 $$ = $1-> access_content_Midi_def (true);
664 | midi_body assignment semicolon {
667 | midi_body translator_spec_block {
668 $$-> assign_translator ($2);
670 | midi_body tempo_request semicolon {
671 $$->set_tempo ($2->dur_.length_mom (), $2->metronome_i_);
680 TEMPO steno_duration '=' unsigned {
684 $$-> metronome_i_ = $4;
688 Music_list: /* empty */ {
690 $$->set_spot (THIS->here_input ());
709 | ALTERNATIVE Music_sequence {
711 $2->set_spot (THIS->here_input ());
719 REPEAT STRING unsigned Music Alternative_music
721 Music_sequence* m = dynamic_cast <Music_sequence*> ($5);
722 if (m && $3 < m->length_i ())
723 $5->warning (_ ("More alternatives than repeats. Junking excess alternatives."));
725 Repeated_music * r = new Repeated_music ($4, $3 >? 1, m);
727 r->fold_b_ = (*$2 == "fold");
728 r->volta_fold_b_ = (*$2 == "volta");
730 r->set_spot ($4->spot ());
734 Music_sequence: '{' Music_list '}' {
735 $$ = new Music_sequence ($2);
736 $$->set_spot ($2->spot ());
741 SEQUENTIAL '{' Music_list '}' {
742 $$ = new Sequential_music ($3);
743 $$->set_spot ($3->spot ());
745 | '{' Music_list '}' {
746 $$ = new Sequential_music ($2);
747 $$->set_spot ($2->spot ());
752 SIMULTANEOUS '{' Music_list '}'{
753 $$ = new Simultaneous_music ($3);
754 $$->set_spot ($3->spot ());
756 | '<' Music_list '>' {
757 $$ = new Simultaneous_music ($2);
758 $$->set_spot ($2->spot ());
763 request_chord { $$ = $1; }
764 | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); }
767 | Simple_music '*' unsigned '/' unsigned {
769 $$->compress (Moment($3, $5 ));
771 | Simple_music '*' unsigned {
773 $$->compress (Moment ($3, 1));
779 CONTEXT STRING Music {
780 Context_specced_music *csm = new Context_specced_music ($3);
782 csm->translator_type_str_ = *$2;
783 csm->translator_id_str_ = "";
789 $$ = new Grace_music ($2);
791 | CONTEXT STRING '=' STRING Music {
792 Context_specced_music *csm = new Context_specced_music ($5);
794 csm->translator_type_str_ = *$2;
795 csm->translator_id_str_ = *$4;
802 THIS->remember_spot ();
805 unsigned '/' unsigned Music
808 $$ = new Time_scaled_music ($3, $5, $6);
809 $$->set_spot (THIS->pop_spot ());
811 | Repeated_music { $$ = $1; }
812 | Simultaneous_music { $$ = $1; }
813 | Sequential_music { $$ = $1; }
814 | TRANSPOSE musical_pitch Music {
815 $$ = new Transposed_music ($3, *$2);
818 | TRANSPOSE steno_tonic_pitch Music {
819 $$ = new Transposed_music ($3, *$2);
823 { THIS->lexer_p_->push_note_state (); }
826 THIS->lexer_p_->pop_state ();
829 { THIS->lexer_p_->push_chord_state (); }
833 THIS->lexer_p_->pop_state ();
836 { THIS->lexer_p_->push_lyric_state (); }
840 THIS->lexer_p_->pop_state ();
842 | relative_music { $$ = $1; }
843 | re_rhythmed_music { $$ = $1; }
847 RELATIVE absolute_musical_pitch Music {
848 $$ = new Relative_octave_music ($3, *$2);
854 ADDLYRICS Music Music {
855 Lyric_combine_music * l = new Lyric_combine_music ($2, $3);
861 TRANSLATOR STRING '=' STRING {
862 Change_translator * t = new Change_translator;
863 t-> change_to_type_str_ = *$2;
864 t-> change_to_id_str_ = *$4;
867 $$->set_spot (THIS->here_input ());
874 PROPERTY STRING '.' STRING '=' scalar {
875 Translation_property *t = new Translation_property;
880 Context_specced_music *csm = new Context_specced_music (t);
882 $$->set_spot (THIS->here_input ());
884 csm-> translator_type_str_ = *$2;
893 string { $$ = new Scalar (*$1); delete $1; }
894 | int { $$ = new Scalar ($1); }
899 pre_requests simple_element post_requests {
900 Music_sequence *l = dynamic_cast<Music_sequence*>($2);
901 for (int i=0; i < $1->size(); i++)
902 l->add_music ($1->elem(i));
903 for (int i=0; i < $3->size(); i++)
904 l->add_music ($3->elem(i));
913 $$ = new Request_chord;
914 $$-> set_spot (THIS->here_input ());
915 $1-> set_spot (THIS->here_input ());
916 ((Simultaneous_music*)$$) ->add_music ($1);//ugh
922 | verbose_command_req semicolon { $$ = $1; }
933 $$ = new Barcheck_req;
939 Span_req*b= new Span_req;
940 b->span_dir_ = START;
941 b->span_type_str_ = "beam";
945 if (!Duration::duration_type_b ($3))
946 THIS->parser_error (_f ("not a duration: %d", $3));
948 THIS->parser_error (_ ("Can't abbreviate"));
950 THIS->set_abbrev_beam ($3);
952 Chord_tremolo_req* a = new Chord_tremolo_req;
953 a->span_dir_ = START;
954 a->type_i_ = THIS->abbrev_beam_type_i_;
958 if (!THIS->abbrev_beam_type_i_)
960 Span_req*b= new Span_req;
962 b->span_type_str_ = "beam";
967 Chord_tremolo_req* a = new Chord_tremolo_req;
969 a->type_i_ = THIS->abbrev_beam_type_i_;
970 THIS->set_abbrev_beam (0);
975 $$ = new Breathing_sign_req;
982 $$ = new Bar_req (*$2);
986 $$ = new Mark_req (*$2);
990 $$ = new Mark_req (to_str ($2));
992 | TIME_T unsigned '/' unsigned {
993 Time_signature_change_req *m = new Time_signature_change_req;
999 Break_req * b = new Break_req;
1001 b-> set_spot (THIS->here_input ());
1004 | SKIP duration_length {
1005 Skip_req * skip_p = new Skip_req;
1006 skip_p->duration_ = *$2;
1013 | CADENZA unsigned {
1014 $$ = new Cadenza_req ($2);
1016 | PARTIAL duration_length {
1017 $$ = new Partial_measure_req ($2->length_mom ());
1021 $$ = new Clef_change_req (*$2);
1024 | KEY NOTENAME_PITCH optional_modality {
1025 Key_change_req *key_p= new Key_change_req;
1026 key_p->key_.pitch_arr_.push (*$2);
1027 key_p->key_.ordinary_key_b_ = true;
1028 key_p->key_.modality_i_ = $3;
1032 | KEYSIGNATURE pitch_list {
1033 Key_change_req *key_p= new Key_change_req;
1034 key_p->key_.pitch_arr_ = *$2;
1035 key_p->key_.ordinary_key_b_ = false;
1044 $$ = new Link_array<Request>;
1046 | post_requests post_request {
1047 $2->set_spot (THIS->here_input ());
1059 request_that_take_dir:
1062 | script_abbreviation {
1063 Identifier*i = THIS->lexer_p_->lookup_identifier ("dash-" + *$1);
1064 Articulation_req *a = new Articulation_req;
1065 a->articulation_str_ = *i->access_content_String (false);
1072 script_dir request_that_take_dir {
1073 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1074 gs->dir_ = Direction ($1);
1076 $2->warning (_ ("Can't specify direction for this request"));
1082 REQUEST_IDENTIFIER {
1083 $$ = (Request*)$1->access_content_Request (true);
1084 $$->set_spot (THIS->here_input ());
1086 | TEXTSCRIPT STRING STRING {
1087 Text_script_req *ts_p = new Text_script_req;
1088 ts_p-> text_str_ = *$2;
1089 ts_p-> style_str_ = *$3;
1090 ts_p->set_spot (THIS->here_input ());
1095 | SPANREQUEST int STRING {
1096 Span_req * sp_p = new Span_req;
1097 sp_p-> span_dir_ = Direction($2);
1098 sp_p->span_type_str_ = *$3;
1099 sp_p->set_spot (THIS->here_input ());
1103 Tremolo_req* a = new Tremolo_req;
1104 a->set_spot (THIS->here_input ());
1109 Articulation_req * a = new Articulation_req;
1110 a->articulation_str_ = *$2;
1111 a->set_spot (THIS->here_input ());
1144 steno_musical_pitch:
1148 | NOTENAME_PITCH sup_quotes {
1150 $$->octave_i_ += $2;
1152 | NOTENAME_PITCH sub_quotes {
1154 $$->octave_i_ += - $2;
1162 | TONICNAME_PITCH sup_quotes {
1164 $$->octave_i_ += $2;
1166 | TONICNAME_PITCH sub_quotes {
1168 $$->octave_i_ += - $2;
1172 explicit_musical_pitch:
1173 MUSICAL_PITCH '{' int_list '}' {/* ugh */
1174 Array<int> &a = *$3;
1176 $$ = new Musical_pitch;
1177 $$->octave_i_ = a[0];
1178 $$->notename_i_ = a[1];
1179 $$->accidental_i_ = a[2];
1185 steno_musical_pitch {
1187 THIS->set_last_pitch ($1);
1189 | explicit_musical_pitch {
1191 THIS->set_last_pitch ($1);
1196 DURATION '{' int_list '}' {
1198 Array<int> &a = *$3;
1201 $$-> durlog_i_ = a[0];
1202 $$-> dots_i_ = a[1];
1210 if (!THIS->lexer_p_->lyric_state_b ())
1211 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1212 $$ = new Extender_req;
1218 if (!THIS->lexer_p_->lyric_state_b ())
1219 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1220 $$ = new Hyphen_req;
1225 close_request_parens {
1227 dynamic_cast<Span_req*> ($$)->span_dir_ = START;
1230 close_request_parens:
1232 Span_req* s= new Span_req;
1234 s->span_type_str_ = "slur";
1237 Span_req*s =new Span_req;
1239 s->span_type_str_ = "crescendo";
1242 Span_req*s =new Span_req;
1244 s->span_type_str_ = "decrescendo";
1250 open_request_parens {
1252 dynamic_cast<Span_req*> ($$)->span_dir_ = STOP;
1256 open_request_parens:
1258 Span_req *s = new Span_req;
1259 s->span_type_str_ = "crescendo";
1263 Span_req* s= new Span_req;
1265 s->span_type_str_ = "slur";
1271 Text_script_req *t = new Text_script_req;
1275 $$->set_spot (THIS->here_input ());
1278 Text_script_req* t = new Text_script_req;
1280 t->text_str_ = to_str ($1);
1281 t->style_str_ = "finger";
1282 $$->set_spot (THIS->here_input ());
1286 script_abbreviation:
1288 $$ = new String ("hat");
1291 $$ = new String ("plus");
1294 $$ = new String ("dash");
1297 $$ = new String ("bar");
1300 $$ = new String ("larger");
1303 $$ = new String ("dot");
1311 | '-' { $$ = CENTER; }
1316 $$ = new Link_array<Request>;
1318 | pre_requests open_request {
1323 absolute_musical_pitch:
1324 steno_musical_pitch {
1333 | duration_length '*' unsigned {
1334 $$->plet_.iso_i_ *= $3;
1336 | duration_length '/' unsigned {
1337 $$->plet_.type_i_ *= $3;
1341 entered_notemode_duration:
1343 THIS->set_last_duration ($1);
1347 optional_notemode_duration:
1349 $$ = new Duration (THIS->default_duration_);
1351 | entered_notemode_duration {
1359 if (!Duration::duration_type_b ($1))
1360 THIS->parser_error (_f ("not a duration: %d", $1));
1362 $$->durlog_i_ = Duration_convert::i2_type ($1);
1365 | DURATION_IDENTIFIER {
1366 $$ = $1->access_content_Duration (true);
1368 | steno_duration '.' {
1379 if (!Duration::duration_type_b ($2))
1380 THIS->parser_error (_f ("not a duration: %d", $2));
1382 THIS->parser_error (_ ("Can't abbreviate"));
1389 musical_pitch exclamations questions optional_notemode_duration {
1390 if (!THIS->lexer_p_->note_state_b ())
1391 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1394 Note_req *n = new Note_req;
1400 if (THIS->abbrev_beam_type_i_)
1402 if (n->duration_.plet_b ())
1403 THIS->parser_error (_ ("Can't abbreviate tuplet"));
1405 n->duration_.set_plet (1, 2);
1407 n->cautionary_b_ = $3 % 2;
1408 n->forceacc_b_ = $2 % 2 || n->cautionary_b_;
1410 Simultaneous_music*v = new Request_chord;
1411 v->set_spot (THIS->here_input ());
1412 n->set_spot (THIS->here_input ());
1418 | RESTNAME optional_notemode_duration {
1419 $$ = THIS->get_rest_element (*$1, $2);
1420 delete $1; // delete notename
1422 | MEASURES optional_notemode_duration {
1423 Multi_measure_rest_req* m = new Multi_measure_rest_req;
1427 Simultaneous_music*velt_p = new Request_chord;
1428 velt_p->set_spot (THIS->here_input ());
1429 velt_p->add_music (m);
1432 | REPETITIONS optional_notemode_duration {
1433 Repetitions_req* r = new Repetitions_req;
1437 Simultaneous_music*velt_p = new Request_chord;
1438 velt_p->set_spot (THIS->here_input ());
1439 velt_p->add_music (r);
1442 | STRING optional_notemode_duration {
1443 if (!THIS->lexer_p_->lyric_state_b ())
1444 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1445 $$ = THIS->get_word_element (*$1, $2);
1449 if (!THIS->lexer_p_->chord_state_b ())
1450 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1456 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion {
1457 $$ = THIS->get_chord (*$1, $3, $4, $5, *$2);
1462 $$ = new Array<Musical_pitch>;
1464 | CHORD_MINUS chord_notes {
1473 | chord_notes '.' chord_step {
1481 $$ = new Array<Musical_pitch>;
1483 | CHORD_CARET chord_notes {
1493 | '/' steno_tonic_pitch {
1500 $$ = new Array<Musical_pitch>;
1503 | CHORDMODIFIER_PITCH {
1504 $$ = new Array<Musical_pitch>;
1507 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
1508 $$ = new Array<Musical_pitch>;
1516 $$ = new Musical_pitch;
1517 $$->notename_i_ = ($1 - 1) % 7;
1518 $$->octave_i_ = $1 > 7 ? 1 : 0;
1519 $$->accidental_i_ = 0;
1522 $$ = new Musical_pitch;
1523 $$->notename_i_ = ($1 - 1) % 7;
1524 $$->octave_i_ = $1 > 7 ? 1 : 0;
1525 $$->accidental_i_ = 1;
1527 | unsigned CHORD_MINUS {
1528 $$ = new Musical_pitch;
1529 $$->notename_i_ = ($1 - 1) % 7;
1530 $$->octave_i_ = $1 > 7 ? 1 : 0;
1531 $$->accidental_i_ = -1;
1539 $$ = new Array<Musical_pitch>;
1541 | pitch_list musical_pitch {
1574 $$ = *$1->access_content_int (false);
1583 | STRING_IDENTIFIER {
1584 $$ = $1->access_content_String (true);
1586 | string '+' string {
1595 | exclamations '!' { $$ ++; }
1600 | questions '?' { $$ ++; }
1610 My_lily_parser::set_yydebug (bool b)
1617 My_lily_parser::do_yyparse ()
1619 yyparse ((void*)this);