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.12");
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;
109 Notename_table *chordmodifiertab;
111 General_script_def * script;
114 Music_list *music_list;
119 Music_output_def * outputdef;
120 Musical_pitch * pitch;
124 Notename_table *notenametab;
129 Simultaneous_music *chord;
132 Symtables* symtables;
145 yylex (YYSTYPE *s, void * v_l)
147 My_lily_parser *pars_l = (My_lily_parser*) v_l;
148 My_lily_lexer * lex_l = pars_l->lexer_p_;
150 lex_l->lexval_l = (void*) s;
151 return lex_l->yylex ();
159 /* tokens which are not keywords */
167 %token CHORDMODIFIERS
221 %token E_EXCLAMATION E_SMALLER E_BIGGER E_CHAR
225 %token <pitch> NOTENAME_PITCH
226 %token <pitch> TONICNAME_PITCH
227 %token <pitch> CHORDMODIFIER_PITCH
228 %token <id> DURATION_IDENTIFIER
229 %token <id> IDENTIFIER
230 %token <id> NOTENAME_TABLE_IDENTIFIER
231 %token <id> MUSIC_IDENTIFIER
232 %token <id> POST_REQUEST_IDENTIFIER
233 %token <id> SCRIPT_IDENTIFIER
234 %token <id> COMMAND_IDENTIFIER
235 %token <id> REAL_IDENTIFIER
236 %token <id> STRING_IDENTIFIER
237 %token <id> TRANS_IDENTIFIER
238 %token <id> INT_IDENTIFIER
239 %token <id> SCORE_IDENTIFIER
240 %token <id> MIDI_IDENTIFIER
241 %token <id> PAPER_IDENTIFIER
242 %token <id> REQUEST_IDENTIFIER
244 %token <string> DURATION RESTNAME
245 %token <string> STRING
249 %type <outputdef> output_def
250 %type <scope> mudela_header mudela_header_body
252 %type <i> open_request_parens close_request_parens
253 %type <i> open_abbrev_parens
254 %type <i> open_plet_parens close_plet_parens
255 %type <i> sub_quotes sup_quotes
256 %type <music> simple_element request_chord command_element Simple_music Composite_music
257 %type <music> Alternative_music Repeated_music
258 %type <i> abbrev_type
259 %type <i> int unsigned
261 %type <i> optional_modality
262 %type <id> identifier_init simple_identifier_init block_identifier
263 %type <duration> steno_duration notemode_duration
264 %type <duration> entered_notemode_duration explicit_duration
265 %type <interval> dinterval
266 %type <intvec> intastint_list int_list
267 %type <symtables> symtables symtables_body
269 %type <pitch> explicit_musical_pitch steno_musical_pitch musical_pitch absolute_musical_pitch
270 %type <pitch> steno_tonic_pitch
271 %type <notereq> steno_notepitch
272 %type <pitch_arr> pitch_list
273 %type <music> chord notemode_chord
274 %type <pitch_arr> chord_additions chord_subtractions
275 %type <pitch> chord_addsub chord_note
276 %type <midi> midi_block midi_body
277 %type <duration> duration_length
279 %type <scalar> scalar
280 %type <music> Music relative_music Sequential_music Simultaneous_music
281 %type <music> property_def translator_change
282 %type <music_list> Music_list
283 %type <paper> paper_block paper_def_body
284 %type <real> real_expression real dimension
285 %type <request> abbrev_command_req
286 %type <request> post_request structured_post_request
287 %type <pair> plet_fraction
288 %type <request> command_req verbose_command_req
289 %type <request> script_req dynamic_req extender_req
290 %type <string> string
291 %type <score> score_block score_body
292 %type <intarr> shape_array
293 %type <script> script_definition script_body mudela_script gen_script_def
294 %type <textdef> text_def finger
295 %type <string> script_abbreviation
296 %type <symbol> symboldef
297 %type <symtable> symtable symtable_body
298 %type <trans> translator_spec translator_spec_body
299 %type <tempo> tempo_request
300 %type <notenametab> notenames_body notenames_block chordmodifiers_block
302 /* 5 extra for notemode_chord */
313 | mudela toplevel_expression {}
314 | mudela assignment { }
316 | mudela check_version { }
321 THIS->lexer_p_->set_notename_table ($1);
323 | chordmodifiers_block {
324 THIS->lexer_p_->set_chordmodifier_table ($1);
327 delete header_global_p;
328 header_global_p = $1;
331 score_global_array.push ($1);
334 Identifier * id = new
335 Paper_def_identifier ($1, PAPER_IDENTIFIER);
336 THIS->lexer_p_->set_identifier ("$defaultpaper", id)
339 Identifier * id = new
340 Midi_def_identifier ($1, MIDI_IDENTIFIER);
341 THIS->lexer_p_->set_identifier ("$defaultmidi", id)
349 read_lily_scm_file (*$2);
353 gh_eval_str ($2->ch_l ());
359 Mudela_version ver (*$2);
360 if (!((ver >= oldest_version) && (ver <= version))) {
361 if (THIS->ignore_version_b_) {
362 THIS->here_input ().error (_f ("incorrect mudela version: %s (%s, %s)", ver.str (), oldest_version.str (), version.str ()));
364 THIS->fatal_error_i_ = 1;
365 THIS->parser_error (_f ("incorrect mudela version: %s (%s, %s)", ver.str (), oldest_version.str (), version.str ()));
372 chordmodifiers_block:
373 CHORDMODIFIERS '{' notenames_body '}' { $$ = $3; }
378 NOTENAMES '{' notenames_body '}' { $$ = $3; }
385 $$ = new Notename_table;
387 | NOTENAME_TABLE_IDENTIFIER {
388 $$ = $1-> access_content_Notename_table(true);
390 | notenames_body STRING '=' explicit_musical_pitch {
401 THIS->lexer_p_-> scope_l_arr_.push ($$);
403 | mudela_header_body assignment ';' {
409 HEADER '{' mudela_header_body '}' {
411 THIS->lexer_p_-> scope_l_arr_.pop ();
421 THIS->remember_spot ();
423 /* cont */ '=' identifier_init {
424 THIS->lexer_p_->set_identifier (*$1, $4);
425 $4->init_b_ = THIS->init_parse_b_;
426 $4->set_spot (THIS->pop_spot ());
431 simple_identifier_init: identifier_init
440 $$ = new Score_identifier ($1, SCORE_IDENTIFIER);
443 | chordmodifiers_block {
444 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
447 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
450 $$ = new Paper_def_identifier ($1, PAPER_IDENTIFIER);
453 $$ = new Midi_def_identifier ($1, MIDI_IDENTIFIER);
457 $$ = new Symtables_identifier ($1, IDENTIFIER);
460 $$ = new Translator_identifier ($1, TRANS_IDENTIFIER);
463 $$ = new Music_identifier ($1, MUSIC_IDENTIFIER);
467 $$ = new Request_identifier ($1, POST_REQUEST_IDENTIFIER);
469 | explicit_duration {
470 $$ = new Duration_identifier ($1, DURATION_IDENTIFIER);
473 $$ = new Real_identifier (new Real ($1), REAL_IDENTIFIER);
476 $$ = new String_identifier ($1, STRING_IDENTIFIER);
479 $$ = new int_identifier (new int ($1), INT_IDENTIFIER);
481 | script_definition {
482 $$ = new General_script_def_identifier ($1, SCRIPT_IDENTIFIER);
488 TRANSLATOR '{' translator_spec_body '}'
492 translator_spec_body:
494 $$ = $1->access_content_Translator (true);
495 $$-> set_spot (THIS->here_input ());
498 Translator* t = get_translator_l (*$2);
499 Translator_group * tg = dynamic_cast<Translator_group*> (t);
502 THIS->parser_error (_("Need a translator group for a context"));
505 t->set_spot (THIS->here_input ());
509 | translator_spec_body STRING '=' simple_identifier_init ';' {
511 String_identifier *s = dynamic_cast<String_identifier*> (id);
512 Real_identifier *r= dynamic_cast<Real_identifier*>(id);
513 int_identifier *i = dynamic_cast<int_identifier*> (id);
516 if (s) str = *s->access_content_String (false);
517 if (i) str = to_str (*i->access_content_int (false));
518 if (r) str = to_str (*r->access_content_Real (false));
520 THIS->parser_error (_("Wrong type for property value"));
523 $$->set_property (*$2, str);
525 | translator_spec_body NAME STRING ';' {
529 | translator_spec_body CONSISTS STRING ';' {
530 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, true);
533 | translator_spec_body ACCEPTS STRING ';' {
534 dynamic_cast<Translator_group*> ($$)-> set_acceptor (*$3, true);
537 | translator_spec_body REMOVE STRING ';' {
538 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, false);
547 SCORE { THIS->remember_spot ();
548 THIS->error_level_i_ =0;
550 /*cont*/ '{' score_body '}' {
552 $$->set_spot (THIS->pop_spot ());
553 if (!$$->def_p_arr_.size ())
554 $$->add_output (THIS->default_paper_p ());
556 /* handle error levels. */
557 $$->errorlevel_i_ = THIS->error_level_i_;
558 THIS->error_level_i_ = 0;
566 $$ = $1->access_content_Score (true);
568 | score_body mudela_header {
573 $2->warning (_ ("More than one music block"));
576 | score_body output_def {
594 /* */ { $$ =new Array<int>; }
595 | intastint_list int '*' int {
596 $$->push ($2); $$->push ($4);
598 | intastint_list int {
599 $$->push ($2); $$->push (1);
608 PAPER '{' paper_def_body '}' {
610 THIS-> lexer_p_->scope_l_arr_.pop ();
626 Paper_def *p = THIS->default_paper_p ();
627 THIS-> lexer_p_-> scope_l_arr_.push (p->scope_p_);
630 | PAPER_IDENTIFIER optional_semicolon {
631 Paper_def *p = $1->access_content_Paper_def (true);
632 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
635 | paper_def_body int '=' symtables { // ugh, what a syntax
636 Lookup * l = new Lookup (*$4);
637 $$->set_lookup ($2, l);
639 | paper_def_body assignment ';' {
642 | paper_def_body translator_spec {
643 $$->assign_translator ($2);
645 | paper_def_body SHAPE '=' shape_array ';' {
646 $$->shape_int_a_ = *$4;
649 | paper_def_body error {
656 real_expression { $$ = $1; }
681 $$= *$1->access_content_Real (false);
683 | '-' real_expression %prec UNARY_MINUS {
686 | real_expression '*' real_expression {
689 | real_expression '/' real_expression {
692 | real_expression '+' real_expression {
695 | real_expression '-' real_expression {
698 | '(' real_expression ')' {
706 $$ = new Array<Interval>;
708 | shape_array real real {
709 $$->push(Interval($2, $2 + $3));
718 '{' midi_body '}' { $$ = $3; }
721 midi_body: /* empty */ {
722 $$ = THIS->default_midi_p ();
725 $$ = $1-> access_content_Midi_def (true);
727 | midi_body translator_spec {
728 $$-> assign_translator ($2);
730 | midi_body tempo_request ';' {
731 $$->set_tempo ($2->dur_.length (), $2->metronome_i_);
740 TEMPO entered_notemode_duration '=' unsigned {
744 $$-> metronome_i_ = $4;
748 Music_list: /* empty */ {
765 Music_list* m = new Music_list;
766 $$ = new Sequential_music (m);
768 | ALTERNATIVE Simultaneous_music {
771 | ALTERNATIVE Sequential_music {
776 Repeated_music: REPEAT unsigned Music Alternative_music {
777 Music_sequence* m = dynamic_cast <Music_sequence*> ($4);
779 $$ = new Repeated_music ($3, $2 >? 1, m);
783 Sequential_music: '{' Music_list '}' {
784 $$ = new Sequential_music ($2);
788 Simultaneous_music: '<' Music_list '>' {
789 $$ = new Simultaneous_music ($2);
794 request_chord { $$ = $1; }
795 | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); }
804 $$->translator_type_str_ = *$2;
807 | TYPE STRING '=' STRING Music {
809 $$->translator_type_str_ = *$2;
810 $$->translator_id_str_ = *$4;
815 THIS->remember_spot ();
821 $$ = new Compressed_music ($3, $5, $6);
822 $$->set_spot (THIS->pop_spot ());
824 | Repeated_music { $$ = $1; }
825 | Simultaneous_music { $$ = $1; }
826 | Sequential_music { $$ = $1; }
827 | TRANSPOSE musical_pitch Music {
828 $$ = new Transposed_music ($3, *$2);
831 | TRANSPOSE steno_tonic_pitch Music {
832 $$ = new Transposed_music ($3, *$2);
836 { THIS->lexer_p_->push_note_state (); }
839 THIS->lexer_p_->pop_state ();
842 { THIS->lexer_p_->push_chord_state (); }
846 THIS->lexer_p_->pop_state ();
849 { THIS->lexer_p_->push_lyric_state (); }
853 THIS->lexer_p_->pop_state ();
855 | relative_music { $$ = $1; }
859 RELATIVE absolute_musical_pitch Music {
860 $$ = new Relative_octave_music ($3, *$2);
866 TRANSLATOR STRING '=' STRING {
867 Change_translator * t = new Change_translator;
868 t-> change_to_type_str_ = *$2;
869 t-> change_to_id_str_ = *$4;
872 $$->set_spot (THIS->here_input ());
879 PROPERTY STRING '.' STRING '=' scalar {
880 Translation_property *t = new Translation_property;
881 t-> translator_type_str_ = *$2;
885 $$->set_spot (THIS->here_input ());
893 STRING { $$ = new Scalar (*$1); delete $1; }
894 | int { $$ = new Scalar ($1); }
899 pre_requests simple_element post_requests {
900 THIS->add_requests ((Simultaneous_music*)$2);//ugh
908 $$ = new Request_chord;
909 $$-> set_spot (THIS->here_input ());
910 $1-> set_spot (THIS->here_input ());
911 ((Simultaneous_music*)$$) ->add_music ($1);//ugh
917 | verbose_command_req ';' { $$ = $1; }
922 $$ = new Barcheck_req;
924 | COMMAND_IDENTIFIER {
925 $$ = $1->access_content_Request (true);
930 $$->spantype = Span_req::START;
934 $$->spantype = Span_req::STOP;
942 $$ = new Bar_req (*$2);
946 $$ = new Mark_req (*$2);
950 $$ = new Mark_req (to_str ($2));
952 | TIME_T unsigned '/' unsigned {
953 Time_signature_change_req *m = new Time_signature_change_req;
959 Break_req * b = new Break_req;
961 b-> set_spot (THIS->here_input ());
964 | SKIP duration_length {
965 Skip_req * skip_p = new Skip_req;
966 skip_p->duration_ = *$2;
974 $$ = new Cadenza_req ($2);
976 | PARTIAL duration_length {
977 $$ = new Partial_measure_req ($2->length ());
981 $$ = new Clef_change_req (*$2);
984 | KEY NOTENAME_PITCH optional_modality {
985 Key_change_req *key_p= new Key_change_req;
986 key_p->pitch_arr_.push(*$2);
987 key_p->ordinary_key_b_ = true;
988 key_p->modality_i_ = $3;
992 | KEYSIGNATURE pitch_list {
993 Key_change_req *key_p= new Key_change_req;
994 key_p->pitch_arr_ = *$2;
995 key_p->ordinary_key_b_ = false;
999 | GROUPING intastint_list {
1000 $$ = get_grouping_req (*$2); delete $2;
1006 /* something silly happened. Junk this stuff*/
1007 if (!THIS->post_reqs.empty ())
1009 warning ("Junking post-requests");
1010 THIS->post_reqs.clear ();
1013 | post_requests structured_post_request {
1014 $2->set_spot (THIS->here_input ());
1015 THIS->post_reqs.push ($2);
1017 | post_requests close_request_parens {
1018 Array<Request*>& r = *THIS->get_parens_request ($2);
1019 for (int i = 0; i < r.size (); i++ )
1020 r[i]->set_spot (THIS->here_input ());
1021 THIS->post_reqs.concat (r);
1026 structured_post_request:
1032 POST_REQUEST_IDENTIFIER {
1033 $$ = (Request*)$1->access_content_Request (true);
1039 Abbreviation_req* a = new Abbreviation_req;
1074 steno_musical_pitch:
1078 | NOTENAME_PITCH sup_quotes {
1080 $$->octave_i_ += $2;
1082 | NOTENAME_PITCH sub_quotes {
1084 $$->octave_i_ += - $2;
1092 | TONICNAME_PITCH sup_quotes {
1094 $$->octave_i_ += $2;
1096 | TONICNAME_PITCH sub_quotes {
1098 $$->octave_i_ += - $2;
1102 explicit_musical_pitch:
1103 MUSICAL_PITCH '{' int_list '}' {/* ugh */
1104 Array<int> &a = *$3;
1106 $$ = new Musical_pitch;
1107 $$->octave_i_ = a[0];
1108 $$->notename_i_ = a[1];
1109 $$->accidental_i_ = a[2];
1116 | explicit_musical_pitch
1126 | steno_notepitch '!' {
1127 $$->forceacc_b_ = ! $$->forceacc_b_;
1129 | steno_notepitch '?' {
1130 $$->forceacc_b_ = ! $$->forceacc_b_;
1131 $$->cautionary_b_ = ! $$->cautionary_b_;
1137 DURATION '{' int_list '}' {
1139 Array<int> &a = *$3;
1142 $$-> durlog_i_ = a[0];
1143 $$-> dots_i_ = a[1];
1151 if (!THIS->lexer_p_->lyric_state_b ())
1152 THIS->parser_error (_ ("have to be in Lyric mode for lyrics"));
1153 Extender_req * e_p = new Extender_req;
1154 e_p->spantype = Span_req::START;
1156 THIS->extender_req = e_p;
1160 ABSDYNAMIC '{' unsigned '}' {
1161 Absolute_dynamic_req *ad_p = new Absolute_dynamic_req;
1162 ad_p ->loudness_ = (Dynamic_req::Loudness)$3;
1165 | SPANDYNAMIC '{' int int '}' {
1166 Span_dynamic_req * sp_p = new Span_dynamic_req;
1167 sp_p->spantype = (Span_req::Spantype)$4;
1168 sp_p-> dynamic_dir_ = (Direction)$3;
1174 unsigned '/' unsigned {
1181 $$[0] = guess_plet_a[(num <? GUESS_PLET) - 1];
1189 THIS->plet_.type_i_ = $2[1];
1190 THIS->plet_.iso_i_ = $2[0];
1191 THIS->default_duration_.plet_ = THIS->plet_;
1195 THIS->plet_.type_i_ = 1;
1196 THIS->plet_.iso_i_ = 1;
1197 THIS->default_duration_.plet_ = THIS->plet_;
1199 | TELP plet_fraction {
1201 THIS->plet_.type_i_ = $2[1];
1202 THIS->plet_.iso_i_ = $2[0];
1203 THIS->default_duration_.plet_ = THIS->plet_;
1207 close_request_parens:
1229 if (!Duration::duration_type_b ($3))
1230 THIS->parser_error (_f ("not a duration: %d", $3));
1232 THIS->parser_error (_ ("can't abbreviate"));
1234 THIS->set_abbrev_beam ($3);
1241 THIS->plet_.type_i_ = $2[1];
1242 THIS->plet_.iso_i_ = $2[0];
1243 THIS->default_duration_.plet_ = THIS->plet_;
1245 | PLET plet_fraction {
1247 THIS->plet_.type_i_ = $2[1];
1248 THIS->plet_.iso_i_ = $2[0];
1249 THIS->default_duration_.plet_ = THIS->plet_;
1253 open_request_parens:
1263 | open_abbrev_parens
1270 SCRIPT '{' script_body '}' { $$ = $3; }
1274 STRING int int int int int {
1275 Script_def *s = new Script_def;
1276 s->set_from_input (*$1,$2, $3,$4,$5, $6);
1283 script_dir gen_script_def {
1284 Musical_script_req *m = new Musical_script_req;
1286 m->scriptdef_p_ = $2;
1287 m->set_spot (THIS->here_input ());
1289 m->dir_ = (Direction)$1;
1296 ((Text_def*) $$)->align_dir_ = LEFT; /* UGH */
1300 $$-> set_spot (THIS->here_input ());
1304 ((Text_def*)$$)->align_dir_ = RIGHT; /* UGH */
1310 Text_def *t = new Text_def;
1314 $$->set_spot (THIS->here_input ());
1320 Text_def* t = new Text_def;
1322 t->text_str_ = to_str ($1);
1323 t->style_str_ = "finger";
1324 $$->set_spot (THIS->here_input ());
1328 script_abbreviation:
1329 '^' { $$ = get_scriptdef ('^'); }
1330 | '+' { $$ = get_scriptdef ('+'); }
1331 | '-' { $$ = get_scriptdef ('-'); }
1332 | '|' { $$ = get_scriptdef ('|'); }
1333 | 'o' { $$ = get_scriptdef ('o'); }
1334 | '>' { $$ = get_scriptdef ('>'); }
1336 $$ = get_scriptdef ('.');
1341 SCRIPT_IDENTIFIER { $$ = $1->access_content_General_script_def (true); }
1342 | script_definition { $$ = $1; }
1343 | script_abbreviation {
1344 $$ = THIS->lexer_p_->lookup_identifier (*$1)->access_content_General_script_def (true);
1357 if (THIS->extender_req)
1359 Extender_req * e_p = new Extender_req;
1360 e_p->spantype = Span_req::STOP;
1361 THIS->pre_reqs.push (e_p);
1362 THIS->extender_req = 0;
1366 | pre_requests open_request_parens {
1368 Array<Request*>& r = *THIS->get_parens_request ($2);
1369 for (int i = 0; i < r.size (); i++ )
1370 r[i]->set_spot (THIS->here_input ());
1371 THIS->pre_reqs.concat (r);
1376 absolute_musical_pitch:
1377 steno_musical_pitch {
1390 | dots '.' { $$ ++; }
1393 entered_notemode_duration:
1395 $$ = new Duration (THIS->default_duration_);
1398 $$ = new Duration (THIS->default_duration_);
1402 THIS->set_last_duration ($1);
1407 entered_notemode_duration {
1415 if (!Duration::duration_type_b ($1))
1416 THIS->parser_error (_f ("not a duration: %d", $1));
1418 $$->durlog_i_ = Duration_convert::i2_type ($1);
1419 $$->set_plet (THIS->plet_.iso_i_, THIS->plet_.type_i_);
1422 | DURATION_IDENTIFIER {
1423 $$ = $1->access_content_Duration (true);
1425 | steno_duration '.' {
1428 | steno_duration '*' unsigned {
1429 $$->plet_.iso_i_ *= $3;
1431 | steno_duration '/' unsigned {
1432 $$->plet_.type_i_ *= $3;
1442 if (!Duration::duration_type_b ($2))
1443 THIS->parser_error (_f ("not a duration: %d", $2));
1445 THIS->parser_error (_ ("can't abbreviate"));
1453 steno_notepitch notemode_duration {
1454 if (!THIS->lexer_p_->note_state_b ())
1455 THIS->parser_error (_ ("have to be in Note mode for notes"));
1456 $1->duration_ = *$2;
1457 $$ = THIS->get_note_element ($1, $2);
1459 | RESTNAME notemode_duration {
1460 $$ = THIS->get_rest_element (*$1, $2);
1461 delete $1; // delete notename
1463 | MEASURES notemode_duration {
1464 Multi_measure_rest_req* m = new Multi_measure_rest_req;
1468 Simultaneous_music*velt_p = new Request_chord;
1469 velt_p->set_spot (THIS->here_input ());
1470 velt_p->add_music (m);
1473 | STRING notemode_duration {
1474 if (!THIS->lexer_p_->lyric_state_b ())
1475 THIS->parser_error (_ ("have to be in Lyric mode for lyrics"));
1476 $$ = THIS->get_word_element (*$1, $2);
1480 if (!THIS->lexer_p_->chord_state_b ())
1481 THIS->parser_error (_ ("have to be in Chord mode for chords"));
1488 notemode_duration steno_musical_pitch chord_additions chord_subtractions {
1489 $$ = THIS->get_chord (*$2, $3, $4, *$1);
1494 $$ = new Array<Musical_pitch>;
1496 | chord_additions chord_note {
1500 | chord_additions CHORDMODIFIER_PITCH {
1502 urg, this is kind of ugly.
1503 all but "sus" chord modifiers can be
1504 handled as chord_additions...
1513 $$ = new Musical_pitch;
1514 $$->notename_i_ = ($1 - 1) % 7;
1515 $$->octave_i_ = $1 > 7 ? 1 : 0;
1516 $$->accidental_i_ = 0;
1519 $$ = new Musical_pitch;
1520 $$->notename_i_ = ($1 - 1) % 7;
1521 $$->octave_i_ = $1 > 7 ? 1 : 0;
1522 $$->accidental_i_ = 1;
1525 $$ = new Musical_pitch;
1526 $$->notename_i_ = ($1 - 1) % 7;
1527 $$->octave_i_ = $1 > 7 ? 1 : 0;
1528 $$->accidental_i_ = -1;
1534 $$ = new Array<Musical_pitch>;
1537 $$ = new Array<Musical_pitch>;
1539 | chord_subtractions chord_addsub {
1549 $$ = new Array<Musical_pitch>;
1551 | pitch_list musical_pitch {
1583 $$ = *$1->access_content_int (false);
1592 | STRING_IDENTIFIER {
1593 $$ = $1->access_content_String (true);
1595 | string '+' string {
1607 SYMBOLTABLES '{' symtables_body '}' { $$ = $3; }
1615 $$ = $1->access_content_Symtables (true);
1617 | symtables_body FONT STRING {
1619 $$->font_path_ = global_path.find (*$3);
1620 if (!$$->font_path_.length_i ())
1621 THIS->here_input ().error (_f("can't open file: `%s'", $3->ch_C()));
1625 | symtables_body STRING '=' symtable {
1632 TABLE '{' symtable_body '}' { $$ = $3; }
1636 { $$ = new Symtable; }
1637 | symtable_body STRING symboldef {
1638 $$->elem (*$2) = *$3;
1645 STRING unsigned box {
1647 $$ = new Atom (*$1, *$3);
1652 Box b (Interval (0,0), Interval (0,0));
1654 $$ = new Atom (*$1, b);
1660 dinterval dinterval {
1661 $$ = new Box (*$1, *$2);
1667 dinterval: real real {
1668 $$ = new Interval ($1, $2);
1675 My_lily_parser::set_yydebug (bool b)
1682 My_lily_parser::do_yyparse ()
1684 yyparse ((void*)this);