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_CHAR E_EXCLAMATION E_SMALLER E_BIGGER
191 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET
193 %type <i> exclamations questions
195 %token <pitch> NOTENAME_PITCH
196 %token <pitch> TONICNAME_PITCH
197 %token <pitch> CHORDMODIFIER_PITCH
198 %token <id> DURATION_IDENTIFIER
199 %token <id> IDENTIFIER
200 %token <id> NOTENAME_TABLE_IDENTIFIER
201 %token <id> MUSIC_IDENTIFIER
202 %token <id> REQUEST_IDENTIFIER
203 %token <id> REAL_IDENTIFIER
204 %token <id> STRING_IDENTIFIER
205 %token <id> TRANS_IDENTIFIER
206 %token <id> INT_IDENTIFIER
207 %token <id> SCORE_IDENTIFIER
208 %token <id> MIDI_IDENTIFIER
209 %token <id> PAPER_IDENTIFIER
211 %token <scm> DURATION RESTNAME
217 %type <outputdef> output_def
218 %type <scope> mudela_header mudela_header_body
219 %type <request> open_request_parens close_request_parens open_request close_request
220 %type <request> request_with_dir request_that_take_dir verbose_request
221 %type <i> sub_quotes sup_quotes
222 %type <music> simple_element request_chord command_element Simple_music Composite_music
223 %type <music> Alternative_music Repeated_music
224 %type <i> abbrev_type
225 %type <i> int unsigned
227 %type <i> optional_modality
228 %type <id> identifier_init
229 %type <duration> steno_duration optional_notemode_duration
230 %type <duration> entered_notemode_duration explicit_duration
231 %type <intvec> int_list
232 %type <reqvec> pre_requests post_requests
233 %type <request> gen_text_def
234 %type <pitch> explicit_musical_pitch steno_musical_pitch musical_pitch absolute_musical_pitch
235 %type <pitch> steno_tonic_pitch
237 %type <pitch_arr> pitch_list
239 %type <pitch_arr> chord_additions chord_subtractions chord_notes chord_step
240 %type <pitch> chord_note chord_inversion chord_bass
241 %type <midi> midi_block midi_body
242 %type <duration> duration_length
244 %type <scm> embedded_scm scalar
245 %type <music> Music Sequential_music Simultaneous_music Music_sequence
246 %type <music> relative_music re_rhythmed_music
247 %type <music> property_def translator_change
248 %type <music_list> Music_list
249 %type <paper> paper_block paper_def_body
250 %type <real> real real_with_dimension
251 %type <request> abbrev_command_req
252 %type <request> post_request
253 %type <request> command_req verbose_command_req
254 %type <request> extender_req
255 %type <request> hyphen_req
257 %type <score> score_block score_body
258 %type <realarr> real_array
260 %type <scm> script_abbreviation
261 %type <trans> translator_spec_block translator_spec_body
262 %type <tempo> tempo_request
263 %type <notenametab> notenames_body notenames_block chordmodifiers_block
274 | mudela toplevel_expression {}
275 | mudela assignment { }
278 THIS->error_level_i_ =1;
284 THIS->lexer_p_->set_notename_table ($1);
286 | chordmodifiers_block {
287 THIS->lexer_p_->set_chordmodifier_table ($1);
290 delete header_global_p;
291 header_global_p = $1;
294 score_global_array.push ($1);
297 Identifier * id = new
298 Paper_def_identifier ($1, PAPER_IDENTIFIER);
299 THIS->lexer_p_->set_identifier ("$defaultpaper", id)
302 Identifier * id = new
303 Midi_def_identifier ($1, MIDI_IDENTIFIER);
304 THIS->lexer_p_->set_identifier ("$defaultmidi", id)
316 chordmodifiers_block:
317 CHORDMODIFIERS '{' notenames_body '}' { $$ = $3; }
322 NOTENAMES '{' notenames_body '}' { $$ = $3; }
329 $$ = new Notename_table;
331 | NOTENAME_TABLE_IDENTIFIER {
332 $$ = $1-> access_content_Notename_table(true);
334 | notenames_body STRING '=' explicit_musical_pitch {
335 (*$$)[ly_scm2string ($2)] = *$4;
344 THIS->lexer_p_-> scope_l_arr_.push ($$);
346 | mudela_header_body assignment semicolon {
352 HEADER '{' mudela_header_body '}' {
354 THIS->lexer_p_-> scope_l_arr_.pop ();
364 THIS->remember_spot ();
366 /* cont */ '=' identifier_init {
367 THIS->lexer_p_->set_identifier (ly_scm2string ($1), $4);
368 $4->init_b_ = THIS->init_parse_b_;
369 $4->set_spot (THIS->pop_spot ());
377 $$ = new Score_identifier ($1, SCORE_IDENTIFIER);
380 | chordmodifiers_block {
381 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
384 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
387 $$ = new Paper_def_identifier ($1, PAPER_IDENTIFIER);
390 $$ = new Midi_def_identifier ($1, MIDI_IDENTIFIER);
393 | translator_spec_block {
394 $$ = new Translator_group_identifier ($1, TRANS_IDENTIFIER);
397 $$ = new Music_identifier ($1, MUSIC_IDENTIFIER);
401 $$ = new Request_identifier ($1, REQUEST_IDENTIFIER);
403 | explicit_duration {
404 $$ = new Duration_identifier ($1, DURATION_IDENTIFIER);
407 $$ = new Real_identifier (new Real ($1), REAL_IDENTIFIER);
410 $$ = new String_identifier (new String (ly_scm2string ($1)), STRING_IDENTIFIER);
413 $$ = new int_identifier (new int ($1), INT_IDENTIFIER);
417 translator_spec_block:
418 TRANSLATOR '{' translator_spec_body '}'
424 translator_spec_body:
426 $$ = $1->access_content_Translator_group (true);
427 $$-> set_spot (THIS->here_input ());
429 | TYPE STRING semicolon {
430 Translator* t = get_translator_l (ly_scm2string ($2));
431 Translator_group * tg = dynamic_cast<Translator_group*> (t);
434 THIS->parser_error (_("Need a translator group for a context"));
436 tg = dynamic_cast<Translator_group*> (t->clone ());
437 tg->set_spot (THIS->here_input ());
440 | translator_spec_body STRING '=' embedded_scm {
441 Translator_group* tg = dynamic_cast<Translator_group*> ($$);
442 tg->set_property (ly_scm2string ($2), $4);
444 | translator_spec_body STRING '=' identifier_init semicolon {
446 String_identifier *s = dynamic_cast<String_identifier*> (id);
447 Real_identifier *r= dynamic_cast<Real_identifier*>(id);
448 int_identifier *i = dynamic_cast<int_identifier*> (id);
451 if (s) v = ly_str02scm (s->access_content_String (false)->ch_C());
452 if (i) v = gh_int2scm (*i->access_content_int (false));
453 if (r) v = gh_double2scm (*r->access_content_Real (false));
455 THIS->parser_error (_("Wrong type for property value"));
459 Translator_group* tg = dynamic_cast<Translator_group*> ($$);
461 tg->set_property (ly_scm2string ($2), v);
463 | translator_spec_body NAME STRING semicolon {
464 $$->type_str_ = ly_scm2string ($3);
466 | translator_spec_body CONSISTS STRING semicolon {
467 dynamic_cast<Translator_group*> ($$)-> set_element (ly_scm2string ($3), true);
469 | translator_spec_body CONSISTSEND STRING semicolon {
470 dynamic_cast<Translator_group*> ($$)-> set_element (ly_scm2string ($3), true);
472 | translator_spec_body ACCEPTS STRING semicolon {
473 dynamic_cast<Translator_group*> ($$)-> set_acceptor (ly_scm2string ($3), true);
475 | translator_spec_body REMOVE STRING semicolon {
476 dynamic_cast<Translator_group*> ($$)-> set_element (ly_scm2string ($3), false);
486 /*cont*/ '{' score_body '}' {
488 if (!$$->def_p_arr_.size ())
489 $$->add_output (THIS->default_paper_p ());
495 $$->set_spot (THIS->here_input ());
498 $$ = $1->access_content_Score (true);
500 | score_body mudela_header {
505 $2->warning (_ ("More than one music block"));
508 | score_body output_def {
530 PAPER '{' paper_def_body '}' {
532 THIS-> lexer_p_->scope_l_arr_.pop ();
539 Paper_def *p = THIS->default_paper_p ();
540 THIS-> lexer_p_-> scope_l_arr_.push (p->scope_p_);
544 Paper_def *p = $1->access_content_Paper_def (true);
545 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
548 | paper_def_body int '=' FONT STRING { // ugh, what a syntax
549 Lookup * l = new Lookup;
550 l->font_name_ = ly_scm2string ($5);
551 $$->set_lookup ($2, l);
553 | paper_def_body assignment semicolon {
556 | paper_def_body SCM_T '=' SCM_T {
557 if (!gh_symbol_p ($2))
558 THIS->parser_error ("expect a symbol as lvalue");
560 $$->default_properties_[$2] = $4;
562 | paper_def_body SCM_T '=' real semicolon {
563 if (!gh_symbol_p ($2))
564 THIS->parser_error ("expect a symbol as lvalue");
566 $$->default_properties_[$2] = gh_double2scm ($4);
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_ = (ly_scm2string ($2) == "fold");
735 r->volta_fold_b_ = (ly_scm2string ($2) == "volta");
736 r->set_spot ($4->spot ());
740 Music_sequence: '{' Music_list '}' {
741 $$ = new Music_sequence ($2);
742 $$->set_spot ($2->spot ());
747 SEQUENTIAL '{' Music_list '}' {
748 $$ = new Sequential_music ($3);
749 $$->set_spot ($3->spot ());
751 | '{' Music_list '}' {
752 $$ = new Sequential_music ($2);
753 $$->set_spot ($2->spot ());
758 SIMULTANEOUS '{' Music_list '}'{
759 $$ = new Simultaneous_music ($3);
760 $$->set_spot ($3->spot ());
762 | '<' Music_list '>' {
763 $$ = new Simultaneous_music ($2);
764 $$->set_spot ($2->spot ());
769 request_chord { $$ = $1; }
770 | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); }
773 | Simple_music '*' unsigned '/' unsigned {
775 $$->compress (Moment($3, $5 ));
777 | Simple_music '*' unsigned {
779 $$->compress (Moment ($3, 1));
785 CONTEXT STRING Music {
786 Context_specced_music *csm = new Context_specced_music ($3);
788 csm->translator_type_str_ = ly_scm2string ($2);
789 csm->translator_id_str_ = "";
794 | AUTOCHANGE STRING Music {
795 Auto_change_music * chm = new Auto_change_music (ly_scm2string ($2), $3);
798 chm->set_spot ($3->spot ());
801 $$ = new Grace_music ($2);
803 | CONTEXT STRING '=' STRING Music {
804 Context_specced_music *csm = new Context_specced_music ($5);
806 csm->translator_type_str_ = ly_scm2string ($2);
807 csm->translator_id_str_ = ly_scm2string ($4);
812 THIS->remember_spot ();
815 unsigned '/' unsigned Music
818 $$ = new Time_scaled_music ($3, $5, $6);
819 $$->set_spot (THIS->pop_spot ());
821 | Repeated_music { $$ = $1; }
822 | Simultaneous_music { $$ = $1; }
823 | Sequential_music { $$ = $1; }
824 | TRANSPOSE musical_pitch Music {
825 $$ = new Transposed_music ($3, *$2);
828 | TRANSPOSE steno_tonic_pitch Music {
829 $$ = new Transposed_music ($3, *$2);
833 { THIS->lexer_p_->push_note_state (); }
836 THIS->lexer_p_->pop_state ();
839 { THIS->lexer_p_->push_chord_state (); }
843 THIS->lexer_p_->pop_state ();
846 { THIS->lexer_p_->push_lyric_state (); }
850 THIS->lexer_p_->pop_state ();
852 | relative_music { $$ = $1; }
853 | re_rhythmed_music { $$ = $1; }
857 RELATIVE absolute_musical_pitch Music {
858 $$ = new Relative_octave_music ($3, *$2);
864 ADDLYRICS Music Music {
865 Lyric_combine_music * l = new Lyric_combine_music ($2, $3);
871 TRANSLATOR STRING '=' STRING {
872 Change_translator * t = new Change_translator;
873 t-> change_to_type_str_ = ly_scm2string ($2);
874 t-> change_to_id_str_ = ly_scm2string ($4);
877 $$->set_spot (THIS->here_input ());
882 PROPERTY STRING '.' STRING '=' scalar {
883 Translation_property *t = new Translation_property;
885 t->var_str_ = ly_scm2string ($4);
888 Context_specced_music *csm = new Context_specced_music (t);
890 $$->set_spot (THIS->here_input ());
892 csm-> translator_type_str_ = ly_scm2string ($2);
898 | int { $$ = gh_int2scm ($1); }
899 | embedded_scm { $$ = $1; }
904 pre_requests simple_element post_requests {
905 Music_sequence *l = dynamic_cast<Music_sequence*>($2);
906 for (int i=0; i < $1->size(); i++)
907 l->add_music ($1->elem(i));
908 for (int i=0; i < $3->size(); i++)
909 l->add_music ($3->elem(i));
918 $$ = new Request_chord;
919 $$-> set_spot (THIS->here_input ());
920 $1-> set_spot (THIS->here_input ());
921 ((Simultaneous_music*)$$) ->add_music ($1);//ugh
927 | verbose_command_req semicolon { $$ = $1; }
938 $$ = new Barcheck_req;
944 Span_req*b= new Span_req;
945 b->span_dir_ = START;
946 b->span_type_str_ = "beam";
950 if (!Duration::duration_type_b ($3))
951 THIS->parser_error (_f ("not a duration: %d", $3));
953 THIS->parser_error (_ ("Can't abbreviate"));
955 THIS->set_abbrev_beam ($3);
957 Chord_tremolo_req* a = new Chord_tremolo_req;
958 a->span_dir_ = START;
959 a->type_i_ = THIS->abbrev_beam_type_i_;
963 if (!THIS->abbrev_beam_type_i_)
965 Span_req*b= new Span_req;
967 b->span_type_str_ = "beam";
972 Chord_tremolo_req* a = new Chord_tremolo_req;
974 a->type_i_ = THIS->abbrev_beam_type_i_;
975 THIS->set_abbrev_beam (0);
980 $$ = new Breathing_sign_req;
987 $$ = new Bar_req (ly_scm2string ($2));
990 $$ = new Mark_req (ly_scm2string ($2));
994 $$ = new Mark_req (to_str ($2));
996 | TIME_T unsigned '/' unsigned {
997 Time_signature_change_req *m = new Time_signature_change_req;
1003 Break_req * b = new Break_req;
1004 b->penalty_f_ = $2 / 100.0;
1005 b->set_spot (THIS->here_input ());
1008 | SKIP duration_length {
1009 Skip_req * skip_p = new Skip_req;
1010 skip_p->duration_ = *$2;
1017 | CADENZA unsigned {
1018 $$ = new Cadenza_req ($2);
1020 | PARTIAL duration_length {
1021 $$ = new Partial_measure_req ($2->length_mom ());
1025 $$ = new Clef_change_req (ly_scm2string ($2));
1028 /* UGH. optional. */
1029 | KEY NOTENAME_PITCH optional_modality {
1030 Key_change_req *key_p= new Key_change_req;
1031 key_p->key_.pitch_arr_.push (*$2);
1032 key_p->key_.ordinary_key_b_ = true;
1033 key_p->key_.modality_i_ = $3;
1037 | KEYSIGNATURE pitch_list {
1038 Key_change_req *key_p= new Key_change_req;
1039 key_p->key_.pitch_arr_ = *$2;
1040 key_p->key_.ordinary_key_b_ = false;
1049 $$ = new Link_array<Request>;
1051 | post_requests post_request {
1052 $2->set_spot (THIS->here_input ());
1064 request_that_take_dir:
1067 | script_abbreviation {
1068 Identifier*i = THIS->lexer_p_->lookup_identifier ("dash-" + ly_scm2string ($1));
1069 Articulation_req *a = new Articulation_req;
1070 a->articulation_str_ = *i->access_content_String (false);
1076 script_dir request_that_take_dir {
1077 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1078 gs->dir_ = Direction ($1);
1080 $2->warning (_ ("Can't specify direction for this request"));
1086 REQUEST_IDENTIFIER {
1087 $$ = (Request*)$1->access_content_Request (true);
1088 $$->set_spot (THIS->here_input ());
1090 | TEXTSCRIPT STRING STRING {
1091 Text_script_req *ts_p = new Text_script_req;
1092 ts_p-> text_str_ = ly_scm2string ($2);
1093 ts_p-> style_str_ = ly_scm2string ($3);
1094 ts_p->set_spot (THIS->here_input ());
1098 | SPANREQUEST int STRING {
1099 Span_req * sp_p = new Span_req;
1100 sp_p-> span_dir_ = Direction($2);
1101 sp_p->span_type_str_ = ly_scm2string ($3);
1102 sp_p->set_spot (THIS->here_input ());
1106 Tremolo_req* a = new Tremolo_req;
1107 a->set_spot (THIS->here_input ());
1112 Articulation_req * a = new Articulation_req;
1113 a->articulation_str_ = ly_scm2string ($2);
1114 a->set_spot (THIS->here_input ());
1147 steno_musical_pitch:
1151 | NOTENAME_PITCH sup_quotes {
1153 $$->octave_i_ += $2;
1155 | NOTENAME_PITCH sub_quotes {
1157 $$->octave_i_ += - $2;
1165 | TONICNAME_PITCH sup_quotes {
1167 $$->octave_i_ += $2;
1169 | TONICNAME_PITCH sub_quotes {
1171 $$->octave_i_ += - $2;
1175 explicit_musical_pitch:
1176 MUSICAL_PITCH '{' int_list '}' {/* ugh */
1177 Array<int> &a = *$3;
1179 $$ = new Musical_pitch;
1180 $$->octave_i_ = a[0];
1181 $$->notename_i_ = a[1];
1182 $$->accidental_i_ = a[2];
1188 steno_musical_pitch {
1190 THIS->set_last_pitch ($1);
1192 | explicit_musical_pitch {
1194 THIS->set_last_pitch ($1);
1199 DURATION '{' int_list '}' {
1201 Array<int> &a = *$3;
1204 $$-> durlog_i_ = a[0];
1205 $$-> dots_i_ = a[1];
1213 if (!THIS->lexer_p_->lyric_state_b ())
1214 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1215 $$ = new Extender_req;
1221 if (!THIS->lexer_p_->lyric_state_b ())
1222 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1223 $$ = new Hyphen_req;
1228 close_request_parens {
1230 dynamic_cast<Span_req*> ($$)->span_dir_ = START;
1233 close_request_parens:
1235 Span_req* s= new Span_req;
1237 s->span_type_str_ = "slur";
1240 Span_req*s =new Span_req;
1242 s->span_type_str_ = "crescendo";
1245 Span_req*s =new Span_req;
1247 s->span_type_str_ = "decrescendo";
1253 open_request_parens {
1255 dynamic_cast<Span_req*> ($$)->span_dir_ = STOP;
1259 open_request_parens:
1261 Span_req *s = new Span_req;
1262 s->span_type_str_ = "crescendo";
1266 Span_req* s= new Span_req;
1268 s->span_type_str_ = "slur";
1274 Text_script_req *t = new Text_script_req;
1276 t->text_str_ = ly_scm2string ($1);
1278 $$->set_spot (THIS->here_input ());
1281 Text_script_req* t = new Text_script_req;
1283 t->text_str_ = to_str ($1);
1284 t->style_str_ = "finger";
1285 $$->set_spot (THIS->here_input ());
1289 script_abbreviation:
1291 $$ = gh_str02scm ("hat");
1294 $$ = gh_str02scm("plus");
1297 $$ = gh_str02scm ("dash");
1300 $$ = gh_str02scm ("bar");
1303 $$ = gh_str02scm ("larger");
1306 $$ = gh_str02scm ("dot");
1314 | '-' { $$ = CENTER; }
1319 $$ = new Link_array<Request>;
1321 | pre_requests open_request {
1326 absolute_musical_pitch:
1327 steno_musical_pitch {
1336 | duration_length '*' unsigned {
1337 $$->plet_.iso_i_ *= $3;
1339 | duration_length '/' unsigned {
1340 $$->plet_.type_i_ *= $3;
1344 entered_notemode_duration:
1346 THIS->set_last_duration ($1);
1350 optional_notemode_duration:
1352 $$ = new Duration (THIS->default_duration_);
1354 | entered_notemode_duration {
1362 if (!Duration::duration_type_b ($1))
1363 THIS->parser_error (_f ("not a duration: %d", $1));
1365 $$->durlog_i_ = Duration_convert::i2_type ($1);
1368 | DURATION_IDENTIFIER {
1369 $$ = $1->access_content_Duration (true);
1371 | steno_duration '.' {
1382 if (!Duration::duration_type_b ($2))
1383 THIS->parser_error (_f ("not a duration: %d", $2));
1385 THIS->parser_error (_ ("Can't abbreviate"));
1392 musical_pitch exclamations questions optional_notemode_duration {
1393 if (!THIS->lexer_p_->note_state_b ())
1394 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1397 Note_req *n = new Note_req;
1403 if (THIS->abbrev_beam_type_i_)
1405 if (n->duration_.plet_b ())
1406 THIS->parser_error (_ ("Can't abbreviate tuplet"));
1408 n->duration_.set_plet (1, 2);
1410 n->cautionary_b_ = $3 % 2;
1411 n->forceacc_b_ = $2 % 2 || n->cautionary_b_;
1413 Simultaneous_music*v = new Request_chord;
1414 v->set_spot (THIS->here_input ());
1415 n->set_spot (THIS->here_input ());
1421 | RESTNAME optional_notemode_duration {
1422 $$ = THIS->get_rest_element (ly_scm2string ($1), $2);
1425 | MEASURES optional_notemode_duration {
1426 Multi_measure_rest_req* m = new Multi_measure_rest_req;
1430 Simultaneous_music*velt_p = new Request_chord;
1431 velt_p->set_spot (THIS->here_input ());
1432 velt_p->add_music (m);
1435 | REPETITIONS optional_notemode_duration {
1436 Repetitions_req* r = new Repetitions_req;
1440 Simultaneous_music*velt_p = new Request_chord;
1441 velt_p->set_spot (THIS->here_input ());
1442 velt_p->add_music (r);
1445 | STRING optional_notemode_duration {
1446 if (!THIS->lexer_p_->lyric_state_b ())
1447 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1448 $$ = THIS->get_word_element (ly_scm2string ($1), $2);
1452 if (!THIS->lexer_p_->chord_state_b ())
1453 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1459 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
1460 $$ = THIS->get_chord (*$1, $3, $4, $5, $6, *$2);
1465 $$ = new Array<Musical_pitch>;
1467 | CHORD_COLON chord_notes {
1476 | chord_notes '.' chord_step {
1484 $$ = new Array<Musical_pitch>;
1486 | CHORD_CARET chord_notes {
1496 | '/' steno_tonic_pitch {
1498 $$->set_spot (THIS->here_input ());
1506 | CHORD_BASS steno_tonic_pitch {
1508 $$->set_spot (THIS->here_input ());
1514 $$ = new Array<Musical_pitch>;
1517 | CHORDMODIFIER_PITCH {
1518 $$ = new Array<Musical_pitch>;
1521 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
1522 $$ = new Array<Musical_pitch>;
1530 $$ = new Musical_pitch;
1531 $$->notename_i_ = ($1 - 1) % 7;
1532 $$->octave_i_ = $1 > 7 ? 1 : 0;
1533 $$->accidental_i_ = 0;
1536 $$ = new Musical_pitch;
1537 $$->notename_i_ = ($1 - 1) % 7;
1538 $$->octave_i_ = $1 > 7 ? 1 : 0;
1539 $$->accidental_i_ = 1;
1541 | unsigned CHORD_MINUS {
1542 $$ = new Musical_pitch;
1543 $$->notename_i_ = ($1 - 1) % 7;
1544 $$->octave_i_ = $1 > 7 ? 1 : 0;
1545 $$->accidental_i_ = -1;
1553 $$ = new Array<Musical_pitch>;
1555 | pitch_list musical_pitch {
1588 $$ = *$1->access_content_int (false);
1597 | STRING_IDENTIFIER {
1598 $$ = ly_str02scm ($1->access_content_String (true)->ch_C ());
1600 | string '+' string {
1601 $$ = scm_string_append (scm_listify ($1, $3, SCM_UNDEFINED));
1608 | exclamations '!' { $$ ++; }
1613 | questions '?' { $$ ++; }
1623 My_lily_parser::set_yydebug (bool b)
1630 My_lily_parser::do_yyparse ()
1632 yyparse ((void*)this);