1 %{ // -*-Fundamental-*-
4 parser.yy -- Bison/C++ parser for mudela
6 source file of the GNU LilyPond music typesetter
8 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 Jan Nieuwenhuizen <janneke@gnu.org>
13 #include "lily-guile.hh"
14 #include "notename-table.hh"
15 #include "translation-property.hh"
18 #include "my-lily-lexer.hh"
19 #include "paper-def.hh"
20 #include "midi-def.hh"
22 #include "file-path.hh"
25 #include "dimensions.hh"
26 #include "identifier.hh"
27 #include "command-request.hh"
28 #include "musical-request.hh"
29 #include "my-lily-parser.hh"
30 #include "context-specced-music.hh"
31 #include "translator-group.hh"
33 #include "music-list.hh"
34 #include "duration-convert.hh"
35 #include "change-translator.hh"
36 #include "file-results.hh"
38 #include "relative-music.hh"
39 #include "lyric-combine-music.hh"
40 #include "transposed-music.hh"
41 #include "time-scaled-music.hh"
42 #include "repeated-music.hh"
43 #include "mudela-version.hh"
44 #include "grace-music.hh"
45 #include "auto-change-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;
82 Notename_table *chordmodifiertab;
87 Music_list *music_list;
92 Music_output_def * outputdef;
93 Musical_pitch * pitch;
96 Notename_table *notenametab;
101 /* We use SCMs to do strings, because it saves us the trouble of
102 deleting them. Let's hope that a stack overflow doesnt trigger a move
103 of the parse stack onto the heap. */
107 Translator_group* trans;
115 yylex (YYSTYPE *s, void * v_l)
117 My_lily_parser *pars_l = (My_lily_parser*) v_l;
118 My_lily_lexer * lex_l = pars_l->lexer_p_;
120 lex_l->lexval_l = (void*) s;
121 return lex_l->yylex ();
129 /* tokens which are not keywords */
137 %token CHORDMODIFIERS
190 %token E_EXCLAMATION E_SMALLER E_BIGGER E_CHAR CHORD_MINUS CHORD_CARET
192 %type <i> exclamations questions
194 %token <pitch> NOTENAME_PITCH
195 %token <pitch> TONICNAME_PITCH
196 %token <pitch> CHORDMODIFIER_PITCH
197 %token <id> DURATION_IDENTIFIER
198 %token <id> IDENTIFIER
199 %token <id> NOTENAME_TABLE_IDENTIFIER
200 %token <id> MUSIC_IDENTIFIER
201 %token <id> REQUEST_IDENTIFIER
202 %token <id> REAL_IDENTIFIER
203 %token <id> STRING_IDENTIFIER
204 %token <id> TRANS_IDENTIFIER
205 %token <id> INT_IDENTIFIER
206 %token <id> SCORE_IDENTIFIER
207 %token <id> MIDI_IDENTIFIER
208 %token <id> PAPER_IDENTIFIER
210 %token <scm> DURATION RESTNAME
216 %type <outputdef> output_def
217 %type <scope> mudela_header mudela_header_body
218 %type <request> open_request_parens close_request_parens open_request close_request
219 %type <request> request_with_dir request_that_take_dir verbose_request
220 %type <i> sub_quotes sup_quotes
221 %type <music> simple_element request_chord command_element Simple_music Composite_music
222 %type <music> Alternative_music Repeated_music
223 %type <i> abbrev_type
224 %type <i> int unsigned
226 %type <i> optional_modality
227 %type <id> identifier_init
228 %type <duration> steno_duration optional_notemode_duration
229 %type <duration> entered_notemode_duration explicit_duration
230 %type <intvec> int_list
231 %type <reqvec> pre_requests post_requests
232 %type <request> gen_text_def
233 %type <pitch> explicit_musical_pitch steno_musical_pitch musical_pitch absolute_musical_pitch
234 %type <pitch> steno_tonic_pitch
236 %type <pitch_arr> pitch_list
238 %type <pitch_arr> chord_additions chord_subtractions chord_notes chord_step
239 %type <pitch> chord_note chord_inversion
240 %type <midi> midi_block midi_body
241 %type <duration> duration_length
243 %type <scm> embedded_scm scalar
244 %type <music> Music Sequential_music Simultaneous_music Music_sequence
245 %type <music> relative_music re_rhythmed_music
246 %type <music> property_def translator_change
247 %type <music_list> Music_list
248 %type <paper> paper_block paper_def_body
249 %type <real> real real_with_dimension
250 %type <request> abbrev_command_req
251 %type <request> post_request
252 %type <request> command_req verbose_command_req
253 %type <request> extender_req
254 %type <request> hyphen_req
256 %type <score> score_block score_body
257 %type <realarr> real_array
259 %type <scm> script_abbreviation
260 %type <trans> translator_spec_block translator_spec_body
261 %type <tempo> tempo_request
262 %type <notenametab> notenames_body notenames_block chordmodifiers_block
273 | mudela toplevel_expression {}
274 | mudela assignment { }
277 THIS->error_level_i_ =1;
283 THIS->lexer_p_->set_notename_table ($1);
285 | chordmodifiers_block {
286 THIS->lexer_p_->set_chordmodifier_table ($1);
289 delete header_global_p;
290 header_global_p = $1;
293 score_global_array.push ($1);
296 Identifier * id = new
297 Paper_def_identifier ($1, PAPER_IDENTIFIER);
298 THIS->lexer_p_->set_identifier ("$defaultpaper", id)
301 Identifier * id = new
302 Midi_def_identifier ($1, MIDI_IDENTIFIER);
303 THIS->lexer_p_->set_identifier ("$defaultmidi", id)
315 chordmodifiers_block:
316 CHORDMODIFIERS '{' notenames_body '}' { $$ = $3; }
321 NOTENAMES '{' notenames_body '}' { $$ = $3; }
328 $$ = new Notename_table;
330 | NOTENAME_TABLE_IDENTIFIER {
331 $$ = $1-> access_content_Notename_table(true);
333 | notenames_body STRING '=' explicit_musical_pitch {
334 (*$$)[ly_scm2string ($2)] = *$4;
343 THIS->lexer_p_-> scope_l_arr_.push ($$);
345 | mudela_header_body assignment semicolon {
351 HEADER '{' mudela_header_body '}' {
353 THIS->lexer_p_-> scope_l_arr_.pop ();
363 THIS->remember_spot ();
365 /* cont */ '=' identifier_init {
366 THIS->lexer_p_->set_identifier (ly_scm2string ($1), $4);
367 $4->init_b_ = THIS->init_parse_b_;
368 $4->set_spot (THIS->pop_spot ());
376 $$ = new Score_identifier ($1, SCORE_IDENTIFIER);
379 | chordmodifiers_block {
380 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
383 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
386 $$ = new Paper_def_identifier ($1, PAPER_IDENTIFIER);
389 $$ = new Midi_def_identifier ($1, MIDI_IDENTIFIER);
392 | translator_spec_block {
393 $$ = new Translator_group_identifier ($1, TRANS_IDENTIFIER);
396 $$ = new Music_identifier ($1, MUSIC_IDENTIFIER);
400 $$ = new Request_identifier ($1, REQUEST_IDENTIFIER);
402 | explicit_duration {
403 $$ = new Duration_identifier ($1, DURATION_IDENTIFIER);
406 $$ = new Real_identifier (new Real ($1), REAL_IDENTIFIER);
409 $$ = new String_identifier (new String (ly_scm2string ($1)), STRING_IDENTIFIER);
412 $$ = new int_identifier (new int ($1), INT_IDENTIFIER);
416 translator_spec_block:
417 TRANSLATOR '{' translator_spec_body '}'
423 translator_spec_body:
425 $$ = $1->access_content_Translator_group (true);
426 $$-> set_spot (THIS->here_input ());
428 | TYPE STRING semicolon {
429 Translator* t = get_translator_l (ly_scm2string ($2));
430 Translator_group * tg = dynamic_cast<Translator_group*> (t);
433 THIS->parser_error (_("Need a translator group for a context"));
435 tg = dynamic_cast<Translator_group*> (t->clone ());
436 tg->set_spot (THIS->here_input ());
439 | translator_spec_body STRING '=' embedded_scm {
440 Translator_group* tg = dynamic_cast<Translator_group*> ($$);
441 tg->set_property (ly_scm2string ($2), $4);
443 | translator_spec_body STRING '=' identifier_init semicolon {
445 String_identifier *s = dynamic_cast<String_identifier*> (id);
446 Real_identifier *r= dynamic_cast<Real_identifier*>(id);
447 int_identifier *i = dynamic_cast<int_identifier*> (id);
450 if (s) v = ly_ch_C_to_scm (s->access_content_String (false)->ch_C());
451 if (i) v = gh_int2scm (*i->access_content_int (false));
452 if (r) v = gh_double2scm (*r->access_content_Real (false));
454 THIS->parser_error (_("Wrong type for property value"));
458 Translator_group* tg = dynamic_cast<Translator_group*> ($$);
460 tg->set_property (ly_scm2string ($2), v);
462 | translator_spec_body NAME STRING semicolon {
463 $$->type_str_ = ly_scm2string ($3);
465 | translator_spec_body CONSISTS STRING semicolon {
466 dynamic_cast<Translator_group*> ($$)-> set_element (ly_scm2string ($3), true);
468 | translator_spec_body CONSISTSEND STRING semicolon {
469 dynamic_cast<Translator_group*> ($$)-> set_element (ly_scm2string ($3), true);
471 | translator_spec_body ACCEPTS STRING semicolon {
472 dynamic_cast<Translator_group*> ($$)-> set_acceptor (ly_scm2string ($3), true);
474 | translator_spec_body REMOVE STRING semicolon {
475 dynamic_cast<Translator_group*> ($$)-> set_element (ly_scm2string ($3), false);
485 /*cont*/ '{' score_body '}' {
487 if (!$$->def_p_arr_.size ())
488 $$->add_output (THIS->default_paper_p ());
494 $$->set_spot (THIS->here_input ());
497 $$ = $1->access_content_Score (true);
499 | score_body mudela_header {
504 $2->warning (_ ("More than one music block"));
507 | score_body output_def {
529 PAPER '{' paper_def_body '}' {
531 THIS-> lexer_p_->scope_l_arr_.pop ();
538 Paper_def *p = THIS->default_paper_p ();
539 THIS-> lexer_p_-> scope_l_arr_.push (p->scope_p_);
543 Paper_def *p = $1->access_content_Paper_def (true);
544 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
547 | paper_def_body int '=' FONT STRING { // ugh, what a syntax
548 Lookup * l = new Lookup;
549 l->font_name_ = ly_scm2string ($5);
550 $$->set_lookup ($2, l);
552 | paper_def_body assignment semicolon {
555 | paper_def_body translator_spec_block {
556 $$->assign_translator ($2);
558 | paper_def_body SHAPE real_array semicolon {
563 warning (_ ("Need even number of args for shape array"));
565 for (int i=0; i < $3->size (); i+=2)
567 Real l = $3->elem (i);
568 $$->shape_int_a_.push (Interval (l,
569 l + $3->elem (i+1)));
573 | paper_def_body error {
599 | real_with_dimension
601 $$= *$1->access_content_Real (false);
603 | '-' real %prec UNARY_MINUS {
626 $$ = new Array<Real>;
630 $$ = new Array<Real>;
632 | real_array ',' real {
644 THIS-> lexer_p_-> scope_l_arr_.pop();
648 midi_body: /* empty */ {
649 Midi_def * p =THIS->default_midi_p ();
651 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
654 Midi_def * p =$1-> access_content_Midi_def (true);
656 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
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_ = (ly_scm2string ($2) == "fold");
722 r->volta_fold_b_ = (ly_scm2string ($2) == "volta");
723 r->set_spot ($4->spot ());
727 Music_sequence: '{' Music_list '}' {
728 $$ = new Music_sequence ($2);
729 $$->set_spot ($2->spot ());
734 SEQUENTIAL '{' Music_list '}' {
735 $$ = new Sequential_music ($3);
736 $$->set_spot ($3->spot ());
738 | '{' Music_list '}' {
739 $$ = new Sequential_music ($2);
740 $$->set_spot ($2->spot ());
745 SIMULTANEOUS '{' Music_list '}'{
746 $$ = new Simultaneous_music ($3);
747 $$->set_spot ($3->spot ());
749 | '<' Music_list '>' {
750 $$ = new Simultaneous_music ($2);
751 $$->set_spot ($2->spot ());
756 request_chord { $$ = $1; }
757 | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); }
760 | Simple_music '*' unsigned '/' unsigned {
762 $$->compress (Moment($3, $5 ));
764 | Simple_music '*' unsigned {
766 $$->compress (Moment ($3, 1));
772 CONTEXT STRING Music {
773 Context_specced_music *csm = new Context_specced_music ($3);
775 csm->translator_type_str_ = ly_scm2string ($2);
776 csm->translator_id_str_ = "";
781 | AUTOCHANGE STRING Music {
782 Auto_change_music * chm = new Auto_change_music (ly_scm2string ($2), $3);
785 chm->set_spot ($3->spot ());
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_ = ly_scm2string ($2);
794 csm->translator_id_str_ = ly_scm2string ($4);
799 THIS->remember_spot ();
802 unsigned '/' unsigned Music
805 $$ = new Time_scaled_music ($3, $5, $6);
806 $$->set_spot (THIS->pop_spot ());
808 | Repeated_music { $$ = $1; }
809 | Simultaneous_music { $$ = $1; }
810 | Sequential_music { $$ = $1; }
811 | TRANSPOSE musical_pitch Music {
812 $$ = new Transposed_music ($3, *$2);
815 | TRANSPOSE steno_tonic_pitch Music {
816 $$ = new Transposed_music ($3, *$2);
820 { THIS->lexer_p_->push_note_state (); }
823 THIS->lexer_p_->pop_state ();
826 { THIS->lexer_p_->push_chord_state (); }
830 THIS->lexer_p_->pop_state ();
833 { THIS->lexer_p_->push_lyric_state (); }
837 THIS->lexer_p_->pop_state ();
839 | relative_music { $$ = $1; }
840 | re_rhythmed_music { $$ = $1; }
844 RELATIVE absolute_musical_pitch Music {
845 $$ = new Relative_octave_music ($3, *$2);
851 ADDLYRICS Music Music {
852 Lyric_combine_music * l = new Lyric_combine_music ($2, $3);
858 TRANSLATOR STRING '=' STRING {
859 Change_translator * t = new Change_translator;
860 t-> change_to_type_str_ = ly_scm2string ($2);
861 t-> change_to_id_str_ = ly_scm2string ($4);
864 $$->set_spot (THIS->here_input ());
869 PROPERTY STRING '.' STRING '=' scalar {
870 Translation_property *t = new Translation_property;
872 t->var_str_ = ly_scm2string ($4);
875 Context_specced_music *csm = new Context_specced_music (t);
877 $$->set_spot (THIS->here_input ());
879 csm-> translator_type_str_ = ly_scm2string ($2);
885 | int { $$ = gh_int2scm ($1); }
886 | embedded_scm { $$ = $1; }
891 pre_requests simple_element post_requests {
892 Music_sequence *l = dynamic_cast<Music_sequence*>($2);
893 for (int i=0; i < $1->size(); i++)
894 l->add_music ($1->elem(i));
895 for (int i=0; i < $3->size(); i++)
896 l->add_music ($3->elem(i));
905 $$ = new Request_chord;
906 $$-> set_spot (THIS->here_input ());
907 $1-> set_spot (THIS->here_input ());
908 ((Simultaneous_music*)$$) ->add_music ($1);//ugh
914 | verbose_command_req semicolon { $$ = $1; }
925 $$ = new Barcheck_req;
931 Span_req*b= new Span_req;
932 b->span_dir_ = START;
933 b->span_type_str_ = "beam";
937 if (!Duration::duration_type_b ($3))
938 THIS->parser_error (_f ("not a duration: %d", $3));
940 THIS->parser_error (_ ("Can't abbreviate"));
942 THIS->set_abbrev_beam ($3);
944 Chord_tremolo_req* a = new Chord_tremolo_req;
945 a->span_dir_ = START;
946 a->type_i_ = THIS->abbrev_beam_type_i_;
950 if (!THIS->abbrev_beam_type_i_)
952 Span_req*b= new Span_req;
954 b->span_type_str_ = "beam";
959 Chord_tremolo_req* a = new Chord_tremolo_req;
961 a->type_i_ = THIS->abbrev_beam_type_i_;
962 THIS->set_abbrev_beam (0);
967 $$ = new Breathing_sign_req;
974 $$ = new Bar_req (ly_scm2string ($2));
977 $$ = new Mark_req (ly_scm2string ($2));
981 $$ = new Mark_req (to_str ($2));
983 | TIME_T unsigned '/' unsigned {
984 Time_signature_change_req *m = new Time_signature_change_req;
990 Break_req * b = new Break_req;
991 b->penalty_f_ = $2 / 100.0;
992 b->set_spot (THIS->here_input ());
995 | SKIP duration_length {
996 Skip_req * skip_p = new Skip_req;
997 skip_p->duration_ = *$2;
1004 | CADENZA unsigned {
1005 $$ = new Cadenza_req ($2);
1007 | PARTIAL duration_length {
1008 $$ = new Partial_measure_req ($2->length_mom ());
1012 $$ = new Clef_change_req (ly_scm2string ($2));
1015 /* UGH. optional. */
1016 | KEY NOTENAME_PITCH optional_modality {
1017 Key_change_req *key_p= new Key_change_req;
1018 key_p->key_.pitch_arr_.push (*$2);
1019 key_p->key_.ordinary_key_b_ = true;
1020 key_p->key_.modality_i_ = $3;
1024 | KEYSIGNATURE pitch_list {
1025 Key_change_req *key_p= new Key_change_req;
1026 key_p->key_.pitch_arr_ = *$2;
1027 key_p->key_.ordinary_key_b_ = false;
1036 $$ = new Link_array<Request>;
1038 | post_requests post_request {
1039 $2->set_spot (THIS->here_input ());
1051 request_that_take_dir:
1054 | script_abbreviation {
1055 Identifier*i = THIS->lexer_p_->lookup_identifier ("dash-" + ly_scm2string ($1));
1056 Articulation_req *a = new Articulation_req;
1057 a->articulation_str_ = *i->access_content_String (false);
1063 script_dir request_that_take_dir {
1064 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1065 gs->dir_ = Direction ($1);
1067 $2->warning (_ ("Can't specify direction for this request"));
1073 REQUEST_IDENTIFIER {
1074 $$ = (Request*)$1->access_content_Request (true);
1075 $$->set_spot (THIS->here_input ());
1077 | TEXTSCRIPT STRING STRING {
1078 Text_script_req *ts_p = new Text_script_req;
1079 ts_p-> text_str_ = ly_scm2string ($2);
1080 ts_p-> style_str_ = ly_scm2string ($3);
1081 ts_p->set_spot (THIS->here_input ());
1085 | SPANREQUEST int STRING {
1086 Span_req * sp_p = new Span_req;
1087 sp_p-> span_dir_ = Direction($2);
1088 sp_p->span_type_str_ = ly_scm2string ($3);
1089 sp_p->set_spot (THIS->here_input ());
1093 Tremolo_req* a = new Tremolo_req;
1094 a->set_spot (THIS->here_input ());
1099 Articulation_req * a = new Articulation_req;
1100 a->articulation_str_ = ly_scm2string ($2);
1101 a->set_spot (THIS->here_input ());
1134 steno_musical_pitch:
1138 | NOTENAME_PITCH sup_quotes {
1140 $$->octave_i_ += $2;
1142 | NOTENAME_PITCH sub_quotes {
1144 $$->octave_i_ += - $2;
1152 | TONICNAME_PITCH sup_quotes {
1154 $$->octave_i_ += $2;
1156 | TONICNAME_PITCH sub_quotes {
1158 $$->octave_i_ += - $2;
1162 explicit_musical_pitch:
1163 MUSICAL_PITCH '{' int_list '}' {/* ugh */
1164 Array<int> &a = *$3;
1166 $$ = new Musical_pitch;
1167 $$->octave_i_ = a[0];
1168 $$->notename_i_ = a[1];
1169 $$->accidental_i_ = a[2];
1175 steno_musical_pitch {
1177 THIS->set_last_pitch ($1);
1179 | explicit_musical_pitch {
1181 THIS->set_last_pitch ($1);
1186 DURATION '{' int_list '}' {
1188 Array<int> &a = *$3;
1191 $$-> durlog_i_ = a[0];
1192 $$-> dots_i_ = a[1];
1200 if (!THIS->lexer_p_->lyric_state_b ())
1201 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1202 $$ = new Extender_req;
1208 if (!THIS->lexer_p_->lyric_state_b ())
1209 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1210 $$ = new Hyphen_req;
1215 close_request_parens {
1217 dynamic_cast<Span_req*> ($$)->span_dir_ = START;
1220 close_request_parens:
1222 Span_req* s= new Span_req;
1224 s->span_type_str_ = "slur";
1227 Span_req*s =new Span_req;
1229 s->span_type_str_ = "crescendo";
1232 Span_req*s =new Span_req;
1234 s->span_type_str_ = "decrescendo";
1240 open_request_parens {
1242 dynamic_cast<Span_req*> ($$)->span_dir_ = STOP;
1246 open_request_parens:
1248 Span_req *s = new Span_req;
1249 s->span_type_str_ = "crescendo";
1253 Span_req* s= new Span_req;
1255 s->span_type_str_ = "slur";
1261 Text_script_req *t = new Text_script_req;
1263 t->text_str_ = ly_scm2string ($1);
1265 $$->set_spot (THIS->here_input ());
1268 Text_script_req* t = new Text_script_req;
1270 t->text_str_ = to_str ($1);
1271 t->style_str_ = "finger";
1272 $$->set_spot (THIS->here_input ());
1276 script_abbreviation:
1278 $$ = gh_str02scm ("hat");
1281 $$ = gh_str02scm("plus");
1284 $$ = gh_str02scm ("dash");
1287 $$ = gh_str02scm ("bar");
1290 $$ = gh_str02scm ("larger");
1293 $$ = gh_str02scm ("dot");
1301 | '-' { $$ = CENTER; }
1306 $$ = new Link_array<Request>;
1308 | pre_requests open_request {
1313 absolute_musical_pitch:
1314 steno_musical_pitch {
1323 | duration_length '*' unsigned {
1324 $$->plet_.iso_i_ *= $3;
1326 | duration_length '/' unsigned {
1327 $$->plet_.type_i_ *= $3;
1331 entered_notemode_duration:
1333 THIS->set_last_duration ($1);
1337 optional_notemode_duration:
1339 $$ = new Duration (THIS->default_duration_);
1341 | entered_notemode_duration {
1349 if (!Duration::duration_type_b ($1))
1350 THIS->parser_error (_f ("not a duration: %d", $1));
1352 $$->durlog_i_ = Duration_convert::i2_type ($1);
1355 | DURATION_IDENTIFIER {
1356 $$ = $1->access_content_Duration (true);
1358 | steno_duration '.' {
1369 if (!Duration::duration_type_b ($2))
1370 THIS->parser_error (_f ("not a duration: %d", $2));
1372 THIS->parser_error (_ ("Can't abbreviate"));
1379 musical_pitch exclamations questions optional_notemode_duration {
1380 if (!THIS->lexer_p_->note_state_b ())
1381 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1384 Note_req *n = new Note_req;
1390 if (THIS->abbrev_beam_type_i_)
1392 if (n->duration_.plet_b ())
1393 THIS->parser_error (_ ("Can't abbreviate tuplet"));
1395 n->duration_.set_plet (1, 2);
1397 n->cautionary_b_ = $3 % 2;
1398 n->forceacc_b_ = $2 % 2 || n->cautionary_b_;
1400 Simultaneous_music*v = new Request_chord;
1401 v->set_spot (THIS->here_input ());
1402 n->set_spot (THIS->here_input ());
1408 | RESTNAME optional_notemode_duration {
1409 $$ = THIS->get_rest_element (ly_scm2string ($1), $2);
1412 | MEASURES optional_notemode_duration {
1413 Multi_measure_rest_req* m = new Multi_measure_rest_req;
1417 Simultaneous_music*velt_p = new Request_chord;
1418 velt_p->set_spot (THIS->here_input ());
1419 velt_p->add_music (m);
1422 | REPETITIONS optional_notemode_duration {
1423 Repetitions_req* r = new Repetitions_req;
1427 Simultaneous_music*velt_p = new Request_chord;
1428 velt_p->set_spot (THIS->here_input ());
1429 velt_p->add_music (r);
1432 | STRING optional_notemode_duration {
1433 if (!THIS->lexer_p_->lyric_state_b ())
1434 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1435 $$ = THIS->get_word_element (ly_scm2string ($1), $2);
1439 if (!THIS->lexer_p_->chord_state_b ())
1440 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1446 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion {
1447 $$ = THIS->get_chord (*$1, $3, $4, $5, *$2);
1452 $$ = new Array<Musical_pitch>;
1454 | CHORD_MINUS chord_notes {
1463 | chord_notes '.' chord_step {
1471 $$ = new Array<Musical_pitch>;
1473 | CHORD_CARET chord_notes {
1483 | '/' steno_tonic_pitch {
1490 $$ = new Array<Musical_pitch>;
1493 | CHORDMODIFIER_PITCH {
1494 $$ = new Array<Musical_pitch>;
1497 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
1498 $$ = new Array<Musical_pitch>;
1506 $$ = new Musical_pitch;
1507 $$->notename_i_ = ($1 - 1) % 7;
1508 $$->octave_i_ = $1 > 7 ? 1 : 0;
1509 $$->accidental_i_ = 0;
1512 $$ = new Musical_pitch;
1513 $$->notename_i_ = ($1 - 1) % 7;
1514 $$->octave_i_ = $1 > 7 ? 1 : 0;
1515 $$->accidental_i_ = 1;
1517 | unsigned CHORD_MINUS {
1518 $$ = new Musical_pitch;
1519 $$->notename_i_ = ($1 - 1) % 7;
1520 $$->octave_i_ = $1 > 7 ? 1 : 0;
1521 $$->accidental_i_ = -1;
1529 $$ = new Array<Musical_pitch>;
1531 | pitch_list musical_pitch {
1564 $$ = *$1->access_content_int (false);
1573 | STRING_IDENTIFIER {
1574 $$ = ly_ch_C_to_scm ($1->access_content_String (true)->ch_C ());
1576 | string '+' string {
1577 $$ = scm_string_append (scm_listify ($1, $3, SCM_UNDEFINED));
1584 | exclamations '!' { $$ ++; }
1589 | questions '?' { $$ ++; }
1599 My_lily_parser::set_yydebug (bool b)
1606 My_lily_parser::do_yyparse ()
1608 yyparse ((void*)this);