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"
17 #include "script-def.hh"
18 #include "symtable.hh"
21 #include "my-lily-lexer.hh"
22 #include "paper-def.hh"
23 #include "midi-def.hh"
25 #include "file-path.hh"
28 #include "parseconstruct.hh"
29 #include "dimensions.hh"
30 #include "identifier.hh"
31 #include "command-request.hh"
32 #include "musical-request.hh"
33 #include "my-lily-parser.hh"
34 #include "text-def.hh"
35 #include "translator-group.hh"
37 #include "music-list.hh"
38 #include "duration-convert.hh"
39 #include "change-translator.hh"
40 #include "file-results.hh"
41 #include "mudela-version.hh"
43 #include "relative-music.hh"
44 #include "transposed-music.hh"
45 #include "compressed-music.hh"
46 #include "repeated-music.hh"
49 Mudela_version oldest_version ("1.0.7");
50 Mudela_version version ("1.0.11");
53 // needed for bison.simple's malloc() and free()
56 int const GUESS_PLET = 5;
57 int guess_plet_a[GUESS_PLET] =
77 Assignment (Assignment const&s)
79 name_p_ = new String (*s.name_p_);
80 id_p_ = s.id_p_->clone ();
84 Paper_def* current_paper = 0;
90 #define YYERROR_VERBOSE 1
92 #define YYPARSE_PARAM my_lily_parser_l
93 #define YYLEX_PARAM my_lily_parser_l
94 #define THIS ((My_lily_parser *) my_lily_parser_l)
96 #define yyerror THIS->parser_error
97 #define ARRAY_SIZE(a,s) if (a.size () != s) THIS->parser_error (_f("expecting %d arguments", s))
103 Array<Interval>* intarr;
104 Array<Musical_pitch> *pitch_arr;
105 Array<String> * strvec;
108 Simultaneous_music *chord;
113 Music_list *music_list;
118 Music_output_def * outputdef;
119 Musical_pitch * pitch;
123 Notename_table *notenametab;
127 General_script_def * script;
132 Symtables* symtables;
144 yylex (YYSTYPE *s, void * v_l)
146 My_lily_parser *pars_l = (My_lily_parser*) v_l;
147 My_lily_lexer * lex_l = pars_l->lexer_p_;
149 lex_l->lexval_l = (void*) s;
150 return lex_l->yylex ();
158 /* tokens which are not keywords */
219 %token E_EXCLAMATION E_SMALLER E_BIGGER E_CHAR
223 %token <pitch> NOTENAME_PITCH
224 %token <id> DURATION_IDENTIFIER
225 %token <id> IDENTIFIER
226 %token <id> NOTENAME_TABLE_IDENTIFIER
227 %token <id> MUSIC_IDENTIFIER
228 %token <id> POST_REQUEST_IDENTIFIER
229 %token <id> SCRIPT_IDENTIFIER
230 %token <id> COMMAND_IDENTIFIER
231 %token <id> REAL_IDENTIFIER
232 %token <id> STRING_IDENTIFIER
233 %token <id> TRANS_IDENTIFIER
234 %token <id> INT_IDENTIFIER
235 %token <id> SCORE_IDENTIFIER
236 %token <id> MIDI_IDENTIFIER
237 %token <id> PAPER_IDENTIFIER
238 %token <id> REQUEST_IDENTIFIER
240 %token <string> DURATION RESTNAME
241 %token <string> STRING
245 %type <outputdef> output_def
246 %type <scope> mudela_header mudela_header_body
248 %type <i> open_request_parens close_request_parens
249 %type <i> open_abbrev_parens
250 %type <i> open_plet_parens close_plet_parens
251 %type <i> sub_quotes sup_quotes
252 %type <music> simple_element request_chord command_element Simple_music Composite_music
253 %type <music> Alternative_music Repeated_music
254 %type <i> abbrev_type
255 %type <i> int unsigned
257 %type <i> optional_modality
258 %type <id> identifier_init simple_identifier_init block_identifier
259 %type <duration> steno_duration notemode_duration
260 %type <duration> entered_notemode_duration explicit_duration
261 %type <interval> dinterval
262 %type <intvec> intastint_list int_list
263 %type <symtables> symtables symtables_body
265 %type <pitch> explicit_musical_pitch steno_musical_pitch musical_pitch absolute_musical_pitch
266 %type <notereq> steno_notepitch
267 %type <pitch_arr> pitch_list
269 %type <pitch_arr> chord_additions chord_subtractions
270 %type <pitch> chord_note
271 %type <midi> midi_block midi_body
272 %type <duration> duration_length
274 %type <scalar> scalar
275 %type <music> Music relative_music Sequential_music Simultaneous_music
276 %type <music> property_def translator_change
277 %type <music_list> Music_list
278 %type <paper> paper_block paper_def_body
279 %type <real> real_expression real dimension
280 %type <request> abbrev_command_req
281 %type <request> post_request structured_post_request
282 %type <pair> plet_fraction
283 %type <request> command_req verbose_command_req
284 %type <request> script_req dynamic_req extender_req
285 %type <string> string
286 %type <score> score_block score_body
287 %type <intarr> shape_array
288 %type <script> script_definition script_body mudela_script gen_script_def
289 %type <textdef> text_def finger
290 %type <string> script_abbreviation
291 %type <symbol> symboldef
292 %type <symtable> symtable symtable_body
293 %type <trans> translator_spec translator_spec_body
294 %type <tempo> tempo_request
295 %type <notenametab> notenames_body notenames_block
306 | mudela toplevel_expression {}
307 | mudela assignment { }
309 | mudela check_version { }
314 THIS->lexer_p_->set_notename_table ($1);
317 delete header_global_p;
318 header_global_p = $1;
321 score_global_array.push ($1);
324 Identifier * id = new
325 Paper_def_identifier ($1, PAPER_IDENTIFIER);
326 THIS->lexer_p_->set_identifier ("$defaultpaper", id)
329 Identifier * id = new
330 Midi_def_identifier ($1, MIDI_IDENTIFIER);
331 THIS->lexer_p_->set_identifier ("$defaultmidi", id)
339 read_lily_scm_file (*$2);
343 gh_eval_str ($2->ch_l ());
349 Mudela_version ver (*$2);
350 if (!((ver >= oldest_version) && (ver <= version))) {
351 if (THIS->ignore_version_b_) {
352 THIS->here_input ().error (_f ("incorrect mudela version: %s (%s, %s)", ver.str (), oldest_version.str (), version.str ()));
354 THIS->fatal_error_i_ = 1;
355 THIS->parser_error (_f ("incorrect mudela version: %s (%s, %s)", ver.str (), oldest_version.str (), version.str ()));
363 NOTENAMES '{' notenames_body '}' { $$ = $3; }
370 $$ = new Notename_table;
372 | NOTENAME_TABLE_IDENTIFIER {
373 $$ = $1-> access_content_Notename_table(true);
375 | notenames_body STRING '=' explicit_musical_pitch {
386 THIS->lexer_p_-> scope_l_arr_.push ($$);
388 | mudela_header_body assignment ';' {
394 HEADER '{' mudela_header_body '}' {
396 THIS->lexer_p_-> scope_l_arr_.pop ();
406 THIS->remember_spot ();
408 /* cont */ '=' identifier_init {
409 THIS->lexer_p_->set_identifier (*$1, $4);
410 $4->init_b_ = THIS->init_parse_b_;
411 $4->set_spot (THIS->pop_spot ());
416 simple_identifier_init: identifier_init
425 $$ = new Score_identifier ($1, SCORE_IDENTIFIER);
429 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
432 $$ = new Paper_def_identifier ($1, PAPER_IDENTIFIER);
435 $$ = new Midi_def_identifier ($1, MIDI_IDENTIFIER);
439 $$ = new Symtables_identifier ($1, IDENTIFIER);
442 $$ = new Translator_identifier ($1, TRANS_IDENTIFIER);
445 $$ = new Music_identifier ($1, MUSIC_IDENTIFIER);
449 $$ = new Request_identifier ($1, POST_REQUEST_IDENTIFIER);
451 | explicit_duration {
452 $$ = new Duration_identifier ($1, DURATION_IDENTIFIER);
455 $$ = new Real_identifier (new Real ($1), REAL_IDENTIFIER);
458 $$ = new String_identifier ($1, STRING_IDENTIFIER);
461 $$ = new int_identifier (new int ($1), INT_IDENTIFIER);
463 | script_definition {
464 $$ = new General_script_def_identifier ($1, SCRIPT_IDENTIFIER);
470 TRANSLATOR '{' translator_spec_body '}'
474 translator_spec_body:
476 $$ = $1->access_content_Translator (true);
477 $$-> set_spot (THIS->here_input ());
480 Translator* t = get_translator_l (*$2);
481 Translator_group * tg = dynamic_cast<Translator_group*> (t);
484 THIS->parser_error (_("Need a translator group for a context"));
487 t->set_spot (THIS->here_input ());
491 | translator_spec_body STRING '=' simple_identifier_init ';' {
493 String_identifier *s = dynamic_cast<String_identifier*> (id);
494 Real_identifier *r= dynamic_cast<Real_identifier*>(id);
495 int_identifier *i = dynamic_cast<int_identifier*> (id);
498 if (s) str = *s->access_content_String (false);
499 if (i) str = to_str (*i->access_content_int (false));
500 if (r) str = to_str (*r->access_content_Real (false));
502 THIS->parser_error (_("Wrong type for property value"));
505 $$->set_property (*$2, str);
507 | translator_spec_body NAME STRING ';' {
511 | translator_spec_body CONSISTS STRING ';' {
512 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, true);
515 | translator_spec_body ACCEPTS STRING ';' {
516 dynamic_cast<Translator_group*> ($$)-> set_acceptor (*$3, true);
519 | translator_spec_body REMOVE STRING ';' {
520 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, false);
529 SCORE { THIS->remember_spot ();
530 THIS->error_level_i_ =0;
532 /*cont*/ '{' score_body '}' {
534 $$->set_spot (THIS->pop_spot ());
535 if (!$$->def_p_arr_.size ())
536 $$->add_output (THIS->default_paper_p ());
538 /* handle error levels. */
539 $$->errorlevel_i_ = THIS->error_level_i_;
540 THIS->error_level_i_ = 0;
548 $$ = $1->access_content_Score (true);
550 | score_body mudela_header {
555 $2->warning (_ ("More than one music block"));
558 | score_body output_def {
576 /* */ { $$ =new Array<int>; }
577 | intastint_list int '*' int {
578 $$->push ($2); $$->push ($4);
580 | intastint_list int {
581 $$->push ($2); $$->push (1);
590 PAPER '{' paper_def_body '}' {
592 THIS-> lexer_p_->scope_l_arr_.pop ();
603 Paper_def *p = THIS->default_paper_p ();
604 THIS-> lexer_p_-> scope_l_arr_.push (p->scope_p_);
607 | PAPER_IDENTIFIER optional_semicolon {
608 Paper_def *p = $1->access_content_Paper_def (true);
609 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
612 | paper_def_body int '=' symtables { // ugh, what a syntax
613 Lookup * l = new Lookup (*$4);
614 $$->set_lookup ($2, l);
616 | paper_def_body assignment ';' {
619 | paper_def_body translator_spec {
620 $$->assign_translator ($2);
622 | paper_def_body SHAPE '=' shape_array ';' {
623 $$->shape_int_a_ = *$4;
626 | paper_def_body error {
633 real_expression { $$ = $1; }
658 $$= *$1->access_content_Real (false);
660 | '-' real_expression %prec UNARY_MINUS {
663 | real_expression '*' real_expression {
666 | real_expression '/' real_expression {
669 | real_expression '+' real_expression {
672 | real_expression '-' real_expression {
675 | '(' real_expression ')' {
683 $$ = new Array<Interval>;
685 | shape_array real real {
686 $$->push(Interval($2, $2 + $3));
695 '{' midi_body '}' { $$ = $3; }
698 midi_body: /* empty */ {
699 $$ = THIS->default_midi_p ();
702 $$ = $1-> access_content_Midi_def (true);
704 | midi_body translator_spec {
705 $$-> assign_translator ($2);
707 | midi_body tempo_request ';' {
708 $$->set_tempo ($2->dur_.length (), $2->metronome_i_);
717 TEMPO entered_notemode_duration '=' unsigned {
721 $$-> metronome_i_ = $4;
725 Music_list: /* empty */ {
742 Music_list* m = new Music_list;
743 $$ = new Sequential_music (m);
745 | ALTERNATIVE Simultaneous_music {
748 | ALTERNATIVE Sequential_music {
753 Repeated_music: REPEAT unsigned Music Alternative_music {
754 Music_sequence* m = dynamic_cast <Music_sequence*> ($4);
756 $$ = new Repeated_music ($3, $2 >? 1, m);
760 Sequential_music: '{' Music_list '}' {
761 $$ = new Sequential_music ($2);
765 Simultaneous_music: '<' Music_list '>' {
766 $$ = new Simultaneous_music ($2);
771 request_chord { $$ = $1; }
772 | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); }
781 $$->translator_type_str_ = *$2;
784 | TYPE STRING '=' STRING Music {
786 $$->translator_type_str_ = *$2;
787 $$->translator_id_str_ = *$4;
792 THIS->remember_spot ();
798 $$ = new Compressed_music ($3, $5, $6);
799 $$->set_spot (THIS->pop_spot ());
801 | Repeated_music { $$ = $1; }
802 | Simultaneous_music { $$ = $1; }
803 | Sequential_music { $$ = $1; }
804 | TRANSPOSE musical_pitch Music {
805 $$ = new Transposed_music ($3, *$2);
809 { THIS->lexer_p_->push_note_state (); }
812 THIS->lexer_p_->pop_state ();
815 { THIS->lexer_p_->push_chord_state (); }
819 THIS->lexer_p_->pop_state ();
822 { THIS->lexer_p_->push_lyric_state (); }
826 THIS->lexer_p_->pop_state ();
828 | relative_music { $$ = $1; }
832 RELATIVE absolute_musical_pitch Music {
833 $$ = new Relative_octave_music ($3, *$2);
839 TRANSLATOR STRING '=' STRING {
840 Change_translator * t = new Change_translator;
841 t-> change_to_type_str_ = *$2;
842 t-> change_to_id_str_ = *$4;
845 $$->set_spot (THIS->here_input ());
852 PROPERTY STRING '.' STRING '=' scalar {
853 Translation_property *t = new Translation_property;
854 t-> translator_type_str_ = *$2;
858 $$->set_spot (THIS->here_input ());
866 STRING { $$ = new Scalar (*$1); delete $1; }
867 | int { $$ = new Scalar ($1); }
872 pre_requests simple_element post_requests {
873 THIS->add_requests ((Simultaneous_music*)$2);//ugh
881 $$ = new Request_chord;
882 $$-> set_spot (THIS->here_input ());
883 $1-> set_spot (THIS->here_input ());
884 ((Simultaneous_music*)$$) ->add_music ($1);//ugh
890 | verbose_command_req ';' { $$ = $1; }
895 $$ = new Barcheck_req;
897 | COMMAND_IDENTIFIER {
898 $$ = $1->access_content_Request (true);
903 $$->spantype = Span_req::START;
907 $$->spantype = Span_req::STOP;
915 $$ = new Bar_req (*$2);
919 $$ = new Mark_req (*$2);
923 $$ = new Mark_req (to_str ($2));
925 | TIME_T unsigned '/' unsigned {
926 Time_signature_change_req *m = new Time_signature_change_req;
932 Break_req * b = new Break_req;
934 b-> set_spot (THIS->here_input ());
937 | SKIP duration_length {
938 Skip_req * skip_p = new Skip_req;
939 skip_p->duration_ = *$2;
947 $$ = new Cadenza_req ($2);
949 | PARTIAL duration_length {
950 $$ = new Partial_measure_req ($2->length ());
954 $$ = new Clef_change_req (*$2);
957 | KEY NOTENAME_PITCH optional_modality {
958 Key_change_req *key_p= new Key_change_req;
959 key_p->pitch_arr_.push(*$2);
960 key_p->ordinary_key_b_ = true;
961 key_p->modality_i_ = $3;
965 | KEYSIGNATURE pitch_list {
966 Key_change_req *key_p= new Key_change_req;
967 key_p->pitch_arr_ = *$2;
968 key_p->ordinary_key_b_ = false;
972 | GROUPING intastint_list {
973 $$ = get_grouping_req (*$2); delete $2;
979 /* something silly happened. Junk this stuff*/
980 if (!THIS->post_reqs.empty ())
982 warning ("Junking post-requests");
983 THIS->post_reqs.clear ();
986 | post_requests structured_post_request {
987 $2->set_spot (THIS->here_input ());
988 THIS->post_reqs.push ($2);
990 | post_requests close_request_parens {
991 Array<Request*>& r = *THIS->get_parens_request ($2);
992 for (int i = 0; i < r.size (); i++ )
993 r[i]->set_spot (THIS->here_input ());
994 THIS->post_reqs.concat (r);
999 structured_post_request:
1005 POST_REQUEST_IDENTIFIER {
1006 $$ = (Request*)$1->access_content_Request (true);
1012 Abbreviation_req* a = new Abbreviation_req;
1047 steno_musical_pitch:
1051 | NOTENAME_PITCH sup_quotes {
1053 $$->octave_i_ += $2;
1055 | NOTENAME_PITCH sub_quotes {
1057 $$->octave_i_ += - $2;
1061 explicit_musical_pitch:
1062 MUSICAL_PITCH '{' int_list '}' {/* ugh */
1063 Array<int> &a = *$3;
1065 $$ = new Musical_pitch;
1066 $$->octave_i_ = a[0];
1067 $$->notename_i_ = a[1];
1068 $$->accidental_i_ = a[2];
1075 | explicit_musical_pitch
1085 | steno_notepitch '!' {
1086 $$->forceacc_b_ = ! $$->forceacc_b_;
1088 | steno_notepitch '?' {
1089 $$->forceacc_b_ = ! $$->forceacc_b_;
1090 $$->cautionary_b_ = ! $$->cautionary_b_;
1096 DURATION '{' int_list '}' {
1098 Array<int> &a = *$3;
1101 $$-> durlog_i_ = a[0];
1102 $$-> dots_i_ = a[1];
1110 if (!THIS->lexer_p_->lyric_state_b ())
1111 THIS->parser_error (_ ("have to be in Lyric mode for lyrics"));
1112 Extender_req * e_p = new Extender_req;
1113 e_p->spantype = Span_req::START;
1115 THIS->extender_req = e_p;
1119 ABSDYNAMIC '{' unsigned '}' {
1120 Absolute_dynamic_req *ad_p = new Absolute_dynamic_req;
1121 ad_p ->loudness_ = (Dynamic_req::Loudness)$3;
1124 | SPANDYNAMIC '{' int int '}' {
1125 Span_dynamic_req * sp_p = new Span_dynamic_req;
1126 sp_p->spantype = (Span_req::Spantype)$4;
1127 sp_p-> dynamic_dir_ = (Direction)$3;
1133 unsigned '/' unsigned {
1140 $$[0] = guess_plet_a[(num <? GUESS_PLET) - 1];
1148 THIS->plet_.type_i_ = $2[1];
1149 THIS->plet_.iso_i_ = $2[0];
1150 THIS->default_duration_.plet_ = THIS->plet_;
1154 THIS->plet_.type_i_ = 1;
1155 THIS->plet_.iso_i_ = 1;
1156 THIS->default_duration_.plet_ = THIS->plet_;
1158 | TELP plet_fraction {
1160 THIS->plet_.type_i_ = $2[1];
1161 THIS->plet_.iso_i_ = $2[0];
1162 THIS->default_duration_.plet_ = THIS->plet_;
1166 close_request_parens:
1188 if (!Duration::duration_type_b ($3))
1189 THIS->parser_error (_f ("not a duration: %d", $3));
1191 THIS->parser_error (_ ("can't abbreviate"));
1193 THIS->set_abbrev_beam ($3);
1200 THIS->plet_.type_i_ = $2[1];
1201 THIS->plet_.iso_i_ = $2[0];
1202 THIS->default_duration_.plet_ = THIS->plet_;
1204 | PLET plet_fraction {
1206 THIS->plet_.type_i_ = $2[1];
1207 THIS->plet_.iso_i_ = $2[0];
1208 THIS->default_duration_.plet_ = THIS->plet_;
1212 open_request_parens:
1222 | open_abbrev_parens
1229 SCRIPT '{' script_body '}' { $$ = $3; }
1233 STRING int int int int int {
1234 Script_def *s = new Script_def;
1235 s->set_from_input (*$1,$2, $3,$4,$5, $6);
1242 script_dir gen_script_def {
1243 Musical_script_req *m = new Musical_script_req;
1245 m->scriptdef_p_ = $2;
1246 m->set_spot (THIS->here_input ());
1248 m->dir_ = (Direction)$1;
1255 ((Text_def*) $$)->align_dir_ = LEFT; /* UGH */
1259 $$-> set_spot (THIS->here_input ());
1263 ((Text_def*)$$)->align_dir_ = RIGHT; /* UGH */
1269 Text_def *t = new Text_def;
1273 $$->set_spot (THIS->here_input ());
1279 Text_def* t = new Text_def;
1281 t->text_str_ = to_str ($1);
1282 t->style_str_ = "finger";
1283 $$->set_spot (THIS->here_input ());
1287 script_abbreviation:
1288 '^' { $$ = get_scriptdef ('^'); }
1289 | '+' { $$ = get_scriptdef ('+'); }
1290 | '-' { $$ = get_scriptdef ('-'); }
1291 | '|' { $$ = get_scriptdef ('|'); }
1292 | 'o' { $$ = get_scriptdef ('o'); }
1293 | '>' { $$ = get_scriptdef ('>'); }
1295 $$ = get_scriptdef ('.');
1300 SCRIPT_IDENTIFIER { $$ = $1->access_content_General_script_def (true); }
1301 | script_definition { $$ = $1; }
1302 | script_abbreviation {
1303 $$ = THIS->lexer_p_->lookup_identifier (*$1)->access_content_General_script_def (true);
1316 if (THIS->extender_req)
1318 Extender_req * e_p = new Extender_req;
1319 e_p->spantype = Span_req::STOP;
1320 THIS->pre_reqs.push (e_p);
1321 THIS->extender_req = 0;
1325 | pre_requests open_request_parens {
1327 Array<Request*>& r = *THIS->get_parens_request ($2);
1328 for (int i = 0; i < r.size (); i++ )
1329 r[i]->set_spot (THIS->here_input ());
1330 THIS->pre_reqs.concat (r);
1335 absolute_musical_pitch:
1336 steno_musical_pitch {
1349 | dots '.' { $$ ++; }
1352 entered_notemode_duration:
1354 $$ = new Duration (THIS->default_duration_);
1357 $$ = new Duration (THIS->default_duration_);
1361 THIS->set_last_duration ($1);
1366 entered_notemode_duration {
1374 if (!Duration::duration_type_b ($1))
1375 THIS->parser_error (_f ("not a duration: %d", $1));
1377 $$->durlog_i_ = Duration_convert::i2_type ($1);
1378 $$->set_plet (THIS->plet_.iso_i_, THIS->plet_.type_i_);
1381 | DURATION_IDENTIFIER {
1382 $$ = $1->access_content_Duration (true);
1384 | steno_duration '.' {
1387 | steno_duration '*' unsigned {
1388 $$->plet_.iso_i_ *= $3;
1390 | steno_duration '/' unsigned {
1391 $$->plet_.type_i_ *= $3;
1401 if (!Duration::duration_type_b ($2))
1402 THIS->parser_error (_f ("not a duration: %d", $2));
1404 THIS->parser_error (_ ("can't abbreviate"));
1412 steno_notepitch notemode_duration {
1413 if (!THIS->lexer_p_->note_state_b ()
1414 && !THIS->lexer_p_->chord_state_b ())
1415 THIS->parser_error (_ ("have to be in Note mode for notes"));
1416 $1->duration_ = *$2;
1417 $$ = THIS->get_note_element ($1, $2);
1419 | RESTNAME notemode_duration {
1420 $$ = THIS->get_rest_element (*$1, $2);
1421 delete $1; // delete notename
1423 | MEASURES notemode_duration {
1424 Multi_measure_rest_req* m = new Multi_measure_rest_req;
1428 Simultaneous_music*velt_p = new Request_chord;
1429 velt_p->set_spot (THIS->here_input ());
1430 velt_p->add_music (m);
1433 | STRING notemode_duration {
1434 if (!THIS->lexer_p_->lyric_state_b ())
1435 THIS->parser_error (_ ("have to be in Lyric mode for lyrics"));
1436 $$ = THIS->get_word_element (*$1, $2);
1440 if (!THIS->lexer_p_->chord_state_b ())
1441 THIS->parser_error (_ ("have to be in Chord mode for chords"));
1448 NOTENAME_PITCH chord_additions chord_subtractions {
1451 $$ = THIS->get_chord (*$1, $2, $3, d);
1456 $$ = new Array<Musical_pitch>;
1458 | chord_additions chord_note {
1466 $$ = new Musical_pitch;
1467 $$->notename_i_ = ($1 - 1) % 8;
1468 $$->octave_i_ = $1 > 7 ? 1 : 0;
1469 $$->accidental_i_ = 0;
1472 $$ = new Musical_pitch;
1473 $$->notename_i_ = ($1 - 1) % 8;
1474 $$->octave_i_ = $1 > 7 ? 1 : 0;
1475 $$->accidental_i_ = 1;
1478 $$ = new Musical_pitch;
1479 $$->notename_i_ = ($1 - 1) % 8;
1480 $$->octave_i_ = $1 > 7 ? 1 : 0;
1481 $$->accidental_i_ = -1;
1487 $$ = new Array<Musical_pitch>;
1489 | '^' chord_subtractions chord_note {
1499 $$ = new Array<Musical_pitch>;
1501 | pitch_list musical_pitch {
1533 $$ = *$1->access_content_int (false);
1542 | STRING_IDENTIFIER {
1543 $$ = $1->access_content_String (true);
1545 | string '+' string {
1557 SYMBOLTABLES '{' symtables_body '}' { $$ = $3; }
1565 $$ = $1->access_content_Symtables (true);
1567 | symtables_body FONT STRING {
1569 $$->font_path_ = global_path.find (*$3);
1570 if (!$$->font_path_.length_i ())
1571 THIS->here_input ().error (_f("can't open file: `%s'", $3->ch_C()));
1575 | symtables_body STRING '=' symtable {
1582 TABLE '{' symtable_body '}' { $$ = $3; }
1586 { $$ = new Symtable; }
1587 | symtable_body STRING symboldef {
1588 $$->elem (*$2) = *$3;
1595 STRING unsigned box {
1597 $$ = new Atom (*$1, *$3);
1602 Box b (Interval (0,0), Interval (0,0));
1604 $$ = new Atom (*$1, b);
1610 dinterval dinterval {
1611 $$ = new Box (*$1, *$2);
1617 dinterval: real real {
1618 $$ = new Interval ($1, $2);
1625 My_lily_parser::set_yydebug (bool b)
1632 My_lily_parser::do_yyparse ()
1634 yyparse ((void*)this);