1 %{ // -*-Fundamental-*-
4 parser.yy -- Bison/C++ parser for lilypond
6 source file of the GNU LilyPond music typesetter
8 (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 Jan Nieuwenhuizen <janneke@gnu.org>
13 Two shift/reduce problems:
20 the rules for who is protecting what are very shady. TODO: uniformise
29 #include "translator-def.hh"
30 #include "lily-guile.hh"
31 #include "change-iterator.hh"
33 #include "my-lily-lexer.hh"
34 #include "paper-def.hh"
35 #include "midi-def.hh"
37 #include "file-path.hh"
39 #include "dimensions.hh"
40 #include "command-request.hh"
41 #include "musical-request.hh"
42 #include "my-lily-parser.hh"
43 #include "context-specced-music.hh"
45 #include "music-list.hh"
46 #include "output-property-music-iterator.hh"
47 #include "property-iterator.hh"
48 #include "input-file-results.hh"
50 #include "relative-music.hh"
51 #include "lyric-combine-music.hh"
52 #include "transposed-music.hh"
53 #include "time-scaled-music.hh"
54 #include "repeated-music.hh"
55 #include "untransposable-music.hh"
56 #include "lilypond-input-version.hh"
57 #include "grace-music.hh"
58 #include "part-combine-music.hh"
59 #include "scm-hash.hh"
60 #include "auto-change-iterator.hh"
61 #include "un-relativable-music.hh"
63 #include "ly-modules.hh"
66 regular_identifier_b (SCM id)
68 String str = ly_scm2string (id);
69 char const *s = str.to_str0 () ;
74 v = v && isalpha (*s);
84 return t && t == 1 << intlog2 (t);
88 set_music_properties (Music *p, SCM a)
90 for (SCM k = a; gh_pair_p (k); k = ly_cdr (k))
92 p->internal_set_mus_property (ly_caar (k), ly_cdar (k));
100 parser_make_music (SCM sym)
102 if (!make_music_proc)
103 make_music_proc = scm_primitive_eval (ly_symbol2scm ("make-music-by-name"));
105 SCM rv = scm_call_1 (make_music_proc, sym);
110 scm_gc_protect_object (rv);
111 return unsmob_music (rv);
114 #define MY_MAKE_MUSIC(x) parser_make_music (ly_symbol2scm (x))
117 set_property_music (SCM sym, SCM value)
119 Music * p = MY_MAKE_MUSIC("PropertySet");
120 p->set_mus_property ("symbol", sym);
121 p->set_mus_property ("value", value);
126 // needed for bison.simple's malloc () and free ()
128 // #include <malloc.h>
133 #define YYERROR_VERBOSE 1
135 #define YYPARSE_PARAM my_lily_parser
136 #define YYLEX_PARAM my_lily_parser
138 ((My_lily_parser *) my_lily_parser)
140 #define yyerror THIS->parser_error
144 /* We use SCMs to do strings, because it saves us the trouble of
145 deleting them. Let's hope that a stack overflow doesnt trigger a move
146 of the parse stack onto the heap. */
151 Link_array<Music> *reqvec;
153 String *string; // needed by the lexer as temporary scratch area.
156 Scheme_hash_table *scmhash;
157 Music_output_def * outputdef;
165 yylex (YYSTYPE *s, void * v)
167 My_lily_parser *pars = (My_lily_parser*) v;
168 My_lily_lexer * lex = pars->lexer_;
170 lex->lexval = (void*) s;
171 return lex->yylex ();
179 /* tokens which are not keywords */
189 %token CHORDMODIFIERS
197 %token GROBDESCRIPTIONS
203 %token FIGURES FIGURE_OPEN FIGURE_CLOSE
204 %token FIGURE_BRACKET_CLOSE FIGURE_BRACKET_OPEN
214 %token MULTI_MEASURE_REST
227 %token OVERRIDE SET REVERT
240 %token COMMANDSPANREQUEST
242 %token OUTPUTPROPERTY
253 %token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE
254 %token E_LEFTSQUARE E_RIGHTSQUARE E_TILDE
256 %token <i> E_UNSIGNED
257 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET CHORD_SLASH
260 %type <i> exclamations questions dots optional_rest
261 %type <i> bass_number bass_mod
262 %type <scm> br_bass_figure bass_figure figure_list figure_spec
264 %token <scm> NOTENAME_PITCH
265 %token <scm> TONICNAME_PITCH
266 %token <scm> CHORDMODIFIER_PITCH
267 %token <scm> DURATION_IDENTIFIER
268 %token <scm> FRACTION
269 %token <id> IDENTIFIER
272 %token <scm> SCORE_IDENTIFIER
273 %token <scm> MUSIC_OUTPUT_DEF_IDENTIFIER
275 %token <scm> NUMBER_IDENTIFIER
276 %token <scm> REQUEST_IDENTIFIER
277 %token <scm> MUSIC_IDENTIFIER TRANSLATOR_IDENTIFIER
278 %token <scm> STRING_IDENTIFIER SCM_IDENTIFIER
279 %token <scm> RESTNAME
285 %type <outputdef> output_def
286 %type <scm> lilypond_header lilypond_header_body
287 %type <music> open_request_parens close_request_parens open_request close_request
288 %type <music> request_with_dir request_that_take_dir verbose_request
289 %type <i> sub_quotes sup_quotes
290 %type <music> simple_element request_chord command_element Simple_music Composite_music
291 %type <music> Repeated_music
292 %type <scm> Alternative_music
293 %type <i> tremolo_type
294 %type <i> bare_int bare_unsigned
296 %type <scm> identifier_init
298 %type <scm> steno_duration optional_notemode_duration multiplied_duration
299 %type <scm> verbose_duration
301 %type <reqvec> pre_requests post_requests
302 %type <music> gen_text_def
303 %type <scm> steno_pitch pitch absolute_pitch
304 %type <scm> explicit_pitch steno_tonic_pitch
306 %type <scm> chord_additions chord_subtractions chord_notes chord_step
308 %type <scm> chord_note chord_inversion chord_bass
309 %type <scm> duration_length fraction
311 %type <scm> embedded_scm scalar
312 %type <music> Music Sequential_music Simultaneous_music
313 %type <music> relative_music re_rhythmed_music part_combined_music
314 %type <music> property_def translator_change simple_property_def
315 %type <scm> Music_list
316 %type <outputdef> music_output_def_body
317 %type <music> shorthand_command_req
318 %type <music> post_request
319 %type <music> command_req verbose_command_req
320 %type <music> extender_req
321 %type <music> hyphen_req
322 %type <music> string_request
323 %type <scm> string bare_number number_expression number_term number_factor
325 %type <score> score_block score_body
327 %type <scm> translator_spec_block translator_spec_body
328 %type <tempo> tempo_request
329 %type <scm> notenames_body notenames_block chordmodifiers_block
330 %type <scm> script_abbreviation
336 /* We don't assign precedence to / and *, because we might need varied
337 prec levels in different prods */
343 lilypond: /* empty */
344 | lilypond toplevel_expression {}
345 | lilypond assignment { }
347 THIS->error_level_ = 1;
350 THIS->error_level_ = 1;
356 THIS->lexer_->pitchname_tab_ = $1;
358 | chordmodifiers_block {
359 THIS->lexer_->chordmodifier_tab_ = $1;
362 THIS->input_file_->header_ = $1;
365 THIS->input_file_->scores_.push ($1);
368 if (dynamic_cast<Paper_def*> ($1))
369 THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultpaper"), $1->self_scm ());
370 else if (dynamic_cast<Midi_def*> ($1))
371 THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultmidi"), $1->self_scm ());
384 chordmodifiers_block:
385 CHORDMODIFIERS notenames_body { $$ = $2; }
389 PITCHNAMES notenames_body { $$ = $2; }
394 int i = scm_ilength ($1);
396 SCM tab = scm_make_vector (gh_int2scm (i), SCM_EOL);
397 for (SCM s = $1; gh_pair_p (s); s = ly_cdr (s)) {
398 SCM pt = ly_cdar (s);
399 if (!unsmob_pitch (pt))
400 THIS->parser_error ("Need pitch object.");
402 scm_hashq_set_x (tab, ly_caar (s), pt);
409 lilypond_header_body:
411 $$ = ly_make_anonymous_module ();
412 THIS->lexer_->add_scope ($$);
414 | lilypond_header_body assignment {
420 HEADER '{' lilypond_header_body '}' {
421 $$ = THIS->lexer_-> remove_scope();
433 /* cont */ '=' identifier_init {
436 Should find generic way of associating input with objects.
438 Input ip = THIS->pop_spot ();
440 if (! regular_identifier_b ($1))
442 ip.warning (_ ("Identifier should have alphabetic characters only"));
445 THIS->lexer_->set_identifier ($1, $4);
448 TODO: devise standard for protection in parser.
450 The parser stack lives on the C-stack, which means that
451 all objects can be unprotected as soon as they're here.
461 $$ = $1->self_scm ();
462 scm_gc_unprotect_object ($$);
465 $$ = $1->self_scm ();
466 scm_gc_unprotect_object ($$);
468 | translator_spec_block {
472 $$ = $1->self_scm ();
473 scm_gc_unprotect_object ($$);
476 $$ = $1->self_scm ();
477 scm_gc_unprotect_object ($$);
482 | number_expression {
493 translator_spec_block:
494 TRANSLATOR '{' translator_spec_body '}'
500 translator_spec_body:
501 TRANSLATOR_IDENTIFIER {
502 $$ = unsmob_translator_def ($1)->clone_scm ();
503 unsmob_translator_def ($$)-> set_spot (THIS->here_input ());
506 $$ = Translator_def::make_scm ();
507 Translator_def*td = unsmob_translator_def ($$);
508 td->translator_group_type_ = $2;
509 td->set_spot (THIS->here_input ());
511 | translator_spec_body STRING '=' embedded_scm {
512 unsmob_translator_def ($$)->add_property_assign ($2, $4);
514 | translator_spec_body STRING OVERRIDE embedded_scm '=' embedded_scm {
515 unsmob_translator_def ($$)
516 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
518 | translator_spec_body STRING SET embedded_scm '=' embedded_scm {
519 unsmob_translator_def ($$)
520 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
522 | translator_spec_body STRING REVERT embedded_scm {
523 unsmob_translator_def ($$)->add_pop_property (
524 scm_string_to_symbol ($2), $4);
526 | translator_spec_body NAME STRING {
527 unsmob_translator_def ($$)->type_name_ = $3;
529 | translator_spec_body CONSISTS STRING {
530 unsmob_translator_def ($$)->add_element ($3);
532 | translator_spec_body ALIAS STRING {
533 Translator_def*td = unsmob_translator_def ($$);
534 td->type_aliases_ = scm_cons ($3, td->type_aliases_);
536 | translator_spec_body GROBDESCRIPTIONS embedded_scm {
537 Translator_def*td = unsmob_translator_def($$);
538 // td->add_property_assign (ly_symbol2scm ("allGrobDescriptions"), $3);
539 for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p))
540 td->add_property_assign (scm_symbol_to_string (ly_caar (p)), ly_cdar (p));
542 | translator_spec_body CONSISTSEND STRING {
543 unsmob_translator_def ($$)->add_last_element ( $3);
545 | translator_spec_body ACCEPTS STRING {
546 unsmob_translator_def ($$)->set_acceptor ($3,true);
548 | translator_spec_body DENIES STRING {
549 unsmob_translator_def ($$)->set_acceptor ($3,false);
551 | translator_spec_body REMOVE STRING {
552 unsmob_translator_def ($$)->remove_element ($3);
563 /*cont*/ '{' score_body '}' {
566 if (!$$->defs_.size ())
568 Music_output_def *id =
569 unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
570 $$->add_output (id ? id->clone () : new Paper_def );
579 $$->set_spot (THIS->here_input ());
580 SCM m = $1->self_scm ();
581 scm_gc_unprotect_object (m);
586 SCM check_funcs = scm_c_eval_string ("toplevel-music-functions");
587 for (; gh_pair_p (check_funcs); check_funcs = gh_cdr (check_funcs))
588 m = gh_call1 (gh_car (check_funcs), m);
593 $$ = new Score (*unsmob_score ($1));
594 $$->set_spot (THIS->here_input ());
596 | score_body lilypond_header {
599 | score_body output_def {
612 music_output_def_body '}' {
614 THIS-> lexer_-> remove_scope ();
618 music_output_def_body:
620 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultmidi"));
625 p = dynamic_cast<Midi_def*> (id->clone ());
630 THIS->lexer_->add_scope (p->scope_);
633 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
636 p = dynamic_cast<Paper_def*> (id->clone ());
639 THIS-> lexer_->add_scope (p->scope_);
642 | PAPER '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
643 Music_output_def *p = unsmob_music_output_def ($3);
645 THIS->lexer_->add_scope (p->scope_);
648 | MIDI '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
649 Music_output_def *p = unsmob_music_output_def ($3);
652 THIS->lexer_->add_scope (p->scope_);
655 | music_output_def_body assignment {
658 | music_output_def_body translator_spec_block {
659 $$->assign_translator ($2);
661 | music_output_def_body STYLESHEET embedded_scm {
662 dynamic_cast<Paper_def*> ($$)-> style_sheet_ = $3;
664 | music_output_def_body tempo_request {
666 junk this ? there already is tempo stuff in
669 int m = gh_scm2int ( $2->get_mus_property ("metronome-count"));
670 Duration *d = unsmob_duration ($2->get_mus_property ("duration"));
671 Midi_def * md = dynamic_cast<Midi_def*> ($$);
673 md->set_tempo (d->length_mom (), m);
675 | music_output_def_body error {
681 TEMPO steno_duration '=' bare_unsigned {
682 $$ = MY_MAKE_MUSIC("TempoEvent");
683 $$->set_mus_property ("duration", $2);
684 $$->set_mus_property ("metronome-count", gh_int2scm ( $4));
689 The representation of a list is the
693 to have efficient append.
695 Music_list: /* empty */ {
696 $$ = scm_cons (SCM_EOL, SCM_EOL);
700 SCM c = scm_cons ($2->self_scm (), SCM_EOL);
701 scm_gc_unprotect_object ($2->self_scm ()); /* UGH */
702 if (gh_pair_p (ly_cdr (s)))
703 gh_set_cdr_x (ly_cdr (s), c); /* append */
705 gh_set_car_x (s, c); /* set first cons */
706 gh_set_cdr_x (s, c) ; /* remember last cell */
722 | ALTERNATIVE '{' Music_list '}' {
728 REPEAT string bare_unsigned Music Alternative_music
732 SCM alts = gh_pair_p ($5) ? gh_car ($5) : SCM_EOL;
733 if (times < scm_ilength (alts)) {
734 unsmob_music (gh_car (alts))
735 ->origin ()->warning (
736 _("More alternatives than repeats. Junking excess alternatives."));
737 alts = ly_truncate_list (times, alts);
740 Music *r = MY_MAKE_MUSIC("RepeatedMusic");
743 r-> set_mus_property ("element", beg->self_scm ());
744 scm_gc_unprotect_object (beg->self_scm ());
746 r->set_mus_property ("repeat-count", gh_int2scm (times >? 1));
748 r-> set_mus_property ("elements",alts);
749 SCM func = scm_primitive_eval (ly_symbol2scm ("repeat-name-to-ctor"));
750 SCM result = gh_call1 (func, $2);
752 if (gh_equal_p ($2, scm_makfrom0str ("tremolo")))
755 we can not get durations and other stuff correct down the line, so we have to
756 add to the duration log here.
758 SCM func = scm_primitive_eval (ly_symbol2scm ("shift-duration-log"));
760 gh_call3 (func, r->self_scm (), gh_int2scm(-intlog2 ($3*2/3)),gh_int2scm(1));
762 gh_call3 (func, r->self_scm (), gh_int2scm(-intlog2 ($3)), gh_int2scm(0));
765 set_music_properties (r, result);
767 r->set_spot (*$4->origin ());
774 SEQUENTIAL '{' Music_list '}' {
775 $$ = MY_MAKE_MUSIC("SequentialMusic");
776 $$->set_mus_property ("elements", ly_car ($3));
777 $$->set_spot(THIS->here_input());
779 | '{' Music_list '}' {
780 $$ = MY_MAKE_MUSIC("SequentialMusic");
781 $$->set_mus_property ("elements", ly_car ($2));
782 $$->set_spot(THIS->here_input());
787 SIMULTANEOUS '{' Music_list '}'{
788 $$ = MY_MAKE_MUSIC("SimultaneousMusic");
789 $$->set_mus_property ("elements", ly_car ($3));
790 $$->set_spot(THIS->here_input());
793 | '<' Music_list '>' {
794 $$ = MY_MAKE_MUSIC("SimultaneousMusic");
795 $$->set_mus_property ("elements", ly_car ($2));
796 $$->set_spot(THIS->here_input());
801 request_chord { $$ = $1; }
802 | OUTPUTPROPERTY embedded_scm embedded_scm '=' embedded_scm {
804 if (!gh_symbol_p ($3))
806 THIS->parser_error (_ ("Second argument must be a symbol"));
808 /* Should check # args */
809 if (!gh_procedure_p (pred))
811 THIS->parser_error (_ ("First argument must be a procedure taking one argument"));
814 Music*m = MY_MAKE_MUSIC("OutputPropertySetMusic");
815 m->set_mus_property ("predicate", pred);
816 m->set_mus_property ("grob-property", $3);
817 m->set_mus_property ("grob-value", $5);
822 $$ = unsmob_music ($1)->clone ();
824 $$->set_spot (THIS->here_input());
832 CONTEXT STRING Music {
833 Music*csm =TYPED_MAKE_MUSIC("ContextSpeccedMusic");
835 csm->set_mus_property ("element", $3->self_scm ());
836 scm_gc_unprotect_object ($3->self_scm ());
838 csm->set_mus_property ("context-type",$2);
839 csm->set_mus_property ("context-id", scm_makfrom0str (""));
843 | AUTOCHANGE STRING Music {
844 Music*chm = MY_MAKE_MUSIC("AutoChangeMusic");
845 chm->set_mus_property ("element", $3->self_scm ());
847 scm_gc_unprotect_object ($3->self_scm ());
848 chm->set_mus_property ("what", $2);
851 chm->set_spot (*$3->origin ());
856 The other version is for easier debugging of
857 Sequential_music_iterator in combination with grace notes.
860 SCM start = THIS->lexer_->lookup_identifier ("startGraceMusic");
861 SCM stop = THIS->lexer_->lookup_identifier ("stopGraceMusic");
862 Music *startm = unsmob_music (start);
863 Music *stopm = unsmob_music (stop);
867 stopm = stopm->clone ();
868 ms = scm_cons (stopm->self_scm (), ms);
869 scm_gc_unprotect_object (stopm->self_scm ());
871 ms = scm_cons ($2->self_scm (), ms);
872 scm_gc_unprotect_object ($2->self_scm());
874 startm = startm->clone ();
875 ms = scm_cons (startm->self_scm () , ms);
876 scm_gc_unprotect_object (startm->self_scm ());
880 Music* seq = MY_MAKE_MUSIC("SequentialMusic");
881 seq->set_mus_property ("elements", ms);
884 $$ = MY_MAKE_MUSIC("GraceMusic");
885 $$->set_mus_property ("element", seq->self_scm ());
886 scm_gc_unprotect_object (seq->self_scm ());
888 $$ = MY_MAKE_MUSIC("GraceMusic");
889 $$->set_mus_property ("element", $2->self_scm ());
890 scm_gc_unprotect_object ($2->self_scm ());
893 | CONTEXT string '=' string Music {
894 Music * csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
896 csm->set_mus_property ("element", $5->self_scm ());
897 scm_gc_unprotect_object ($5->self_scm ());
899 csm->set_mus_property ("context-type", $2);
900 csm->set_mus_property ("context-id", $4);
911 int n = gh_scm2int (ly_car ($3)); int d = gh_scm2int (ly_cdr ($3));
913 $$= MY_MAKE_MUSIC("TimeScaledMusic");
914 $$->set_spot (THIS->pop_spot ());
917 $$->set_mus_property ("element", mp->self_scm ());
918 scm_gc_unprotect_object (mp->self_scm ());
919 $$->set_mus_property ("numerator", gh_int2scm (n));
920 $$->set_mus_property ("denominator", gh_int2scm (d));
921 $$->compress (Moment (Rational (n,d)));
924 | Repeated_music { $$ = $1; }
925 | Simultaneous_music { $$ = $1; }
926 | Sequential_music { $$ = $1; }
927 | TRANSPOSE pitch Music {
928 $$ = MY_MAKE_MUSIC("TransposedMusic");
930 Pitch pit = *unsmob_pitch ($2);
933 $$->set_mus_property ("element", p->self_scm ());
934 scm_gc_unprotect_object (p->self_scm ());
936 | TRANSPOSE steno_tonic_pitch Music {
937 $$ = MY_MAKE_MUSIC("TransposedMusic");
939 Pitch pit = *unsmob_pitch ($2);
942 $$->set_mus_property ("element", p->self_scm ());
943 scm_gc_unprotect_object (p->self_scm ());
946 | APPLY embedded_scm Music {
947 SCM ret = gh_call1 ($2, $3->self_scm ());
948 Music *m = unsmob_music (ret);
950 THIS->parser_error ("\\apply must return a Music");
951 m = MY_MAKE_MUSIC("Music");
956 { THIS->lexer_->push_note_state (); }
959 THIS->lexer_->pop_state ();
962 { THIS->lexer_->push_figuredbass_state (); }
965 Music * chm = MY_MAKE_MUSIC("UntransposableMusic");
966 chm->set_mus_property ("element", $3->self_scm ());
968 scm_gc_unprotect_object ($3->self_scm());
970 THIS->lexer_->pop_state ();
973 { THIS->lexer_->push_chord_state (); }
976 Music * chm = MY_MAKE_MUSIC("UnrelativableMusic");
977 chm->set_mus_property ("element", $3->self_scm ());
978 scm_gc_unprotect_object ($3->self_scm());
981 THIS->lexer_->pop_state ();
984 { THIS->lexer_->push_lyric_state (); }
988 THIS->lexer_->pop_state ();
990 | relative_music { $$ = $1; }
991 | re_rhythmed_music { $$ = $1; }
992 | part_combined_music { $$ = $1; }
996 RELATIVE absolute_pitch Music {
998 Pitch pit = *unsmob_pitch ($2);
999 $$ = MY_MAKE_MUSIC("RelativeOctaveMusic");
1001 $$->set_mus_property ("element", p->self_scm ());
1002 scm_gc_unprotect_object (p->self_scm ());
1004 $$->set_mus_property ("last-pitch", p->to_relative_octave (pit).smobbed_copy ());
1010 ADDLYRICS Music Music {
1011 Music*l =MY_MAKE_MUSIC("LyricCombineMusic");
1012 l->set_mus_property ("elements", gh_list ($2->self_scm (), $3->self_scm (), SCM_UNDEFINED));
1013 scm_gc_unprotect_object ($3->self_scm ());
1014 scm_gc_unprotect_object ($2->self_scm ());
1019 part_combined_music:
1020 PARTCOMBINE STRING Music Music {
1021 Music * p= MY_MAKE_MUSIC("PartCombineMusic");
1022 p->set_mus_property ("what", $2);
1023 p->set_mus_property ("elements", gh_list ($3->self_scm (),$4->self_scm (), SCM_UNDEFINED));
1025 scm_gc_unprotect_object ($3->self_scm ());
1026 scm_gc_unprotect_object ($4->self_scm ());
1033 TRANSLATOR STRING '=' STRING {
1034 Music*t= MY_MAKE_MUSIC("TranslatorChange");
1035 t-> set_mus_property ("change-to-type", $2);
1036 t-> set_mus_property ("change-to-id", $4);
1039 $$->set_spot (THIS->here_input ());
1045 | ONCE simple_property_def {
1047 SCM e = $2->get_mus_property ("element");
1048 unsmob_music (e)->set_mus_property ("once", SCM_BOOL_T);
1052 simple_property_def:
1053 PROPERTY STRING '.' STRING '=' scalar {
1054 Music *t = set_property_music (scm_string_to_symbol ($4), $6);
1055 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1057 csm->set_mus_property ("element", t->self_scm ());
1058 scm_gc_unprotect_object (t->self_scm ());
1061 $$->set_spot (THIS->here_input ());
1063 csm-> set_mus_property ("context-type", $2);
1065 | PROPERTY STRING '.' STRING UNSET {
1067 Music *t = MY_MAKE_MUSIC("PropertyUnset");
1068 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1070 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1071 csm->set_mus_property ("element", t->self_scm ());
1072 scm_gc_unprotect_object (t->self_scm ());
1075 $$->set_spot (THIS->here_input ());
1077 csm-> set_mus_property ("context-type", $2);
1079 | PROPERTY STRING '.' STRING SET embedded_scm '=' embedded_scm {
1081 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1082 bool itc = internal_type_checking_global_b;
1083 Music *t = MY_MAKE_MUSIC("OverrideProperty");
1085 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1086 t->set_mus_property ("pop-first", SCM_BOOL_T);
1088 internal_type_checking_global_b = false;
1089 t->set_mus_property ("grob-property", $6);
1091 internal_type_checking_global_b = itc;
1092 t->set_mus_property ("grob-value", $8);
1094 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1095 csm->set_mus_property ("element", t->self_scm ());
1096 scm_gc_unprotect_object (t->self_scm ());
1098 $$->set_spot (THIS->here_input ());
1100 csm-> set_mus_property ("context-type", $2);
1102 | PROPERTY STRING '.' STRING OVERRIDE
1103 embedded_scm '=' embedded_scm
1109 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1110 bool itc = internal_type_checking_global_b;
1112 Music *t = MY_MAKE_MUSIC("OverrideProperty");
1113 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1115 internal_type_checking_global_b = false;
1116 t->set_mus_property ("grob-property", $6);
1117 t->set_mus_property ("grob-value", $8);
1119 internal_type_checking_global_b = itc;
1121 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1122 csm->set_mus_property ("element", t->self_scm ());
1123 scm_gc_unprotect_object (t->self_scm ());
1126 $$->set_spot (THIS->here_input ());
1128 csm-> set_mus_property ("context-type", $2);
1131 | PROPERTY STRING '.' STRING REVERT embedded_scm {
1132 Music *t = MY_MAKE_MUSIC("RevertProperty");
1134 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1135 bool itc = internal_type_checking_global_b;
1137 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1139 internal_type_checking_global_b = false;
1140 t->set_mus_property ("grob-property", $6);
1142 internal_type_checking_global_b = itc;
1144 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1145 csm->set_mus_property ("element", t->self_scm ());
1146 scm_gc_unprotect_object (t->self_scm ());
1149 $$->set_spot (THIS->here_input ());
1151 csm-> set_mus_property ("context-type", $2);
1158 | bare_int { $$ = gh_int2scm ($1); }
1159 | embedded_scm { $$ = $1; }
1166 } /*cont */ simple_element post_requests {
1167 Music_sequence *l = dynamic_cast<Music_sequence*> ($3);
1170 for (int i=0; i < $1->size (); i++) {
1171 Music * m = $1->elem (i);
1172 l->append_music (m);
1184 $$ = MY_MAKE_MUSIC("RequestChord");
1185 $$->set_mus_property ("elements", scm_cons ($1->self_scm (), SCM_EOL));
1186 scm_gc_unprotect_object ($1->self_scm());
1188 $$-> set_spot (THIS->here_input ());
1189 $1-> set_spot (THIS->here_input ());
1192 Music *l = MY_MAKE_MUSIC("SpanEvent");
1193 l->set_mus_property ("span-direction", gh_int2scm (START));
1194 l->set_mus_property ("span-type", scm_makfrom0str ("ligature"));
1195 l->set_spot (THIS->here_input ());
1197 $$ = MY_MAKE_MUSIC("RequestChord");
1198 $$->set_mus_property ("elements", scm_cons (l->self_scm (), SCM_EOL));
1199 scm_gc_unprotect_object (l->self_scm());
1200 $$->set_spot (THIS->here_input ());
1203 Music *l = MY_MAKE_MUSIC("SpanEvent");
1204 l->set_mus_property ("span-direction", gh_int2scm (STOP));
1205 l->set_mus_property ("span-type", scm_makfrom0str ("ligature"));
1206 l->set_spot (THIS->here_input ());
1208 $$ = MY_MAKE_MUSIC("RequestChord");
1209 $$->set_mus_property ("elements", scm_cons (l->self_scm (), SCM_EOL));
1210 $$->set_spot (THIS->here_input ());
1211 scm_gc_unprotect_object (l->self_scm());
1215 $$ = MY_MAKE_MUSIC("VoiceSeparator");
1216 $$->set_spot (THIS->here_input ());
1220 $$ = MY_MAKE_MUSIC("BarCheck");
1221 $$->set_spot (THIS->here_input ());
1224 Music *t = set_property_music (ly_symbol2scm ("whichBar"), $2);
1226 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1227 csm->set_mus_property ("element", t->self_scm ());
1228 scm_gc_unprotect_object (t->self_scm ());
1231 $$->set_spot (THIS->here_input ());
1233 csm->set_mus_property ("context-type", scm_makfrom0str ("Timing"));
1235 | PARTIAL duration_length {
1236 Moment m = - unsmob_duration ($2)->length_mom ();
1237 Music * p = set_property_music (ly_symbol2scm ( "measurePosition"),m.smobbed_copy ());
1239 Music * sp = MY_MAKE_MUSIC("ContextSpeccedMusic");
1240 sp->set_mus_property ("element", p->self_scm ());
1241 scm_gc_unprotect_object (p->self_scm ());
1244 sp-> set_mus_property ("context-type", scm_makfrom0str ("Timing"));
1247 SCM func = scm_primitive_eval (ly_symbol2scm ("clef-name-to-properties"));
1248 SCM result = gh_call1 (func, $2);
1251 for (SCM s = result ; gh_pair_p (s); s = ly_cdr (s)) {
1252 Music * p = MY_MAKE_MUSIC("Music");
1253 set_music_properties (p, ly_car (s));
1254 l = scm_cons (p->self_scm (), l);
1255 scm_gc_unprotect_object (p->self_scm ());
1257 Music * seq = MY_MAKE_MUSIC("SequentialMusic");
1258 seq->set_mus_property ("elements", l);
1260 Music * sp = MY_MAKE_MUSIC("ContextSpeccedMusic");
1261 sp->set_mus_property ("element", seq->self_scm ());
1262 scm_gc_unprotect_object (seq->self_scm ());
1265 sp-> set_mus_property ("context-type", scm_makfrom0str ("Staff"));
1268 Music * p1 = set_property_music (ly_symbol2scm ( "timeSignatureFraction"), $2);
1270 int l = gh_scm2int (ly_car ($2));
1271 int o = gh_scm2int (ly_cdr ($2));
1273 Moment one_beat = Moment (1)/Moment (o);
1274 Moment len = Moment (l) * one_beat;
1277 Music *p2 = set_property_music (ly_symbol2scm ("measureLength"), len.smobbed_copy ());
1278 Music *p3 = set_property_music (ly_symbol2scm ("beatLength"), one_beat.smobbed_copy ());
1280 SCM list = scm_list_n (p1->self_scm (), p2->self_scm (), p3->self_scm(), SCM_UNDEFINED);
1281 Music *seq = MY_MAKE_MUSIC("SequentialMusic");
1282 seq->set_mus_property ("elements", list);
1285 Music * sp = MY_MAKE_MUSIC("ContextSpeccedMusic");
1286 sp->set_mus_property ("element", seq->self_scm ());
1288 scm_gc_unprotect_object (p3->self_scm ());
1289 scm_gc_unprotect_object (p2->self_scm ());
1290 scm_gc_unprotect_object (p1->self_scm ());
1291 scm_gc_unprotect_object (seq->self_scm ());
1295 sp-> set_mus_property ("context-type", scm_makfrom0str ( "Timing"));
1300 shorthand_command_req { $$ = $1; }
1301 | verbose_command_req { $$ = $1; }
1304 shorthand_command_req:
1312 $$ = MY_MAKE_MUSIC("TieEvent");
1315 Music *b= MY_MAKE_MUSIC("SpanEvent");
1316 b->set_mus_property ("span-direction", gh_int2scm (START))
1318 b->set_mus_property ("span-type", scm_makfrom0str ("beam"));
1322 THIS->last_beam_start_ = b->self_scm ();
1325 Music *b= MY_MAKE_MUSIC("SpanEvent");
1326 b->set_mus_property ("span-direction", gh_int2scm (STOP))
1328 b->set_mus_property ("span-type", scm_makfrom0str ("beam"));
1332 $$ = MY_MAKE_MUSIC("BreathingSignEvent");
1335 $$ = MY_MAKE_MUSIC("PorrectusEvent");
1339 verbose_command_req:
1340 COMMANDSPANREQUEST bare_int STRING { /*TODO: junkme */
1341 Music * sp = MY_MAKE_MUSIC("SpanEvent");
1342 sp->set_mus_property ("span-direction", gh_int2scm (Direction ($2)));
1343 sp->set_mus_property ("span-type",$3);
1344 sp->set_spot (THIS->here_input ());
1348 Music * m = MY_MAKE_MUSIC("MarkEvent");
1352 Music *m = MY_MAKE_MUSIC("MarkEvent");
1353 m->set_mus_property ("label", $2);
1357 Music * b = MY_MAKE_MUSIC("BreakEvent");
1359 if (!gh_number_p (s))
1362 b->set_mus_property ("penalty", s);
1363 b->set_spot (THIS->here_input ());
1366 | SKIP duration_length {
1367 Music * skip = MY_MAKE_MUSIC("SkipEvent");
1368 skip->set_mus_property ("duration", $2);
1376 Music *key= MY_MAKE_MUSIC("KeyChangeEvent");
1379 | KEY NOTENAME_PITCH SCM_IDENTIFIER {
1380 Music *key= MY_MAKE_MUSIC("KeyChangeEvent");
1382 key->set_mus_property ("pitch-alist", $3);
1383 ((Music*)key)->transpose (* unsmob_pitch ($2));
1390 $$ = new Link_array<Music>;
1392 | post_requests post_request {
1393 $2->set_spot (THIS->here_input ());
1408 Music * s = MY_MAKE_MUSIC("StringNumberEvent");
1409 s->set_mus_property ("string-number", gh_int2scm($1));
1410 s->set_spot (THIS->here_input ());
1416 request_that_take_dir:
1419 | script_abbreviation {
1420 SCM s = THIS->lexer_->lookup_identifier ("dash" + ly_scm2string ($1));
1421 Music *a = MY_MAKE_MUSIC("ArticulationEvent");
1422 if (gh_string_p (s))
1423 a->set_mus_property ("articulation-type", s);
1424 else THIS->parser_error (_ ("Expecting string as script definition"));
1430 script_dir request_that_take_dir {
1431 $2->set_mus_property ("direction", gh_int2scm ($1));
1437 REQUEST_IDENTIFIER {
1438 $$ = unsmob_music ($1)->clone ();
1439 $$->set_spot (THIS->here_input ());
1441 | DYNAMICSCRIPT embedded_scm {
1443 TODO: junkme, use text-type == dynamic
1445 Music *d = MY_MAKE_MUSIC("TextScriptEvent");
1446 SCM dyn = ly_symbol2scm ("dynamic");
1447 d->set_mus_property ("text-type" , dyn);
1448 d->set_mus_property ("text", $2);
1449 d->set_spot (THIS->here_input ());
1452 | SPANREQUEST bare_int STRING {
1453 Music * sp = MY_MAKE_MUSIC("SpanEvent");
1454 sp->set_mus_property ("span-direction", gh_int2scm ( $2));
1455 sp->set_mus_property ("span-type", $3);
1456 sp->set_spot (THIS->here_input ());
1460 Music * a = MY_MAKE_MUSIC("TremoloEvent");
1461 a->set_spot (THIS->here_input ());
1462 a->set_mus_property ("tremolo-type", gh_int2scm ($1));
1466 Music * a = MY_MAKE_MUSIC("ArticulationEvent");
1467 a->set_mus_property ("articulation-type", $2);
1468 a->set_spot (THIS->here_input ());
1473 duh, junk this syntax from the parser, if possible.
1476 Music *a = MY_MAKE_MUSIC("ArpeggioEvent");
1477 a->set_spot (THIS->here_input ());
1481 Music *g = MY_MAKE_MUSIC("GlissandoEvent");
1482 g->set_spot /* No pun intended */ (THIS->here_input ());
1509 | NOTENAME_PITCH sup_quotes {
1510 Pitch p = *unsmob_pitch ($1);
1512 $$ = p.smobbed_copy ();
1514 | NOTENAME_PITCH sub_quotes {
1515 Pitch p =* unsmob_pitch ($1);
1518 $$ = p.smobbed_copy ();
1531 | TONICNAME_PITCH sup_quotes {
1532 Pitch p = *unsmob_pitch ($1);
1534 $$ = p.smobbed_copy ();
1536 | TONICNAME_PITCH sub_quotes {
1537 Pitch p =* unsmob_pitch ($1);
1540 $$ = p.smobbed_copy ();
1555 PITCH embedded_scm {
1557 if (!unsmob_pitch ($2)) {
1558 THIS->parser_error (_f ("Expecting musical-pitch value", 3));
1559 $$ = Pitch ().smobbed_copy ();
1565 DURATION embedded_scm {
1567 if (!unsmob_duration ($2))
1569 THIS->parser_error (_ ("Must have duration object"));
1570 $$ = Duration ().smobbed_copy ();
1577 if (!THIS->lexer_->lyric_state_b ())
1578 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1579 $$ = MY_MAKE_MUSIC("ExtenderEvent");
1585 if (!THIS->lexer_->lyric_state_b ())
1586 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1587 $$ = MY_MAKE_MUSIC("HyphenEvent");
1592 close_request_parens {
1594 dynamic_cast<Music *> ($$)->set_mus_property ("span-direction", gh_int2scm (START))
1599 close_request_parens:
1601 Music * s= MY_MAKE_MUSIC("SpanEvent");
1603 s->set_mus_property ("span-type", scm_makfrom0str ( "slur"));
1604 s->set_spot (THIS->here_input());
1607 Music * s= MY_MAKE_MUSIC("SpanEvent");
1609 s->set_mus_property ("span-type", scm_makfrom0str ( "phrasing-slur"));
1610 s->set_spot (THIS->here_input());
1613 Music *s =MY_MAKE_MUSIC("SpanEvent");
1615 s->set_mus_property ("span-type", scm_makfrom0str ( "crescendo"));
1616 s->set_spot (THIS->here_input());
1619 Music *s =MY_MAKE_MUSIC("SpanEvent");
1621 s->set_mus_property ("span-type", scm_makfrom0str ("decrescendo"));
1622 s->set_spot (THIS->here_input());
1628 open_request_parens {
1630 dynamic_cast<Music *> ($$)->set_mus_property ("span-direction", gh_int2scm (STOP))
1635 open_request_parens:
1637 Music *s = MY_MAKE_MUSIC("SpanEvent");
1638 s->set_mus_property ("span-type", scm_makfrom0str ( "crescendo"));
1639 s->set_spot (THIS->here_input());
1644 Music * s= MY_MAKE_MUSIC("SpanEvent");
1646 s->set_mus_property ("span-type", scm_makfrom0str ( "slur"));
1647 s->set_spot (THIS->here_input());
1651 Music * s= MY_MAKE_MUSIC("SpanEvent");
1653 s->set_mus_property ("span-type", scm_makfrom0str ( "phrasing-slur"));
1654 s->set_spot (THIS->here_input());
1660 Music *t = MY_MAKE_MUSIC("TextScriptEvent");
1661 t->set_mus_property ("text", $1);
1662 t->set_spot (THIS->here_input ());
1666 Music *t = MY_MAKE_MUSIC("TextScriptEvent");
1667 t->set_mus_property ("text", $1);
1668 t->set_spot (THIS->here_input ());
1672 String ds = to_string ($1);
1673 Music * t = MY_MAKE_MUSIC("TextScriptEvent");
1674 SCM finger = ly_symbol2scm ("finger");
1675 t->set_mus_property ("text", scm_makfrom0str (ds.to_str0 ()));
1676 t->set_mus_property ("text-type" , finger);
1677 t->set_spot (THIS->here_input ());
1682 script_abbreviation:
1684 $$ = scm_makfrom0str ("Hat");
1687 $$ = scm_makfrom0str ("Plus");
1690 $$ = scm_makfrom0str ("Dash");
1693 $$ = scm_makfrom0str ("Bar");
1696 $$ = scm_makfrom0str ("Larger");
1699 $$ = scm_makfrom0str ("Dot");
1702 $$ = scm_makfrom0str ("Underscore");
1709 | '-' { $$ = CENTER; }
1714 $$ = new Link_array<Music>;
1716 | pre_requests open_request {
1728 multiplied_duration {
1731 | verbose_duration {
1736 optional_notemode_duration:
1738 Duration dd = THIS->default_duration_;
1739 $$ = dd.smobbed_copy ();
1741 THIS->beam_check ($$);
1743 | multiplied_duration {
1745 THIS->default_duration_ = *unsmob_duration ($$);
1747 THIS->beam_check ($$);
1749 | verbose_duration {
1751 THIS->default_duration_ = *unsmob_duration ($$);
1756 bare_unsigned dots {
1758 if (!is_duration_b ($1))
1759 THIS->parser_error (_f ("not a duration: %d", $1));
1763 $$ = Duration (l, $2).smobbed_copy ();
1765 | DURATION_IDENTIFIER dots {
1766 Duration *d =unsmob_duration ($1);
1767 Duration k (d->duration_log (),d->dot_count () + $2);
1768 $$ = k.smobbed_copy ();
1775 multiplied_duration:
1779 | multiplied_duration '*' bare_unsigned {
1780 $$ = unsmob_duration ($$)->compressed ( $3) .smobbed_copy ();
1782 | multiplied_duration '*' FRACTION {
1783 Rational m (gh_scm2int (ly_car ($3)), gh_scm2int (ly_cdr ($3)));
1785 $$ = unsmob_duration ($$)->compressed (m).smobbed_copy ();
1790 FRACTION { $$ = $1; }
1791 | UNSIGNED '/' UNSIGNED {
1792 $$ = scm_cons (gh_int2scm ($1), gh_int2scm ($3));
1810 | ':' bare_unsigned {
1811 if (!is_duration_b ($2))
1812 THIS->parser_error (_f ("not a duration: %d", $2));
1831 Music *bfr = MY_MAKE_MUSIC("BassFigureEvent");
1832 $$ = bfr->self_scm();
1833 scm_gc_unprotect_object ($$);
1836 Music *bfr = MY_MAKE_MUSIC("BassFigureEvent");
1837 $$ = bfr->self_scm();
1839 bfr->set_mus_property ("figure", gh_int2scm ($1));
1841 scm_gc_unprotect_object ($$);
1843 | bass_figure bass_mod {
1844 Music *m = unsmob_music ($1);
1846 SCM salter =m->get_mus_property ("alteration");
1847 int alter = gh_number_p ( salter) ? gh_scm2int (salter) : 0;
1848 m->set_mus_property ("alteration",
1849 gh_int2scm (alter + $2));
1851 m->set_mus_property ("alteration", gh_int2scm (0));
1859 unsmob_music ($$)->set_mus_property ("bracket-start", SCM_BOOL_T);
1864 | br_bass_figure ']' {
1866 unsmob_music ($1)->set_mus_property ("bracket-stop", SCM_BOOL_T);
1874 | figure_list br_bass_figure {
1875 $$ = scm_cons ($2, $1);
1880 FIGURE_OPEN figure_list FIGURE_CLOSE {
1881 Music * m = MY_MAKE_MUSIC("RequestChord");
1882 $2 = scm_reverse_x ($2, SCM_EOL);
1883 m->set_mus_property ("elements", $2);
1884 $$ = m->self_scm ();
1895 pitch exclamations questions optional_notemode_duration optional_rest {
1897 Input i = THIS->pop_spot ();
1898 if (!THIS->lexer_->note_state_b ())
1899 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1903 n = MY_MAKE_MUSIC("RestEvent");
1905 n = MY_MAKE_MUSIC("NoteEvent");
1907 n->set_mus_property ("pitch", $1);
1908 n->set_mus_property ("duration", $4);
1912 n->set_mus_property ("cautionary", SCM_BOOL_T);
1913 if ($2 % 2 || $3 % 2)
1914 n->set_mus_property ("force-accidental", SCM_BOOL_T);
1916 Music *v = MY_MAKE_MUSIC("RequestChord");
1917 v->set_mus_property ("elements", scm_list_n (n->self_scm (), SCM_UNDEFINED));
1918 scm_gc_unprotect_object (n->self_scm());
1924 | figure_spec optional_notemode_duration {
1925 Music * m = unsmob_music ($1);
1926 Input i = THIS->pop_spot ();
1928 for (SCM s = m->get_mus_property ("elements"); gh_pair_p (s); s = ly_cdr (s))
1930 unsmob_music (ly_car (s))->set_mus_property ("duration", $2);
1934 | RESTNAME optional_notemode_duration {
1936 Input i = THIS->pop_spot ();
1937 SCM e = SCM_UNDEFINED;
1938 if (ly_scm2string ($1) =="s") {
1940 Music * skip = MY_MAKE_MUSIC("SkipEvent");
1941 skip->set_mus_property ("duration" ,$2);
1943 e = skip->self_scm ();
1946 Music * rest_req = MY_MAKE_MUSIC("RestEvent");
1947 rest_req->set_mus_property ("duration", $2);
1948 rest_req->set_spot (i);
1949 e = rest_req->self_scm ();
1951 Music * velt = MY_MAKE_MUSIC("RequestChord");
1952 velt-> set_mus_property ("elements", scm_list_n (e,SCM_UNDEFINED));
1957 | MULTI_MEASURE_REST optional_notemode_duration {
1960 Music * sk = MY_MAKE_MUSIC("SkipEvent");
1961 sk->set_mus_property ("duration", $2);
1962 Music *sp1 = MY_MAKE_MUSIC("SpanEvent");
1963 Music *sp2 = MY_MAKE_MUSIC("SpanEvent");
1964 sp1-> set_mus_property ("span-direction", gh_int2scm (START))
1966 sp2-> set_mus_property ("span-direction", gh_int2scm (STOP))
1968 SCM r = scm_makfrom0str ("rest");
1969 sp1->set_mus_property ("span-type", r);
1970 sp2->set_mus_property ("span-type", r);
1972 Music *rqc1 = MY_MAKE_MUSIC("RequestChord");
1973 rqc1->set_mus_property ("elements", scm_list_n (sp1->self_scm (), SCM_UNDEFINED));
1974 Music *rqc2 = MY_MAKE_MUSIC("RequestChord");
1975 rqc2->set_mus_property ("elements", scm_list_n (sk->self_scm (), SCM_UNDEFINED));;
1976 Music *rqc3 = MY_MAKE_MUSIC("RequestChord");
1977 rqc3->set_mus_property ("elements", scm_list_n (sp2->self_scm (), SCM_UNDEFINED));;
1979 SCM ms = scm_list_n (rqc1->self_scm (), rqc2->self_scm (), rqc3->self_scm (), SCM_UNDEFINED);
1981 $$ = MY_MAKE_MUSIC("SequentialMusic");
1982 $$->set_mus_property ("elements", ms);
1984 | STRING optional_notemode_duration {
1985 Input i = THIS->pop_spot ();
1987 Music * lreq = MY_MAKE_MUSIC("LyricEvent");
1988 lreq->set_mus_property ("text", $1);
1989 lreq->set_mus_property ("duration",$2);
1991 Music * velt = MY_MAKE_MUSIC("RequestChord");
1992 velt->set_mus_property ("elements", scm_list_n (lreq->self_scm (), SCM_UNDEFINED));
1997 Input i = THIS->pop_spot ();
1999 if (!THIS->lexer_->chord_state_b ())
2000 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
2007 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
2008 $$ = Chord::get_chord ($1, $3, $4, $5, $6, $2);
2009 $$->set_spot (THIS->here_input ());
2016 | CHORD_COLON chord_notes {
2025 | chord_notes '.' chord_step {
2026 $$ = gh_append2 ($$, $3);
2034 | CHORD_CARET chord_notes {
2044 | CHORD_SLASH steno_tonic_pitch {
2053 | CHORD_BASS steno_tonic_pitch {
2060 $$ = scm_cons ($1, SCM_EOL);
2062 | CHORDMODIFIER_PITCH {
2063 $$ = scm_cons (unsmob_pitch ($1)->smobbed_copy (), SCM_EOL);
2065 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
2066 $$ = scm_list_n (unsmob_pitch ($1)->smobbed_copy (),
2074 m.notename_ = ($1 - 1) % 7;
2075 m.octave_ = $1 > 7 ? 1 : 0;
2078 $$ = m.smobbed_copy ();
2080 | bare_unsigned '+' {
2082 m.notename_ = ($1 - 1) % 7;
2083 m.octave_ = $1 > 7 ? 1 : 0;
2087 $$ = m.smobbed_copy ();
2089 | bare_unsigned CHORD_MINUS {
2091 m.notename_ = ($1 - 1) % 7;
2092 m.octave_ = $1 > 7 ? 1 : 0;
2095 $$ = m.smobbed_copy ();
2103 number_expression '+' number_term {
2104 $$ = scm_sum ($1, $3);
2106 | number_expression '-' number_term {
2107 $$ = scm_difference ($1, $3);
2116 | number_factor '*' number_factor {
2117 $$ = scm_product ($1, $3);
2119 | number_factor '/' number_factor {
2120 $$ = scm_divide ($1, $3);
2125 '(' number_expression ')' {
2128 | '-' number_factor { /* %prec UNARY_MINUS */
2129 $$ = scm_difference ($2, SCM_UNDEFINED);
2137 $$ = gh_int2scm ($1);
2142 | NUMBER_IDENTIFIER {
2146 $$ = gh_double2scm (gh_scm2double ($1) CM );
2149 $$ = gh_double2scm (gh_scm2double ($1) PT);
2152 $$ = gh_double2scm (gh_scm2double ($1) INCH);
2155 $$ = gh_double2scm (gh_scm2double ($1) MM);
2158 $$ = gh_double2scm (gh_scm2double ($1) CHAR);
2174 if (scm_integer_p ($1) == SCM_BOOL_T)
2176 int k = gh_scm2int ($1);
2180 THIS->parser_error (_ ("need integer number arg"));
2194 | STRING_IDENTIFIER {
2197 | string '+' string {
2198 $$ = scm_string_append (scm_list_n ($1, $3, SCM_UNDEFINED));
2205 | exclamations '!' { $$ ++; }
2210 | questions '?' { $$ ++; }
2217 My_lily_parser::set_yydebug (bool )
2224 extern My_lily_parser * current_parser;
2227 My_lily_parser::do_yyparse ()
2230 current_parser = this;;
2231 yyparse ((void*)this);
2236 Should make this optional? It will also complain when you do
2240 which is entirely legitimate.
2242 Or we can scrap it. Barchecks should detect wrong durations, and
2243 skipTypesetting speeds it up a lot.
2246 My_lily_parser::beam_check (SCM dur)
2248 Duration *d = unsmob_duration (dur);
2249 if (unsmob_music (last_beam_start_) && d->duration_log () <= 2)
2251 Music * m = unsmob_music (last_beam_start_);
2252 m->origin ()->warning (_("Suspect duration found following this beam"));
2254 last_beam_start_ = SCM_EOL;