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 SCM_T '=' SCM_T {
556 if (!gh_symbol_p ($2))
557 THIS->parser_error ("expect a symbol as lvalue");
559 $$->default_properties_[$2] = $4;
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 {
650 THIS-> lexer_p_-> scope_l_arr_.pop();
654 midi_body: /* empty */ {
655 Midi_def * p =THIS->default_midi_p ();
657 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
660 Midi_def * p =$1-> access_content_Midi_def (true);
662 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
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_ = (ly_scm2string ($2) == "fold");
728 r->volta_fold_b_ = (ly_scm2string ($2) == "volta");
729 r->set_spot ($4->spot ());
733 Music_sequence: '{' Music_list '}' {
734 $$ = new Music_sequence ($2);
735 $$->set_spot ($2->spot ());
740 SEQUENTIAL '{' Music_list '}' {
741 $$ = new Sequential_music ($3);
742 $$->set_spot ($3->spot ());
744 | '{' Music_list '}' {
745 $$ = new Sequential_music ($2);
746 $$->set_spot ($2->spot ());
751 SIMULTANEOUS '{' Music_list '}'{
752 $$ = new Simultaneous_music ($3);
753 $$->set_spot ($3->spot ());
755 | '<' Music_list '>' {
756 $$ = new Simultaneous_music ($2);
757 $$->set_spot ($2->spot ());
762 request_chord { $$ = $1; }
763 | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); }
766 | Simple_music '*' unsigned '/' unsigned {
768 $$->compress (Moment($3, $5 ));
770 | Simple_music '*' unsigned {
772 $$->compress (Moment ($3, 1));
778 CONTEXT STRING Music {
779 Context_specced_music *csm = new Context_specced_music ($3);
781 csm->translator_type_str_ = ly_scm2string ($2);
782 csm->translator_id_str_ = "";
787 | AUTOCHANGE STRING Music {
788 Auto_change_music * chm = new Auto_change_music (ly_scm2string ($2), $3);
791 chm->set_spot ($3->spot ());
794 $$ = new Grace_music ($2);
796 | CONTEXT STRING '=' STRING Music {
797 Context_specced_music *csm = new Context_specced_music ($5);
799 csm->translator_type_str_ = ly_scm2string ($2);
800 csm->translator_id_str_ = ly_scm2string ($4);
805 THIS->remember_spot ();
808 unsigned '/' unsigned Music
811 $$ = new Time_scaled_music ($3, $5, $6);
812 $$->set_spot (THIS->pop_spot ());
814 | Repeated_music { $$ = $1; }
815 | Simultaneous_music { $$ = $1; }
816 | Sequential_music { $$ = $1; }
817 | TRANSPOSE musical_pitch Music {
818 $$ = new Transposed_music ($3, *$2);
821 | TRANSPOSE steno_tonic_pitch Music {
822 $$ = new Transposed_music ($3, *$2);
826 { THIS->lexer_p_->push_note_state (); }
829 THIS->lexer_p_->pop_state ();
832 { THIS->lexer_p_->push_chord_state (); }
836 THIS->lexer_p_->pop_state ();
839 { THIS->lexer_p_->push_lyric_state (); }
843 THIS->lexer_p_->pop_state ();
845 | relative_music { $$ = $1; }
846 | re_rhythmed_music { $$ = $1; }
850 RELATIVE absolute_musical_pitch Music {
851 $$ = new Relative_octave_music ($3, *$2);
857 ADDLYRICS Music Music {
858 Lyric_combine_music * l = new Lyric_combine_music ($2, $3);
864 TRANSLATOR STRING '=' STRING {
865 Change_translator * t = new Change_translator;
866 t-> change_to_type_str_ = ly_scm2string ($2);
867 t-> change_to_id_str_ = ly_scm2string ($4);
870 $$->set_spot (THIS->here_input ());
875 PROPERTY STRING '.' STRING '=' scalar {
876 Translation_property *t = new Translation_property;
878 t->var_str_ = ly_scm2string ($4);
881 Context_specced_music *csm = new Context_specced_music (t);
883 $$->set_spot (THIS->here_input ());
885 csm-> translator_type_str_ = ly_scm2string ($2);
891 | int { $$ = gh_int2scm ($1); }
892 | embedded_scm { $$ = $1; }
897 pre_requests simple_element post_requests {
898 Music_sequence *l = dynamic_cast<Music_sequence*>($2);
899 for (int i=0; i < $1->size(); i++)
900 l->add_music ($1->elem(i));
901 for (int i=0; i < $3->size(); i++)
902 l->add_music ($3->elem(i));
911 $$ = new Request_chord;
912 $$-> set_spot (THIS->here_input ());
913 $1-> set_spot (THIS->here_input ());
914 ((Simultaneous_music*)$$) ->add_music ($1);//ugh
920 | verbose_command_req semicolon { $$ = $1; }
931 $$ = new Barcheck_req;
937 Span_req*b= new Span_req;
938 b->span_dir_ = START;
939 b->span_type_str_ = "beam";
943 if (!Duration::duration_type_b ($3))
944 THIS->parser_error (_f ("not a duration: %d", $3));
946 THIS->parser_error (_ ("Can't abbreviate"));
948 THIS->set_abbrev_beam ($3);
950 Chord_tremolo_req* a = new Chord_tremolo_req;
951 a->span_dir_ = START;
952 a->type_i_ = THIS->abbrev_beam_type_i_;
956 if (!THIS->abbrev_beam_type_i_)
958 Span_req*b= new Span_req;
960 b->span_type_str_ = "beam";
965 Chord_tremolo_req* a = new Chord_tremolo_req;
967 a->type_i_ = THIS->abbrev_beam_type_i_;
968 THIS->set_abbrev_beam (0);
973 $$ = new Breathing_sign_req;
980 $$ = new Bar_req (ly_scm2string ($2));
983 $$ = new Mark_req (ly_scm2string ($2));
987 $$ = new Mark_req (to_str ($2));
989 | TIME_T unsigned '/' unsigned {
990 Time_signature_change_req *m = new Time_signature_change_req;
996 Break_req * b = new Break_req;
997 b->penalty_f_ = $2 / 100.0;
998 b->set_spot (THIS->here_input ());
1001 | SKIP duration_length {
1002 Skip_req * skip_p = new Skip_req;
1003 skip_p->duration_ = *$2;
1010 | CADENZA unsigned {
1011 $$ = new Cadenza_req ($2);
1013 | PARTIAL duration_length {
1014 $$ = new Partial_measure_req ($2->length_mom ());
1018 $$ = new Clef_change_req (ly_scm2string ($2));
1021 /* UGH. optional. */
1022 | KEY NOTENAME_PITCH optional_modality {
1023 Key_change_req *key_p= new Key_change_req;
1024 key_p->key_.pitch_arr_.push (*$2);
1025 key_p->key_.ordinary_key_b_ = true;
1026 key_p->key_.modality_i_ = $3;
1030 | KEYSIGNATURE pitch_list {
1031 Key_change_req *key_p= new Key_change_req;
1032 key_p->key_.pitch_arr_ = *$2;
1033 key_p->key_.ordinary_key_b_ = false;
1042 $$ = new Link_array<Request>;
1044 | post_requests post_request {
1045 $2->set_spot (THIS->here_input ());
1057 request_that_take_dir:
1060 | script_abbreviation {
1061 Identifier*i = THIS->lexer_p_->lookup_identifier ("dash-" + ly_scm2string ($1));
1062 Articulation_req *a = new Articulation_req;
1063 a->articulation_str_ = *i->access_content_String (false);
1069 script_dir request_that_take_dir {
1070 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1071 gs->dir_ = Direction ($1);
1073 $2->warning (_ ("Can't specify direction for this request"));
1079 REQUEST_IDENTIFIER {
1080 $$ = (Request*)$1->access_content_Request (true);
1081 $$->set_spot (THIS->here_input ());
1083 | TEXTSCRIPT STRING STRING {
1084 Text_script_req *ts_p = new Text_script_req;
1085 ts_p-> text_str_ = ly_scm2string ($2);
1086 ts_p-> style_str_ = ly_scm2string ($3);
1087 ts_p->set_spot (THIS->here_input ());
1091 | SPANREQUEST int STRING {
1092 Span_req * sp_p = new Span_req;
1093 sp_p-> span_dir_ = Direction($2);
1094 sp_p->span_type_str_ = ly_scm2string ($3);
1095 sp_p->set_spot (THIS->here_input ());
1099 Tremolo_req* a = new Tremolo_req;
1100 a->set_spot (THIS->here_input ());
1105 Articulation_req * a = new Articulation_req;
1106 a->articulation_str_ = ly_scm2string ($2);
1107 a->set_spot (THIS->here_input ());
1140 steno_musical_pitch:
1144 | NOTENAME_PITCH sup_quotes {
1146 $$->octave_i_ += $2;
1148 | NOTENAME_PITCH sub_quotes {
1150 $$->octave_i_ += - $2;
1158 | TONICNAME_PITCH sup_quotes {
1160 $$->octave_i_ += $2;
1162 | TONICNAME_PITCH sub_quotes {
1164 $$->octave_i_ += - $2;
1168 explicit_musical_pitch:
1169 MUSICAL_PITCH '{' int_list '}' {/* ugh */
1170 Array<int> &a = *$3;
1172 $$ = new Musical_pitch;
1173 $$->octave_i_ = a[0];
1174 $$->notename_i_ = a[1];
1175 $$->accidental_i_ = a[2];
1181 steno_musical_pitch {
1183 THIS->set_last_pitch ($1);
1185 | explicit_musical_pitch {
1187 THIS->set_last_pitch ($1);
1192 DURATION '{' int_list '}' {
1194 Array<int> &a = *$3;
1197 $$-> durlog_i_ = a[0];
1198 $$-> dots_i_ = a[1];
1206 if (!THIS->lexer_p_->lyric_state_b ())
1207 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1208 $$ = new Extender_req;
1214 if (!THIS->lexer_p_->lyric_state_b ())
1215 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1216 $$ = new Hyphen_req;
1221 close_request_parens {
1223 dynamic_cast<Span_req*> ($$)->span_dir_ = START;
1226 close_request_parens:
1228 Span_req* s= new Span_req;
1230 s->span_type_str_ = "slur";
1233 Span_req*s =new Span_req;
1235 s->span_type_str_ = "crescendo";
1238 Span_req*s =new Span_req;
1240 s->span_type_str_ = "decrescendo";
1246 open_request_parens {
1248 dynamic_cast<Span_req*> ($$)->span_dir_ = STOP;
1252 open_request_parens:
1254 Span_req *s = new Span_req;
1255 s->span_type_str_ = "crescendo";
1259 Span_req* s= new Span_req;
1261 s->span_type_str_ = "slur";
1267 Text_script_req *t = new Text_script_req;
1269 t->text_str_ = ly_scm2string ($1);
1271 $$->set_spot (THIS->here_input ());
1274 Text_script_req* t = new Text_script_req;
1276 t->text_str_ = to_str ($1);
1277 t->style_str_ = "finger";
1278 $$->set_spot (THIS->here_input ());
1282 script_abbreviation:
1284 $$ = gh_str02scm ("hat");
1287 $$ = gh_str02scm("plus");
1290 $$ = gh_str02scm ("dash");
1293 $$ = gh_str02scm ("bar");
1296 $$ = gh_str02scm ("larger");
1299 $$ = gh_str02scm ("dot");
1307 | '-' { $$ = CENTER; }
1312 $$ = new Link_array<Request>;
1314 | pre_requests open_request {
1319 absolute_musical_pitch:
1320 steno_musical_pitch {
1329 | duration_length '*' unsigned {
1330 $$->plet_.iso_i_ *= $3;
1332 | duration_length '/' unsigned {
1333 $$->plet_.type_i_ *= $3;
1337 entered_notemode_duration:
1339 THIS->set_last_duration ($1);
1343 optional_notemode_duration:
1345 $$ = new Duration (THIS->default_duration_);
1347 | entered_notemode_duration {
1355 if (!Duration::duration_type_b ($1))
1356 THIS->parser_error (_f ("not a duration: %d", $1));
1358 $$->durlog_i_ = Duration_convert::i2_type ($1);
1361 | DURATION_IDENTIFIER {
1362 $$ = $1->access_content_Duration (true);
1364 | steno_duration '.' {
1375 if (!Duration::duration_type_b ($2))
1376 THIS->parser_error (_f ("not a duration: %d", $2));
1378 THIS->parser_error (_ ("Can't abbreviate"));
1385 musical_pitch exclamations questions optional_notemode_duration {
1386 if (!THIS->lexer_p_->note_state_b ())
1387 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1390 Note_req *n = new Note_req;
1396 if (THIS->abbrev_beam_type_i_)
1398 if (n->duration_.plet_b ())
1399 THIS->parser_error (_ ("Can't abbreviate tuplet"));
1401 n->duration_.set_plet (1, 2);
1403 n->cautionary_b_ = $3 % 2;
1404 n->forceacc_b_ = $2 % 2 || n->cautionary_b_;
1406 Simultaneous_music*v = new Request_chord;
1407 v->set_spot (THIS->here_input ());
1408 n->set_spot (THIS->here_input ());
1414 | RESTNAME optional_notemode_duration {
1415 $$ = THIS->get_rest_element (ly_scm2string ($1), $2);
1418 | MEASURES optional_notemode_duration {
1419 Multi_measure_rest_req* m = new Multi_measure_rest_req;
1423 Simultaneous_music*velt_p = new Request_chord;
1424 velt_p->set_spot (THIS->here_input ());
1425 velt_p->add_music (m);
1428 | REPETITIONS optional_notemode_duration {
1429 Repetitions_req* r = new Repetitions_req;
1433 Simultaneous_music*velt_p = new Request_chord;
1434 velt_p->set_spot (THIS->here_input ());
1435 velt_p->add_music (r);
1438 | STRING optional_notemode_duration {
1439 if (!THIS->lexer_p_->lyric_state_b ())
1440 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1441 $$ = THIS->get_word_element (ly_scm2string ($1), $2);
1445 if (!THIS->lexer_p_->chord_state_b ())
1446 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1452 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion {
1453 $$ = THIS->get_chord (*$1, $3, $4, $5, *$2);
1458 $$ = new Array<Musical_pitch>;
1460 | CHORD_MINUS chord_notes {
1469 | chord_notes '.' chord_step {
1477 $$ = new Array<Musical_pitch>;
1479 | CHORD_CARET chord_notes {
1489 | '/' steno_tonic_pitch {
1496 $$ = new Array<Musical_pitch>;
1499 | CHORDMODIFIER_PITCH {
1500 $$ = new Array<Musical_pitch>;
1503 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
1504 $$ = new Array<Musical_pitch>;
1512 $$ = new Musical_pitch;
1513 $$->notename_i_ = ($1 - 1) % 7;
1514 $$->octave_i_ = $1 > 7 ? 1 : 0;
1515 $$->accidental_i_ = 0;
1518 $$ = new Musical_pitch;
1519 $$->notename_i_ = ($1 - 1) % 7;
1520 $$->octave_i_ = $1 > 7 ? 1 : 0;
1521 $$->accidental_i_ = 1;
1523 | unsigned CHORD_MINUS {
1524 $$ = new Musical_pitch;
1525 $$->notename_i_ = ($1 - 1) % 7;
1526 $$->octave_i_ = $1 > 7 ? 1 : 0;
1527 $$->accidental_i_ = -1;
1535 $$ = new Array<Musical_pitch>;
1537 | pitch_list musical_pitch {
1570 $$ = *$1->access_content_int (false);
1579 | STRING_IDENTIFIER {
1580 $$ = ly_ch_C_to_scm ($1->access_content_String (true)->ch_C ());
1582 | string '+' string {
1583 $$ = scm_string_append (scm_listify ($1, $3, SCM_UNDEFINED));
1590 | exclamations '!' { $$ ++; }
1595 | questions '?' { $$ ++; }
1605 My_lily_parser::set_yydebug (bool b)
1612 My_lily_parser::do_yyparse ()
1614 yyparse ((void*)this);