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_substractions 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 $$-> set_spot (THIS->here_input ());
432 | TYPE STRING semicolon {
433 Translator* t = get_translator_l (*$2);
434 Translator_group * tg = dynamic_cast<Translator_group*> (t);
437 THIS->parser_error (_("Need a translator group for a context"));
440 t->set_spot (THIS->here_input ());
444 | translator_spec_body STRING '=' identifier_init semicolon {
446 String_identifier *s = dynamic_cast<String_identifier*> (id);
447 Real_identifier *r= dynamic_cast<Real_identifier*>(id);
448 int_identifier *i = dynamic_cast<int_identifier*> (id);
451 if (s) str = *s->access_content_String (false);
452 if (i) str = to_str (*i->access_content_int (false));
453 if (r) str = to_str (*r->access_content_Real (false));
455 THIS->parser_error (_("Wrong type for property value"));
459 Translator_group * tr = dynamic_cast<Translator_group*>($$);
460 tr->set_property (*$2, str);
462 | translator_spec_body NAME STRING semicolon {
466 | translator_spec_body CONSISTS STRING semicolon {
467 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, true);
470 | translator_spec_body CONSISTSEND STRING semicolon {
471 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, true);
474 | translator_spec_body ACCEPTS STRING semicolon {
475 dynamic_cast<Translator_group*> ($$)-> set_acceptor (*$3, true);
478 | translator_spec_body REMOVE STRING semicolon {
479 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, false);
490 /*cont*/ '{' score_body '}' {
492 if (!$$->def_p_arr_.size ())
493 $$->add_output (THIS->default_paper_p ());
499 $$->set_spot (THIS->here_input ());
502 $$ = $1->access_content_Score (true);
504 | score_body mudela_header {
509 $2->warning (_ ("More than one music block"));
512 | score_body output_def {
534 PAPER '{' paper_def_body '}' {
536 THIS-> lexer_p_->scope_l_arr_.pop ();
543 Paper_def *p = THIS->default_paper_p ();
544 THIS-> lexer_p_-> scope_l_arr_.push (p->scope_p_);
548 Paper_def *p = $1->access_content_Paper_def (true);
549 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
552 | paper_def_body int '=' FONT STRING { // ugh, what a syntax
553 Lookup * l = new Lookup;
556 $$->set_lookup ($2, l);
558 | paper_def_body assignment semicolon {
561 | paper_def_body translator_spec_block {
562 $$->assign_translator ($2);
564 | paper_def_body SHAPE real_array semicolon {
569 warning ("Need even number of args for shape array");
571 for (int i=0; i < $3->size (); i+=2)
573 Real l = $3->elem (i);
574 $$->shape_int_a_.push (Interval (l,
575 l + $3->elem (i+1)));
579 | paper_def_body error {
605 | real_with_dimension
607 $$= *$1->access_content_Real (false);
609 | '-' real %prec UNARY_MINUS {
632 $$ = new Array<Real>;
636 $$ = new Array<Real>;
638 | real_array ',' real {
649 '{' midi_body '}' { $$ = $3; }
652 midi_body: /* empty */ {
653 $$ = THIS->default_midi_p ();
656 $$ = $1-> access_content_Midi_def (true);
658 | midi_body assignment semicolon {
661 | midi_body translator_spec_block {
662 $$-> assign_translator ($2);
664 | midi_body tempo_request semicolon {
665 $$->set_tempo ($2->dur_.length_mom (), $2->metronome_i_);
674 TEMPO steno_duration '=' unsigned {
678 $$-> metronome_i_ = $4;
682 Music_list: /* empty */ {
684 $$->set_spot (THIS->here_input ());
703 | ALTERNATIVE Music_sequence {
705 $2->set_spot (THIS->here_input ());
713 REPEAT STRING unsigned Music Alternative_music
715 Music_sequence* m = dynamic_cast <Music_sequence*> ($5);
716 if (m && $3 < m->length_i ())
717 $5->warning ("More alternatives than repeats. Junking excess alternatives.");
719 Repeated_music * r = new Repeated_music ($4, $3 >? 1, m);
721 r->fold_b_ = (*$2 == "fold");
722 r->volta_fold_b_ = (*$2 == "volta");
724 r->set_spot ($4->spot ());
728 Music_sequence: '{' Music_list '}' {
729 $$ = new Music_sequence ($2);
730 $$->set_spot ($2->spot ());
735 SEQUENTIAL '{' Music_list '}' {
736 $$ = new Sequential_music ($3);
737 $$->set_spot ($3->spot ());
739 | '{' Music_list '}' {
740 $$ = new Sequential_music ($2);
741 $$->set_spot ($2->spot ());
746 SIMULTANEOUS '{' Music_list '}'{
747 $$ = new Simultaneous_music ($3);
748 $$->set_spot ($3->spot ());
750 | '<' Music_list '>' {
751 $$ = new Simultaneous_music ($2);
752 $$->set_spot ($2->spot ());
757 request_chord { $$ = $1; }
758 | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); }
761 | Simple_music '*' unsigned '/' unsigned {
763 $$->compress (Moment($3, $5 ));
765 | Simple_music '*' unsigned {
767 $$->compress (Moment ($3, 1));
773 CONTEXT STRING Music {
774 Context_specced_music *csm = new Context_specced_music ($3);
776 csm->translator_type_str_ = *$2;
777 csm->translator_id_str_ = "";
783 $$ = new Grace_music ($2);
785 | CONTEXT STRING '=' STRING Music {
786 Context_specced_music *csm = new Context_specced_music ($5);
788 csm->translator_type_str_ = *$2;
789 csm->translator_id_str_ = *$4;
796 THIS->remember_spot ();
799 unsigned '/' unsigned Music
802 $$ = new Time_scaled_music ($3, $5, $6);
803 $$->set_spot (THIS->pop_spot ());
805 | Repeated_music { $$ = $1; }
806 | Simultaneous_music { $$ = $1; }
807 | Sequential_music { $$ = $1; }
808 | TRANSPOSE musical_pitch Music {
809 $$ = new Transposed_music ($3, *$2);
812 | TRANSPOSE steno_tonic_pitch Music {
813 $$ = new Transposed_music ($3, *$2);
817 { THIS->lexer_p_->push_note_state (); }
820 THIS->lexer_p_->pop_state ();
823 { THIS->lexer_p_->push_chord_state (); }
827 THIS->lexer_p_->pop_state ();
830 { THIS->lexer_p_->push_lyric_state (); }
834 THIS->lexer_p_->pop_state ();
836 | relative_music { $$ = $1; }
837 | re_rhythmed_music { $$ = $1; }
841 RELATIVE absolute_musical_pitch Music {
842 $$ = new Relative_octave_music ($3, *$2);
848 ADDLYRICS Music Music {
849 Lyric_combine_music * l = new Lyric_combine_music ($2, $3);
855 TRANSLATOR STRING '=' STRING {
856 Change_translator * t = new Change_translator;
857 t-> change_to_type_str_ = *$2;
858 t-> change_to_id_str_ = *$4;
861 $$->set_spot (THIS->here_input ());
868 PROPERTY STRING '.' STRING '=' scalar {
869 Translation_property *t = new Translation_property;
874 Context_specced_music *csm = new Context_specced_music (t);
876 $$->set_spot (THIS->here_input ());
878 csm-> translator_type_str_ = *$2;
887 string { $$ = new Scalar (*$1); delete $1; }
888 | int { $$ = new Scalar ($1); }
893 pre_requests simple_element post_requests {
894 Music_sequence *l = dynamic_cast<Music_sequence*>($2);
895 for (int i=0; i < $1->size(); i++)
896 l->add_music ($1->elem(i));
897 for (int i=0; i < $3->size(); i++)
898 l->add_music ($3->elem(i));
907 $$ = new Request_chord;
908 $$-> set_spot (THIS->here_input ());
909 $1-> set_spot (THIS->here_input ());
910 ((Simultaneous_music*)$$) ->add_music ($1);//ugh
916 | verbose_command_req semicolon { $$ = $1; }
927 $$ = new Barcheck_req;
933 Span_req*b= new Span_req;
934 b->span_dir_ = START;
935 b->span_type_str_ = "beam";
939 if (!Duration::duration_type_b ($3))
940 THIS->parser_error (_f ("not a duration: %d", $3));
942 THIS->parser_error (_ ("can't abbreviate"));
944 THIS->set_abbrev_beam ($3);
946 Chord_tremolo_req* a = new Chord_tremolo_req;
947 a->span_dir_ = START;
948 a->type_i_ = THIS->abbrev_beam_type_i_;
952 if (!THIS->abbrev_beam_type_i_)
954 Span_req*b= new Span_req;
956 b->span_type_str_ = "beam";
961 Chord_tremolo_req* a = new Chord_tremolo_req;
963 a->type_i_ = THIS->abbrev_beam_type_i_;
964 THIS->set_abbrev_beam (0);
969 $$ = new Breathing_sign_req;
976 $$ = new Bar_req (*$2);
980 $$ = new Mark_req (*$2);
984 $$ = new Mark_req (to_str ($2));
986 | TIME_T unsigned '/' unsigned {
987 Time_signature_change_req *m = new Time_signature_change_req;
993 Break_req * b = new Break_req;
995 b-> set_spot (THIS->here_input ());
998 | SKIP duration_length {
999 Skip_req * skip_p = new Skip_req;
1000 skip_p->duration_ = *$2;
1007 | CADENZA unsigned {
1008 $$ = new Cadenza_req ($2);
1010 | PARTIAL duration_length {
1011 $$ = new Partial_measure_req ($2->length_mom ());
1015 $$ = new Clef_change_req (*$2);
1018 | KEY NOTENAME_PITCH optional_modality {
1019 Key_change_req *key_p= new Key_change_req;
1020 key_p->key_.pitch_arr_.push (*$2);
1021 key_p->key_.ordinary_key_b_ = true;
1022 key_p->key_.modality_i_ = $3;
1026 | KEYSIGNATURE pitch_list {
1027 Key_change_req *key_p= new Key_change_req;
1028 key_p->key_.pitch_arr_ = *$2;
1029 key_p->key_.ordinary_key_b_ = false;
1038 $$ = new Link_array<Request>;
1040 | post_requests post_request {
1041 $2->set_spot (THIS->here_input ());
1053 request_that_take_dir:
1056 | script_abbreviation {
1057 Identifier*i = THIS->lexer_p_->lookup_identifier ("dash-" + *$1);
1058 Articulation_req *a = new Articulation_req;
1059 a->articulation_str_ = *i->access_content_String (false);
1066 script_dir request_that_take_dir {
1067 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1068 gs->dir_ = Direction ($1);
1070 $2->warning ("Can't specify direction for this request");
1076 REQUEST_IDENTIFIER {
1077 $$ = (Request*)$1->access_content_Request (true);
1078 $$->set_spot (THIS->here_input ());
1080 | TEXTSCRIPT STRING STRING {
1081 Text_script_req *ts_p = new Text_script_req;
1082 ts_p-> text_str_ = *$2;
1083 ts_p-> style_str_ = *$3;
1084 ts_p->set_spot (THIS->here_input ());
1089 | SPANREQUEST int STRING {
1090 Span_req * sp_p = new Span_req;
1091 sp_p-> span_dir_ = Direction($2);
1092 sp_p->span_type_str_ = *$3;
1093 sp_p->set_spot (THIS->here_input ());
1097 Tremolo_req* a = new Tremolo_req;
1098 a->set_spot (THIS->here_input ());
1103 Articulation_req * a = new Articulation_req;
1104 a->articulation_str_ = *$2;
1105 a->set_spot (THIS->here_input ());
1138 steno_musical_pitch:
1142 | NOTENAME_PITCH sup_quotes {
1144 $$->octave_i_ += $2;
1146 | NOTENAME_PITCH sub_quotes {
1148 $$->octave_i_ += - $2;
1156 | TONICNAME_PITCH sup_quotes {
1158 $$->octave_i_ += $2;
1160 | TONICNAME_PITCH sub_quotes {
1162 $$->octave_i_ += - $2;
1166 explicit_musical_pitch:
1167 MUSICAL_PITCH '{' int_list '}' {/* ugh */
1168 Array<int> &a = *$3;
1170 $$ = new Musical_pitch;
1171 $$->octave_i_ = a[0];
1172 $$->notename_i_ = a[1];
1173 $$->accidental_i_ = a[2];
1179 steno_musical_pitch {
1181 THIS->set_last_pitch ($1);
1183 | explicit_musical_pitch {
1185 THIS->set_last_pitch ($1);
1190 DURATION '{' int_list '}' {
1192 Array<int> &a = *$3;
1195 $$-> durlog_i_ = a[0];
1196 $$-> dots_i_ = a[1];
1204 if (!THIS->lexer_p_->lyric_state_b ())
1205 THIS->parser_error (_ ("have to be in Lyric mode for lyrics"));
1206 $$ = new Extender_req;
1212 if (!THIS->lexer_p_->lyric_state_b ())
1213 THIS->parser_error (_ ("have to be in Lyric mode for lyrics"));
1214 $$ = new Hyphen_req;
1219 close_request_parens {
1221 dynamic_cast<Span_req*> ($$)->span_dir_ = START;
1224 close_request_parens:
1226 Span_req* s= new Span_req;
1228 s->span_type_str_ = "slur";
1231 Span_req*s =new Span_req;
1233 s->span_type_str_ = "crescendo";
1236 Span_req*s =new Span_req;
1238 s->span_type_str_ = "decrescendo";
1244 open_request_parens {
1246 dynamic_cast<Span_req*> ($$)->span_dir_ = STOP;
1250 open_request_parens:
1252 Span_req *s = new Span_req;
1253 s->span_type_str_ = "crescendo";
1257 Span_req* s= new Span_req;
1259 s->span_type_str_ = "slur";
1265 Text_script_req *t = new Text_script_req;
1269 $$->set_spot (THIS->here_input ());
1272 Text_script_req* t = new Text_script_req;
1274 t->text_str_ = to_str ($1);
1275 t->style_str_ = "finger";
1276 $$->set_spot (THIS->here_input ());
1280 script_abbreviation:
1282 $$ = new String ("hat");
1285 $$ = new String ("plus");
1288 $$ = new String ("dash");
1291 $$ = new String ("bar");
1294 $$ = new String ("larger");
1297 $$ = new String ("dot");
1305 | '-' { $$ = CENTER; }
1310 $$ = new Link_array<Request>;
1312 | pre_requests open_request {
1317 absolute_musical_pitch:
1318 steno_musical_pitch {
1327 | duration_length '*' unsigned {
1328 $$->plet_.iso_i_ *= $3;
1330 | duration_length '/' unsigned {
1331 $$->plet_.type_i_ *= $3;
1335 entered_notemode_duration:
1337 THIS->set_last_duration ($1);
1341 optional_notemode_duration:
1343 $$ = new Duration (THIS->default_duration_);
1345 | entered_notemode_duration {
1353 if (!Duration::duration_type_b ($1))
1354 THIS->parser_error (_f ("not a duration: %d", $1));
1356 $$->durlog_i_ = Duration_convert::i2_type ($1);
1359 | DURATION_IDENTIFIER {
1360 $$ = $1->access_content_Duration (true);
1362 | steno_duration '.' {
1373 if (!Duration::duration_type_b ($2))
1374 THIS->parser_error (_f ("not a duration: %d", $2));
1376 THIS->parser_error (_ ("can't abbreviate"));
1383 musical_pitch exclamations questions optional_notemode_duration {
1384 if (!THIS->lexer_p_->note_state_b ())
1385 THIS->parser_error (_ ("have to be in Note mode for notes"));
1388 Note_req *n = new Note_req;
1394 if (THIS->abbrev_beam_type_i_)
1396 if (n->duration_.plet_b ())
1397 THIS->parser_error (_ ("can't abbreviate tuplet"));
1399 n->duration_.set_plet (1, 2);
1401 n->cautionary_b_ = $3 % 2;
1402 n->forceacc_b_ = $2 % 2 || n->cautionary_b_;
1404 Simultaneous_music*v = new Request_chord;
1405 v->set_spot (THIS->here_input ());
1406 n->set_spot (THIS->here_input ());
1412 | RESTNAME optional_notemode_duration {
1413 $$ = THIS->get_rest_element (*$1, $2);
1414 delete $1; // delete notename
1416 | MEASURES optional_notemode_duration {
1417 Multi_measure_rest_req* m = new Multi_measure_rest_req;
1421 Simultaneous_music*velt_p = new Request_chord;
1422 velt_p->set_spot (THIS->here_input ());
1423 velt_p->add_music (m);
1426 | REPETITIONS optional_notemode_duration {
1427 Repetitions_req* r = new Repetitions_req;
1431 Simultaneous_music*velt_p = new Request_chord;
1432 velt_p->set_spot (THIS->here_input ());
1433 velt_p->add_music (r);
1436 | STRING optional_notemode_duration {
1437 if (!THIS->lexer_p_->lyric_state_b ())
1438 THIS->parser_error (_ ("have to be in Lyric mode for lyrics"));
1439 $$ = THIS->get_word_element (*$1, $2);
1443 if (!THIS->lexer_p_->chord_state_b ())
1444 THIS->parser_error (_ ("have to be in Chord mode for chords"));
1450 steno_tonic_pitch optional_notemode_duration chord_additions chord_substractions chord_inversion {
1451 $$ = THIS->get_chord (*$1, $3, $4, $5, *$2);
1456 $$ = new Array<Musical_pitch>;
1458 | CHORD_MINUS chord_notes {
1467 | chord_notes '.' chord_step {
1473 chord_substractions:
1475 $$ = new Array<Musical_pitch>;
1477 | CHORD_CARET chord_notes {
1487 | '/' steno_tonic_pitch {
1494 $$ = new Array<Musical_pitch>;
1497 | CHORDMODIFIER_PITCH {
1498 $$ = new Array<Musical_pitch>;
1501 | CHORDMODIFIER_PITCH chord_note {
1502 $$ = new Array<Musical_pitch>;
1510 $$ = new Musical_pitch;
1511 $$->notename_i_ = ($1 - 1) % 7;
1512 $$->octave_i_ = $1 > 7 ? 1 : 0;
1513 $$->accidental_i_ = 0;
1516 $$ = new Musical_pitch;
1517 $$->notename_i_ = ($1 - 1) % 7;
1518 $$->octave_i_ = $1 > 7 ? 1 : 0;
1519 $$->accidental_i_ = 1;
1521 | unsigned CHORD_MINUS {
1522 $$ = new Musical_pitch;
1523 $$->notename_i_ = ($1 - 1) % 7;
1524 $$->octave_i_ = $1 > 7 ? 1 : 0;
1525 $$->accidental_i_ = -1;
1533 $$ = new Array<Musical_pitch>;
1535 | pitch_list musical_pitch {
1568 $$ = *$1->access_content_int (false);
1577 | STRING_IDENTIFIER {
1578 $$ = $1->access_content_String (true);
1580 | string '+' string {
1589 | exclamations '!' { $$ ++; }
1594 | questions '?' { $$ ++; }
1604 My_lily_parser::set_yydebug (bool b)
1611 My_lily_parser::do_yyparse ()
1613 yyparse ((void*)this);