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.10");
50 Mudela_version version ("1.0.12");
53 // needed for bison.simple's malloc() and free()
67 Assignment (Assignment const&s)
69 name_p_ = new String (*s.name_p_);
70 id_p_ = s.id_p_->clone ();
74 Paper_def* current_paper = 0;
80 #define YYERROR_VERBOSE 1
82 #define YYPARSE_PARAM my_lily_parser_l
83 #define YYLEX_PARAM my_lily_parser_l
84 #define THIS ((My_lily_parser *) my_lily_parser_l)
86 #define yyerror THIS->parser_error
87 #define ARRAY_SIZE(a,s) if (a.size () != s) THIS->parser_error (_f("expecting %d arguments", s))
93 Array<Interval>* intarr;
94 Array<Musical_pitch> *pitch_arr;
95 Array<String> * strvec;
99 Notename_table *chordmodifiertab;
101 General_script_def * script;
104 Music_list *music_list;
109 Music_output_def * outputdef;
110 Musical_pitch * pitch;
114 Notename_table *notenametab;
119 Simultaneous_music *chord;
122 Symtables* symtables;
134 yylex (YYSTYPE *s, void * v_l)
136 My_lily_parser *pars_l = (My_lily_parser*) v_l;
137 My_lily_lexer * lex_l = pars_l->lexer_p_;
139 lex_l->lexval_l = (void*) s;
140 return lex_l->yylex ();
148 /* tokens which are not keywords */
155 %token CHORDMODIFIERS
203 %token E_EXCLAMATION E_SMALLER E_BIGGER E_CHAR
207 %token <pitch> NOTENAME_PITCH
208 %token <pitch> TONICNAME_PITCH
209 %token <pitch> CHORDMODIFIER_PITCH
210 %token <id> DURATION_IDENTIFIER
211 %token <id> IDENTIFIER
212 %token <id> NOTENAME_TABLE_IDENTIFIER
213 %token <id> MUSIC_IDENTIFIER
214 %token <id> POST_REQUEST_IDENTIFIER
215 %token <id> SCRIPT_IDENTIFIER
216 %token <id> COMMAND_IDENTIFIER
217 %token <id> REAL_IDENTIFIER
218 %token <id> STRING_IDENTIFIER
219 %token <id> TRANS_IDENTIFIER
220 %token <id> INT_IDENTIFIER
221 %token <id> SCORE_IDENTIFIER
222 %token <id> MIDI_IDENTIFIER
223 %token <id> PAPER_IDENTIFIER
225 %token <string> DURATION RESTNAME
226 %token <string> STRING
230 %type <outputdef> output_def
231 %type <scope> mudela_header mudela_header_body
233 %type <i> open_request_parens close_request_parens
234 %type <i> open_abbrev_parens
235 %type <i> sub_quotes sup_quotes
236 %type <music> simple_element request_chord command_element Simple_music Composite_music
237 %type <music> Alternative_music Repeated_music
238 %type <i> abbrev_type
239 %type <i> int unsigned
241 %type <i> optional_modality
242 %type <id> identifier_init simple_identifier_init block_identifier
243 %type <duration> steno_duration notemode_duration
244 %type <duration> entered_notemode_duration explicit_duration
245 %type <interval> dinterval
246 %type <intvec> intastint_list int_list
247 %type <symtables> symtables symtables_body
249 %type <pitch> explicit_musical_pitch steno_musical_pitch musical_pitch absolute_musical_pitch
250 %type <pitch> steno_tonic_pitch
251 %type <notereq> steno_notepitch
252 %type <pitch_arr> pitch_list
253 %type <music> chord notemode_chord
254 %type <pitch_arr> chord_additions chord_subtractions
255 %type <pitch> chord_addsub chord_note
256 %type <midi> midi_block midi_body
257 %type <duration> duration_length
259 %type <scalar> scalar
260 %type <music> Music relative_music Sequential_music Simultaneous_music
261 %type <music> property_def translator_change
262 %type <music_list> Music_list
263 %type <paper> paper_block paper_def_body
264 %type <real> real_expression real dimension
265 %type <request> abbrev_command_req
266 %type <request> post_request structured_post_request
267 %type <request> command_req verbose_command_req
268 %type <request> script_req dynamic_req extender_req
269 %type <string> string
270 %type <score> score_block score_body
271 %type <intarr> shape_array
272 %type <script> script_definition script_body mudela_script gen_script_def
273 %type <textdef> text_def finger
274 %type <string> script_abbreviation
275 %type <symbol> symboldef
276 %type <symtable> symtable symtable_body
277 %type <trans> translator_spec translator_spec_body
278 %type <tempo> tempo_request
279 %type <notenametab> notenames_body notenames_block chordmodifiers_block
281 /* 5 extra for notemode_chord */
292 | mudela toplevel_expression {}
293 | mudela assignment { }
295 | mudela check_version { }
300 THIS->lexer_p_->set_notename_table ($1);
302 | chordmodifiers_block {
303 THIS->lexer_p_->set_chordmodifier_table ($1);
306 delete header_global_p;
307 header_global_p = $1;
310 score_global_array.push ($1);
313 Identifier * id = new
314 Paper_def_identifier ($1, PAPER_IDENTIFIER);
315 THIS->lexer_p_->set_identifier ("$defaultpaper", id)
318 Identifier * id = new
319 Midi_def_identifier ($1, MIDI_IDENTIFIER);
320 THIS->lexer_p_->set_identifier ("$defaultmidi", id)
328 read_lily_scm_file (*$2);
332 gh_eval_str ($2->ch_l ());
338 Mudela_version ver (*$2);
339 if (!((ver >= oldest_version) && (ver <= version))) {
340 if (THIS->ignore_version_b_) {
341 THIS->here_input ().error (_f ("incorrect mudela version: %s (%s, %s)", ver.str (), oldest_version.str (), version.str ()));
343 THIS->fatal_error_i_ = 1;
344 THIS->parser_error (_f ("incorrect mudela version: %s (%s, %s)", ver.str (), oldest_version.str (), version.str ()));
351 chordmodifiers_block:
352 CHORDMODIFIERS '{' notenames_body '}' { $$ = $3; }
357 NOTENAMES '{' notenames_body '}' { $$ = $3; }
364 $$ = new Notename_table;
366 | NOTENAME_TABLE_IDENTIFIER {
367 $$ = $1-> access_content_Notename_table(true);
369 | notenames_body STRING '=' explicit_musical_pitch {
380 THIS->lexer_p_-> scope_l_arr_.push ($$);
382 | mudela_header_body assignment ';' {
388 HEADER '{' mudela_header_body '}' {
390 THIS->lexer_p_-> scope_l_arr_.pop ();
400 THIS->remember_spot ();
402 /* cont */ '=' identifier_init {
403 THIS->lexer_p_->set_identifier (*$1, $4);
404 $4->init_b_ = THIS->init_parse_b_;
405 $4->set_spot (THIS->pop_spot ());
410 simple_identifier_init: identifier_init
419 $$ = new Score_identifier ($1, SCORE_IDENTIFIER);
422 | chordmodifiers_block {
423 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
426 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
429 $$ = new Paper_def_identifier ($1, PAPER_IDENTIFIER);
432 $$ = new Midi_def_identifier ($1, MIDI_IDENTIFIER);
436 $$ = new Symtables_identifier ($1, IDENTIFIER);
439 $$ = new Translator_identifier ($1, TRANS_IDENTIFIER);
442 $$ = new Music_identifier ($1, MUSIC_IDENTIFIER);
446 $$ = new Request_identifier ($1, POST_REQUEST_IDENTIFIER);
448 | explicit_duration {
449 $$ = new Duration_identifier ($1, DURATION_IDENTIFIER);
452 $$ = new Real_identifier (new Real ($1), REAL_IDENTIFIER);
455 $$ = new String_identifier ($1, STRING_IDENTIFIER);
458 $$ = new int_identifier (new int ($1), INT_IDENTIFIER);
460 | script_definition {
461 $$ = new General_script_def_identifier ($1, SCRIPT_IDENTIFIER);
467 TRANSLATOR '{' translator_spec_body '}'
471 translator_spec_body:
473 $$ = $1->access_content_Translator (true);
474 $$-> set_spot (THIS->here_input ());
477 Translator* t = get_translator_l (*$2);
478 Translator_group * tg = dynamic_cast<Translator_group*> (t);
481 THIS->parser_error (_("Need a translator group for a context"));
484 t->set_spot (THIS->here_input ());
488 | translator_spec_body STRING '=' simple_identifier_init ';' {
490 String_identifier *s = dynamic_cast<String_identifier*> (id);
491 Real_identifier *r= dynamic_cast<Real_identifier*>(id);
492 int_identifier *i = dynamic_cast<int_identifier*> (id);
495 if (s) str = *s->access_content_String (false);
496 if (i) str = to_str (*i->access_content_int (false));
497 if (r) str = to_str (*r->access_content_Real (false));
499 THIS->parser_error (_("Wrong type for property value"));
502 $$->set_property (*$2, str);
504 | translator_spec_body NAME STRING ';' {
508 | translator_spec_body CONSISTS STRING ';' {
509 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, true);
512 | translator_spec_body ACCEPTS STRING ';' {
513 dynamic_cast<Translator_group*> ($$)-> set_acceptor (*$3, true);
516 | translator_spec_body REMOVE STRING ';' {
517 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, false);
526 SCORE { THIS->remember_spot ();
527 THIS->error_level_i_ =0;
529 /*cont*/ '{' score_body '}' {
531 $$->set_spot (THIS->pop_spot ());
532 if (!$$->def_p_arr_.size ())
533 $$->add_output (THIS->default_paper_p ());
535 /* handle error levels. */
536 $$->errorlevel_i_ = THIS->error_level_i_;
537 THIS->error_level_i_ = 0;
545 $$ = $1->access_content_Score (true);
547 | score_body mudela_header {
552 $2->warning (_ ("More than one music block"));
555 | score_body output_def {
573 /* */ { $$ =new Array<int>; }
574 | intastint_list int '*' int {
575 $$->push ($2); $$->push ($4);
577 | intastint_list int {
578 $$->push ($2); $$->push (1);
587 PAPER '{' paper_def_body '}' {
589 THIS-> lexer_p_->scope_l_arr_.pop ();
605 Paper_def *p = THIS->default_paper_p ();
606 THIS-> lexer_p_-> scope_l_arr_.push (p->scope_p_);
609 | PAPER_IDENTIFIER optional_semicolon {
610 Paper_def *p = $1->access_content_Paper_def (true);
611 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
614 | paper_def_body int '=' symtables { // ugh, what a syntax
615 Lookup * l = new Lookup (*$4);
616 $$->set_lookup ($2, l);
618 | paper_def_body assignment ';' {
621 | paper_def_body translator_spec {
622 $$->assign_translator ($2);
624 | paper_def_body SHAPE '=' shape_array ';' {
625 $$->shape_int_a_ = *$4;
628 | paper_def_body error {
635 real_expression { $$ = $1; }
660 $$= *$1->access_content_Real (false);
662 | '-' real_expression %prec UNARY_MINUS {
665 | real_expression '*' real_expression {
668 | real_expression '/' real_expression {
671 | real_expression '+' real_expression {
674 | real_expression '-' real_expression {
677 | '(' real_expression ')' {
685 $$ = new Array<Interval>;
687 | shape_array real real {
688 $$->push(Interval($2, $2 + $3));
697 '{' midi_body '}' { $$ = $3; }
700 midi_body: /* empty */ {
701 $$ = THIS->default_midi_p ();
704 $$ = $1-> access_content_Midi_def (true);
706 | midi_body translator_spec {
707 $$-> assign_translator ($2);
709 | midi_body tempo_request ';' {
710 $$->set_tempo ($2->dur_.length (), $2->metronome_i_);
719 TEMPO entered_notemode_duration '=' unsigned {
723 $$-> metronome_i_ = $4;
727 Music_list: /* empty */ {
744 Music_list* m = new Music_list;
745 $$ = new Sequential_music (m);
747 | ALTERNATIVE Simultaneous_music {
750 | ALTERNATIVE Sequential_music {
755 Repeated_music: REPEAT unsigned Music Alternative_music {
756 Music_sequence* m = dynamic_cast <Music_sequence*> ($4);
758 $$ = new Repeated_music ($3, $2 >? 1, m);
762 Sequential_music: '{' Music_list '}' {
763 $$ = new Sequential_music ($2);
767 Simultaneous_music: '<' Music_list '>' {
768 $$ = new Simultaneous_music ($2);
773 request_chord { $$ = $1; }
774 | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); }
777 | Simple_music '*' unsigned '/' unsigned { }
778 | Simple_music '*' unsigned { }
786 $$->translator_type_str_ = *$2;
789 | TYPE STRING '=' STRING Music {
791 $$->translator_type_str_ = *$2;
792 $$->translator_id_str_ = *$4;
797 THIS->remember_spot ();
800 unsigned '/' unsigned Music
803 $$ = new Compressed_music ($3, $5, $6);
804 $$->set_spot (THIS->pop_spot ());
806 | Repeated_music { $$ = $1; }
807 | Simultaneous_music { $$ = $1; }
808 | Sequential_music { $$ = $1; }
809 | TRANSPOSE musical_pitch Music {
810 $$ = new Transposed_music ($3, *$2);
813 | TRANSPOSE steno_tonic_pitch Music {
814 $$ = new Transposed_music ($3, *$2);
818 { THIS->lexer_p_->push_note_state (); }
821 THIS->lexer_p_->pop_state ();
824 { THIS->lexer_p_->push_chord_state (); }
828 THIS->lexer_p_->pop_state ();
831 { THIS->lexer_p_->push_lyric_state (); }
835 THIS->lexer_p_->pop_state ();
837 | relative_music { $$ = $1; }
841 RELATIVE absolute_musical_pitch Music {
842 $$ = new Relative_octave_music ($3, *$2);
848 TRANSLATOR STRING '=' STRING {
849 Change_translator * t = new Change_translator;
850 t-> change_to_type_str_ = *$2;
851 t-> change_to_id_str_ = *$4;
854 $$->set_spot (THIS->here_input ());
861 PROPERTY STRING '.' STRING '=' scalar {
862 Translation_property *t = new Translation_property;
863 t-> translator_type_str_ = *$2;
867 $$->set_spot (THIS->here_input ());
875 STRING { $$ = new Scalar (*$1); delete $1; }
876 | int { $$ = new Scalar ($1); }
881 pre_requests simple_element post_requests {
882 THIS->add_requests ((Simultaneous_music*)$2);//ugh
890 $$ = new Request_chord;
891 $$-> set_spot (THIS->here_input ());
892 $1-> set_spot (THIS->here_input ());
893 ((Simultaneous_music*)$$) ->add_music ($1);//ugh
899 | verbose_command_req ';' { $$ = $1; }
904 $$ = new Barcheck_req;
906 | COMMAND_IDENTIFIER {
907 $$ = $1->access_content_Request (true);
911 $$ = new Command_tie_req;
915 $$->spantype = Span_req::START;
919 $$->spantype = Span_req::STOP;
927 $$ = new Bar_req (*$2);
931 $$ = new Mark_req (*$2);
935 $$ = new Mark_req (to_str ($2));
937 | TIME_T unsigned '/' unsigned {
938 Time_signature_change_req *m = new Time_signature_change_req;
944 Break_req * b = new Break_req;
946 b-> set_spot (THIS->here_input ());
949 | SKIP duration_length {
950 Skip_req * skip_p = new Skip_req;
951 skip_p->duration_ = *$2;
959 $$ = new Cadenza_req ($2);
961 | PARTIAL duration_length {
962 $$ = new Partial_measure_req ($2->length ());
966 $$ = new Clef_change_req (*$2);
969 | KEY NOTENAME_PITCH optional_modality {
970 Key_change_req *key_p= new Key_change_req;
971 key_p->pitch_arr_.push(*$2);
972 key_p->ordinary_key_b_ = true;
973 key_p->modality_i_ = $3;
977 | KEYSIGNATURE pitch_list {
978 Key_change_req *key_p= new Key_change_req;
979 key_p->pitch_arr_ = *$2;
980 key_p->ordinary_key_b_ = false;
984 | GROUPING intastint_list {
985 $$ = get_grouping_req (*$2); delete $2;
991 /* something silly happened. Junk this stuff*/
992 if (!THIS->post_reqs.empty ())
994 warning ("Junking post-requests");
995 THIS->post_reqs.clear ();
998 | post_requests structured_post_request {
999 $2->set_spot (THIS->here_input ());
1000 THIS->post_reqs.push ($2);
1002 | post_requests close_request_parens {
1003 Array<Request*>& r = *THIS->get_parens_request ($2);
1004 for (int i = 0; i < r.size (); i++ )
1005 r[i]->set_spot (THIS->here_input ());
1006 THIS->post_reqs.concat (r);
1011 structured_post_request:
1017 POST_REQUEST_IDENTIFIER {
1018 $$ = (Request*)$1->access_content_Request (true);
1024 Abbreviation_req* a = new Abbreviation_req;
1059 steno_musical_pitch:
1063 | NOTENAME_PITCH sup_quotes {
1065 $$->octave_i_ += $2;
1067 | NOTENAME_PITCH sub_quotes {
1069 $$->octave_i_ += - $2;
1077 | TONICNAME_PITCH sup_quotes {
1079 $$->octave_i_ += $2;
1081 | TONICNAME_PITCH sub_quotes {
1083 $$->octave_i_ += - $2;
1087 explicit_musical_pitch:
1088 MUSICAL_PITCH '{' int_list '}' {/* ugh */
1089 Array<int> &a = *$3;
1091 $$ = new Musical_pitch;
1092 $$->octave_i_ = a[0];
1093 $$->notename_i_ = a[1];
1094 $$->accidental_i_ = a[2];
1101 | explicit_musical_pitch
1111 | steno_notepitch '!' {
1112 $$->forceacc_b_ = ! $$->forceacc_b_;
1114 | steno_notepitch '?' {
1115 $$->forceacc_b_ = ! $$->forceacc_b_;
1116 $$->cautionary_b_ = ! $$->cautionary_b_;
1122 DURATION '{' int_list '}' {
1124 Array<int> &a = *$3;
1127 $$-> durlog_i_ = a[0];
1128 $$-> dots_i_ = a[1];
1136 if (!THIS->lexer_p_->lyric_state_b ())
1137 THIS->parser_error (_ ("have to be in Lyric mode for lyrics"));
1138 Extender_req * e_p = new Extender_req;
1139 e_p->spantype = Span_req::START;
1141 THIS->extender_req = e_p;
1145 ABSDYNAMIC '{' unsigned '}' {
1146 Absolute_dynamic_req *ad_p = new Absolute_dynamic_req;
1147 ad_p ->loudness_ = (Dynamic_req::Loudness)$3;
1150 | SPANDYNAMIC '{' int int '}' {
1151 Span_dynamic_req * sp_p = new Span_dynamic_req;
1152 sp_p->spantype = (Span_req::Spantype)$4;
1153 sp_p-> dynamic_dir_ = (Direction)$3;
1160 close_request_parens:
1181 if (!Duration::duration_type_b ($3))
1182 THIS->parser_error (_f ("not a duration: %d", $3));
1184 THIS->parser_error (_ ("can't abbreviate"));
1186 THIS->set_abbrev_beam ($3);
1191 open_request_parens:
1201 | open_abbrev_parens
1207 SCRIPT '{' script_body '}' { $$ = $3; }
1211 STRING int int int int int {
1212 Script_def *s = new Script_def;
1213 s->set_from_input (*$1,$2, $3,$4,$5, $6);
1220 script_dir gen_script_def {
1221 Musical_script_req *m = new Musical_script_req;
1223 m->scriptdef_p_ = $2;
1224 m->set_spot (THIS->here_input ());
1226 m->dir_ = (Direction)$1;
1233 ((Text_def*) $$)->align_dir_ = LEFT; /* UGH */
1237 $$-> set_spot (THIS->here_input ());
1241 ((Text_def*)$$)->align_dir_ = RIGHT; /* UGH */
1247 Text_def *t = new Text_def;
1251 $$->set_spot (THIS->here_input ());
1257 Text_def* t = new Text_def;
1259 t->text_str_ = to_str ($1);
1260 t->style_str_ = "finger";
1261 $$->set_spot (THIS->here_input ());
1265 script_abbreviation:
1266 '^' { $$ = get_scriptdef ('^'); }
1267 | '+' { $$ = get_scriptdef ('+'); }
1268 | '-' { $$ = get_scriptdef ('-'); }
1269 | '|' { $$ = get_scriptdef ('|'); }
1270 | 'o' { $$ = get_scriptdef ('o'); }
1271 | '>' { $$ = get_scriptdef ('>'); }
1273 $$ = get_scriptdef ('.');
1278 SCRIPT_IDENTIFIER { $$ = $1->access_content_General_script_def (true); }
1279 | script_definition { $$ = $1; }
1280 | script_abbreviation {
1281 $$ = THIS->lexer_p_->lookup_identifier (*$1)->access_content_General_script_def (true);
1294 if (THIS->extender_req)
1296 Extender_req * e_p = new Extender_req;
1297 e_p->spantype = Span_req::STOP;
1298 THIS->pre_reqs.push (e_p);
1299 THIS->extender_req = 0;
1303 | pre_requests open_request_parens {
1305 Array<Request*>& r = *THIS->get_parens_request ($2);
1306 for (int i = 0; i < r.size (); i++ )
1307 r[i]->set_spot (THIS->here_input ());
1308 THIS->pre_reqs.concat (r);
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;
1333 | dots '.' { $$ ++; }
1336 entered_notemode_duration:
1338 $$ = new Duration (THIS->default_duration_);
1341 $$ = new Duration (THIS->default_duration_);
1345 THIS->set_last_duration ($1);
1350 entered_notemode_duration {
1358 if (!Duration::duration_type_b ($1))
1359 THIS->parser_error (_f ("not a duration: %d", $1));
1361 $$->durlog_i_ = Duration_convert::i2_type ($1);
1364 | DURATION_IDENTIFIER {
1365 $$ = $1->access_content_Duration (true);
1367 | steno_duration '.' {
1378 if (!Duration::duration_type_b ($2))
1379 THIS->parser_error (_f ("not a duration: %d", $2));
1381 THIS->parser_error (_ ("can't abbreviate"));
1389 steno_notepitch notemode_duration {
1390 if (!THIS->lexer_p_->note_state_b ())
1391 THIS->parser_error (_ ("have to be in Note mode for notes"));
1392 $1->duration_ = *$2;
1393 $$ = THIS->get_note_element ($1, $2);
1395 | RESTNAME notemode_duration {
1396 $$ = THIS->get_rest_element (*$1, $2);
1397 delete $1; // delete notename
1399 | MEASURES notemode_duration {
1400 Multi_measure_rest_req* m = new Multi_measure_rest_req;
1404 Simultaneous_music*velt_p = new Request_chord;
1405 velt_p->set_spot (THIS->here_input ());
1406 velt_p->add_music (m);
1409 | STRING notemode_duration {
1410 if (!THIS->lexer_p_->lyric_state_b ())
1411 THIS->parser_error (_ ("have to be in Lyric mode for lyrics"));
1412 $$ = THIS->get_word_element (*$1, $2);
1416 if (!THIS->lexer_p_->chord_state_b ())
1417 THIS->parser_error (_ ("have to be in Chord mode for chords"));
1420 | '@' notemode_chord {
1421 if (!THIS->lexer_p_->note_state_b ())
1422 THIS->parser_error (_ ("have to be in Note mode for @chords"));
1428 steno_tonic_pitch notemode_duration chord_additions chord_subtractions {
1429 $$ = THIS->get_chord (*$1, $3, $4, *$2);
1433 steno_musical_pitch notemode_duration chord_additions chord_subtractions {
1434 $$ = THIS->get_chord (*$1, $3, $4, *$2);
1439 $$ = new Array<Musical_pitch>;
1442 $$ = new Array<Musical_pitch>;
1444 | chord_additions chord_addsub {
1451 chord_note optional_dot
1452 | CHORDMODIFIER_PITCH optional_dot
1457 $$ = new Musical_pitch;
1458 $$->notename_i_ = ($1 - 1) % 7;
1459 $$->octave_i_ = $1 > 7 ? 1 : 0;
1460 $$->accidental_i_ = 0;
1463 $$ = new Musical_pitch;
1464 $$->notename_i_ = ($1 - 1) % 7;
1465 $$->octave_i_ = $1 > 7 ? 1 : 0;
1466 $$->accidental_i_ = 1;
1469 $$ = new Musical_pitch;
1470 $$->notename_i_ = ($1 - 1) % 7;
1471 $$->octave_i_ = $1 > 7 ? 1 : 0;
1472 $$->accidental_i_ = -1;
1478 $$ = new Array<Musical_pitch>;
1481 $$ = new Array<Musical_pitch>;
1483 | chord_subtractions chord_addsub {
1493 $$ = new Array<Musical_pitch>;
1495 | pitch_list musical_pitch {
1527 $$ = *$1->access_content_int (false);
1536 | STRING_IDENTIFIER {
1537 $$ = $1->access_content_String (true);
1539 | string '+' string {
1551 SYMBOLTABLES '{' symtables_body '}' { $$ = $3; }
1559 $$ = $1->access_content_Symtables (true);
1561 | symtables_body FONT STRING {
1563 $$->font_path_ = global_path.find (*$3);
1564 if (!$$->font_path_.length_i ())
1565 THIS->here_input ().error (_f("can't open file: `%s'", $3->ch_C()));
1569 | symtables_body STRING '=' symtable {
1576 TABLE '{' symtable_body '}' { $$ = $3; }
1580 { $$ = new Symtable; }
1581 | symtable_body STRING symboldef {
1582 $$->elem (*$2) = *$3;
1589 STRING unsigned box {
1591 $$ = new Atom (*$1, *$3);
1596 Box b (Interval (0,0), Interval (0,0));
1598 $$ = new Atom (*$1, b);
1604 dinterval dinterval {
1605 $$ = new Box (*$1, *$2);
1611 dinterval: real real {
1612 $$ = new Interval ($1, $2);
1619 My_lily_parser::set_yydebug (bool b)
1626 My_lily_parser::do_yyparse ()
1628 yyparse ((void*)this);