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"
46 #include "auto-change-music.hh"
49 Mudela_version oldest_version ("1.1.52");
54 print_mudela_versions (ostream &os)
56 os << _f ("Oldest supported input version: %s", oldest_version.str ())
59 // needed for bison.simple's malloc() and free()
66 #define YYERROR_VERBOSE 1
68 #define YYPARSE_PARAM my_lily_parser_l
69 #define YYLEX_PARAM my_lily_parser_l
70 #define THIS ((My_lily_parser *) my_lily_parser_l)
72 #define yyerror THIS->parser_error
73 #define ARRAY_SIZE(a,s) if (a.size () != s) THIS->parser_error (_f ("Expecting %d arguments", s))
80 Array<Musical_pitch> *pitch_arr;
81 Link_array<Request> *reqvec;
82 Array<String> * strvec;
84 Notename_table *chordmodifiertab;
88 Music_list *music_list;
93 Music_output_def * outputdef;
94 Musical_pitch * pitch;
97 Notename_table *notenametab;
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 */
135 %token CHORDMODIFIERS
189 %token E_EXCLAMATION E_SMALLER E_BIGGER E_CHAR 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> NOTENAME_TABLE_IDENTIFIER
199 %token <id> MUSIC_IDENTIFIER
200 %token <id> REQUEST_IDENTIFIER
201 %token <id> REAL_IDENTIFIER
202 %token <id> STRING_IDENTIFIER
203 %token <id> TRANS_IDENTIFIER
204 %token <id> INT_IDENTIFIER
205 %token <id> SCORE_IDENTIFIER
206 %token <id> MIDI_IDENTIFIER
207 %token <id> PAPER_IDENTIFIER
209 %token <string> DURATION RESTNAME
210 %token <string> STRING
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> abbrev_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> explicit_musical_pitch steno_musical_pitch musical_pitch absolute_musical_pitch
232 %type <pitch> steno_tonic_pitch
234 %type <pitch_arr> pitch_list
236 %type <pitch_arr> chord_additions chord_subtractions chord_notes chord_step
237 %type <pitch> chord_note chord_inversion
238 %type <midi> midi_block midi_body
239 %type <duration> duration_length
241 %type <scalar> scalar
242 %type <music> Music Sequential_music Simultaneous_music Music_sequence
243 %type <music> relative_music re_rhythmed_music
244 %type <music> property_def translator_change
245 %type <music_list> Music_list
246 %type <paper> paper_block paper_def_body
247 %type <real> real real_with_dimension
248 %type <request> abbrev_command_req
249 %type <request> post_request
250 %type <request> command_req verbose_command_req
251 %type <request> extender_req
252 %type <request> hyphen_req
253 %type <string> string
254 %type <score> score_block score_body
255 %type <realarr> real_array
257 %type <string> script_abbreviation
258 %type <trans> translator_spec_block translator_spec_body
259 %type <tempo> tempo_request
260 %type <notenametab> notenames_body notenames_block chordmodifiers_block
271 | mudela toplevel_expression {}
272 | mudela assignment { }
275 THIS->error_level_i_ =1;
281 THIS->lexer_p_->set_notename_table ($1);
283 | chordmodifiers_block {
284 THIS->lexer_p_->set_chordmodifier_table ($1);
287 delete header_global_p;
288 header_global_p = $1;
291 score_global_array.push ($1);
294 Identifier * id = new
295 Paper_def_identifier ($1, PAPER_IDENTIFIER);
296 THIS->lexer_p_->set_identifier ("$defaultpaper", id)
299 Identifier * id = new
300 Midi_def_identifier ($1, MIDI_IDENTIFIER);
301 THIS->lexer_p_->set_identifier ("$defaultmidi", id)
308 SCMFILE STRING semicolon {
309 read_lily_scm_file (*$2);
312 | SCM_T STRING semicolon {
313 if (THIS->lexer_p_->main_input_b_ && safe_global_b)
314 error (_("Can't evaluate Scheme in safe mode"));
315 gh_eval_str ($2->ch_l ());
320 chordmodifiers_block:
321 CHORDMODIFIERS '{' notenames_body '}' { $$ = $3; }
326 NOTENAMES '{' notenames_body '}' { $$ = $3; }
333 $$ = new Notename_table;
335 | NOTENAME_TABLE_IDENTIFIER {
336 $$ = $1-> access_content_Notename_table(true);
338 | notenames_body STRING '=' explicit_musical_pitch {
349 THIS->lexer_p_-> scope_l_arr_.push ($$);
351 | mudela_header_body assignment semicolon {
357 HEADER '{' mudela_header_body '}' {
359 THIS->lexer_p_-> scope_l_arr_.pop ();
369 THIS->remember_spot ();
371 /* cont */ '=' identifier_init {
372 THIS->lexer_p_->set_identifier (*$1, $4);
373 $4->init_b_ = THIS->init_parse_b_;
374 $4->set_spot (THIS->pop_spot ());
382 $$ = new Score_identifier ($1, SCORE_IDENTIFIER);
385 | chordmodifiers_block {
386 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
389 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
392 $$ = new Paper_def_identifier ($1, PAPER_IDENTIFIER);
395 $$ = new Midi_def_identifier ($1, MIDI_IDENTIFIER);
398 | translator_spec_block {
399 $$ = new Translator_identifier ($1, TRANS_IDENTIFIER);
402 $$ = new Music_identifier ($1, MUSIC_IDENTIFIER);
406 $$ = new Request_identifier ($1, REQUEST_IDENTIFIER);
408 | explicit_duration {
409 $$ = new Duration_identifier ($1, DURATION_IDENTIFIER);
412 $$ = new Real_identifier (new Real ($1), REAL_IDENTIFIER);
415 $$ = new String_identifier ($1, STRING_IDENTIFIER);
418 $$ = new int_identifier (new int ($1), INT_IDENTIFIER);
422 translator_spec_block:
423 TRANSLATOR '{' translator_spec_body '}'
429 translator_spec_body:
431 $$ = $1->access_content_Translator (true);
432 Translator_group * tg = dynamic_cast<Translator_group*> ($$);
434 THIS->parser_error (_("Need a translator group for a context"));
435 $$-> set_spot (THIS->here_input ());
437 | TYPE STRING semicolon {
438 Translator* t = get_translator_l (*$2);
439 Translator_group * tg = dynamic_cast<Translator_group*> (t);
442 THIS->parser_error (_("Need a translator group for a context"));
445 t->set_spot (THIS->here_input ());
449 | translator_spec_body STRING '=' identifier_init semicolon {
451 String_identifier *s = dynamic_cast<String_identifier*> (id);
452 Real_identifier *r= dynamic_cast<Real_identifier*>(id);
453 int_identifier *i = dynamic_cast<int_identifier*> (id);
456 if (s) str = *s->access_content_String (false);
457 if (i) str = to_str (*i->access_content_int (false));
458 if (r) str = to_str (*r->access_content_Real (false));
460 THIS->parser_error (_("Wrong type for property value"));
464 Translator_group* tg = dynamic_cast<Translator_group*> ($$);
466 THIS->parser_error (_("Need a translator group for a context"));
467 tg->set_property (*$2, str);
469 | translator_spec_body NAME STRING semicolon {
473 | translator_spec_body CONSISTS STRING semicolon {
474 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, true);
477 | translator_spec_body CONSISTSEND STRING semicolon {
478 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, true);
481 | translator_spec_body ACCEPTS STRING semicolon {
482 dynamic_cast<Translator_group*> ($$)-> set_acceptor (*$3, true);
485 | translator_spec_body REMOVE STRING semicolon {
486 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, false);
497 /*cont*/ '{' score_body '}' {
499 if (!$$->def_p_arr_.size ())
500 $$->add_output (THIS->default_paper_p ());
506 $$->set_spot (THIS->here_input ());
509 $$ = $1->access_content_Score (true);
511 | score_body mudela_header {
516 $2->warning (_ ("More than one music block"));
519 | score_body output_def {
541 PAPER '{' paper_def_body '}' {
543 THIS-> lexer_p_->scope_l_arr_.pop ();
550 Paper_def *p = THIS->default_paper_p ();
551 THIS-> lexer_p_-> scope_l_arr_.push (p->scope_p_);
555 Paper_def *p = $1->access_content_Paper_def (true);
556 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
559 | paper_def_body int '=' FONT STRING { // ugh, what a syntax
560 Lookup * l = new Lookup;
563 $$->set_lookup ($2, l);
565 | paper_def_body assignment semicolon {
568 | paper_def_body translator_spec_block {
569 $$->assign_translator ($2);
571 | paper_def_body SHAPE real_array semicolon {
576 warning (_ ("Need even number of args for shape array"));
578 for (int i=0; i < $3->size (); i+=2)
580 Real l = $3->elem (i);
581 $$->shape_int_a_.push (Interval (l,
582 l + $3->elem (i+1)));
586 | paper_def_body error {
612 | real_with_dimension
614 $$= *$1->access_content_Real (false);
616 | '-' real %prec UNARY_MINUS {
639 $$ = new Array<Real>;
643 $$ = new Array<Real>;
645 | real_array ',' real {
656 '{' midi_body '}' { $$ = $3; }
659 midi_body: /* empty */ {
660 $$ = THIS->default_midi_p ();
663 $$ = $1-> access_content_Midi_def (true);
665 | midi_body assignment semicolon {
668 | midi_body translator_spec_block {
669 $$-> assign_translator ($2);
671 | midi_body tempo_request semicolon {
672 $$->set_tempo ($2->dur_.length_mom (), $2->metronome_i_);
681 TEMPO steno_duration '=' unsigned {
685 $$-> metronome_i_ = $4;
689 Music_list: /* empty */ {
691 $$->set_spot (THIS->here_input ());
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->volta_fold_b_ = (*$2 == "volta");
731 r->set_spot ($4->spot ());
735 Music_sequence: '{' Music_list '}' {
736 $$ = new Music_sequence ($2);
737 $$->set_spot ($2->spot ());
742 SEQUENTIAL '{' Music_list '}' {
743 $$ = new Sequential_music ($3);
744 $$->set_spot ($3->spot ());
746 | '{' Music_list '}' {
747 $$ = new Sequential_music ($2);
748 $$->set_spot ($2->spot ());
753 SIMULTANEOUS '{' Music_list '}'{
754 $$ = new Simultaneous_music ($3);
755 $$->set_spot ($3->spot ());
757 | '<' Music_list '>' {
758 $$ = new Simultaneous_music ($2);
759 $$->set_spot ($2->spot ());
764 request_chord { $$ = $1; }
765 | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); }
768 | Simple_music '*' unsigned '/' unsigned {
770 $$->compress (Moment($3, $5 ));
772 | Simple_music '*' unsigned {
774 $$->compress (Moment ($3, 1));
780 CONTEXT STRING Music {
781 Context_specced_music *csm = new Context_specced_music ($3);
783 csm->translator_type_str_ = *$2;
784 csm->translator_id_str_ = "";
789 | AUTOCHANGE STRING Music {
790 Auto_change_music * chm = new Auto_change_music (*$2, $3);
793 chm->set_spot ($3->spot ());
796 $$ = new Grace_music ($2);
798 | CONTEXT STRING '=' STRING Music {
799 Context_specced_music *csm = new Context_specced_music ($5);
801 csm->translator_type_str_ = *$2;
802 csm->translator_id_str_ = *$4;
809 THIS->remember_spot ();
812 unsigned '/' unsigned Music
815 $$ = new Time_scaled_music ($3, $5, $6);
816 $$->set_spot (THIS->pop_spot ());
818 | Repeated_music { $$ = $1; }
819 | Simultaneous_music { $$ = $1; }
820 | Sequential_music { $$ = $1; }
821 | TRANSPOSE musical_pitch Music {
822 $$ = new Transposed_music ($3, *$2);
825 | TRANSPOSE steno_tonic_pitch Music {
826 $$ = new Transposed_music ($3, *$2);
830 { THIS->lexer_p_->push_note_state (); }
833 THIS->lexer_p_->pop_state ();
836 { THIS->lexer_p_->push_chord_state (); }
840 THIS->lexer_p_->pop_state ();
843 { THIS->lexer_p_->push_lyric_state (); }
847 THIS->lexer_p_->pop_state ();
849 | relative_music { $$ = $1; }
850 | re_rhythmed_music { $$ = $1; }
854 RELATIVE absolute_musical_pitch Music {
855 $$ = new Relative_octave_music ($3, *$2);
861 ADDLYRICS Music Music {
862 Lyric_combine_music * l = new Lyric_combine_music ($2, $3);
868 TRANSLATOR STRING '=' STRING {
869 Change_translator * t = new Change_translator;
870 t-> change_to_type_str_ = *$2;
871 t-> change_to_id_str_ = *$4;
874 $$->set_spot (THIS->here_input ());
881 PROPERTY STRING '.' STRING '=' scalar {
882 Translation_property *t = new Translation_property;
887 Context_specced_music *csm = new Context_specced_music (t);
889 $$->set_spot (THIS->here_input ());
891 csm-> translator_type_str_ = *$2;
900 string { $$ = new Scalar (*$1); delete $1; }
901 | int { $$ = new Scalar ($1); }
906 pre_requests simple_element post_requests {
907 Music_sequence *l = dynamic_cast<Music_sequence*>($2);
908 for (int i=0; i < $1->size(); i++)
909 l->add_music ($1->elem(i));
910 for (int i=0; i < $3->size(); i++)
911 l->add_music ($3->elem(i));
920 $$ = new Request_chord;
921 $$-> set_spot (THIS->here_input ());
922 $1-> set_spot (THIS->here_input ());
923 ((Simultaneous_music*)$$) ->add_music ($1);//ugh
929 | verbose_command_req semicolon { $$ = $1; }
940 $$ = new Barcheck_req;
946 Span_req*b= new Span_req;
947 b->span_dir_ = START;
948 b->span_type_str_ = "beam";
952 if (!Duration::duration_type_b ($3))
953 THIS->parser_error (_f ("not a duration: %d", $3));
955 THIS->parser_error (_ ("Can't abbreviate"));
957 THIS->set_abbrev_beam ($3);
959 Chord_tremolo_req* a = new Chord_tremolo_req;
960 a->span_dir_ = START;
961 a->type_i_ = THIS->abbrev_beam_type_i_;
965 if (!THIS->abbrev_beam_type_i_)
967 Span_req*b= new Span_req;
969 b->span_type_str_ = "beam";
974 Chord_tremolo_req* a = new Chord_tremolo_req;
976 a->type_i_ = THIS->abbrev_beam_type_i_;
977 THIS->set_abbrev_beam (0);
982 $$ = new Breathing_sign_req;
989 $$ = new Bar_req (*$2);
993 $$ = new Mark_req (*$2);
997 $$ = new Mark_req (to_str ($2));
999 | TIME_T unsigned '/' unsigned {
1000 Time_signature_change_req *m = new Time_signature_change_req;
1006 Break_req * b = new Break_req;
1008 b-> set_spot (THIS->here_input ());
1011 | SKIP duration_length {
1012 Skip_req * skip_p = new Skip_req;
1013 skip_p->duration_ = *$2;
1020 | CADENZA unsigned {
1021 $$ = new Cadenza_req ($2);
1023 | PARTIAL duration_length {
1024 $$ = new Partial_measure_req ($2->length_mom ());
1028 $$ = new Clef_change_req (*$2);
1031 | KEY NOTENAME_PITCH optional_modality {
1032 Key_change_req *key_p= new Key_change_req;
1033 key_p->key_.pitch_arr_.push (*$2);
1034 key_p->key_.ordinary_key_b_ = true;
1035 key_p->key_.modality_i_ = $3;
1039 | KEYSIGNATURE pitch_list {
1040 Key_change_req *key_p= new Key_change_req;
1041 key_p->key_.pitch_arr_ = *$2;
1042 key_p->key_.ordinary_key_b_ = false;
1051 $$ = new Link_array<Request>;
1053 | post_requests post_request {
1054 $2->set_spot (THIS->here_input ());
1066 request_that_take_dir:
1069 | script_abbreviation {
1070 Identifier*i = THIS->lexer_p_->lookup_identifier ("dash-" + *$1);
1071 Articulation_req *a = new Articulation_req;
1072 a->articulation_str_ = *i->access_content_String (false);
1079 script_dir request_that_take_dir {
1080 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1081 gs->dir_ = Direction ($1);
1083 $2->warning (_ ("Can't specify direction for this request"));
1089 REQUEST_IDENTIFIER {
1090 $$ = (Request*)$1->access_content_Request (true);
1091 $$->set_spot (THIS->here_input ());
1093 | TEXTSCRIPT STRING STRING {
1094 Text_script_req *ts_p = new Text_script_req;
1095 ts_p-> text_str_ = *$2;
1096 ts_p-> style_str_ = *$3;
1097 ts_p->set_spot (THIS->here_input ());
1102 | SPANREQUEST int STRING {
1103 Span_req * sp_p = new Span_req;
1104 sp_p-> span_dir_ = Direction($2);
1105 sp_p->span_type_str_ = *$3;
1106 sp_p->set_spot (THIS->here_input ());
1110 Tremolo_req* a = new Tremolo_req;
1111 a->set_spot (THIS->here_input ());
1116 Articulation_req * a = new Articulation_req;
1117 a->articulation_str_ = *$2;
1118 a->set_spot (THIS->here_input ());
1151 steno_musical_pitch:
1155 | NOTENAME_PITCH sup_quotes {
1157 $$->octave_i_ += $2;
1159 | NOTENAME_PITCH sub_quotes {
1161 $$->octave_i_ += - $2;
1169 | TONICNAME_PITCH sup_quotes {
1171 $$->octave_i_ += $2;
1173 | TONICNAME_PITCH sub_quotes {
1175 $$->octave_i_ += - $2;
1179 explicit_musical_pitch:
1180 MUSICAL_PITCH '{' int_list '}' {/* ugh */
1181 Array<int> &a = *$3;
1183 $$ = new Musical_pitch;
1184 $$->octave_i_ = a[0];
1185 $$->notename_i_ = a[1];
1186 $$->accidental_i_ = a[2];
1192 steno_musical_pitch {
1194 THIS->set_last_pitch ($1);
1196 | explicit_musical_pitch {
1198 THIS->set_last_pitch ($1);
1203 DURATION '{' int_list '}' {
1205 Array<int> &a = *$3;
1208 $$-> durlog_i_ = a[0];
1209 $$-> dots_i_ = a[1];
1217 if (!THIS->lexer_p_->lyric_state_b ())
1218 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1219 $$ = new Extender_req;
1225 if (!THIS->lexer_p_->lyric_state_b ())
1226 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1227 $$ = new Hyphen_req;
1232 close_request_parens {
1234 dynamic_cast<Span_req*> ($$)->span_dir_ = START;
1237 close_request_parens:
1239 Span_req* s= new Span_req;
1241 s->span_type_str_ = "slur";
1244 Span_req*s =new Span_req;
1246 s->span_type_str_ = "crescendo";
1249 Span_req*s =new Span_req;
1251 s->span_type_str_ = "decrescendo";
1257 open_request_parens {
1259 dynamic_cast<Span_req*> ($$)->span_dir_ = STOP;
1263 open_request_parens:
1265 Span_req *s = new Span_req;
1266 s->span_type_str_ = "crescendo";
1270 Span_req* s= new Span_req;
1272 s->span_type_str_ = "slur";
1278 Text_script_req *t = new Text_script_req;
1282 $$->set_spot (THIS->here_input ());
1285 Text_script_req* t = new Text_script_req;
1287 t->text_str_ = to_str ($1);
1288 t->style_str_ = "finger";
1289 $$->set_spot (THIS->here_input ());
1293 script_abbreviation:
1295 $$ = new String ("hat");
1298 $$ = new String ("plus");
1301 $$ = new String ("dash");
1304 $$ = new String ("bar");
1307 $$ = new String ("larger");
1310 $$ = new String ("dot");
1318 | '-' { $$ = CENTER; }
1323 $$ = new Link_array<Request>;
1325 | pre_requests open_request {
1330 absolute_musical_pitch:
1331 steno_musical_pitch {
1340 | duration_length '*' unsigned {
1341 $$->plet_.iso_i_ *= $3;
1343 | duration_length '/' unsigned {
1344 $$->plet_.type_i_ *= $3;
1348 entered_notemode_duration:
1350 THIS->set_last_duration ($1);
1354 optional_notemode_duration:
1356 $$ = new Duration (THIS->default_duration_);
1358 | entered_notemode_duration {
1366 if (!Duration::duration_type_b ($1))
1367 THIS->parser_error (_f ("not a duration: %d", $1));
1369 $$->durlog_i_ = Duration_convert::i2_type ($1);
1372 | DURATION_IDENTIFIER {
1373 $$ = $1->access_content_Duration (true);
1375 | steno_duration '.' {
1386 if (!Duration::duration_type_b ($2))
1387 THIS->parser_error (_f ("not a duration: %d", $2));
1389 THIS->parser_error (_ ("Can't abbreviate"));
1396 musical_pitch exclamations questions optional_notemode_duration {
1397 if (!THIS->lexer_p_->note_state_b ())
1398 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1401 Note_req *n = new Note_req;
1407 if (THIS->abbrev_beam_type_i_)
1409 if (n->duration_.plet_b ())
1410 THIS->parser_error (_ ("Can't abbreviate tuplet"));
1412 n->duration_.set_plet (1, 2);
1414 n->cautionary_b_ = $3 % 2;
1415 n->forceacc_b_ = $2 % 2 || n->cautionary_b_;
1417 Simultaneous_music*v = new Request_chord;
1418 v->set_spot (THIS->here_input ());
1419 n->set_spot (THIS->here_input ());
1425 | RESTNAME optional_notemode_duration {
1426 $$ = THIS->get_rest_element (*$1, $2);
1427 delete $1; // delete notename
1429 | MEASURES optional_notemode_duration {
1430 Multi_measure_rest_req* m = new Multi_measure_rest_req;
1434 Simultaneous_music*velt_p = new Request_chord;
1435 velt_p->set_spot (THIS->here_input ());
1436 velt_p->add_music (m);
1439 | REPETITIONS optional_notemode_duration {
1440 Repetitions_req* r = new Repetitions_req;
1444 Simultaneous_music*velt_p = new Request_chord;
1445 velt_p->set_spot (THIS->here_input ());
1446 velt_p->add_music (r);
1449 | STRING optional_notemode_duration {
1450 if (!THIS->lexer_p_->lyric_state_b ())
1451 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1452 $$ = THIS->get_word_element (*$1, $2);
1456 if (!THIS->lexer_p_->chord_state_b ())
1457 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1463 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion {
1464 $$ = THIS->get_chord (*$1, $3, $4, $5, *$2);
1469 $$ = new Array<Musical_pitch>;
1471 | CHORD_MINUS chord_notes {
1480 | chord_notes '.' chord_step {
1488 $$ = new Array<Musical_pitch>;
1490 | CHORD_CARET chord_notes {
1500 | '/' steno_tonic_pitch {
1507 $$ = new Array<Musical_pitch>;
1510 | CHORDMODIFIER_PITCH {
1511 $$ = new Array<Musical_pitch>;
1514 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
1515 $$ = new Array<Musical_pitch>;
1523 $$ = new Musical_pitch;
1524 $$->notename_i_ = ($1 - 1) % 7;
1525 $$->octave_i_ = $1 > 7 ? 1 : 0;
1526 $$->accidental_i_ = 0;
1529 $$ = new Musical_pitch;
1530 $$->notename_i_ = ($1 - 1) % 7;
1531 $$->octave_i_ = $1 > 7 ? 1 : 0;
1532 $$->accidental_i_ = 1;
1534 | unsigned CHORD_MINUS {
1535 $$ = new Musical_pitch;
1536 $$->notename_i_ = ($1 - 1) % 7;
1537 $$->octave_i_ = $1 > 7 ? 1 : 0;
1538 $$->accidental_i_ = -1;
1546 $$ = new Array<Musical_pitch>;
1548 | pitch_list musical_pitch {
1581 $$ = *$1->access_content_int (false);
1590 | STRING_IDENTIFIER {
1591 $$ = $1->access_content_String (true);
1593 | string '+' string {
1602 | exclamations '!' { $$ ++; }
1607 | questions '?' { $$ ++; }
1617 My_lily_parser::set_yydebug (bool b)
1624 My_lily_parser::do_yyparse ()
1626 yyparse ((void*)this);