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 "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"
65 regular_identifier_b (SCM id)
67 String str = ly_scm2string (id);
68 char const *s = str.ch_C() ;
73 v = v && isalpha (*s);
81 set_property_music (SCM sym, SCM value)
83 Music * p = new Music (SCM_EOL);
84 p->set_mus_property ("symbol", sym);
85 p->set_mus_property ("iterator-ctor",
86 Property_iterator::constructor_cxx_function);
88 p->set_mus_property ("value", value);
95 return t && t == 1 << intlog2 (t);
99 set_music_properties (Music *p, SCM a)
101 for (SCM k = a; gh_pair_p (k); k = ly_cdr (k))
103 p->internal_set_mus_property (ly_caar (k), ly_cdar (k));
113 // needed for bison.simple's malloc () and free ()
120 #define YYERROR_VERBOSE 1
122 #define YYPARSE_PARAM my_lily_parser_l
123 #define YYLEX_PARAM my_lily_parser_l
125 ((My_lily_parser *) my_lily_parser_l)
127 #define yyerror THIS->parser_error
128 #define ARRAY_SIZE(a,s) if (a.size () != s) THIS->parser_error (_f ("Expecting %d arguments", s))
132 /* We use SCMs to do strings, because it saves us the trouble of
133 deleting them. Let's hope that a stack overflow doesnt trigger a move
134 of the parse stack onto the heap. */
139 Link_array<Request> *reqvec;
141 String *string; // needed by the lexer as temporary scratch area.
144 Scheme_hash_table *scmhash;
145 Music_output_def * outputdef;
157 yylex (YYSTYPE *s, void * v_l)
159 My_lily_parser *pars_l = (My_lily_parser*) v_l;
160 My_lily_lexer * lex_l = pars_l->lexer_p_;
162 lex_l->lexval_l = (void*) s;
163 return lex_l->yylex ();
171 /* tokens which are not keywords */
181 %token CHORDMODIFIERS
189 %token GROBDESCRIPTIONS
195 %token FIGURES FIGURE_OPEN FIGURE_CLOSE
196 %token FIGURE_BRACKET_CLOSE FIGURE_BRACKET_OPEN
206 %token MULTI_MEASURE_REST
218 %token OVERRIDE SET REVERT
231 %token COMMANDSPANREQUEST
233 %token OUTPUTPROPERTY
244 %token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE
245 %token E_LEFTSQUARE E_RIGHTSQUARE E_TILDE
247 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET
251 %type <i> exclamations questions dots optional_rest
252 %type <i> bass_number bass_mod
253 %type <scm> br_bass_figure bass_figure figure_list figure_spec
255 %token <scm> NOTENAME_PITCH
256 %token <scm> TONICNAME_PITCH
257 %token <scm> CHORDMODIFIER_PITCH
258 %token <scm> DURATION_IDENTIFIER
259 %token <scm> FRACTION
260 %token <id> IDENTIFIER
263 %token <scm> SCORE_IDENTIFIER
264 %token <scm> MUSIC_OUTPUT_DEF_IDENTIFIER
266 %token <scm> NUMBER_IDENTIFIER
267 %token <scm> REQUEST_IDENTIFIER
268 %token <scm> MUSIC_IDENTIFIER TRANSLATOR_IDENTIFIER
269 %token <scm> STRING_IDENTIFIER SCM_IDENTIFIER
270 %token <scm> RESTNAME
276 %type <outputdef> output_def
277 %type <scmhash> lilypond_header lilypond_header_body
278 %type <request> open_request_parens close_request_parens open_request close_request
279 %type <request> request_with_dir request_that_take_dir verbose_request
280 %type <i> sub_quotes sup_quotes
281 %type <music> simple_element request_chord command_element Simple_music Composite_music
282 %type <music> Repeated_music
283 %type <scm> Alternative_music
284 %type <i> tremolo_type
285 %type <i> bare_int bare_unsigned
288 %type <scm> identifier_init
290 %type <scm> steno_duration optional_notemode_duration multiplied_duration
291 %type <scm> verbose_duration
293 %type <reqvec> pre_requests post_requests
294 %type <request> gen_text_def
295 %type <scm> steno_pitch pitch absolute_pitch
296 %type <scm> explicit_pitch steno_tonic_pitch
298 %type <scm> chord_additions chord_subtractions chord_notes chord_step
300 %type <scm> chord_note chord_inversion chord_bass
301 %type <scm> duration_length fraction
303 %type <scm> embedded_scm scalar
304 %type <music> Music Sequential_music Simultaneous_music
305 %type <music> relative_music re_rhythmed_music part_combined_music
306 %type <music> property_def translator_change
307 %type <scm> Music_list
308 %type <outputdef> music_output_def_body
309 %type <request> shorthand_command_req
310 %type <request> post_request
311 %type <music> command_req verbose_command_req
312 %type <request> extender_req
313 %type <request> hyphen_req
314 %type <scm> string bare_number number_expression number_term number_factor
316 %type <score> score_block score_body
318 %type <scm> translator_spec_block translator_spec_body
319 %type <tempo> tempo_request
320 %type <scm> notenames_body notenames_block chordmodifiers_block
321 %type <scm> script_abbreviation
327 /* We don't assign precedence to / and *, because we might need varied
328 prec levels in different prods */
334 lilypond: /* empty */
335 | lilypond toplevel_expression {}
336 | lilypond assignment { }
338 THIS->error_level_i_ = 1;
341 THIS->error_level_i_ = 1;
347 THIS->lexer_p_->pitchname_tab_ = $1;
349 | chordmodifiers_block {
350 THIS->lexer_p_->chordmodifier_tab_ = $1;
354 scm_gc_unprotect_object (global_header_p->self_scm ());
355 global_header_p = $1;
358 score_global_array.push ($1);
361 if (dynamic_cast<Paper_def*> ($1))
362 THIS->lexer_p_->set_identifier (gh_str02scm ("$defaultpaper"), $1->self_scm ());
363 else if (dynamic_cast<Midi_def*> ($1))
364 THIS->lexer_p_->set_identifier (gh_str02scm ("$defaultmidi"), $1->self_scm ());
377 chordmodifiers_block:
378 CHORDMODIFIERS notenames_body { $$ = $2; }
382 PITCHNAMES notenames_body { $$ = $2; }
387 int i = scm_ilength ($1);
389 SCM tab = scm_make_vector (gh_int2scm (i), SCM_EOL);
390 for (SCM s = $1; gh_pair_p (s); s = ly_cdr (s)) {
391 SCM pt = ly_cdar (s);
392 if (!unsmob_pitch (pt))
393 THIS->parser_error ("Need pitch object.");
395 scm_hashq_set_x (tab, ly_caar (s), pt);
402 lilypond_header_body:
404 $$ = new Scheme_hash_table;
405 THIS->lexer_p_-> scope_l_arr_.push ($$);
407 | lilypond_header_body assignment {
413 HEADER '{' lilypond_header_body '}' {
415 THIS->lexer_p_->scope_l_arr_.pop ();
427 /* cont */ '=' identifier_init {
430 Should find generic way of associating input with objects.
432 Input ip = THIS->pop_spot ();
434 if (! regular_identifier_b ($1))
436 ip.warning (_ ("Identifier should have alphabetic characters only"));
439 THIS->lexer_p_->set_identifier ($1, $4);
442 TODO: devise standard for protection in parser.
444 The parser stack lives on the C-stack, which means that
445 all objects can be unprotected as soon as they're here.
455 $$ = $1->self_scm ();
456 scm_gc_unprotect_object ($$);
459 $$ = $1->self_scm ();
460 scm_gc_unprotect_object ($$);
462 | translator_spec_block {
466 $$ = $1->self_scm ();
467 scm_gc_unprotect_object ($$);
470 $$ = $1->self_scm ();
471 scm_gc_unprotect_object ($$);
476 | number_expression {
487 translator_spec_block:
488 TRANSLATOR '{' translator_spec_body '}'
494 translator_spec_body:
495 TRANSLATOR_IDENTIFIER {
496 $$ = unsmob_translator_def ($1)->clone_scm ();
497 unsmob_translator_def ($$)-> set_spot (THIS->here_input ());
500 $$ = Translator_def::make_scm ();
501 Translator_def*td = unsmob_translator_def ($$);
502 td->translator_group_type_ = $2;
503 td->set_spot (THIS->here_input ());
505 | translator_spec_body STRING '=' embedded_scm {
506 unsmob_translator_def ($$)->add_property_assign ($2, $4);
508 | translator_spec_body STRING OVERRIDE embedded_scm '=' embedded_scm {
509 unsmob_translator_def ($$)
510 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
512 | translator_spec_body STRING REVERT embedded_scm {
513 unsmob_translator_def ($$)->add_pop_property (
514 scm_string_to_symbol ($2), $4);
516 | translator_spec_body NAME STRING {
517 unsmob_translator_def ($$)->type_name_ = $3;
519 | translator_spec_body CONSISTS STRING {
520 unsmob_translator_def ($$)->add_element ($3);
522 | translator_spec_body ALIAS STRING {
523 Translator_def*td = unsmob_translator_def ($$);
524 td->type_aliases_ = gh_cons ($3, td->type_aliases_);
526 | translator_spec_body GROBDESCRIPTIONS embedded_scm {
527 Translator_def*td = unsmob_translator_def($$);
528 // td->add_property_assign (ly_symbol2scm ("allGrobDescriptions"), $3);
529 for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p))
530 td->add_property_assign (scm_symbol_to_string (ly_caar (p)), ly_cdar (p));
532 | translator_spec_body CONSISTSEND STRING {
533 unsmob_translator_def ($$)->add_last_element ( $3);
535 | translator_spec_body ACCEPTS STRING {
536 unsmob_translator_def ($$)->set_acceptor ($3,true);
538 | translator_spec_body DENIES STRING {
539 unsmob_translator_def ($$)->set_acceptor ($3,false);
541 | translator_spec_body REMOVE STRING {
542 unsmob_translator_def ($$)->remove_element ($3);
553 /*cont*/ '{' score_body '}' {
556 if (!$$->def_p_arr_.size ())
558 Music_output_def *id =
559 unsmob_music_output_def (THIS->lexer_p_->lookup_identifier ("$defaultpaper"));
560 $$->add_output (id ? id->clone () : new Paper_def );
569 $$->set_spot (THIS->here_input ());
570 SCM m = $1->self_scm ();
571 scm_gc_unprotect_object (m);
577 SCM check_func = scm_c_eval_string ("check-start-chords");
578 gh_call1 (check_func, m);
582 $$ = new Score (*unsmob_score ($1));
583 $$->set_spot (THIS->here_input ());
585 | score_body lilypond_header {
586 scm_gc_unprotect_object ($2->self_scm ());
589 | score_body output_def {
602 music_output_def_body '}' {
604 THIS-> lexer_p_-> scope_l_arr_.pop ();
608 music_output_def_body:
610 Music_output_def *id = unsmob_music_output_def (THIS->lexer_p_->lookup_identifier ("$defaultmidi"));
615 p = dynamic_cast<Midi_def*> (id->clone ());
620 THIS->lexer_p_->scope_l_arr_.push (p->variable_tab_);
623 Music_output_def *id = unsmob_music_output_def (THIS->lexer_p_->lookup_identifier ("$defaultpaper"));
626 p = dynamic_cast<Paper_def*> (id->clone ());
629 THIS-> lexer_p_-> scope_l_arr_.push (p->variable_tab_);
632 | PAPER '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
633 Music_output_def *p = unsmob_music_output_def ($3);
635 THIS->lexer_p_->scope_l_arr_.push (p->variable_tab_);
638 | MIDI '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
639 Music_output_def *p = unsmob_music_output_def ($3);
642 THIS->lexer_p_->scope_l_arr_.push (p->variable_tab_);
645 | music_output_def_body assignment {
648 | music_output_def_body translator_spec_block {
649 $$->assign_translator ($2);
651 | music_output_def_body STYLESHEET embedded_scm {
652 dynamic_cast<Paper_def*> ($$)-> style_sheet_ = $3;
654 | music_output_def_body tempo_request {
656 junk this ? there already is tempo stuff in
659 int m = gh_scm2int ( $2->get_mus_property ("metronome-count"));
660 Duration *d = unsmob_duration ($2->get_mus_property ("duration"));
661 Midi_def * md = dynamic_cast<Midi_def*> ($$);
663 md->set_tempo (d->length_mom (), m);
665 | music_output_def_body error {
671 TEMPO steno_duration '=' bare_unsigned {
673 $$->set_mus_property ("duration", $2);
674 $$->set_mus_property ("metronome-count", gh_int2scm ( $4));
679 The representation of a list is the
683 to have efficient append.
685 Music_list: /* empty */ {
686 $$ = gh_cons (SCM_EOL, SCM_EOL);
690 SCM c = gh_cons ($2->self_scm (), SCM_EOL);
691 scm_gc_unprotect_object ($2->self_scm ()); /* UGH */
692 if (gh_pair_p (ly_cdr (s)))
693 gh_set_cdr_x (ly_cdr (s), c); /* append */
695 gh_set_car_x (s, c); /* set first cons */
696 gh_set_cdr_x (s, c) ; /* remember last cell */
712 | ALTERNATIVE '{' Music_list '}' {
718 REPEAT string bare_unsigned Music Alternative_music
722 SCM alts = gh_pair_p ($5) ? gh_car ($5) : SCM_EOL;
723 if (times < scm_ilength (alts)) {
724 unsmob_music (gh_car (alts))
725 ->origin ()->warning (
726 _("More alternatives than repeats. Junking excess alternatives."));
727 alts = ly_truncate_list (times, alts);
730 Repeated_music * r = new Repeated_music (SCM_EOL);
733 r-> set_mus_property ("element", beg->self_scm ());
734 scm_gc_unprotect_object (beg->self_scm ());
736 r->set_mus_property ("repeat-count", gh_int2scm (times >? 1));
738 r-> set_mus_property ("elements",alts);
739 SCM func = scm_primitive_eval (ly_symbol2scm ("repeat-name-to-ctor"));
740 SCM result = gh_call1 (func, $2);
742 set_music_properties (r, result);
744 r->set_spot (*$4->origin ());
750 SEQUENTIAL '{' Music_list '}' {
751 $$ = new Sequential_music (SCM_EOL);
752 $$->set_mus_property ("elements", ly_car ($3));
753 $$->set_spot(THIS->here_input());
755 | '{' Music_list '}' {
756 $$ = new Sequential_music (SCM_EOL);
757 $$->set_mus_property ("elements", ly_car ($2));
758 $$->set_spot(THIS->here_input());
763 SIMULTANEOUS '{' Music_list '}'{
764 $$ = new Simultaneous_music (SCM_EOL);
765 $$->set_mus_property ("elements", ly_car ($3));
766 $$->set_spot(THIS->here_input());
769 | '<' Music_list '>' {
770 $$ = new Simultaneous_music (SCM_EOL);
771 $$->set_mus_property ("elements", ly_car ($2));
772 $$->set_spot(THIS->here_input());
777 request_chord { $$ = $1; }
778 | OUTPUTPROPERTY embedded_scm embedded_scm '=' embedded_scm {
780 if (!gh_symbol_p ($3))
782 THIS->parser_error (_ ("Second argument must be a symbol"));
784 /*hould check # args */
785 if (!gh_procedure_p (pred))
787 THIS->parser_error (_ ("First argument must be a procedure taking 1 argument"));
790 Music *m = new Music (SCM_EOL);
791 m->set_mus_property ("predicate", pred);
792 m->set_mus_property ("grob-property", $3);
793 m->set_mus_property ("grob-value", $5);
794 m->set_mus_property ("iterator-ctor",
795 Output_property_music_iterator::constructor_cxx_function);
800 $$ = unsmob_music ($1)->clone ();
802 $$->set_spot (THIS->here_input());
810 CONTEXT STRING Music {
811 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
812 csm->set_mus_property ("element", $3->self_scm ());
813 scm_gc_unprotect_object ($3->self_scm ());
815 csm->set_mus_property ("context-type",$2);
816 csm->set_mus_property ("context-id", ly_str02scm (""));
820 | AUTOCHANGE STRING Music {
821 Music * chm = new Music_wrapper (SCM_EOL);
822 chm->set_mus_property ("element", $3->self_scm ());
823 chm->set_mus_property ("iterator-ctor", Auto_change_iterator::constructor_cxx_function);
825 scm_gc_unprotect_object ($3->self_scm ());
826 chm->set_mus_property ("what", $2);
829 chm->set_spot (*$3->origin ());
834 The other version is for easier debugging of
835 Sequential_music_iterator in combination with grace notes.
838 SCM start = THIS->lexer_p_->lookup_identifier ("startGraceMusic");
839 SCM stop = THIS->lexer_p_->lookup_identifier ("stopGraceMusic");
840 Music *startm = unsmob_music (start);
841 Music *stopm = unsmob_music (stop);
845 stopm = stopm->clone ();
846 ms = gh_cons (stopm->self_scm (), ms);
847 scm_gc_unprotect_object (stopm->self_scm ());
849 ms = gh_cons ($2->self_scm (), ms);
850 scm_gc_unprotect_object ($2->self_scm());
852 startm = startm->clone ();
853 ms = gh_cons (startm->self_scm () , ms);
854 scm_gc_unprotect_object (startm->self_scm ());
857 Music* seq = new Sequential_music (SCM_EOL);
858 seq->set_mus_property ("elements", ms);
860 $$ = new Grace_music (SCM_EOL);
861 $$->set_mus_property ("element", seq->self_scm ());
862 scm_gc_unprotect_object (seq->self_scm ());
864 $$ = new Grace_music (SCM_EOL);
865 $$->set_mus_property ("element", $2->self_scm ());
866 scm_gc_unprotect_object ($2->self_scm ());
869 | CONTEXT string '=' string Music {
870 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
871 csm->set_mus_property ("element", $5->self_scm ());
872 scm_gc_unprotect_object ($5->self_scm ());
874 csm->set_mus_property ("context-type", $2);
875 csm->set_mus_property ("context-id", $4);
886 int n = gh_scm2int (ly_car ($3)); int d = gh_scm2int (ly_cdr ($3));
888 $$ = new Time_scaled_music (SCM_EOL);
889 $$->set_spot (THIS->pop_spot ());
892 $$->set_mus_property ("element", mp->self_scm ());
893 scm_gc_unprotect_object (mp->self_scm ());
894 $$->set_mus_property ("numerator", gh_int2scm (n));
895 $$->set_mus_property ("denominator", gh_int2scm (d));
896 $$->compress (Moment (Rational (n,d)));
899 | Repeated_music { $$ = $1; }
900 | Simultaneous_music { $$ = $1; }
901 | Sequential_music { $$ = $1; }
902 | TRANSPOSE pitch Music {
903 $$ = new Transposed_music (SCM_EOL);
905 Pitch pit = *unsmob_pitch ($2);
908 $$->set_mus_property ("element", p->self_scm ());
909 scm_gc_unprotect_object (p->self_scm ());
911 | TRANSPOSE steno_tonic_pitch Music {
912 $$ = new Transposed_music (SCM_EOL);
914 Pitch pit = *unsmob_pitch ($2);
917 $$->set_mus_property ("element", p->self_scm ());
918 scm_gc_unprotect_object (p->self_scm ());
921 | APPLY embedded_scm Music {
922 SCM ret = gh_call1 ($2, $3->self_scm ());
923 Music *m = unsmob_music (ret);
925 THIS->parser_error ("\\apply must return a Music");
926 m = new Music (SCM_EOL);
931 { THIS->lexer_p_->push_note_state (); }
934 THIS->lexer_p_->pop_state ();
937 { THIS->lexer_p_->push_figuredbass_state (); }
940 Music * chm = new Untransposable_music () ;
941 chm->set_mus_property ("element", $3->self_scm ());
943 scm_gc_unprotect_object ($3->self_scm());
945 THIS->lexer_p_->pop_state ();
948 { THIS->lexer_p_->push_chord_state (); }
951 Music * chm = new Un_relativable_music ;
952 chm->set_mus_property ("element", $3->self_scm ());
953 scm_gc_unprotect_object ($3->self_scm());
956 THIS->lexer_p_->pop_state ();
959 { THIS->lexer_p_->push_lyric_state (); }
963 THIS->lexer_p_->pop_state ();
965 | relative_music { $$ = $1; }
966 | re_rhythmed_music { $$ = $1; }
967 | part_combined_music { $$ = $1; }
971 RELATIVE absolute_pitch Music {
973 Pitch pit = *unsmob_pitch ($2);
974 $$ = new Relative_octave_music (SCM_EOL);
976 $$->set_mus_property ("element", p->self_scm ());
977 scm_gc_unprotect_object (p->self_scm ());
979 $$->set_mus_property ("last-pitch", p->to_relative_octave (pit).smobbed_copy ());
985 ADDLYRICS Music Music {
986 Lyric_combine_music * l = new Lyric_combine_music (SCM_EOL);
987 l->set_mus_property ("elements", gh_list ($2->self_scm (), $3->self_scm (), SCM_UNDEFINED));
988 scm_gc_unprotect_object ($3->self_scm ());
989 scm_gc_unprotect_object ($2->self_scm ());
995 PARTCOMBINE STRING Music Music {
996 Part_combine_music * p = new Part_combine_music (SCM_EOL);
998 p->set_mus_property ("what", $2);
999 p->set_mus_property ("elements", gh_list ($3->self_scm (),$4->self_scm (), SCM_UNDEFINED));
1001 scm_gc_unprotect_object ($3->self_scm ());
1002 scm_gc_unprotect_object ($4->self_scm ());
1009 TRANSLATOR STRING '=' STRING {
1010 Music * t = new Music (SCM_EOL);
1011 t->set_mus_property ("iterator-ctor",
1012 Change_iterator::constructor_cxx_function);
1013 t-> set_mus_property ("change-to-type", $2);
1014 t-> set_mus_property ("change-to-id", $4);
1017 $$->set_spot (THIS->here_input ());
1022 PROPERTY STRING '.' STRING '=' scalar {
1024 Music *t = set_property_music (scm_string_to_symbol ($4), $6);
1025 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1027 csm->set_mus_property ("element", t->self_scm ());
1028 scm_gc_unprotect_object (t->self_scm ());
1031 $$->set_spot (THIS->here_input ());
1033 csm-> set_mus_property ("context-type", $2);
1035 | PROPERTY STRING '.' STRING UNSET {
1036 Music *t = new Music (SCM_EOL);
1038 t->set_mus_property ("iterator-ctor",
1039 Property_unset_iterator::constructor_cxx_function);
1040 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1042 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1043 csm->set_mus_property ("element", t->self_scm ());
1044 scm_gc_unprotect_object (t->self_scm ());
1047 $$->set_spot (THIS->here_input ());
1049 csm-> set_mus_property ("context-type", $2);
1051 | PROPERTY STRING '.' STRING SET embedded_scm '=' embedded_scm {
1052 Music *t = new Music (SCM_EOL);
1053 t->set_mus_property ("iterator-ctor",
1054 Push_property_iterator::constructor_cxx_function);
1055 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1056 t->set_mus_property ("pop-first", SCM_BOOL_T);
1057 t->set_mus_property ("grob-property", $6);
1058 t->set_mus_property ("grob-value", $8);
1059 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1060 csm->set_mus_property ("element", t->self_scm ());
1061 scm_gc_unprotect_object (t->self_scm ());
1063 $$->set_spot (THIS->here_input ());
1065 csm-> set_mus_property ("context-type", $2);
1067 | PROPERTY STRING '.' STRING OVERRIDE embedded_scm '=' embedded_scm {
1068 Music *t = new Music (SCM_EOL);
1069 t->set_mus_property ("iterator-ctor",
1070 Push_property_iterator::constructor_cxx_function);
1071 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1072 t->set_mus_property ("grob-property", $6);
1073 t->set_mus_property ("grob-value", $8);
1074 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1075 csm->set_mus_property ("element", t->self_scm ());
1076 scm_gc_unprotect_object (t->self_scm ());
1079 $$->set_spot (THIS->here_input ());
1081 csm-> set_mus_property ("context-type", $2);
1083 | PROPERTY STRING '.' STRING REVERT embedded_scm {
1084 Music *t = new Music (SCM_EOL);
1085 t->set_mus_property ("iterator-ctor",
1086 Pop_property_iterator::constructor_cxx_function);
1087 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1088 t->set_mus_property ("grob-property", $6);
1090 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1091 csm->set_mus_property ("element", t->self_scm ());
1092 scm_gc_unprotect_object (t->self_scm ());
1095 $$->set_spot (THIS->here_input ());
1097 csm-> set_mus_property ("context-type", $2);
1103 | bare_int { $$ = gh_int2scm ($1); }
1104 | embedded_scm { $$ = $1; }
1111 } /*cont */ simple_element post_requests {
1112 Music_sequence *l = dynamic_cast<Music_sequence*> ($3);
1115 for (int i=0; i < $1->size (); i++) {
1116 Music * m = $1->elem (i);
1117 l->append_music (m);
1129 $$ = new Request_chord (SCM_EOL);
1130 $$->set_mus_property ("elements", gh_cons ($1->self_scm (), SCM_EOL));
1131 scm_gc_unprotect_object ($1->self_scm());
1133 $$-> set_spot (THIS->here_input ());
1134 $1-> set_spot (THIS->here_input ());
1137 Span_req *l = new Span_req;
1138 l->set_span_dir (START);
1139 l->set_mus_property ("span-type", ly_str02scm ("ligature"));
1140 l->set_spot (THIS->here_input ());
1142 $$ = new Request_chord (SCM_EOL);
1143 $$->set_mus_property ("elements", gh_cons (l->self_scm (), SCM_EOL));
1144 scm_gc_unprotect_object (l->self_scm());
1145 $$->set_spot (THIS->here_input ());
1148 Span_req *l = new Span_req;
1149 l->set_span_dir (STOP);
1150 l->set_mus_property ("span-type", ly_str02scm ("ligature"));
1151 l->set_spot (THIS->here_input ());
1153 $$ = new Request_chord (SCM_EOL);
1154 $$->set_mus_property ("elements", gh_cons (l->self_scm (), SCM_EOL));
1155 $$->set_spot (THIS->here_input ());
1156 scm_gc_unprotect_object (l->self_scm());
1160 $$ = new Music (gh_list (gh_cons (ly_symbol2scm ("name"), ly_symbol2scm ("separator")), SCM_UNDEFINED));
1161 $$->set_spot (THIS->here_input ());
1165 extern Music * get_barcheck();
1166 $$ = get_barcheck ();
1167 $$->set_spot (THIS->here_input ());
1170 Music *t = set_property_music (ly_symbol2scm ("whichBar"), $2);
1172 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1173 csm->set_mus_property ("element", t->self_scm ());
1174 scm_gc_unprotect_object (t->self_scm ());
1177 $$->set_spot (THIS->here_input ());
1179 csm->set_mus_property ("context-type", ly_str02scm ("Score"));
1181 | PARTIAL duration_length {
1182 Moment m = - unsmob_duration ($2)->length_mom ();
1183 Music * p = set_property_music (ly_symbol2scm ( "measurePosition"),m.smobbed_copy ());
1185 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1186 sp->set_mus_property ("element", p->self_scm ());
1187 scm_gc_unprotect_object (p->self_scm ());
1190 sp-> set_mus_property ("context-type", ly_str02scm ( "Score"));
1193 SCM func = scm_primitive_eval (ly_symbol2scm ("clef-name-to-properties"));
1194 SCM result = gh_call1 (func, $2);
1197 for (SCM s = result ; gh_pair_p (s); s = ly_cdr (s)) {
1198 Music * p = new Music (SCM_EOL);
1199 set_music_properties (p, ly_car (s));
1200 l = gh_cons (p->self_scm (), l);
1201 scm_gc_unprotect_object (p->self_scm ());
1203 Sequential_music * seq = new Sequential_music (SCM_EOL);
1204 seq->set_mus_property ("elements", l);
1206 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1207 sp->set_mus_property ("element", seq->self_scm ());
1208 scm_gc_unprotect_object (seq->self_scm ());
1211 sp-> set_mus_property ("context-type", ly_str02scm ("Staff"));
1214 Music * p1 = set_property_music (ly_symbol2scm ( "timeSignatureFraction"), $2);
1216 int l = gh_scm2int (ly_car ($2));
1217 int o = gh_scm2int (ly_cdr ($2));
1219 Moment one_beat = Moment (1)/Moment (o);
1220 Moment len = Moment (l) * one_beat;
1223 Music *p2 = set_property_music (ly_symbol2scm ("measureLength"), len.smobbed_copy ());
1224 Music *p3 = set_property_music (ly_symbol2scm ("beatLength"), one_beat.smobbed_copy ());
1226 SCM list = scm_list_n (p1->self_scm (), p2->self_scm (), p3->self_scm(), SCM_UNDEFINED);
1227 Sequential_music *seq = new Sequential_music (SCM_EOL);
1228 seq->set_mus_property ("elements", list);
1231 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1232 sp->set_mus_property ("element", seq->self_scm ());
1236 scm_gc_unprotect_object (p3->self_scm ());
1237 scm_gc_unprotect_object (p2->self_scm ());
1238 scm_gc_unprotect_object (p1->self_scm ());
1239 scm_gc_unprotect_object (seq->self_scm ());
1244 TODO: should make alias TimingContext for Score
1247 sp-> set_mus_property ("context-type", ly_str02scm ( "Score"));
1252 shorthand_command_req { $$ = $1; }
1253 | verbose_command_req { $$ = $1; }
1256 shorthand_command_req:
1267 Span_req*b= new Span_req;
1268 b->set_span_dir (START);
1269 b->set_mus_property ("span-type", ly_str02scm ("beam"));
1273 THIS->last_beam_start_ = b->self_scm ();
1276 Span_req*b= new Span_req;
1277 b->set_span_dir ( STOP);
1278 b->set_mus_property ("span-type", ly_str02scm ("beam"));
1282 $$ = new Breathing_sign_req;
1285 $$ = new Porrectus_req;
1289 verbose_command_req:
1290 COMMANDSPANREQUEST bare_int STRING { /*TODO: junkme */
1291 Span_req * sp_p = new Span_req;
1292 sp_p-> set_span_dir ( Direction ($2));
1293 sp_p->set_mus_property ("span-type",$3);
1294 sp_p->set_spot (THIS->here_input ());
1298 Mark_req * m = new Mark_req;
1302 Mark_req *m = new Mark_req;
1303 m->set_mus_property ("label", $2);
1308 Break_req * b = new Break_req;
1310 if (!gh_number_p (s))
1313 b->set_mus_property ("penalty", s);
1314 b->set_spot (THIS->here_input ());
1317 | SKIP duration_length {
1318 Skip_req * skip_p = new Skip_req;
1319 skip_p->set_mus_property ("duration", $2);
1327 Key_change_req *key_p= new Key_change_req;
1330 | KEY NOTENAME_PITCH SCM_IDENTIFIER {
1331 Key_change_req *key_p= new Key_change_req;
1333 key_p->set_mus_property ("pitch-alist", $3);
1334 ((Music*)key_p)->transpose (* unsmob_pitch ($2));
1341 $$ = new Link_array<Request>;
1343 | post_requests post_request {
1344 $2->set_spot (THIS->here_input ());
1356 request_that_take_dir:
1359 | script_abbreviation {
1360 SCM s = THIS->lexer_p_->lookup_identifier ("dash" + ly_scm2string ($1));
1361 Articulation_req *a = new Articulation_req;
1362 if (gh_string_p (s))
1363 a->set_mus_property ("articulation-type", s);
1364 else THIS->parser_error (_ ("Expecting string as script definition"));
1370 script_dir request_that_take_dir {
1371 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1372 gs->set_direction (Direction ($1));
1374 $2->origin ()->warning (_ ("Can't specify direction for this request"));
1380 REQUEST_IDENTIFIER {
1381 $$ = dynamic_cast<Request*> (unsmob_music ($1)->clone ());
1382 $$->set_spot (THIS->here_input ());
1384 | DYNAMICSCRIPT embedded_scm {
1386 TODO: junkme, use text-type == dynamic
1388 Text_script_req *d = new Text_script_req;
1389 SCM dyn = ly_symbol2scm ("dynamic");
1390 d->set_mus_property ("text-type" , dyn);
1391 d->set_mus_property ("text", $2);
1392 d->set_spot (THIS->here_input ());
1395 | SPANREQUEST bare_int STRING {
1396 Span_req * sp_p = new Span_req;
1397 sp_p->set_span_dir ( Direction ($2));
1398 sp_p->set_mus_property ("span-type", $3);
1399 sp_p->set_spot (THIS->here_input ());
1403 Tremolo_req* a = new Tremolo_req;
1404 a->set_spot (THIS->here_input ());
1405 a->set_mus_property ("tremolo-type", gh_int2scm ($1));
1409 Articulation_req * a = new Articulation_req;
1410 a->set_mus_property ("articulation-type", $2);
1411 a->set_spot (THIS->here_input ());
1415 duh, junk this syntax from the parser, if possible.
1418 Arpeggio_req *a = new Arpeggio_req;
1419 a->set_spot (THIS->here_input ());
1423 Glissando_req *g = new Glissando_req;
1424 g->set_spot /* No pun intended */ (THIS->here_input ());
1451 | NOTENAME_PITCH sup_quotes {
1452 Pitch p = *unsmob_pitch ($1);
1454 $$ = p.smobbed_copy ();
1456 | NOTENAME_PITCH sub_quotes {
1457 Pitch p =* unsmob_pitch ($1);
1460 $$ = p.smobbed_copy ();
1473 | TONICNAME_PITCH sup_quotes {
1474 Pitch p = *unsmob_pitch ($1);
1476 $$ = p.smobbed_copy ();
1478 | TONICNAME_PITCH sub_quotes {
1479 Pitch p =* unsmob_pitch ($1);
1482 $$ = p.smobbed_copy ();
1497 PITCH embedded_scm {
1499 if (!unsmob_pitch ($2)) {
1500 THIS->parser_error (_f ("Expecting musical-pitch value", 3));
1501 $$ = Pitch ().smobbed_copy ();
1507 DURATION embedded_scm {
1509 if (!unsmob_duration ($2))
1511 THIS->parser_error (_ ("Must have duration object"));
1512 $$ = Duration ().smobbed_copy ();
1519 if (!THIS->lexer_p_->lyric_state_b ())
1520 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1521 $$ = new Extender_req;
1527 if (!THIS->lexer_p_->lyric_state_b ())
1528 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1529 $$ = new Hyphen_req;
1534 close_request_parens {
1536 dynamic_cast<Span_req*> ($$)->set_span_dir ( START);
1540 close_request_parens:
1542 Span_req* s= new Span_req;
1544 s->set_mus_property ("span-type", ly_str02scm ( "slur"));
1545 s->set_spot (THIS->here_input());
1548 Span_req* s= new Span_req;
1550 s->set_mus_property ("span-type", ly_str02scm ( "phrasing-slur"));
1551 s->set_spot (THIS->here_input());
1554 Span_req*s =new Span_req;
1556 s->set_mus_property ("span-type", ly_str02scm ( "crescendo"));
1557 s->set_spot (THIS->here_input());
1560 Span_req*s =new Span_req;
1562 s->set_mus_property ("span-type", ly_str02scm ("decrescendo"));
1563 s->set_spot (THIS->here_input());
1569 open_request_parens {
1571 dynamic_cast<Span_req*> ($$)->set_span_dir (STOP);
1575 open_request_parens:
1577 Span_req *s = new Span_req;
1578 s->set_mus_property ("span-type", ly_str02scm ( "crescendo"));
1579 s->set_spot (THIS->here_input());
1584 Span_req* s= new Span_req;
1586 s->set_mus_property ("span-type", ly_str02scm ( "slur"));
1587 s->set_spot (THIS->here_input());
1591 Span_req* s= new Span_req;
1593 s->set_mus_property ("span-type", ly_str02scm ( "phrasing-slur"));
1594 s->set_spot (THIS->here_input());
1600 Text_script_req *t = new Text_script_req;
1601 t->set_mus_property ("text", $1);
1602 t->set_spot (THIS->here_input ());
1606 Text_script_req *t = new Text_script_req;
1607 t->set_mus_property ("text", $1);
1608 t->set_spot (THIS->here_input ());
1612 String ds = to_str ($1);
1613 Text_script_req* t = new Text_script_req;
1614 SCM finger = ly_symbol2scm ("finger");
1615 t->set_mus_property ("text", ly_str02scm (ds.ch_C ()));
1616 t->set_mus_property ("text-type" , finger);
1617 t->set_spot (THIS->here_input ());
1622 script_abbreviation:
1624 $$ = gh_str02scm ("Hat");
1627 $$ = gh_str02scm ("Plus");
1630 $$ = gh_str02scm ("Dash");
1633 $$ = gh_str02scm ("Bar");
1636 $$ = gh_str02scm ("Larger");
1639 $$ = gh_str02scm ("Dot");
1646 | '-' { $$ = CENTER; }
1651 $$ = new Link_array<Request>;
1653 | pre_requests open_request {
1665 multiplied_duration {
1668 | verbose_duration {
1673 optional_notemode_duration:
1675 Duration dd = THIS->default_duration_;
1676 $$ = dd.smobbed_copy ();
1678 THIS->beam_check ($$);
1680 | multiplied_duration {
1682 THIS->default_duration_ = *unsmob_duration ($$);
1684 THIS->beam_check ($$);
1686 | verbose_duration {
1688 THIS->default_duration_ = *unsmob_duration ($$);
1693 bare_unsigned dots {
1695 if (!is_duration_b ($1))
1696 THIS->parser_error (_f ("not a duration: %d", $1));
1700 $$ = Duration (l, $2).smobbed_copy ();
1702 | DURATION_IDENTIFIER dots {
1703 Duration *d =unsmob_duration ($1);
1704 Duration k (d->duration_log (),d->dot_count () + $2);
1705 $$ = k.smobbed_copy ();
1712 multiplied_duration:
1716 | multiplied_duration '*' bare_unsigned {
1717 $$ = unsmob_duration ($$)->compressed ( $3) .smobbed_copy ();
1719 | multiplied_duration '*' FRACTION {
1720 Rational m (gh_scm2int (ly_car ($3)), gh_scm2int (ly_cdr ($3)));
1722 $$ = unsmob_duration ($$)->compressed (m).smobbed_copy ();
1727 FRACTION { $$ = $1; }
1728 | UNSIGNED '/' UNSIGNED {
1729 $$ = gh_cons (gh_int2scm ($1), gh_int2scm ($3));
1747 | ':' bare_unsigned {
1748 if (!is_duration_b ($2))
1749 THIS->parser_error (_f ("not a duration: %d", $2));
1768 Bass_figure_req *bfr = new Bass_figure_req;
1769 $$ = bfr->self_scm();
1770 scm_gc_unprotect_object ($$);
1773 Bass_figure_req *bfr = new Bass_figure_req;
1774 $$ = bfr->self_scm();
1776 bfr->set_mus_property ("figure", gh_int2scm ($1));
1778 scm_gc_unprotect_object ($$);
1780 | bass_figure bass_mod {
1781 Music *m = unsmob_music ($1);
1783 SCM salter =m->get_mus_property ("alteration");
1784 int alter = gh_number_p( salter) ? gh_scm2int (salter) : 0;
1785 m->set_mus_property ("alteration",
1786 gh_int2scm (alter + $2));
1788 m->set_mus_property ("alteration", gh_int2scm (0));
1796 unsmob_music ($$)->set_mus_property ("bracket-start", SCM_BOOL_T);
1801 | br_bass_figure ']' {
1803 unsmob_music ($1)->set_mus_property ("bracket-stop", SCM_BOOL_T);
1811 | figure_list br_bass_figure {
1812 $$ = gh_cons ($2, $1);
1817 FIGURE_OPEN figure_list FIGURE_CLOSE {
1818 Music * m = new Request_chord (SCM_EOL);
1819 $2 = scm_reverse_x ($2, SCM_EOL);
1820 m->set_mus_property ("elements", $2);
1821 $$ = m->self_scm ();
1832 pitch exclamations questions optional_notemode_duration optional_rest {
1834 Input i = THIS->pop_spot ();
1835 if (!THIS->lexer_p_->note_state_b ())
1836 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1844 n->set_mus_property ("pitch", $1);
1845 n->set_mus_property ("duration", $4);
1849 n->set_mus_property ("cautionary", SCM_BOOL_T);
1850 if ($2 % 2 || $3 % 2)
1851 n->set_mus_property ("force-accidental", SCM_BOOL_T);
1853 Simultaneous_music*v = new Request_chord (SCM_EOL);
1854 v->set_mus_property ("elements", scm_list_n (n->self_scm (), SCM_UNDEFINED));
1855 scm_gc_unprotect_object (n->self_scm());
1861 | figure_spec optional_notemode_duration {
1862 Music * m = unsmob_music ($1);
1863 Input i = THIS->pop_spot ();
1865 for (SCM s = m->get_mus_property ("elements"); gh_pair_p (s); s = ly_cdr (s))
1867 unsmob_music (ly_car (s))->set_mus_property ("duration", $2);
1871 | RESTNAME optional_notemode_duration {
1873 Input i = THIS->pop_spot ();
1874 SCM e = SCM_UNDEFINED;
1875 if (ly_scm2string ($1) =="s") {
1877 Skip_req * skip_p = new Skip_req;
1878 skip_p->set_mus_property ("duration" ,$2);
1879 skip_p->set_spot (i);
1880 e = skip_p->self_scm ();
1883 Rest_req * rest_req_p = new Rest_req;
1884 rest_req_p->set_mus_property ("duration", $2);
1885 rest_req_p->set_spot (i);
1886 e = rest_req_p->self_scm ();
1888 Simultaneous_music* velt_p = new Request_chord (SCM_EOL);
1889 velt_p-> set_mus_property ("elements", scm_list_n (e,SCM_UNDEFINED));
1890 velt_p->set_spot (i);
1894 | MULTI_MEASURE_REST optional_notemode_duration {
1895 Input i = THIS->pop_spot ();
1897 Skip_req * sk = new Skip_req;
1898 sk->set_mus_property ("duration", $2);
1899 Span_req *sp1 = new Span_req;
1900 Span_req *sp2 = new Span_req;
1901 sp1-> set_span_dir ( START);
1902 sp2-> set_span_dir ( STOP);
1903 SCM r = ly_str02scm ("rest");
1904 sp1->set_mus_property ("span-type", r);
1905 sp2->set_mus_property ("span-type", r);
1907 Request_chord * rqc1 = new Request_chord (SCM_EOL);
1908 rqc1->set_mus_property ("elements", scm_list_n (sp1->self_scm (), SCM_UNDEFINED));
1909 Request_chord * rqc2 = new Request_chord (SCM_EOL);
1910 rqc2->set_mus_property ("elements", scm_list_n (sk->self_scm (), SCM_UNDEFINED));;
1911 Request_chord * rqc3 = new Request_chord (SCM_EOL);
1912 rqc3->set_mus_property ("elements", scm_list_n (sp2->self_scm (), SCM_UNDEFINED));;
1914 SCM ms = scm_list_n (rqc1->self_scm (), rqc2->self_scm (), rqc3->self_scm (), SCM_UNDEFINED);
1916 $$ = new Sequential_music (SCM_EOL);
1917 $$->set_mus_property ("elements", ms);
1919 | STRING optional_notemode_duration {
1920 Input i = THIS->pop_spot ();
1922 Lyric_req* lreq_p = new Lyric_req;
1923 lreq_p->set_mus_property ("text", $1);
1924 lreq_p->set_mus_property ("duration",$2);
1925 lreq_p->set_spot (i);
1926 Simultaneous_music* velt_p = new Request_chord (SCM_EOL);
1927 velt_p->set_mus_property ("elements", scm_list_n (lreq_p->self_scm (), SCM_UNDEFINED));
1932 Input i = THIS->pop_spot ();
1934 if (!THIS->lexer_p_->chord_state_b ())
1935 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1942 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
1943 $$ = Chord::get_chord ($1, $3, $4, $5, $6, $2);
1944 $$->set_spot (THIS->here_input ());
1951 | CHORD_COLON chord_notes {
1960 | chord_notes '.' chord_step {
1961 $$ = gh_append2 ($$, $3);
1969 | CHORD_CARET chord_notes {
1979 | '/' steno_tonic_pitch {
1988 | CHORD_BASS steno_tonic_pitch {
1995 $$ = gh_cons ($1, SCM_EOL);
1997 | CHORDMODIFIER_PITCH {
1998 $$ = gh_cons (unsmob_pitch ($1)->smobbed_copy (), SCM_EOL);
2000 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
2001 $$ = scm_list_n (unsmob_pitch ($1)->smobbed_copy (),
2009 m.notename_i_ = ($1 - 1) % 7;
2010 m.octave_i_ = $1 > 7 ? 1 : 0;
2011 m.alteration_i_ = 0;
2013 $$ = m.smobbed_copy ();
2015 | bare_unsigned '+' {
2017 m.notename_i_ = ($1 - 1) % 7;
2018 m.octave_i_ = $1 > 7 ? 1 : 0;
2019 m.alteration_i_ = 1;
2022 $$ = m.smobbed_copy ();
2024 | bare_unsigned CHORD_MINUS {
2026 m.notename_i_ = ($1 - 1) % 7;
2027 m.octave_i_ = $1 > 7 ? 1 : 0;
2028 m.alteration_i_ = -1;
2030 $$ = m.smobbed_copy ();
2038 number_expression '+' number_term {
2039 $$ = scm_sum ($1, $3);
2041 | number_expression '-' number_term {
2042 $$ = scm_difference ($1, $3);
2051 | number_factor '*' number_factor {
2052 $$ = scm_product ($1, $3);
2054 | number_factor '/' number_factor {
2055 $$ = scm_divide ($1, $3);
2060 '(' number_expression ')' {
2063 | '-' number_factor { /* %prec UNARY_MINUS */
2064 $$ = scm_difference ($2, SCM_UNDEFINED);
2072 $$ = gh_int2scm ($1);
2077 | NUMBER_IDENTIFIER {
2081 $$ = gh_double2scm (gh_scm2double ($1) CM );
2084 $$ = gh_double2scm (gh_scm2double ($1) PT);
2087 $$ = gh_double2scm (gh_scm2double ($1) INCH);
2090 $$ = gh_double2scm (gh_scm2double ($1) MM);
2093 $$ = gh_double2scm (gh_scm2double ($1) CHAR);
2109 if (scm_integer_p ($1) == SCM_BOOL_T)
2111 int k = gh_scm2int ($1);
2115 THIS->parser_error (_ ("need integer number arg"));
2129 | STRING_IDENTIFIER {
2132 | string '+' string {
2133 $$ = scm_string_append (scm_list_n ($1, $3, SCM_UNDEFINED));
2140 | exclamations '!' { $$ ++; }
2145 | questions '?' { $$ ++; }
2152 My_lily_parser::set_yydebug (bool )
2159 extern My_lily_parser * current_parser;
2162 My_lily_parser::do_yyparse ()
2165 current_parser = this;;
2166 yyparse ((void*)this);
2171 Should make this optional? It will also complain when you do
2175 which is entirely legitimate.
2177 Or we can scrap it. Barchecks should detect wrong durations, and
2178 skipTypesetting speeds it up a lot.
2181 My_lily_parser::beam_check (SCM dur)
2183 Duration *d = unsmob_duration (dur);
2184 if (unsmob_music (last_beam_start_) && d->duration_log () <= 2)
2186 Music * m = unsmob_music (last_beam_start_);
2187 m->origin ()->warning (_("Suspect duration found following this beam"));
2189 last_beam_start_ = SCM_EOL;