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"
19 #include "my-lily-lexer.hh"
20 #include "paper-def.hh"
21 #include "midi-def.hh"
23 #include "file-path.hh"
26 #include "dimensions.hh"
27 #include "identifier.hh"
28 #include "command-request.hh"
29 #include "musical-request.hh"
30 #include "my-lily-parser.hh"
31 #include "context-specced-music.hh"
32 #include "translator-group.hh"
34 #include "music-list.hh"
35 #include "duration-convert.hh"
36 #include "change-translator.hh"
37 #include "file-results.hh"
39 #include "relative-music.hh"
40 #include "lyric-combine-music.hh"
41 #include "transposed-music.hh"
42 #include "time-scaled-music.hh"
43 #include "repeated-music.hh"
44 #include "mudela-version.hh"
45 #include "grace-music.hh"
46 #include "auto-change-music.hh"
49 Mudela_version oldest_version ("1.1.52");
54 print_mudela_versions (ostream &os)
56 os << _f ("Oldest supported input version: %s", oldest_version.str ())
59 // needed for bison.simple's malloc() and free()
66 #define YYERROR_VERBOSE 1
68 #define YYPARSE_PARAM my_lily_parser_l
69 #define YYLEX_PARAM my_lily_parser_l
70 #define THIS ((My_lily_parser *) my_lily_parser_l)
72 #define yyerror THIS->parser_error
73 #define ARRAY_SIZE(a,s) if (a.size () != s) THIS->parser_error (_f ("Expecting %d arguments", s))
80 Array<Musical_pitch> *pitch_arr;
81 Link_array<Request> *reqvec;
82 Array<String> * strvec;
84 Notename_table *chordmodifiertab;
88 Music_list *music_list;
93 Music_output_def * outputdef;
94 Musical_pitch * pitch;
97 Notename_table *notenametab;
113 yylex (YYSTYPE *s, void * v_l)
115 My_lily_parser *pars_l = (My_lily_parser*) v_l;
116 My_lily_lexer * lex_l = pars_l->lexer_p_;
118 lex_l->lexval_l = (void*) s;
119 return lex_l->yylex ();
127 /* tokens which are not keywords */
135 %token CHORDMODIFIERS
189 %token E_EXCLAMATION E_SMALLER E_BIGGER E_CHAR CHORD_MINUS CHORD_CARET
191 %type <i> exclamations questions
193 %token <pitch> NOTENAME_PITCH
194 %token <pitch> TONICNAME_PITCH
195 %token <pitch> CHORDMODIFIER_PITCH
196 %token <id> DURATION_IDENTIFIER
197 %token <id> IDENTIFIER
198 %token <id> NOTENAME_TABLE_IDENTIFIER
199 %token <id> MUSIC_IDENTIFIER
200 %token <id> REQUEST_IDENTIFIER
201 %token <id> REAL_IDENTIFIER
202 %token <id> STRING_IDENTIFIER
203 %token <id> TRANS_IDENTIFIER
204 %token <id> INT_IDENTIFIER
205 %token <id> SCORE_IDENTIFIER
206 %token <id> MIDI_IDENTIFIER
207 %token <id> PAPER_IDENTIFIER
209 %token <string> DURATION RESTNAME
210 %token <string> STRING
214 %type <outputdef> output_def
215 %type <scope> mudela_header mudela_header_body
216 %type <request> open_request_parens close_request_parens open_request close_request
217 %type <request> request_with_dir request_that_take_dir verbose_request
218 %type <i> sub_quotes sup_quotes
219 %type <music> simple_element request_chord command_element Simple_music Composite_music
220 %type <music> Alternative_music Repeated_music
221 %type <i> abbrev_type
222 %type <i> int unsigned
224 %type <i> optional_modality
225 %type <id> identifier_init
226 %type <duration> steno_duration optional_notemode_duration
227 %type <duration> entered_notemode_duration explicit_duration
228 %type <intvec> int_list
229 %type <reqvec> pre_requests post_requests
230 %type <request> gen_text_def
231 %type <pitch> explicit_musical_pitch steno_musical_pitch musical_pitch absolute_musical_pitch
232 %type <pitch> steno_tonic_pitch
234 %type <pitch_arr> pitch_list
236 %type <pitch_arr> chord_additions chord_subtractions chord_notes chord_step
237 %type <pitch> chord_note chord_inversion
238 %type <midi> midi_block midi_body
239 %type <duration> duration_length
241 %type <scalar> scalar
242 %type <music> Music Sequential_music Simultaneous_music Music_sequence
243 %type <music> relative_music re_rhythmed_music
244 %type <music> property_def translator_change
245 %type <music_list> Music_list
246 %type <paper> paper_block paper_def_body
247 %type <real> real real_with_dimension
248 %type <request> abbrev_command_req
249 %type <request> post_request
250 %type <request> command_req verbose_command_req
251 %type <request> extender_req
252 %type <request> hyphen_req
253 %type <string> string
254 %type <score> score_block score_body
255 %type <realarr> real_array
257 %type <string> script_abbreviation
258 %type <trans> translator_spec_block translator_spec_body
259 %type <tempo> tempo_request
260 %type <notenametab> notenames_body notenames_block chordmodifiers_block
271 | mudela toplevel_expression {}
272 | mudela assignment { }
275 THIS->error_level_i_ =1;
281 THIS->lexer_p_->set_notename_table ($1);
283 | chordmodifiers_block {
284 THIS->lexer_p_->set_chordmodifier_table ($1);
287 delete header_global_p;
288 header_global_p = $1;
291 score_global_array.push ($1);
294 Identifier * id = new
295 Paper_def_identifier ($1, PAPER_IDENTIFIER);
296 THIS->lexer_p_->set_identifier ("$defaultpaper", id)
299 Identifier * id = new
300 Midi_def_identifier ($1, MIDI_IDENTIFIER);
301 THIS->lexer_p_->set_identifier ("$defaultmidi", id)
308 SCMFILE STRING semicolon {
309 read_lily_scm_file (*$2);
312 | SCM_T STRING semicolon {
313 if (THIS->lexer_p_->main_input_b_ && safe_global_b)
314 error (_("Can't evaluate Scheme in safe mode"));
315 gh_eval_str ($2->ch_l ());
320 chordmodifiers_block:
321 CHORDMODIFIERS '{' notenames_body '}' { $$ = $3; }
326 NOTENAMES '{' notenames_body '}' { $$ = $3; }
333 $$ = new Notename_table;
335 | NOTENAME_TABLE_IDENTIFIER {
336 $$ = $1-> access_content_Notename_table(true);
338 | notenames_body STRING '=' explicit_musical_pitch {
349 THIS->lexer_p_-> scope_l_arr_.push ($$);
351 | mudela_header_body assignment semicolon {
357 HEADER '{' mudela_header_body '}' {
359 THIS->lexer_p_-> scope_l_arr_.pop ();
369 THIS->remember_spot ();
371 /* cont */ '=' identifier_init {
372 THIS->lexer_p_->set_identifier (*$1, $4);
373 $4->init_b_ = THIS->init_parse_b_;
374 $4->set_spot (THIS->pop_spot ());
382 $$ = new Score_identifier ($1, SCORE_IDENTIFIER);
385 | chordmodifiers_block {
386 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
389 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
392 $$ = new Paper_def_identifier ($1, PAPER_IDENTIFIER);
395 $$ = new Midi_def_identifier ($1, MIDI_IDENTIFIER);
398 | translator_spec_block {
399 $$ = new Translator_identifier ($1, TRANS_IDENTIFIER);
402 $$ = new Music_identifier ($1, MUSIC_IDENTIFIER);
406 $$ = new Request_identifier ($1, REQUEST_IDENTIFIER);
408 | explicit_duration {
409 $$ = new Duration_identifier ($1, DURATION_IDENTIFIER);
412 $$ = new Real_identifier (new Real ($1), REAL_IDENTIFIER);
415 $$ = new String_identifier ($1, STRING_IDENTIFIER);
418 $$ = new int_identifier (new int ($1), INT_IDENTIFIER);
422 translator_spec_block:
423 TRANSLATOR '{' translator_spec_body '}'
429 translator_spec_body:
431 $$ = $1->access_content_Translator (true);
432 Translator_group * tg = dynamic_cast<Translator_group*> ($$);
434 THIS->parser_error (_("Need a translator group for a context"));
435 $$-> set_spot (THIS->here_input ());
437 | TYPE STRING semicolon {
438 Translator* t = get_translator_l (*$2);
439 Translator_group * tg = dynamic_cast<Translator_group*> (t);
442 THIS->parser_error (_("Need a translator group for a context"));
445 t->set_spot (THIS->here_input ());
449 | translator_spec_body STRING '=' identifier_init semicolon {
451 String_identifier *s = dynamic_cast<String_identifier*> (id);
452 Real_identifier *r= dynamic_cast<Real_identifier*>(id);
453 int_identifier *i = dynamic_cast<int_identifier*> (id);
456 if (s) str = *s->access_content_String (false);
457 if (i) str = to_str (*i->access_content_int (false));
458 if (r) str = to_str (*r->access_content_Real (false));
460 THIS->parser_error (_("Wrong type for property value"));
464 Translator_group* tg = dynamic_cast<Translator_group*> ($$);
466 THIS->parser_error (_("Need a translator group for a context"));
467 tg->set_property (*$2, str);
469 | translator_spec_body NAME STRING semicolon {
473 | translator_spec_body CONSISTS STRING semicolon {
474 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, true);
477 | translator_spec_body CONSISTSEND STRING semicolon {
478 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, true);
481 | translator_spec_body ACCEPTS STRING semicolon {
482 dynamic_cast<Translator_group*> ($$)-> set_acceptor (*$3, true);
485 | translator_spec_body REMOVE STRING semicolon {
486 dynamic_cast<Translator_group*> ($$)-> set_element (*$3, false);
497 /*cont*/ '{' score_body '}' {
499 if (!$$->def_p_arr_.size ())
500 $$->add_output (THIS->default_paper_p ());
506 $$->set_spot (THIS->here_input ());
509 $$ = $1->access_content_Score (true);
511 | score_body mudela_header {
516 $2->warning (_ ("More than one music block"));
519 | score_body output_def {
541 PAPER '{' paper_def_body '}' {
543 THIS-> lexer_p_->scope_l_arr_.pop ();
550 Paper_def *p = THIS->default_paper_p ();
551 THIS-> lexer_p_-> scope_l_arr_.push (p->scope_p_);
555 Paper_def *p = $1->access_content_Paper_def (true);
556 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
559 | paper_def_body int '=' FONT STRING { // ugh, what a syntax
560 Lookup * l = new Lookup;
563 $$->set_lookup ($2, l);
565 | paper_def_body assignment semicolon {
568 | paper_def_body translator_spec_block {
569 $$->assign_translator ($2);
571 | paper_def_body SHAPE real_array semicolon {
576 warning (_ ("Need even number of args for shape array"));
578 for (int i=0; i < $3->size (); i+=2)
580 Real l = $3->elem (i);
581 $$->shape_int_a_.push (Interval (l,
582 l + $3->elem (i+1)));
586 | paper_def_body error {
612 | real_with_dimension
614 $$= *$1->access_content_Real (false);
616 | '-' real %prec UNARY_MINUS {
639 $$ = new Array<Real>;
643 $$ = new Array<Real>;
645 | real_array ',' real {
657 THIS-> lexer_p_-> scope_l_arr_.pop();
661 midi_body: /* empty */ {
662 Midi_def * p =THIS->default_midi_p ();
664 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
667 Midi_def * p =$1-> access_content_Midi_def (true);
669 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
671 | midi_body assignment semicolon {
674 | midi_body translator_spec_block {
675 $$-> assign_translator ($2);
677 | midi_body tempo_request semicolon {
678 $$->set_tempo ($2->dur_.length_mom (), $2->metronome_i_);
687 TEMPO steno_duration '=' unsigned {
691 $$-> metronome_i_ = $4;
695 Music_list: /* empty */ {
697 $$->set_spot (THIS->here_input ());
716 | ALTERNATIVE Music_sequence {
718 $2->set_spot (THIS->here_input ());
726 REPEAT STRING unsigned Music Alternative_music
728 Music_sequence* m = dynamic_cast <Music_sequence*> ($5);
729 if (m && $3 < m->length_i ())
730 $5->warning (_ ("More alternatives than repeats. Junking excess alternatives."));
732 Repeated_music * r = new Repeated_music ($4, $3 >? 1, m);
734 r->fold_b_ = (*$2 == "fold");
735 r->volta_fold_b_ = (*$2 == "volta");
737 r->set_spot ($4->spot ());
741 Music_sequence: '{' Music_list '}' {
742 $$ = new Music_sequence ($2);
743 $$->set_spot ($2->spot ());
748 SEQUENTIAL '{' Music_list '}' {
749 $$ = new Sequential_music ($3);
750 $$->set_spot ($3->spot ());
752 | '{' Music_list '}' {
753 $$ = new Sequential_music ($2);
754 $$->set_spot ($2->spot ());
759 SIMULTANEOUS '{' Music_list '}'{
760 $$ = new Simultaneous_music ($3);
761 $$->set_spot ($3->spot ());
763 | '<' Music_list '>' {
764 $$ = new Simultaneous_music ($2);
765 $$->set_spot ($2->spot ());
770 request_chord { $$ = $1; }
771 | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); }
774 | Simple_music '*' unsigned '/' unsigned {
776 $$->compress (Moment($3, $5 ));
778 | Simple_music '*' unsigned {
780 $$->compress (Moment ($3, 1));
786 CONTEXT STRING Music {
787 Context_specced_music *csm = new Context_specced_music ($3);
789 csm->translator_type_str_ = *$2;
790 csm->translator_id_str_ = "";
795 | AUTOCHANGE STRING Music {
796 Auto_change_music * chm = new Auto_change_music (*$2, $3);
799 chm->set_spot ($3->spot ());
802 $$ = new Grace_music ($2);
804 | CONTEXT STRING '=' STRING Music {
805 Context_specced_music *csm = new Context_specced_music ($5);
807 csm->translator_type_str_ = *$2;
808 csm->translator_id_str_ = *$4;
815 THIS->remember_spot ();
818 unsigned '/' unsigned Music
821 $$ = new Time_scaled_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; }
856 | re_rhythmed_music { $$ = $1; }
860 RELATIVE absolute_musical_pitch Music {
861 $$ = new Relative_octave_music ($3, *$2);
867 ADDLYRICS Music Music {
868 Lyric_combine_music * l = new Lyric_combine_music ($2, $3);
874 TRANSLATOR STRING '=' STRING {
875 Change_translator * t = new Change_translator;
876 t-> change_to_type_str_ = *$2;
877 t-> change_to_id_str_ = *$4;
880 $$->set_spot (THIS->here_input ());
887 PROPERTY STRING '.' STRING '=' scalar {
888 Translation_property *t = new Translation_property;
893 Context_specced_music *csm = new Context_specced_music (t);
895 $$->set_spot (THIS->here_input ());
897 csm-> translator_type_str_ = *$2;
906 string { $$ = new Scalar (*$1); delete $1; }
907 | int { $$ = new Scalar ($1); }
912 pre_requests simple_element post_requests {
913 Music_sequence *l = dynamic_cast<Music_sequence*>($2);
914 for (int i=0; i < $1->size(); i++)
915 l->add_music ($1->elem(i));
916 for (int i=0; i < $3->size(); i++)
917 l->add_music ($3->elem(i));
926 $$ = new Request_chord;
927 $$-> set_spot (THIS->here_input ());
928 $1-> set_spot (THIS->here_input ());
929 ((Simultaneous_music*)$$) ->add_music ($1);//ugh
935 | verbose_command_req semicolon { $$ = $1; }
946 $$ = new Barcheck_req;
952 Span_req*b= new Span_req;
953 b->span_dir_ = START;
954 b->span_type_str_ = "beam";
958 if (!Duration::duration_type_b ($3))
959 THIS->parser_error (_f ("not a duration: %d", $3));
961 THIS->parser_error (_ ("Can't abbreviate"));
963 THIS->set_abbrev_beam ($3);
965 Chord_tremolo_req* a = new Chord_tremolo_req;
966 a->span_dir_ = START;
967 a->type_i_ = THIS->abbrev_beam_type_i_;
971 if (!THIS->abbrev_beam_type_i_)
973 Span_req*b= new Span_req;
975 b->span_type_str_ = "beam";
980 Chord_tremolo_req* a = new Chord_tremolo_req;
982 a->type_i_ = THIS->abbrev_beam_type_i_;
983 THIS->set_abbrev_beam (0);
988 $$ = new Breathing_sign_req;
995 $$ = new Bar_req (*$2);
999 $$ = new Mark_req (*$2);
1003 $$ = new Mark_req (to_str ($2));
1005 | TIME_T unsigned '/' unsigned {
1006 Time_signature_change_req *m = new Time_signature_change_req;
1012 Break_req * b = new Break_req;
1013 b->penalty_f_ = $2 / 100.0;
1014 b->set_spot (THIS->here_input ());
1017 | SKIP duration_length {
1018 Skip_req * skip_p = new Skip_req;
1019 skip_p->duration_ = *$2;
1026 | CADENZA unsigned {
1027 $$ = new Cadenza_req ($2);
1029 | PARTIAL duration_length {
1030 $$ = new Partial_measure_req ($2->length_mom ());
1034 $$ = new Clef_change_req (*$2);
1037 | KEY NOTENAME_PITCH optional_modality {
1038 Key_change_req *key_p= new Key_change_req;
1039 key_p->key_.pitch_arr_.push (*$2);
1040 key_p->key_.ordinary_key_b_ = true;
1041 key_p->key_.modality_i_ = $3;
1045 | KEYSIGNATURE pitch_list {
1046 Key_change_req *key_p= new Key_change_req;
1047 key_p->key_.pitch_arr_ = *$2;
1048 key_p->key_.ordinary_key_b_ = false;
1057 $$ = new Link_array<Request>;
1059 | post_requests post_request {
1060 $2->set_spot (THIS->here_input ());
1072 request_that_take_dir:
1075 | script_abbreviation {
1076 Identifier*i = THIS->lexer_p_->lookup_identifier ("dash-" + *$1);
1077 Articulation_req *a = new Articulation_req;
1078 a->articulation_str_ = *i->access_content_String (false);
1085 script_dir request_that_take_dir {
1086 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1087 gs->dir_ = Direction ($1);
1089 $2->warning (_ ("Can't specify direction for this request"));
1095 REQUEST_IDENTIFIER {
1096 $$ = (Request*)$1->access_content_Request (true);
1097 $$->set_spot (THIS->here_input ());
1099 | TEXTSCRIPT STRING STRING {
1100 Text_script_req *ts_p = new Text_script_req;
1101 ts_p-> text_str_ = *$2;
1102 ts_p-> style_str_ = *$3;
1103 ts_p->set_spot (THIS->here_input ());
1108 | SPANREQUEST int STRING {
1109 Span_req * sp_p = new Span_req;
1110 sp_p-> span_dir_ = Direction($2);
1111 sp_p->span_type_str_ = *$3;
1112 sp_p->set_spot (THIS->here_input ());
1116 Tremolo_req* a = new Tremolo_req;
1117 a->set_spot (THIS->here_input ());
1122 Articulation_req * a = new Articulation_req;
1123 a->articulation_str_ = *$2;
1124 a->set_spot (THIS->here_input ());
1157 steno_musical_pitch:
1161 | NOTENAME_PITCH sup_quotes {
1163 $$->octave_i_ += $2;
1165 | NOTENAME_PITCH sub_quotes {
1167 $$->octave_i_ += - $2;
1175 | TONICNAME_PITCH sup_quotes {
1177 $$->octave_i_ += $2;
1179 | TONICNAME_PITCH sub_quotes {
1181 $$->octave_i_ += - $2;
1185 explicit_musical_pitch:
1186 MUSICAL_PITCH '{' int_list '}' {/* ugh */
1187 Array<int> &a = *$3;
1189 $$ = new Musical_pitch;
1190 $$->octave_i_ = a[0];
1191 $$->notename_i_ = a[1];
1192 $$->accidental_i_ = a[2];
1198 steno_musical_pitch {
1200 THIS->set_last_pitch ($1);
1202 | explicit_musical_pitch {
1204 THIS->set_last_pitch ($1);
1209 DURATION '{' int_list '}' {
1211 Array<int> &a = *$3;
1214 $$-> durlog_i_ = a[0];
1215 $$-> dots_i_ = a[1];
1223 if (!THIS->lexer_p_->lyric_state_b ())
1224 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1225 $$ = new Extender_req;
1231 if (!THIS->lexer_p_->lyric_state_b ())
1232 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1233 $$ = new Hyphen_req;
1238 close_request_parens {
1240 dynamic_cast<Span_req*> ($$)->span_dir_ = START;
1243 close_request_parens:
1245 Span_req* s= new Span_req;
1247 s->span_type_str_ = "slur";
1250 Span_req*s =new Span_req;
1252 s->span_type_str_ = "crescendo";
1255 Span_req*s =new Span_req;
1257 s->span_type_str_ = "decrescendo";
1263 open_request_parens {
1265 dynamic_cast<Span_req*> ($$)->span_dir_ = STOP;
1269 open_request_parens:
1271 Span_req *s = new Span_req;
1272 s->span_type_str_ = "crescendo";
1276 Span_req* s= new Span_req;
1278 s->span_type_str_ = "slur";
1284 Text_script_req *t = new Text_script_req;
1288 $$->set_spot (THIS->here_input ());
1291 Text_script_req* t = new Text_script_req;
1293 t->text_str_ = to_str ($1);
1294 t->style_str_ = "finger";
1295 $$->set_spot (THIS->here_input ());
1299 script_abbreviation:
1301 $$ = new String ("hat");
1304 $$ = new String ("plus");
1307 $$ = new String ("dash");
1310 $$ = new String ("bar");
1313 $$ = new String ("larger");
1316 $$ = new String ("dot");
1324 | '-' { $$ = CENTER; }
1329 $$ = new Link_array<Request>;
1331 | pre_requests open_request {
1336 absolute_musical_pitch:
1337 steno_musical_pitch {
1346 | duration_length '*' unsigned {
1347 $$->plet_.iso_i_ *= $3;
1349 | duration_length '/' unsigned {
1350 $$->plet_.type_i_ *= $3;
1354 entered_notemode_duration:
1356 THIS->set_last_duration ($1);
1360 optional_notemode_duration:
1362 $$ = new Duration (THIS->default_duration_);
1364 | entered_notemode_duration {
1372 if (!Duration::duration_type_b ($1))
1373 THIS->parser_error (_f ("not a duration: %d", $1));
1375 $$->durlog_i_ = Duration_convert::i2_type ($1);
1378 | DURATION_IDENTIFIER {
1379 $$ = $1->access_content_Duration (true);
1381 | steno_duration '.' {
1392 if (!Duration::duration_type_b ($2))
1393 THIS->parser_error (_f ("not a duration: %d", $2));
1395 THIS->parser_error (_ ("Can't abbreviate"));
1402 musical_pitch exclamations questions optional_notemode_duration {
1403 if (!THIS->lexer_p_->note_state_b ())
1404 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1407 Note_req *n = new Note_req;
1413 if (THIS->abbrev_beam_type_i_)
1415 if (n->duration_.plet_b ())
1416 THIS->parser_error (_ ("Can't abbreviate tuplet"));
1418 n->duration_.set_plet (1, 2);
1420 n->cautionary_b_ = $3 % 2;
1421 n->forceacc_b_ = $2 % 2 || n->cautionary_b_;
1423 Simultaneous_music*v = new Request_chord;
1424 v->set_spot (THIS->here_input ());
1425 n->set_spot (THIS->here_input ());
1431 | RESTNAME optional_notemode_duration {
1432 $$ = THIS->get_rest_element (*$1, $2);
1433 delete $1; // delete notename
1435 | MEASURES optional_notemode_duration {
1436 Multi_measure_rest_req* m = new Multi_measure_rest_req;
1440 Simultaneous_music*velt_p = new Request_chord;
1441 velt_p->set_spot (THIS->here_input ());
1442 velt_p->add_music (m);
1445 | REPETITIONS optional_notemode_duration {
1446 Repetitions_req* r = new Repetitions_req;
1450 Simultaneous_music*velt_p = new Request_chord;
1451 velt_p->set_spot (THIS->here_input ());
1452 velt_p->add_music (r);
1455 | STRING optional_notemode_duration {
1456 if (!THIS->lexer_p_->lyric_state_b ())
1457 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1458 $$ = THIS->get_word_element (*$1, $2);
1462 if (!THIS->lexer_p_->chord_state_b ())
1463 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1469 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion {
1470 $$ = THIS->get_chord (*$1, $3, $4, $5, *$2);
1475 $$ = new Array<Musical_pitch>;
1477 | CHORD_MINUS chord_notes {
1486 | chord_notes '.' chord_step {
1494 $$ = new Array<Musical_pitch>;
1496 | CHORD_CARET chord_notes {
1506 | '/' steno_tonic_pitch {
1513 $$ = new Array<Musical_pitch>;
1516 | CHORDMODIFIER_PITCH {
1517 $$ = new Array<Musical_pitch>;
1520 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
1521 $$ = new Array<Musical_pitch>;
1529 $$ = new Musical_pitch;
1530 $$->notename_i_ = ($1 - 1) % 7;
1531 $$->octave_i_ = $1 > 7 ? 1 : 0;
1532 $$->accidental_i_ = 0;
1535 $$ = new Musical_pitch;
1536 $$->notename_i_ = ($1 - 1) % 7;
1537 $$->octave_i_ = $1 > 7 ? 1 : 0;
1538 $$->accidental_i_ = 1;
1540 | unsigned CHORD_MINUS {
1541 $$ = new Musical_pitch;
1542 $$->notename_i_ = ($1 - 1) % 7;
1543 $$->octave_i_ = $1 > 7 ? 1 : 0;
1544 $$->accidental_i_ = -1;
1552 $$ = new Array<Musical_pitch>;
1554 | pitch_list musical_pitch {
1587 $$ = *$1->access_content_int (false);
1596 | STRING_IDENTIFIER {
1597 $$ = $1->access_content_String (true);
1599 | string '+' string {
1608 | exclamations '!' { $$ ++; }
1613 | questions '?' { $$ ++; }
1623 My_lily_parser::set_yydebug (bool b)
1630 My_lily_parser::do_yyparse ()
1632 yyparse ((void*)this);