1 %{ // -*-Fundamental-*-
4 parser.yy -- Bison/C++ parser for mudela
6 source file of the GNU LilyPond music typesetter
8 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 Jan Nieuwenhuizen <janneke@gnu.org>
13 #include "lily-guile.hh"
14 #include "translation-property.hh"
17 #include "my-lily-lexer.hh"
18 #include "paper-def.hh"
19 #include "midi-def.hh"
21 #include "file-path.hh"
23 #include "dimensions.hh"
24 #include "identifier.hh"
25 #include "command-request.hh"
26 #include "musical-request.hh"
27 #include "my-lily-parser.hh"
28 #include "context-specced-music.hh"
29 #include "translator-group.hh"
31 #include "music-list.hh"
32 #include "change-translator.hh"
33 #include "file-results.hh"
35 #include "relative-music.hh"
36 #include "lyric-combine-music.hh"
37 #include "transposed-music.hh"
38 #include "time-scaled-music.hh"
39 #include "repeated-music.hh"
40 #include "mudela-version.hh"
41 #include "grace-music.hh"
42 #include "auto-change-music.hh"
43 #include "output-property.hh"
48 return t == 1 << intlog2(t);
53 Mudela_version oldest_version ("1.3.42");
56 print_mudela_versions (ostream &os)
58 os << _f ("Oldest supported input version: %s", oldest_version.str ())
63 // needed for bison.simple's malloc() and free()
70 #define YYERROR_VERBOSE 1
72 #define YYPARSE_PARAM my_lily_parser_l
73 #define YYLEX_PARAM my_lily_parser_l
74 #define THIS ((My_lily_parser *) my_lily_parser_l)
76 #define yyerror THIS->parser_error
77 #define ARRAY_SIZE(a,s) if (a.size () != s) THIS->parser_error (_f ("Expecting %d arguments", s))
83 Array<Musical_pitch> *pitch_arr;
84 Link_array<Request> *reqvec;
90 Music_list *music_list;
95 Music_output_def * outputdef;
96 Musical_pitch * pitch;
103 /* We use SCMs to do strings, because it saves us the trouble of
104 deleting them. Let's hope that a stack overflow doesnt trigger a move
105 of the parse stack onto the heap. */
109 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 */
136 %token CHORDMODIFIERS
179 %token COMMANDSPANREQUEST
181 %token OUTPUTPROPERTY
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> MUSIC_IDENTIFIER
201 %token <id> REQUEST_IDENTIFIER
202 %token <id> REAL_IDENTIFIER
203 %token <id> STRING_IDENTIFIER
204 %token <id> TRANS_IDENTIFIER
205 %token <id> INT_IDENTIFIER
206 %token <id> SCORE_IDENTIFIER
207 %token <id> MIDI_IDENTIFIER
208 %token <id> PAPER_IDENTIFIER
210 %token <scm> DURATION RESTNAME
216 %type <outputdef> output_def
217 %type <scope> mudela_header mudela_header_body
218 %type <request> open_request_parens close_request_parens open_request close_request
219 %type <request> request_with_dir request_that_take_dir verbose_request
220 %type <i> sub_quotes sup_quotes
221 %type <music> simple_element request_chord command_element Simple_music Composite_music
222 %type <music> Alternative_music Repeated_music
223 %type <i> tremolo_type
224 %type <i> int unsigned
226 %type <i> optional_modality
227 %type <id> identifier_init
228 %type <duration> steno_duration optional_notemode_duration
229 %type <duration> entered_notemode_duration explicit_duration
230 %type <intvec> int_list
231 %type <reqvec> pre_requests post_requests
232 %type <request> gen_text_def
233 %type <pitch> steno_musical_pitch musical_pitch absolute_musical_pitch
234 %type <pitch> steno_tonic_pitch
236 %type <pitch_arr> pitch_list chord_additions chord_subtractions chord_notes chord_step
238 %type <pitch> chord_note chord_inversion chord_bass
239 %type <midi> midi_block midi_body
240 %type <duration> duration_length
242 %type <scm> embedded_scm scalar
243 %type <music> Music Sequential_music Simultaneous_music Music_sequence
244 %type <music> relative_music re_rhythmed_music
245 %type <music> property_def translator_change
246 %type <music_list> Music_list
247 %type <paper> paper_block paper_def_body
248 %type <real> real real_with_dimension
249 %type <request> shorthand_command_req
250 %type <request> post_request
251 %type <request> command_req verbose_command_req
252 %type <request> extender_req
253 %type <request> hyphen_req
255 %type <score> score_block score_body
257 %type <trans> translator_spec_block translator_spec_body
258 %type <tempo> tempo_request
259 %type <scm> notenames_body notenames_block chordmodifiers_block
260 %type <scm> script_abbreviation
271 | mudela toplevel_expression {}
272 | mudela assignment { }
275 THIS->error_level_i_ =1;
281 THIS->lexer_p_->pitchname_tab_ = $1;
283 | chordmodifiers_block {
284 THIS->lexer_p_->chordmodifier_tab_ = $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)
313 chordmodifiers_block:
314 CHORDMODIFIERS notenames_body { $$ = $2; }
319 NOTENAMES notenames_body { $$ = $2; }
326 int i = scm_ilength ($1);
328 SCM tab = scm_make_vector (gh_int2scm (i), SCM_EOL);
329 for (SCM s = $1; s != SCM_EOL; s = gh_cdr (s)) {
330 SCM pt = gh_cdar (s);
331 if (scm_ilength (pt) != 3)
332 THIS->parser_error ("Need three args");
333 scm_hashq_set_x (tab, gh_caar(s), pt);
343 THIS->lexer_p_-> scope_l_arr_.push ($$);
345 | mudela_header_body assignment semicolon {
351 HEADER '{' mudela_header_body '}' {
353 THIS->lexer_p_-> scope_l_arr_.pop ();
363 THIS->remember_spot ();
365 /* cont */ '=' identifier_init {
366 THIS->lexer_p_->set_identifier (ly_scm2string ($1), $4);
368 $4->set_spot (THIS->pop_spot ());
376 $$ = new Score_identifier ($1, SCORE_IDENTIFIER);
380 $$ = new Paper_def_identifier ($1, PAPER_IDENTIFIER);
383 $$ = new Midi_def_identifier ($1, MIDI_IDENTIFIER);
386 | translator_spec_block {
387 $$ = new Translator_group_identifier ($1, TRANS_IDENTIFIER);
390 $$ = new Music_identifier ($1, MUSIC_IDENTIFIER);
394 $$ = new Request_identifier ($1, REQUEST_IDENTIFIER);
396 | explicit_duration {
397 $$ = new Duration_identifier ($1, DURATION_IDENTIFIER);
400 $$ = new Real_identifier (new Real ($1), REAL_IDENTIFIER);
403 $$ = new String_identifier (new String (ly_scm2string ($1)), STRING_IDENTIFIER);
406 $$ = new int_identifier (new int ($1), INT_IDENTIFIER);
410 translator_spec_block:
411 TRANSLATOR '{' translator_spec_body '}'
417 translator_spec_body:
419 $$ = $1->access_content_Translator_group (true);
420 $$-> set_spot (THIS->here_input ());
422 | TYPE STRING semicolon {
423 Translator* t = get_translator_l (ly_scm2string ($2));
424 Translator_group * tg = dynamic_cast<Translator_group*> (t);
427 THIS->parser_error (_("Need a translator group for a context"));
429 tg = dynamic_cast<Translator_group*> (t->clone ());
430 tg->set_spot (THIS->here_input ());
433 | translator_spec_body STRING '=' embedded_scm {
434 Translator_group* tg = dynamic_cast<Translator_group*> ($$);
435 tg->set_property (ly_scm2string ($2), $4);
437 | translator_spec_body STRING '=' identifier_init semicolon {
439 String_identifier *s = dynamic_cast<String_identifier*> (id);
440 Real_identifier *r= dynamic_cast<Real_identifier*>(id);
441 int_identifier *i = dynamic_cast<int_identifier*> (id);
444 if (s) v = ly_str02scm (s->access_content_String (false)->ch_C());
445 if (i) v = gh_int2scm (*i->access_content_int (false));
446 if (r) v = gh_double2scm (*r->access_content_Real (false));
448 THIS->parser_error (_("Wrong type for property value"));
452 Translator_group* tg = dynamic_cast<Translator_group*> ($$);
454 tg->set_property (ly_scm2string ($2), v);
456 | translator_spec_body NAME STRING semicolon {
457 $$->type_str_ = ly_scm2string ($3);
459 | translator_spec_body CONSISTS STRING semicolon {
460 dynamic_cast<Translator_group*> ($$)-> set_element (ly_scm2string ($3), true);
462 | translator_spec_body CONSISTSEND STRING semicolon {
463 dynamic_cast<Translator_group*> ($$)-> set_element (ly_scm2string ($3), true);
465 | translator_spec_body ACCEPTS STRING semicolon {
466 dynamic_cast<Translator_group*> ($$)-> set_acceptor (ly_scm2string ($3), true);
468 | translator_spec_body REMOVE STRING semicolon {
469 dynamic_cast<Translator_group*> ($$)-> set_element (ly_scm2string ($3), false);
479 /*cont*/ '{' score_body '}' {
481 if (!$$->def_p_arr_.size ())
484 THIS->lexer_p_->lookup_identifier ("$defaultpaper");
485 $$->add_output (id ? id->access_content_Paper_def (true) : new Paper_def );
492 $$->set_spot (THIS->here_input ());
495 $$ = $1->access_content_Score (true);
497 | score_body mudela_header {
502 $2->warning (_ ("More than one music block"));
505 | score_body output_def {
527 PAPER '{' paper_def_body '}' {
529 THIS-> lexer_p_->scope_l_arr_.pop ();
536 Identifier *id = THIS->lexer_p_->lookup_identifier ("$defaultpaper");
537 Paper_def *p = id ? id->access_content_Paper_def (true) : new Paper_def;
538 THIS-> lexer_p_-> scope_l_arr_.push (p->scope_p_);
542 Paper_def *p = $1->access_content_Paper_def (true);
543 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
546 | paper_def_body int '=' FONT STRING { // ugh, what a syntax
547 Lookup * l = new Lookup;
548 l->font_name_ = ly_scm2string ($5);
549 $$->set_lookup ($2, l);
551 | paper_def_body assignment semicolon {
554 | paper_def_body SCM_T '=' SCM_T {
555 if (!gh_symbol_p ($2))
556 THIS->parser_error ("expect a symbol as lvalue");
558 $$->default_properties_.set ($2, $4);
560 | paper_def_body SCM_T '=' real semicolon {
561 if (!gh_symbol_p ($2))
562 THIS->parser_error ("expect a symbol as lvalue");
564 $$->default_properties_.set ($2, gh_double2scm ($4));
566 | paper_def_body translator_spec_block {
567 $$->assign_translator ($2);
569 | paper_def_body error {
598 | real_with_dimension
600 $$= *$1->access_content_Real (false);
602 | '-' real %prec UNARY_MINUS {
629 THIS-> lexer_p_-> scope_l_arr_.pop();
633 midi_body: /* empty */ {
634 Identifier *id = THIS->lexer_p_->lookup_identifier ("$defaultmidi");
636 ? id->access_content_Midi_def (true) : new Midi_def ;
639 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
642 Midi_def * p =$1-> access_content_Midi_def (true);
644 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
646 | midi_body assignment semicolon {
649 | midi_body translator_spec_block {
650 $$-> assign_translator ($2);
652 | midi_body tempo_request semicolon {
654 junk this ? there already is tempo stuff in
657 $$->set_tempo ($2->dur_.length_mom (), $2->metronome_i_);
666 TEMPO steno_duration '=' unsigned {
670 $$-> metronome_i_ = $4;
674 Music_list: /* empty */ {
676 $$->set_spot (THIS->here_input ());
695 | ALTERNATIVE Music_sequence {
697 $2->set_spot (THIS->here_input ());
705 REPEAT STRING unsigned Music Alternative_music
707 Music_sequence* m = dynamic_cast <Music_sequence*> ($5);
708 if (m && $3 < m->length_i ())
709 $5->warning (_ ("More alternatives than repeats. Junking excess alternatives."));
711 Repeated_music * r = new Repeated_music ($4, $3 >? 1, m);
713 r->type_ = ly_scm2string ($2);
714 r->fold_b_ = (r->type_ == "fold");
715 r->volta_fold_b_ = (r->type_ == "volta");
716 r->set_spot ($4->spot ());
720 Music_sequence: '{' Music_list '}' {
721 $$ = new Music_sequence ($2);
722 $$->set_spot ($2->spot ());
727 SEQUENTIAL '{' Music_list '}' {
728 $$ = new Sequential_music ($3);
729 $$->set_spot ($3->spot ());
731 | '{' Music_list '}' {
732 $$ = new Sequential_music ($2);
733 $$->set_spot ($2->spot ());
738 SIMULTANEOUS '{' Music_list '}'{
739 $$ = new Simultaneous_music ($3);
740 $$->set_spot ($3->spot ());
742 | '<' Music_list '>' {
743 $$ = new Simultaneous_music ($2);
744 $$->set_spot ($2->spot ());
749 request_chord { $$ = $1; }
750 | OUTPUTPROPERTY embedded_scm embedded_scm '=' embedded_scm {
752 if (!gh_symbol_p ($3))
754 THIS->parser_error (_("Second argument must be a symbol"));
756 /*hould check # args */
757 if (!gh_procedure_p (pred))
759 THIS->parser_error (_("First argument must be a procedure taking 1 argument"));
762 $$ = new Output_property (pred,$3, $5);
764 | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); }
767 | Simple_music '*' unsigned '/' unsigned {
769 $$->compress (Moment($3, $5 ));
771 | Simple_music '*' unsigned {
773 $$->compress (Moment ($3, 1));
779 CONTEXT STRING Music {
780 Context_specced_music *csm = new Context_specced_music ($3);
782 csm->translator_type_str_ = ly_scm2string ($2);
783 csm->translator_id_str_ = "";
788 | AUTOCHANGE STRING Music {
789 Auto_change_music * chm = new Auto_change_music (ly_scm2string ($2), $3);
792 chm->set_spot ($3->spot ());
795 $$ = new Grace_music ($2);
797 | CONTEXT STRING '=' STRING Music {
798 Context_specced_music *csm = new Context_specced_music ($5);
800 csm->translator_type_str_ = ly_scm2string ($2);
801 csm->translator_id_str_ = ly_scm2string ($4);
806 THIS->remember_spot ();
809 unsigned '/' unsigned Music
812 $$ = new Time_scaled_music ($3, $5, $6);
813 $$->set_spot (THIS->pop_spot ());
815 | Repeated_music { $$ = $1; }
816 | Simultaneous_music { $$ = $1; }
817 | Sequential_music { $$ = $1; }
818 | TRANSPOSE musical_pitch Music {
819 $$ = new Transposed_music ($3, *$2);
822 | TRANSPOSE steno_tonic_pitch Music {
823 $$ = new Transposed_music ($3, *$2);
827 { THIS->lexer_p_->push_note_state (); }
830 THIS->lexer_p_->pop_state ();
833 { THIS->lexer_p_->push_chord_state (); }
837 THIS->lexer_p_->pop_state ();
840 { THIS->lexer_p_->push_lyric_state (); }
844 THIS->lexer_p_->pop_state ();
846 | relative_music { $$ = $1; }
847 | re_rhythmed_music { $$ = $1; }
851 RELATIVE absolute_musical_pitch Music {
852 $$ = new Relative_octave_music ($3, *$2);
858 ADDLYRICS Music Music {
859 Lyric_combine_music * l = new Lyric_combine_music ($2, $3);
865 TRANSLATOR STRING '=' STRING {
866 Change_translator * t = new Change_translator;
867 t-> change_to_type_str_ = ly_scm2string ($2);
868 t-> change_to_id_str_ = ly_scm2string ($4);
871 $$->set_spot (THIS->here_input ());
876 PROPERTY STRING '.' STRING '=' scalar {
877 Translation_property *t = new Translation_property;
879 t->var_str_ = ly_scm2string ($4);
882 Context_specced_music *csm = new Context_specced_music (t);
884 $$->set_spot (THIS->here_input ());
886 csm-> translator_type_str_ = ly_scm2string ($2);
892 | int { $$ = gh_int2scm ($1); }
893 | embedded_scm { $$ = $1; }
898 pre_requests simple_element post_requests {
899 Music_sequence *l = dynamic_cast<Music_sequence*>($2);
901 for (int i=0; i < $1->size(); i++)
902 l->add_music ($1->elem(i));
903 for (int i=0; i < $3->size(); i++)
904 l->add_music ($3->elem(i));
907 programming_error ("Need Sequence to add music to");
916 $$ = new Request_chord;
917 $$-> set_spot (THIS->here_input ());
918 $1-> set_spot (THIS->here_input ());
919 ((Simultaneous_music*)$$) ->add_music ($1);//ugh
921 | PARTIAL duration_length ';' {
922 Translation_property * p = new Translation_property;
923 p->var_str_ = "measurePosition";
924 p->value_ = (new Moment (-$2->length_mom ()))->smobify_self ();
926 Context_specced_music * sp = new Context_specced_music (p);
928 sp-> translator_type_str_ = "Score";
933 shorthand_command_req
934 | verbose_command_req semicolon { $$ = $1; }
937 shorthand_command_req:
945 $$ = new Barcheck_req;
951 Span_req*b= new Span_req;
952 b->span_dir_ = START;
953 b->span_type_str_ = "beam";
957 Span_req*b= new Span_req;
959 b->span_type_str_ = "beam";
963 $$ = new Breathing_sign_req;
971 $$ = new Bar_req (ly_scm2string ($2));
973 | COMMANDSPANREQUEST int STRING {
974 Span_req * sp_p = new Span_req;
975 sp_p-> span_dir_ = Direction($2);
976 sp_p->span_type_str_ = ly_scm2string ($3);
977 sp_p->set_spot (THIS->here_input ());
981 Mark_req * m = new Mark_req;
985 Mark_req *m = new Mark_req;
991 Mark_req *m = new Mark_req;
992 m->mark_label_ = gh_int2scm ($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;
1018 $$ = new Clef_change_req (ly_scm2string ($2));
1022 Key_change_req *key_p= new Key_change_req;
1026 /* UGH. optional. */
1028 | KEY NOTENAME_PITCH optional_modality {
1029 Key_change_req *key_p= new Key_change_req;
1031 d.pitch_arr_.push (*$2);
1032 d.ordinary_key_b_ = true;
1035 key_p->key_ = new Key_def (d);
1039 | KEYSIGNATURE pitch_list {
1040 Key_change_req *key_p= new Key_change_req;
1043 d.ordinary_key_b_ = false;
1045 key_p->key_ = new Key_def(d);
1053 $$ = new Link_array<Request>;
1055 | post_requests post_request {
1056 $2->set_spot (THIS->here_input ());
1068 request_that_take_dir:
1071 | script_abbreviation {
1072 Identifier*i = THIS->lexer_p_->lookup_identifier ("dash-" + ly_scm2string ($1));
1073 Articulation_req *a = new Articulation_req;
1074 a->articulation_str_ = *i->access_content_String (false);
1080 script_dir request_that_take_dir {
1081 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1082 gs->dir_ = Direction ($1);
1084 $2->warning (_ ("Can't specify direction for this request"));
1090 REQUEST_IDENTIFIER {
1091 $$ = (Request*)$1->access_content_Request (true);
1092 $$->set_spot (THIS->here_input ());
1094 | TEXTSCRIPT STRING STRING {
1095 Text_script_req *ts_p = new Text_script_req;
1096 ts_p-> text_str_ = ly_scm2string ($2);
1097 ts_p-> style_str_ = ly_scm2string ($3);
1098 ts_p->set_spot (THIS->here_input ());
1102 | SPANREQUEST int STRING {
1103 Span_req * sp_p = new Span_req;
1104 sp_p-> span_dir_ = Direction($2);
1105 sp_p->span_type_str_ = ly_scm2string ($3);
1106 sp_p->set_spot (THIS->here_input ());
1110 Tremolo_req* a = new Tremolo_req;
1111 a->set_spot (THIS->here_input ());
1116 Articulation_req * a = new Articulation_req;
1117 a->articulation_str_ = ly_scm2string ($2);
1118 a->set_spot (THIS->here_input ());
1150 steno_musical_pitch:
1154 | NOTENAME_PITCH sup_quotes {
1156 $$->octave_i_ += $2;
1158 | NOTENAME_PITCH sub_quotes {
1160 $$->octave_i_ += - $2;
1168 | TONICNAME_PITCH sup_quotes {
1170 $$->octave_i_ += $2;
1172 | TONICNAME_PITCH sub_quotes {
1174 $$->octave_i_ += - $2;
1179 steno_musical_pitch {
1182 | MUSICAL_PITCH embedded_scm {
1183 int sz = scm_ilength ($2);
1185 THIS->parser_error (_f ("Expecting %d arguments", 3));
1186 $2 = gh_list (gh_int2scm (0), gh_int2scm (0), gh_int2scm (0), SCM_UNDEFINED);
1188 $$ = new Musical_pitch ($2);
1193 DURATION '{' int_list '}' {
1195 Array<int> &a = *$3;
1198 $$-> durlog_i_ = a[0];
1199 $$-> dots_i_ = a[1];
1207 if (!THIS->lexer_p_->lyric_state_b ())
1208 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1209 $$ = new Extender_req;
1215 if (!THIS->lexer_p_->lyric_state_b ())
1216 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1217 $$ = new Hyphen_req;
1222 close_request_parens {
1224 dynamic_cast<Span_req*> ($$)->span_dir_ = START;
1227 close_request_parens:
1229 Span_req* s= new Span_req;
1231 s->span_type_str_ = "slur";
1234 Span_req*s =new Span_req;
1236 s->span_type_str_ = "crescendo";
1239 Span_req*s =new Span_req;
1241 s->span_type_str_ = "decrescendo";
1247 open_request_parens {
1249 dynamic_cast<Span_req*> ($$)->span_dir_ = STOP;
1253 open_request_parens:
1255 Span_req *s = new Span_req;
1256 s->span_type_str_ = "crescendo";
1260 Span_req* s= new Span_req;
1262 s->span_type_str_ = "slur";
1268 Text_script_req *t = new Text_script_req;
1270 t->text_str_ = ly_scm2string ($1);
1272 $$->set_spot (THIS->here_input ());
1275 Text_script_req* t = new Text_script_req;
1277 t->text_str_ = to_str ($1);
1278 t->style_str_ = "finger";
1279 $$->set_spot (THIS->here_input ());
1283 script_abbreviation:
1285 $$ = gh_str02scm ("hat");
1288 $$ = gh_str02scm("plus");
1291 $$ = gh_str02scm ("dash");
1294 $$ = gh_str02scm ("bar");
1297 $$ = gh_str02scm ("larger");
1300 $$ = gh_str02scm ("dot");
1308 | '-' { $$ = CENTER; }
1313 $$ = new Link_array<Request>;
1315 | pre_requests open_request {
1320 absolute_musical_pitch:
1321 steno_musical_pitch {
1330 | duration_length '*' unsigned {
1331 $$->tuplet_iso_i_ *= $3;
1333 | duration_length '/' unsigned {
1334 $$->tuplet_type_i_ *= $3;
1338 entered_notemode_duration:
1340 THIS->set_last_duration ($1);
1344 optional_notemode_duration:
1346 $$ = new Duration (THIS->default_duration_);
1348 | entered_notemode_duration {
1356 if (!is_duration_b ($1))
1357 THIS->parser_error (_f ("not a duration: %d", $1));
1359 $$->durlog_i_ = intlog2 ($1);
1362 | DURATION_IDENTIFIER {
1363 $$ = $1->access_content_Duration (true);
1365 | steno_duration '.' {
1376 if (!is_duration_b ($2))
1377 THIS->parser_error (_f ("not a duration: %d", $2));
1384 musical_pitch exclamations questions optional_notemode_duration {
1385 if (!THIS->lexer_p_->note_state_b ())
1386 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1389 Note_req *n = new Note_req;
1394 n->cautionary_b_ = $3 % 2;
1395 n->forceacc_b_ = $2 % 2 || n->cautionary_b_;
1397 Simultaneous_music*v = new Request_chord;
1398 v->set_spot ($1->spot ());
1399 n->set_spot ($1->spot ());
1409 | RESTNAME optional_notemode_duration {
1410 Simultaneous_music* velt_p = new Request_chord;
1411 velt_p->set_spot (THIS->here_input());
1413 if (ly_scm2string ($1) =="s")
1415 Skip_req * skip_p = new Skip_req;
1416 skip_p->duration_ = *$2;
1418 skip_p->set_spot (THIS->here_input());
1419 velt_p->add_music (skip_p);
1423 Rest_req * rest_req_p = new Rest_req;
1424 rest_req_p->duration_ = *$2;
1425 rest_req_p->set_spot (THIS->here_input());
1427 velt_p->add_music (rest_req_p);
1433 | MEASURES optional_notemode_duration {
1434 Skip_req * sk = new Skip_req;
1435 sk->duration_ = *$2;
1436 Music_list * ms = new Music_list;
1437 Request_chord * rqc1 = new Request_chord;
1438 Request_chord * rqc2 = new Request_chord;
1439 Request_chord * rqc3 = new Request_chord;
1441 Span_req *sp1 = new Span_req;
1442 Span_req *sp2 = new Span_req;
1443 sp1-> span_dir_ = START;
1444 sp2-> span_dir_ = STOP;
1445 sp1->span_type_str_ = sp2->span_type_str_ = "rest";
1446 rqc1->add_music (sp1);
1447 rqc2->add_music (sk);
1448 rqc3->add_music (sp2);
1450 ms->add_music (rqc1);
1451 ms->add_music (rqc2);
1452 ms->add_music (rqc3);
1454 $$ = new Sequential_music (ms);
1456 | STRING optional_notemode_duration {
1457 if (!THIS->lexer_p_->lyric_state_b ())
1458 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1459 Simultaneous_music* velt_p = new Request_chord;
1461 Lyric_req* lreq_p = new Lyric_req;
1462 lreq_p ->text_str_ = ly_scm2string ($1);
1463 lreq_p->duration_ = *$2;
1464 lreq_p->set_spot (THIS->here_input());
1466 velt_p->add_music (lreq_p);
1473 if (!THIS->lexer_p_->chord_state_b ())
1474 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1480 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
1481 $$ = THIS->get_chord (*$1, $3, $4, $5, $6, *$2);
1486 $$ = new Array<Musical_pitch>;
1488 | CHORD_COLON chord_notes {
1497 | chord_notes '.' chord_step {
1505 $$ = new Array<Musical_pitch>;
1507 | CHORD_CARET chord_notes {
1517 | '/' steno_tonic_pitch {
1519 $$->set_spot (THIS->here_input ());
1527 | CHORD_BASS steno_tonic_pitch {
1529 $$->set_spot (THIS->here_input ());
1535 $$ = new Array<Musical_pitch>;
1538 | CHORDMODIFIER_PITCH {
1539 $$ = new Array<Musical_pitch>;
1542 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
1543 $$ = new Array<Musical_pitch>;
1551 $$ = new Musical_pitch;
1552 $$->notename_i_ = ($1 - 1) % 7;
1553 $$->octave_i_ = $1 > 7 ? 1 : 0;
1554 $$->accidental_i_ = 0;
1557 $$ = new Musical_pitch;
1558 $$->notename_i_ = ($1 - 1) % 7;
1559 $$->octave_i_ = $1 > 7 ? 1 : 0;
1560 $$->accidental_i_ = 1;
1562 | unsigned CHORD_MINUS {
1563 $$ = new Musical_pitch;
1564 $$->notename_i_ = ($1 - 1) % 7;
1565 $$->octave_i_ = $1 > 7 ? 1 : 0;
1566 $$->accidental_i_ = -1;
1574 $$ = new Array<Musical_pitch>;
1576 | pitch_list musical_pitch {
1609 $$ = *$1->access_content_int (false);
1618 | STRING_IDENTIFIER {
1619 $$ = ly_str02scm ($1->access_content_String (true)->ch_C ());
1621 | string '+' string {
1622 $$ = scm_string_append (scm_listify ($1, $3, SCM_UNDEFINED));
1629 | exclamations '!' { $$ ++; }
1634 | questions '?' { $$ ++; }
1644 My_lily_parser::set_yydebug (bool b)
1651 My_lily_parser::do_yyparse ()
1653 yyparse ((void*)this);