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 );
493 $$->set_spot (THIS->here_input ());
497 $$ = $1->access_content_Score (true);
499 | score_body mudela_header {
502 | score_body output_def {
524 PAPER '{' paper_def_body '}' {
526 THIS-> lexer_p_->scope_l_arr_.pop ();
533 Identifier *id = THIS->lexer_p_->lookup_identifier ("$defaultpaper");
534 Paper_def *p = id ? id->access_content_Paper_def (true) : new Paper_def;
535 THIS-> lexer_p_-> scope_l_arr_.push (p->scope_p_);
539 Paper_def *p = $1->access_content_Paper_def (true);
540 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
543 | paper_def_body int '=' FONT STRING { // ugh, what a syntax
544 Lookup * l = new Lookup;
545 l->font_name_ = ly_scm2string ($5);
546 $$->set_lookup ($2, l);
548 | paper_def_body assignment semicolon {
551 | paper_def_body SCM_T '=' SCM_T {
552 if (!gh_symbol_p ($2))
553 THIS->parser_error ("expect a symbol as lvalue");
555 $$->default_properties_.set ($2, $4);
557 | paper_def_body SCM_T '=' real semicolon {
558 if (!gh_symbol_p ($2))
559 THIS->parser_error ("expect a symbol as lvalue");
561 $$->default_properties_.set ($2, gh_double2scm ($4));
563 | paper_def_body translator_spec_block {
564 $$->assign_translator ($2);
566 | paper_def_body error {
595 | real_with_dimension
597 $$= *$1->access_content_Real (false);
599 | '-' real %prec UNARY_MINUS {
626 THIS-> lexer_p_-> scope_l_arr_.pop();
630 midi_body: /* empty */ {
631 Identifier *id = THIS->lexer_p_->lookup_identifier ("$defaultmidi");
633 ? id->access_content_Midi_def (true) : new Midi_def ;
636 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
639 Midi_def * p =$1-> access_content_Midi_def (true);
641 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
643 | midi_body assignment semicolon {
646 | midi_body translator_spec_block {
647 $$-> assign_translator ($2);
649 | midi_body tempo_request semicolon {
651 junk this ? there already is tempo stuff in
654 $$->set_tempo ($2->dur_.length_mom (), $2->metronome_i_);
663 TEMPO steno_duration '=' unsigned {
667 $$-> metronome_i_ = $4;
671 Music_list: /* empty */ {
673 $$->set_spot (THIS->here_input ());
692 | ALTERNATIVE Music_sequence {
694 $2->set_spot (THIS->here_input ());
702 REPEAT STRING unsigned Music Alternative_music
704 Music_sequence* m = dynamic_cast <Music_sequence*> ($5);
705 if (m && $3 < m->length_i ())
706 $5->warning (_ ("More alternatives than repeats. Junking excess alternatives."));
708 Repeated_music * r = new Repeated_music ($4, $3 >? 1, m);
710 r->type_ = ly_scm2string ($2);
711 r->fold_b_ = (r->type_ == "fold");
712 r->volta_fold_b_ = (r->type_ == "volta");
713 r->set_spot ($4->spot ());
717 Music_sequence: '{' Music_list '}' {
718 $$ = new Music_sequence ($2);
719 $$->set_spot ($2->spot ());
724 SEQUENTIAL '{' Music_list '}' {
725 $$ = new Sequential_music ($3);
726 $$->set_spot ($3->spot ());
728 | '{' Music_list '}' {
729 $$ = new Sequential_music ($2);
730 $$->set_spot ($2->spot ());
735 SIMULTANEOUS '{' Music_list '}'{
736 $$ = new Simultaneous_music ($3);
737 $$->set_spot ($3->spot ());
739 | '<' Music_list '>' {
740 $$ = new Simultaneous_music ($2);
741 $$->set_spot ($2->spot ());
746 request_chord { $$ = $1; }
747 | OUTPUTPROPERTY embedded_scm embedded_scm '=' embedded_scm {
749 if (!gh_symbol_p ($3))
751 THIS->parser_error (_("Second argument must be a symbol"));
753 /*hould check # args */
754 if (!gh_procedure_p (pred))
756 THIS->parser_error (_("First argument must be a procedure taking 1 argument"));
759 $$ = new Output_property (pred,$3, $5);
761 | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); }
764 | Simple_music '*' unsigned '/' unsigned {
766 $$->compress (Moment($3, $5 ));
768 | Simple_music '*' unsigned {
770 $$->compress (Moment ($3, 1));
776 CONTEXT STRING Music {
777 Context_specced_music *csm = new Context_specced_music ($3);
779 csm->translator_type_str_ = ly_scm2string ($2);
780 csm->translator_id_str_ = "";
785 | AUTOCHANGE STRING Music {
786 Auto_change_music * chm = new Auto_change_music (ly_scm2string ($2), $3);
789 chm->set_spot ($3->spot ());
792 $$ = new Grace_music ($2);
794 | CONTEXT STRING '=' STRING Music {
795 Context_specced_music *csm = new Context_specced_music ($5);
797 csm->translator_type_str_ = ly_scm2string ($2);
798 csm->translator_id_str_ = ly_scm2string ($4);
803 THIS->remember_spot ();
806 unsigned '/' unsigned Music
809 $$ = new Time_scaled_music ($3, $5, $6);
810 $$->set_spot (THIS->pop_spot ());
812 | Repeated_music { $$ = $1; }
813 | Simultaneous_music { $$ = $1; }
814 | Sequential_music { $$ = $1; }
815 | TRANSPOSE musical_pitch Music {
816 $$ = new Transposed_music ($3, *$2);
819 | TRANSPOSE steno_tonic_pitch Music {
820 $$ = new Transposed_music ($3, *$2);
824 { THIS->lexer_p_->push_note_state (); }
827 THIS->lexer_p_->pop_state ();
830 { THIS->lexer_p_->push_chord_state (); }
834 THIS->lexer_p_->pop_state ();
837 { THIS->lexer_p_->push_lyric_state (); }
841 THIS->lexer_p_->pop_state ();
843 | relative_music { $$ = $1; }
844 | re_rhythmed_music { $$ = $1; }
848 RELATIVE absolute_musical_pitch Music {
849 $$ = new Relative_octave_music ($3, *$2);
855 ADDLYRICS Music Music {
856 Lyric_combine_music * l = new Lyric_combine_music ($2, $3);
862 TRANSLATOR STRING '=' STRING {
863 Change_translator * t = new Change_translator;
864 t-> change_to_type_str_ = ly_scm2string ($2);
865 t-> change_to_id_str_ = ly_scm2string ($4);
868 $$->set_spot (THIS->here_input ());
873 PROPERTY STRING '.' STRING '=' scalar {
874 Translation_property *t = new Translation_property;
876 t->var_str_ = ly_scm2string ($4);
879 Context_specced_music *csm = new Context_specced_music (t);
881 $$->set_spot (THIS->here_input ());
883 csm-> translator_type_str_ = ly_scm2string ($2);
889 | int { $$ = gh_int2scm ($1); }
890 | embedded_scm { $$ = $1; }
895 pre_requests simple_element post_requests {
896 Music_sequence *l = dynamic_cast<Music_sequence*>($2);
898 for (int i=0; i < $1->size(); i++)
899 l->add_music ($1->elem(i));
900 for (int i=0; i < $3->size(); i++)
901 l->add_music ($3->elem(i));
904 programming_error ("Need Sequence to add music to");
913 $$ = new Request_chord;
914 $$-> set_spot (THIS->here_input ());
915 $1-> set_spot (THIS->here_input ());
916 ((Simultaneous_music*)$$) ->add_music ($1);//ugh
918 | PARTIAL duration_length ';' {
919 Translation_property * p = new Translation_property;
920 p->var_str_ = "measurePosition";
921 p->value_ = (new Moment (-$2->length_mom ()))->smobify_self ();
923 Context_specced_music * sp = new Context_specced_music (p);
925 sp-> translator_type_str_ = "Score";
930 shorthand_command_req
931 | verbose_command_req semicolon { $$ = $1; }
934 shorthand_command_req:
942 $$ = new Barcheck_req;
948 Span_req*b= new Span_req;
949 b->span_dir_ = START;
950 b->span_type_str_ = "beam";
954 Span_req*b= new Span_req;
956 b->span_type_str_ = "beam";
960 $$ = new Breathing_sign_req;
968 $$ = new Bar_req (ly_scm2string ($2));
970 | COMMANDSPANREQUEST int STRING {
971 Span_req * sp_p = new Span_req;
972 sp_p-> span_dir_ = Direction($2);
973 sp_p->span_type_str_ = ly_scm2string ($3);
974 sp_p->set_spot (THIS->here_input ());
978 Mark_req * m = new Mark_req;
982 Mark_req *m = new Mark_req;
988 Mark_req *m = new Mark_req;
989 m->mark_label_ = gh_int2scm ($2);
993 | TIME_T unsigned '/' unsigned {
994 Time_signature_change_req *m = new Time_signature_change_req;
1000 Break_req * b = new Break_req;
1001 b->penalty_f_ = $2 / 100.0;
1002 b->set_spot (THIS->here_input ());
1005 | SKIP duration_length {
1006 Skip_req * skip_p = new Skip_req;
1007 skip_p->duration_ = *$2;
1015 $$ = new Clef_change_req (ly_scm2string ($2));
1019 Key_change_req *key_p= new Key_change_req;
1023 /* UGH. optional. */
1025 | KEY NOTENAME_PITCH optional_modality {
1026 Key_change_req *key_p= new Key_change_req;
1028 d.pitch_arr_.push (*$2);
1029 d.ordinary_key_b_ = true;
1032 key_p->key_ = new Key_def (d);
1036 | KEYSIGNATURE pitch_list {
1037 Key_change_req *key_p= new Key_change_req;
1040 d.ordinary_key_b_ = false;
1042 key_p->key_ = new Key_def(d);
1050 $$ = new Link_array<Request>;
1052 | post_requests post_request {
1053 $2->set_spot (THIS->here_input ());
1065 request_that_take_dir:
1068 | script_abbreviation {
1069 Identifier*i = THIS->lexer_p_->lookup_identifier ("dash-" + ly_scm2string ($1));
1070 Articulation_req *a = new Articulation_req;
1071 a->articulation_str_ = *i->access_content_String (false);
1077 script_dir request_that_take_dir {
1078 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1079 gs->dir_ = Direction ($1);
1081 $2->warning (_ ("Can't specify direction for this request"));
1087 REQUEST_IDENTIFIER {
1088 $$ = (Request*)$1->access_content_Request (true);
1089 $$->set_spot (THIS->here_input ());
1091 | TEXTSCRIPT STRING STRING {
1092 Text_script_req *ts_p = new Text_script_req;
1093 ts_p-> text_str_ = ly_scm2string ($2);
1094 ts_p-> style_str_ = ly_scm2string ($3);
1095 ts_p->set_spot (THIS->here_input ());
1099 | SPANREQUEST int STRING {
1100 Span_req * sp_p = new Span_req;
1101 sp_p-> span_dir_ = Direction($2);
1102 sp_p->span_type_str_ = ly_scm2string ($3);
1103 sp_p->set_spot (THIS->here_input ());
1107 Tremolo_req* a = new Tremolo_req;
1108 a->set_spot (THIS->here_input ());
1113 Articulation_req * a = new Articulation_req;
1114 a->articulation_str_ = ly_scm2string ($2);
1115 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;
1176 steno_musical_pitch {
1179 | MUSICAL_PITCH embedded_scm {
1180 int sz = scm_ilength ($2);
1182 THIS->parser_error (_f ("Expecting %d arguments", 3));
1183 $2 = gh_list (gh_int2scm (0), gh_int2scm (0), gh_int2scm (0), SCM_UNDEFINED);
1185 $$ = new Musical_pitch ($2);
1190 DURATION '{' int_list '}' {
1192 Array<int> &a = *$3;
1195 $$-> durlog_i_ = a[0];
1196 $$-> dots_i_ = a[1];
1204 if (!THIS->lexer_p_->lyric_state_b ())
1205 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1206 $$ = new Extender_req;
1212 if (!THIS->lexer_p_->lyric_state_b ())
1213 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1214 $$ = new Hyphen_req;
1219 close_request_parens {
1221 dynamic_cast<Span_req*> ($$)->span_dir_ = START;
1224 close_request_parens:
1226 Span_req* s= new Span_req;
1228 s->span_type_str_ = "slur";
1231 Span_req*s =new Span_req;
1233 s->span_type_str_ = "crescendo";
1236 Span_req*s =new Span_req;
1238 s->span_type_str_ = "decrescendo";
1244 open_request_parens {
1246 dynamic_cast<Span_req*> ($$)->span_dir_ = STOP;
1250 open_request_parens:
1252 Span_req *s = new Span_req;
1253 s->span_type_str_ = "crescendo";
1257 Span_req* s= new Span_req;
1259 s->span_type_str_ = "slur";
1265 Text_script_req *t = new Text_script_req;
1267 t->text_str_ = ly_scm2string ($1);
1269 $$->set_spot (THIS->here_input ());
1272 Text_script_req* t = new Text_script_req;
1274 t->text_str_ = to_str ($1);
1275 t->style_str_ = "finger";
1276 $$->set_spot (THIS->here_input ());
1280 script_abbreviation:
1282 $$ = gh_str02scm ("hat");
1285 $$ = gh_str02scm("plus");
1288 $$ = gh_str02scm ("dash");
1291 $$ = gh_str02scm ("bar");
1294 $$ = gh_str02scm ("larger");
1297 $$ = gh_str02scm ("dot");
1305 | '-' { $$ = CENTER; }
1310 $$ = new Link_array<Request>;
1312 | pre_requests open_request {
1317 absolute_musical_pitch:
1318 steno_musical_pitch {
1327 | duration_length '*' unsigned {
1328 $$->tuplet_iso_i_ *= $3;
1330 | duration_length '/' unsigned {
1331 $$->tuplet_type_i_ *= $3;
1335 entered_notemode_duration:
1337 THIS->set_last_duration ($1);
1341 optional_notemode_duration:
1343 $$ = new Duration (THIS->default_duration_);
1345 | entered_notemode_duration {
1353 if (!is_duration_b ($1))
1354 THIS->parser_error (_f ("not a duration: %d", $1));
1356 $$->durlog_i_ = intlog2 ($1);
1359 | DURATION_IDENTIFIER {
1360 $$ = $1->access_content_Duration (true);
1362 | steno_duration '.' {
1373 if (!is_duration_b ($2))
1374 THIS->parser_error (_f ("not a duration: %d", $2));
1381 musical_pitch exclamations questions optional_notemode_duration {
1382 if (!THIS->lexer_p_->note_state_b ())
1383 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1386 Note_req *n = new Note_req;
1391 n->cautionary_b_ = $3 % 2;
1392 n->forceacc_b_ = $2 % 2 || n->cautionary_b_;
1394 Simultaneous_music*v = new Request_chord;
1395 v->set_spot ($1->spot ());
1396 n->set_spot ($1->spot ());
1406 | RESTNAME optional_notemode_duration {
1407 Simultaneous_music* velt_p = new Request_chord;
1408 velt_p->set_spot (THIS->here_input());
1410 if (ly_scm2string ($1) =="s")
1412 Skip_req * skip_p = new Skip_req;
1413 skip_p->duration_ = *$2;
1415 skip_p->set_spot (THIS->here_input());
1416 velt_p->add_music (skip_p);
1420 Rest_req * rest_req_p = new Rest_req;
1421 rest_req_p->duration_ = *$2;
1422 rest_req_p->set_spot (THIS->here_input());
1424 velt_p->add_music (rest_req_p);
1430 | MEASURES optional_notemode_duration {
1431 Skip_req * sk = new Skip_req;
1432 sk->duration_ = *$2;
1433 Music_list * ms = new Music_list;
1434 Request_chord * rqc1 = new Request_chord;
1435 Request_chord * rqc2 = new Request_chord;
1436 Request_chord * rqc3 = new Request_chord;
1438 Span_req *sp1 = new Span_req;
1439 Span_req *sp2 = new Span_req;
1440 sp1-> span_dir_ = START;
1441 sp2-> span_dir_ = STOP;
1442 sp1->span_type_str_ = sp2->span_type_str_ = "rest";
1443 rqc1->add_music (sp1);
1444 rqc2->add_music (sk);
1445 rqc3->add_music (sp2);
1447 ms->add_music (rqc1);
1448 ms->add_music (rqc2);
1449 ms->add_music (rqc3);
1451 $$ = new Sequential_music (ms);
1453 | STRING optional_notemode_duration {
1454 if (!THIS->lexer_p_->lyric_state_b ())
1455 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1456 Simultaneous_music* velt_p = new Request_chord;
1458 Lyric_req* lreq_p = new Lyric_req;
1459 lreq_p ->text_str_ = ly_scm2string ($1);
1460 lreq_p->duration_ = *$2;
1461 lreq_p->set_spot (THIS->here_input());
1463 velt_p->add_music (lreq_p);
1470 if (!THIS->lexer_p_->chord_state_b ())
1471 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1477 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
1478 $$ = THIS->get_chord (*$1, $3, $4, $5, $6, *$2);
1483 $$ = new Array<Musical_pitch>;
1485 | CHORD_COLON chord_notes {
1494 | chord_notes '.' chord_step {
1502 $$ = new Array<Musical_pitch>;
1504 | CHORD_CARET chord_notes {
1514 | '/' steno_tonic_pitch {
1516 $$->set_spot (THIS->here_input ());
1524 | CHORD_BASS steno_tonic_pitch {
1526 $$->set_spot (THIS->here_input ());
1532 $$ = new Array<Musical_pitch>;
1535 | CHORDMODIFIER_PITCH {
1536 $$ = new Array<Musical_pitch>;
1539 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
1540 $$ = new Array<Musical_pitch>;
1548 $$ = new Musical_pitch;
1549 $$->notename_i_ = ($1 - 1) % 7;
1550 $$->octave_i_ = $1 > 7 ? 1 : 0;
1551 $$->accidental_i_ = 0;
1554 $$ = new Musical_pitch;
1555 $$->notename_i_ = ($1 - 1) % 7;
1556 $$->octave_i_ = $1 > 7 ? 1 : 0;
1557 $$->accidental_i_ = 1;
1559 | unsigned CHORD_MINUS {
1560 $$ = new Musical_pitch;
1561 $$->notename_i_ = ($1 - 1) % 7;
1562 $$->octave_i_ = $1 > 7 ? 1 : 0;
1563 $$->accidental_i_ = -1;
1571 $$ = new Array<Musical_pitch>;
1573 | pitch_list musical_pitch {
1606 $$ = *$1->access_content_int (false);
1615 | STRING_IDENTIFIER {
1616 $$ = ly_str02scm ($1->access_content_String (true)->ch_C ());
1618 | string '+' string {
1619 $$ = scm_string_append (scm_listify ($1, $3, SCM_UNDEFINED));
1626 | exclamations '!' { $$ ++; }
1631 | questions '?' { $$ ++; }
1641 My_lily_parser::set_yydebug (bool b)
1648 My_lily_parser::do_yyparse ()
1650 yyparse ((void*)this);