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"
24 #include "dimensions.hh"
25 #include "identifier.hh"
26 #include "command-request.hh"
27 #include "musical-request.hh"
28 #include "my-lily-parser.hh"
29 #include "context-specced-music.hh"
30 #include "translator-group.hh"
32 #include "music-list.hh"
33 #include "change-translator.hh"
34 #include "file-results.hh"
36 #include "relative-music.hh"
37 #include "lyric-combine-music.hh"
38 #include "transposed-music.hh"
39 #include "time-scaled-music.hh"
40 #include "repeated-music.hh"
41 #include "mudela-version.hh"
42 #include "grace-music.hh"
43 #include "auto-change-music.hh"
44 #include "output-property.hh"
47 Mudela_version oldest_version ("1.3.4");
52 return t == 1 << intlog2(t);
59 print_mudela_versions (ostream &os)
61 os << _f ("Oldest supported input version: %s", oldest_version.str ())
64 // needed for bison.simple's malloc() and free()
71 #define YYERROR_VERBOSE 1
73 #define YYPARSE_PARAM my_lily_parser_l
74 #define YYLEX_PARAM my_lily_parser_l
75 #define THIS ((My_lily_parser *) my_lily_parser_l)
77 #define yyerror THIS->parser_error
78 #define ARRAY_SIZE(a,s) if (a.size () != s) THIS->parser_error (_f ("Expecting %d arguments", s))
84 Array<Musical_pitch> *pitch_arr;
85 Link_array<Request> *reqvec;
87 Notename_table *chordmodifiertab;
92 Music_list *music_list;
97 Music_output_def * outputdef;
98 Musical_pitch * pitch;
101 Notename_table *notenametab;
106 /* We use SCMs to do strings, because it saves us the trouble of
107 deleting them. Let's hope that a stack overflow doesnt trigger a move
108 of the parse stack onto the heap. */
112 Translator_group* trans;
119 yylex (YYSTYPE *s, void * v_l)
121 My_lily_parser *pars_l = (My_lily_parser*) v_l;
122 My_lily_lexer * lex_l = pars_l->lexer_p_;
124 lex_l->lexval_l = (void*) s;
125 return lex_l->yylex ();
133 /* tokens which are not keywords */
140 %token CHORDMODIFIERS
183 %token COMMANDSPANREQUEST
185 %token OUTPUTPROPERTY
194 %token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER
195 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET
197 %type <i> exclamations questions
199 %token <pitch> NOTENAME_PITCH
200 %token <pitch> TONICNAME_PITCH
201 %token <pitch> CHORDMODIFIER_PITCH
202 %token <id> DURATION_IDENTIFIER
203 %token <id> IDENTIFIER
204 %token <id> NOTENAME_TABLE_IDENTIFIER
205 %token <id> MUSIC_IDENTIFIER
206 %token <id> REQUEST_IDENTIFIER
207 %token <id> REAL_IDENTIFIER
208 %token <id> STRING_IDENTIFIER
209 %token <id> TRANS_IDENTIFIER
210 %token <id> INT_IDENTIFIER
211 %token <id> SCORE_IDENTIFIER
212 %token <id> MIDI_IDENTIFIER
213 %token <id> PAPER_IDENTIFIER
215 %token <scm> DURATION RESTNAME
221 %type <outputdef> output_def
222 %type <scope> mudela_header mudela_header_body
223 %type <request> open_request_parens close_request_parens open_request close_request
224 %type <request> request_with_dir request_that_take_dir verbose_request
225 %type <i> sub_quotes sup_quotes
226 %type <music> simple_element request_chord command_element Simple_music Composite_music
227 %type <music> Alternative_music Repeated_music
228 %type <i> abbrev_type
229 %type <i> int unsigned
231 %type <i> optional_modality
232 %type <id> identifier_init
233 %type <duration> steno_duration optional_notemode_duration
234 %type <duration> entered_notemode_duration explicit_duration
235 %type <intvec> int_list
236 %type <reqvec> pre_requests post_requests
237 %type <request> gen_text_def
238 %type <pitch> explicit_musical_pitch steno_musical_pitch musical_pitch absolute_musical_pitch
239 %type <pitch> steno_tonic_pitch
241 %type <pitch_arr> pitch_list
243 %type <pitch_arr> chord_additions chord_subtractions chord_notes chord_step
244 %type <pitch> chord_note chord_inversion chord_bass
245 %type <midi> midi_block midi_body
246 %type <duration> duration_length
248 %type <scm> embedded_scm scalar
249 %type <music> Music Sequential_music Simultaneous_music Music_sequence
250 %type <music> relative_music re_rhythmed_music
251 %type <music> property_def translator_change
252 %type <music_list> Music_list
253 %type <paper> paper_block paper_def_body
254 %type <real> real real_with_dimension
255 %type <request> abbrev_command_req
256 %type <request> post_request
257 %type <request> command_req verbose_command_req
258 %type <request> extender_req
259 %type <request> hyphen_req
261 %type <score> score_block score_body
263 %type <scm> script_abbreviation
264 %type <trans> translator_spec_block translator_spec_body
265 %type <tempo> tempo_request
266 %type <notenametab> notenames_body notenames_block chordmodifiers_block
277 | mudela toplevel_expression {}
278 | mudela assignment { }
281 THIS->error_level_i_ =1;
287 THIS->lexer_p_->set_notename_table ($1);
289 | chordmodifiers_block {
290 THIS->lexer_p_->set_chordmodifier_table ($1);
293 delete header_global_p;
294 header_global_p = $1;
297 score_global_array.push ($1);
300 Identifier * id = new
301 Paper_def_identifier ($1, PAPER_IDENTIFIER);
302 THIS->lexer_p_->set_identifier ("$defaultpaper", id)
305 Identifier * id = new
306 Midi_def_identifier ($1, MIDI_IDENTIFIER);
307 THIS->lexer_p_->set_identifier ("$defaultmidi", id)
319 chordmodifiers_block:
320 CHORDMODIFIERS '{' notenames_body '}' { $$ = $3; }
325 NOTENAMES '{' notenames_body '}' { $$ = $3; }
332 $$ = new Notename_table;
334 | NOTENAME_TABLE_IDENTIFIER {
335 $$ = $1-> access_content_Notename_table(true);
337 | notenames_body STRING '=' explicit_musical_pitch {
338 $$->add_note_name (ly_scm2string ($2), $4);
346 THIS->lexer_p_-> scope_l_arr_.push ($$);
348 | mudela_header_body assignment semicolon {
354 HEADER '{' mudela_header_body '}' {
356 THIS->lexer_p_-> scope_l_arr_.pop ();
366 THIS->remember_spot ();
368 /* cont */ '=' identifier_init {
369 THIS->lexer_p_->set_identifier (ly_scm2string ($1), $4);
370 $4->init_b_ = THIS->init_parse_b_;
371 $4->set_spot (THIS->pop_spot ());
379 $$ = new Score_identifier ($1, SCORE_IDENTIFIER);
382 | chordmodifiers_block {
383 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
386 $$ = new Notename_table_identifier ($1, NOTENAME_TABLE_IDENTIFIER);
389 $$ = new Paper_def_identifier ($1, PAPER_IDENTIFIER);
392 $$ = new Midi_def_identifier ($1, MIDI_IDENTIFIER);
395 | translator_spec_block {
396 $$ = new Translator_group_identifier ($1, TRANS_IDENTIFIER);
399 $$ = new Music_identifier ($1, MUSIC_IDENTIFIER);
403 $$ = new Request_identifier ($1, REQUEST_IDENTIFIER);
405 | explicit_duration {
406 $$ = new Duration_identifier ($1, DURATION_IDENTIFIER);
409 $$ = new Real_identifier (new Real ($1), REAL_IDENTIFIER);
412 $$ = new String_identifier (new String (ly_scm2string ($1)), STRING_IDENTIFIER);
415 $$ = new int_identifier (new int ($1), INT_IDENTIFIER);
419 translator_spec_block:
420 TRANSLATOR '{' translator_spec_body '}'
426 translator_spec_body:
428 $$ = $1->access_content_Translator_group (true);
429 $$-> set_spot (THIS->here_input ());
431 | TYPE STRING semicolon {
432 Translator* t = get_translator_l (ly_scm2string ($2));
433 Translator_group * tg = dynamic_cast<Translator_group*> (t);
436 THIS->parser_error (_("Need a translator group for a context"));
438 tg = dynamic_cast<Translator_group*> (t->clone ());
439 tg->set_spot (THIS->here_input ());
442 | translator_spec_body STRING '=' embedded_scm {
443 Translator_group* tg = dynamic_cast<Translator_group*> ($$);
444 tg->set_property (ly_scm2string ($2), $4);
446 | translator_spec_body STRING '=' identifier_init semicolon {
448 String_identifier *s = dynamic_cast<String_identifier*> (id);
449 Real_identifier *r= dynamic_cast<Real_identifier*>(id);
450 int_identifier *i = dynamic_cast<int_identifier*> (id);
453 if (s) v = ly_str02scm (s->access_content_String (false)->ch_C());
454 if (i) v = gh_int2scm (*i->access_content_int (false));
455 if (r) v = gh_double2scm (*r->access_content_Real (false));
457 THIS->parser_error (_("Wrong type for property value"));
461 Translator_group* tg = dynamic_cast<Translator_group*> ($$);
463 tg->set_property (ly_scm2string ($2), v);
465 | translator_spec_body NAME STRING semicolon {
466 $$->type_str_ = ly_scm2string ($3);
468 | translator_spec_body CONSISTS STRING semicolon {
469 dynamic_cast<Translator_group*> ($$)-> set_element (ly_scm2string ($3), true);
471 | translator_spec_body CONSISTSEND STRING semicolon {
472 dynamic_cast<Translator_group*> ($$)-> set_element (ly_scm2string ($3), true);
474 | translator_spec_body ACCEPTS STRING semicolon {
475 dynamic_cast<Translator_group*> ($$)-> set_acceptor (ly_scm2string ($3), true);
477 | translator_spec_body REMOVE STRING semicolon {
478 dynamic_cast<Translator_group*> ($$)-> set_element (ly_scm2string ($3), false);
488 /*cont*/ '{' score_body '}' {
490 if (!$$->def_p_arr_.size ())
491 $$->add_output (THIS->default_paper_p ());
497 $$->set_spot (THIS->here_input ());
500 $$ = $1->access_content_Score (true);
502 | score_body mudela_header {
507 $2->warning (_ ("More than one music block"));
510 | score_body output_def {
532 PAPER '{' paper_def_body '}' {
534 THIS-> lexer_p_->scope_l_arr_.pop ();
541 Paper_def *p = THIS->default_paper_p ();
542 THIS-> lexer_p_-> scope_l_arr_.push (p->scope_p_);
546 Paper_def *p = $1->access_content_Paper_def (true);
547 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
550 | paper_def_body int '=' FONT STRING { // ugh, what a syntax
551 Lookup * l = new Lookup;
552 l->font_name_ = ly_scm2string ($5);
553 $$->set_lookup ($2, l);
555 | paper_def_body assignment semicolon {
558 | paper_def_body SCM_T '=' SCM_T {
559 if (!gh_symbol_p ($2))
560 THIS->parser_error ("expect a symbol as lvalue");
562 $$->default_properties_.set ($2, $4);
564 | paper_def_body SCM_T '=' real semicolon {
565 if (!gh_symbol_p ($2))
566 THIS->parser_error ("expect a symbol as lvalue");
568 $$->default_properties_.set ($2, gh_double2scm ($4));
570 | paper_def_body translator_spec_block {
571 $$->assign_translator ($2);
573 | paper_def_body error {
602 | real_with_dimension
604 $$= *$1->access_content_Real (false);
606 | '-' real %prec UNARY_MINUS {
633 THIS-> lexer_p_-> scope_l_arr_.pop();
637 midi_body: /* empty */ {
638 Midi_def * p =THIS->default_midi_p ();
640 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
643 Midi_def * p =$1-> access_content_Midi_def (true);
645 THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
647 | midi_body assignment semicolon {
650 | midi_body translator_spec_block {
651 $$-> assign_translator ($2);
653 | midi_body tempo_request semicolon {
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->fold_b_ = (ly_scm2string ($2) == "fold");
711 r->volta_fold_b_ = (ly_scm2string ($2) == "volta");
712 r->set_spot ($4->spot ());
716 Music_sequence: '{' Music_list '}' {
717 $$ = new Music_sequence ($2);
718 $$->set_spot ($2->spot ());
723 SEQUENTIAL '{' Music_list '}' {
724 $$ = new Sequential_music ($3);
725 $$->set_spot ($3->spot ());
727 | '{' Music_list '}' {
728 $$ = new Sequential_music ($2);
729 $$->set_spot ($2->spot ());
734 SIMULTANEOUS '{' Music_list '}'{
735 $$ = new Simultaneous_music ($3);
736 $$->set_spot ($3->spot ());
738 | '<' Music_list '>' {
739 $$ = new Simultaneous_music ($2);
740 $$->set_spot ($2->spot ());
745 request_chord { $$ = $1; }
746 | OUTPUTPROPERTY embedded_scm embedded_scm '=' embedded_scm {
748 if (!gh_symbol_p ($3))
750 THIS->parser_error (_("Second argument must be a symbol"));
752 /*hould check # args */
753 if (!gh_procedure_p (pred))
755 THIS->parser_error (_("First argument must be a procedure taking 1 argument"));
758 $$ = new Output_property (pred,$3, $5);
760 | MUSIC_IDENTIFIER { $$ = $1->access_content_Music (true); }
763 | Simple_music '*' unsigned '/' unsigned {
765 $$->compress (Moment($3, $5 ));
767 | Simple_music '*' unsigned {
769 $$->compress (Moment ($3, 1));
775 CONTEXT STRING Music {
776 Context_specced_music *csm = new Context_specced_music ($3);
778 csm->translator_type_str_ = ly_scm2string ($2);
779 csm->translator_id_str_ = "";
784 | AUTOCHANGE STRING Music {
785 Auto_change_music * chm = new Auto_change_music (ly_scm2string ($2), $3);
788 chm->set_spot ($3->spot ());
791 $$ = new Grace_music ($2);
793 | CONTEXT STRING '=' STRING Music {
794 Context_specced_music *csm = new Context_specced_music ($5);
796 csm->translator_type_str_ = ly_scm2string ($2);
797 csm->translator_id_str_ = ly_scm2string ($4);
802 THIS->remember_spot ();
805 unsigned '/' unsigned Music
808 $$ = new Time_scaled_music ($3, $5, $6);
809 $$->set_spot (THIS->pop_spot ());
811 | Repeated_music { $$ = $1; }
812 | Simultaneous_music { $$ = $1; }
813 | Sequential_music { $$ = $1; }
814 | TRANSPOSE musical_pitch Music {
815 $$ = new Transposed_music ($3, *$2);
818 | TRANSPOSE steno_tonic_pitch Music {
819 $$ = new Transposed_music ($3, *$2);
823 { THIS->lexer_p_->push_note_state (); }
826 THIS->lexer_p_->pop_state ();
829 { THIS->lexer_p_->push_chord_state (); }
833 THIS->lexer_p_->pop_state ();
836 { THIS->lexer_p_->push_lyric_state (); }
840 THIS->lexer_p_->pop_state ();
842 | relative_music { $$ = $1; }
843 | re_rhythmed_music { $$ = $1; }
847 RELATIVE absolute_musical_pitch Music {
848 $$ = new Relative_octave_music ($3, *$2);
854 ADDLYRICS Music Music {
855 Lyric_combine_music * l = new Lyric_combine_music ($2, $3);
861 TRANSLATOR STRING '=' STRING {
862 Change_translator * t = new Change_translator;
863 t-> change_to_type_str_ = ly_scm2string ($2);
864 t-> change_to_id_str_ = ly_scm2string ($4);
867 $$->set_spot (THIS->here_input ());
872 PROPERTY STRING '.' STRING '=' scalar {
873 Translation_property *t = new Translation_property;
875 t->var_str_ = ly_scm2string ($4);
878 Context_specced_music *csm = new Context_specced_music (t);
880 $$->set_spot (THIS->here_input ());
882 csm-> translator_type_str_ = ly_scm2string ($2);
888 | int { $$ = gh_int2scm ($1); }
889 | embedded_scm { $$ = $1; }
894 pre_requests simple_element post_requests {
895 Music_sequence *l = dynamic_cast<Music_sequence*>($2);
897 for (int i=0; i < $1->size(); i++)
898 l->add_music ($1->elem(i));
899 for (int i=0; i < $3->size(); i++)
900 l->add_music ($3->elem(i));
903 programming_error ("Need Sequence to add music to");
912 $$ = new Request_chord;
913 $$-> set_spot (THIS->here_input ());
914 $1-> set_spot (THIS->here_input ());
915 ((Simultaneous_music*)$$) ->add_music ($1);//ugh
917 | PARTIAL duration_length ';' {
918 Translation_property * p = new Translation_property;
919 p->var_str_ = "measurePosition";
920 p->value_ = (new Moment (-$2->length_mom ()))->smobify_self ();
922 Context_specced_music * sp = new Context_specced_music (p);
924 sp-> translator_type_str_ = "Score";
930 | verbose_command_req semicolon { $$ = $1; }
941 $$ = new Barcheck_req;
947 Span_req*b= new Span_req;
948 b->span_dir_ = START;
949 b->span_type_str_ = "beam";
953 if (!is_duration_b ($3))
954 THIS->parser_error (_f ("not a duration: %d", $3));
956 THIS->parser_error (_ ("Can't abbreviate"));
958 THIS->set_abbrev_beam ($3);
960 Chord_tremolo_req* a = new Chord_tremolo_req;
961 a->span_dir_ = START;
962 a->type_i_ = THIS->abbrev_beam_type_i_;
966 if (!THIS->abbrev_beam_type_i_)
968 Span_req*b= new Span_req;
970 b->span_type_str_ = "beam";
975 Chord_tremolo_req* a = new Chord_tremolo_req;
977 a->type_i_ = THIS->abbrev_beam_type_i_;
978 THIS->set_abbrev_beam (0);
983 $$ = new Breathing_sign_req;
991 $$ = new Bar_req (ly_scm2string ($2));
993 | COMMANDSPANREQUEST int STRING {
994 Span_req * sp_p = new Span_req;
995 sp_p-> span_dir_ = Direction($2);
996 sp_p->span_type_str_ = ly_scm2string ($3);
997 sp_p->set_spot (THIS->here_input ());
1001 Mark_req *m = new Mark_req;
1002 m->str_ = ly_scm2string ($2);
1007 Mark_req *m = new Mark_req;
1008 m->str_ = to_str ($2);
1011 | TIME_T unsigned '/' unsigned {
1012 Time_signature_change_req *m = new Time_signature_change_req;
1018 Break_req * b = new Break_req;
1019 b->penalty_f_ = $2 / 100.0;
1020 b->set_spot (THIS->here_input ());
1023 | SKIP duration_length {
1024 Skip_req * skip_p = new Skip_req;
1025 skip_p->duration_ = *$2;
1033 $$ = new Clef_change_req (ly_scm2string ($2));
1036 /* UGH. optional. */
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;
1056 $$ = new Link_array<Request>;
1058 | post_requests post_request {
1059 $2->set_spot (THIS->here_input ());
1071 request_that_take_dir:
1074 | script_abbreviation {
1075 Identifier*i = THIS->lexer_p_->lookup_identifier ("dash-" + ly_scm2string ($1));
1076 Articulation_req *a = new Articulation_req;
1077 a->articulation_str_ = *i->access_content_String (false);
1083 script_dir request_that_take_dir {
1084 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1085 gs->dir_ = Direction ($1);
1087 $2->warning (_ ("Can't specify direction for this request"));
1093 REQUEST_IDENTIFIER {
1094 $$ = (Request*)$1->access_content_Request (true);
1095 $$->set_spot (THIS->here_input ());
1097 | TEXTSCRIPT STRING STRING {
1098 Text_script_req *ts_p = new Text_script_req;
1099 ts_p-> text_str_ = ly_scm2string ($2);
1100 ts_p-> style_str_ = ly_scm2string ($3);
1101 ts_p->set_spot (THIS->here_input ());
1105 | SPANREQUEST int STRING {
1106 Span_req * sp_p = new Span_req;
1107 sp_p-> span_dir_ = Direction($2);
1108 sp_p->span_type_str_ = ly_scm2string ($3);
1109 sp_p->set_spot (THIS->here_input ());
1113 Tremolo_req* a = new Tremolo_req;
1114 a->set_spot (THIS->here_input ());
1119 Articulation_req * a = new Articulation_req;
1120 a->articulation_str_ = ly_scm2string ($2);
1121 a->set_spot (THIS->here_input ());
1154 steno_musical_pitch:
1158 | NOTENAME_PITCH sup_quotes {
1160 $$->octave_i_ += $2;
1162 | NOTENAME_PITCH sub_quotes {
1164 $$->octave_i_ += - $2;
1172 | TONICNAME_PITCH sup_quotes {
1174 $$->octave_i_ += $2;
1176 | TONICNAME_PITCH sub_quotes {
1178 $$->octave_i_ += - $2;
1182 explicit_musical_pitch:
1183 MUSICAL_PITCH '{' int_list '}' {/* ugh */
1184 Array<int> &a = *$3;
1186 $$ = new Musical_pitch;
1187 $$->octave_i_ = a[0];
1188 $$->notename_i_ = a[1];
1189 $$->accidental_i_ = a[2];
1195 steno_musical_pitch {
1198 | explicit_musical_pitch {
1204 DURATION '{' int_list '}' {
1206 Array<int> &a = *$3;
1209 $$-> durlog_i_ = a[0];
1210 $$-> dots_i_ = a[1];
1218 if (!THIS->lexer_p_->lyric_state_b ())
1219 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1220 $$ = new Extender_req;
1226 if (!THIS->lexer_p_->lyric_state_b ())
1227 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1228 $$ = new Hyphen_req;
1233 close_request_parens {
1235 dynamic_cast<Span_req*> ($$)->span_dir_ = START;
1238 close_request_parens:
1240 Span_req* s= new Span_req;
1242 s->span_type_str_ = "slur";
1245 Span_req*s =new Span_req;
1247 s->span_type_str_ = "crescendo";
1250 Span_req*s =new Span_req;
1252 s->span_type_str_ = "decrescendo";
1258 open_request_parens {
1260 dynamic_cast<Span_req*> ($$)->span_dir_ = STOP;
1264 open_request_parens:
1266 Span_req *s = new Span_req;
1267 s->span_type_str_ = "crescendo";
1271 Span_req* s= new Span_req;
1273 s->span_type_str_ = "slur";
1279 Text_script_req *t = new Text_script_req;
1281 t->text_str_ = ly_scm2string ($1);
1283 $$->set_spot (THIS->here_input ());
1286 Text_script_req* t = new Text_script_req;
1288 t->text_str_ = to_str ($1);
1289 t->style_str_ = "finger";
1290 $$->set_spot (THIS->here_input ());
1294 script_abbreviation:
1296 $$ = gh_str02scm ("hat");
1299 $$ = gh_str02scm("plus");
1302 $$ = gh_str02scm ("dash");
1305 $$ = gh_str02scm ("bar");
1308 $$ = gh_str02scm ("larger");
1311 $$ = gh_str02scm ("dot");
1319 | '-' { $$ = CENTER; }
1324 $$ = new Link_array<Request>;
1326 | pre_requests open_request {
1331 absolute_musical_pitch:
1332 steno_musical_pitch {
1341 | duration_length '*' unsigned {
1342 $$->tuplet_iso_i_ *= $3;
1344 | duration_length '/' unsigned {
1345 $$->tuplet_type_i_ *= $3;
1349 entered_notemode_duration:
1351 THIS->set_last_duration ($1);
1355 optional_notemode_duration:
1357 $$ = new Duration (THIS->default_duration_);
1359 | entered_notemode_duration {
1367 if (!is_duration_b ($1))
1368 THIS->parser_error (_f ("not a duration: %d", $1));
1370 $$->durlog_i_ = intlog2 ($1);
1373 | DURATION_IDENTIFIER {
1374 $$ = $1->access_content_Duration (true);
1376 | steno_duration '.' {
1387 if (!is_duration_b ($2))
1388 THIS->parser_error (_f ("not a duration: %d", $2));
1390 THIS->parser_error (_ ("Can't abbreviate"));
1397 musical_pitch exclamations questions optional_notemode_duration {
1398 if (!THIS->lexer_p_->note_state_b ())
1399 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1402 Note_req *n = new Note_req;
1406 if (THIS->abbrev_beam_type_i_)
1408 if (n->duration_.plet_b ())
1409 THIS->parser_error (_ ("Can't abbreviate tuplet"));
1411 n->duration_.set_plet (1, 2);
1413 n->cautionary_b_ = $3 % 2;
1414 n->forceacc_b_ = $2 % 2 || n->cautionary_b_;
1416 Simultaneous_music*v = new Request_chord;
1417 v->set_spot ($1->spot ());
1418 n->set_spot ($1->spot ());
1428 | RESTNAME optional_notemode_duration {
1429 Simultaneous_music* velt_p = new Request_chord;
1430 velt_p->set_spot (THIS->here_input());
1432 if (ly_scm2string ($1) =="s")
1434 Skip_req * skip_p = new Skip_req;
1435 skip_p->duration_ = *$2;
1437 skip_p->set_spot (THIS->here_input());
1438 velt_p->add_music (skip_p);
1442 Rest_req * rest_req_p = new Rest_req;
1443 rest_req_p->duration_ = *$2;
1444 rest_req_p->set_spot (THIS->here_input());
1446 velt_p->add_music (rest_req_p);
1452 | MEASURES optional_notemode_duration {
1453 Skip_req * sk = new Skip_req;
1454 sk->duration_ = *$2;
1455 Music_list * ms = new Music_list;
1456 Request_chord * rqc1 = new Request_chord;
1457 Request_chord * rqc2 = new Request_chord;
1458 Request_chord * rqc3 = new Request_chord;
1460 Span_req *sp1 = new Span_req;
1461 Span_req *sp2 = new Span_req;
1462 sp1-> span_dir_ = START;
1463 sp2-> span_dir_ = STOP;
1464 sp1->span_type_str_ = sp2->span_type_str_ = "rest";
1465 rqc1->add_music (sp1);
1466 rqc2->add_music (sk);
1467 rqc3->add_music (sp2);
1469 ms->add_music (rqc1);
1470 ms->add_music (rqc2);
1471 ms->add_music (rqc3);
1473 $$ = new Sequential_music (ms);
1475 | STRING optional_notemode_duration {
1476 if (!THIS->lexer_p_->lyric_state_b ())
1477 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1478 Simultaneous_music* velt_p = new Request_chord;
1480 Lyric_req* lreq_p = new Lyric_req;
1481 lreq_p ->text_str_ = ly_scm2string ($1);
1482 lreq_p->duration_ = *$2;
1483 lreq_p->set_spot (THIS->here_input());
1485 velt_p->add_music (lreq_p);
1492 if (!THIS->lexer_p_->chord_state_b ())
1493 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1499 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
1500 $$ = THIS->get_chord (*$1, $3, $4, $5, $6, *$2);
1505 $$ = new Array<Musical_pitch>;
1507 | CHORD_COLON chord_notes {
1516 | chord_notes '.' chord_step {
1524 $$ = new Array<Musical_pitch>;
1526 | CHORD_CARET chord_notes {
1536 | '/' steno_tonic_pitch {
1538 $$->set_spot (THIS->here_input ());
1546 | CHORD_BASS steno_tonic_pitch {
1548 $$->set_spot (THIS->here_input ());
1554 $$ = new Array<Musical_pitch>;
1557 | CHORDMODIFIER_PITCH {
1558 $$ = new Array<Musical_pitch>;
1561 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
1562 $$ = new Array<Musical_pitch>;
1570 $$ = new Musical_pitch;
1571 $$->notename_i_ = ($1 - 1) % 7;
1572 $$->octave_i_ = $1 > 7 ? 1 : 0;
1573 $$->accidental_i_ = 0;
1576 $$ = new Musical_pitch;
1577 $$->notename_i_ = ($1 - 1) % 7;
1578 $$->octave_i_ = $1 > 7 ? 1 : 0;
1579 $$->accidental_i_ = 1;
1581 | unsigned CHORD_MINUS {
1582 $$ = new Musical_pitch;
1583 $$->notename_i_ = ($1 - 1) % 7;
1584 $$->octave_i_ = $1 > 7 ? 1 : 0;
1585 $$->accidental_i_ = -1;
1593 $$ = new Array<Musical_pitch>;
1595 | pitch_list musical_pitch {
1628 $$ = *$1->access_content_int (false);
1637 | STRING_IDENTIFIER {
1638 $$ = ly_str02scm ($1->access_content_String (true)->ch_C ());
1640 | string '+' string {
1641 $$ = scm_string_append (scm_listify ($1, $3, SCM_UNDEFINED));
1648 | exclamations '!' { $$ ++; }
1653 | questions '?' { $$ ++; }
1663 My_lily_parser::set_yydebug (bool b)
1670 My_lily_parser::do_yyparse ()
1672 yyparse ((void*)this);