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"
42 #include "my-lily-parser.hh"
44 #include "music-list.hh"
45 #include "output-property-music-iterator.hh"
46 #include "property-iterator.hh"
47 #include "input-file-results.hh"
49 #include "relative-music.hh"
50 #include "lyric-combine-music.hh"
51 #include "transposed-music.hh"
52 #include "time-scaled-music.hh"
53 #include "repeated-music.hh"
54 #include "untransposable-music.hh"
55 #include "lilypond-input-version.hh"
56 #include "grace-music.hh"
57 #include "scm-hash.hh"
58 #include "auto-change-iterator.hh"
59 #include "un-relativable-music.hh"
61 #include "ly-modules.hh"
64 regular_identifier_b (SCM id)
66 String str = ly_scm2string (id);
67 char const *s = str.to_str0 () ;
72 v = v && isalpha (*s);
82 return t && t == 1 << intlog2 (t);
86 set_music_properties (Music *p, SCM a)
88 for (SCM k = a; gh_pair_p (k); k = ly_cdr (k))
90 p->internal_set_mus_property (ly_caar (k), ly_cdar (k));
96 #define MY_MAKE_MUSIC(x) make_music_by_name (ly_symbol2scm (x))
99 set_property_music (SCM sym, SCM value)
101 Music * p = MY_MAKE_MUSIC("PropertySet");
102 p->set_mus_property ("symbol", sym);
103 p->set_mus_property ("value", value);
108 make_span_req (SCM name)
112 proc = scm_c_eval_string ("old-span-request->event");
113 SCM m = scm_call_1 (proc, name);
114 scm_gc_protect_object (m);
115 return unsmob_music (m);
118 // needed for bison.simple's malloc () and free ()
120 // #include <malloc.h>
125 #define YYERROR_VERBOSE 1
127 #define YYPARSE_PARAM my_lily_parser
128 #define YYLEX_PARAM my_lily_parser
130 ((My_lily_parser *) my_lily_parser)
132 #define yyerror THIS->parser_error
136 /* We use SCMs to do strings, because it saves us the trouble of
137 deleting them. Let's hope that a stack overflow doesnt trigger a move
138 of the parse stack onto the heap. */
143 Link_array<Music> *reqvec;
145 String *string; // needed by the lexer as temporary scratch area.
148 Scheme_hash_table *scmhash;
149 Music_output_def * outputdef;
156 yylex (YYSTYPE *s, void * v)
158 My_lily_parser *pars = (My_lily_parser*) v;
159 My_lily_lexer * lex = pars->lexer_;
161 lex->lexval = (void*) s;
162 return lex->yylex ();
170 /* tokens which are not keywords */
180 %token CHORDMODIFIERS
188 %token GROBDESCRIPTIONS
194 %token FIGURES FIGURE_OPEN FIGURE_CLOSE
195 %token FIGURE_BRACKET_CLOSE FIGURE_BRACKET_OPEN
205 %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 <i> E_UNSIGNED
248 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET CHORD_SLASH
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 <scm> lilypond_header lilypond_header_body
278 %type <music> open_request_parens close_request_parens open_request close_request
279 %type <music> 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
287 %type <scm> identifier_init
289 %type <scm> steno_duration optional_notemode_duration multiplied_duration
290 %type <scm> verbose_duration
292 %type <reqvec> pre_requests post_requests
293 %type <music> gen_text_def
294 %type <scm> steno_pitch pitch absolute_pitch
295 %type <scm> explicit_pitch steno_tonic_pitch
297 %type <scm> chord_additions chord_subtractions chord_notes chord_step
299 %type <scm> chord_note chord_inversion chord_bass
300 %type <scm> duration_length fraction
302 %type <scm> embedded_scm scalar
303 %type <music> Music Sequential_music Simultaneous_music
304 %type <music> relative_music re_rhythmed_music part_combined_music
305 %type <music> property_def translator_change simple_property_def
306 %type <scm> Music_list
307 %type <outputdef> music_output_def_body
308 %type <music> shorthand_command_req
309 %type <music> post_request
310 %type <music> command_req verbose_command_req
311 %type <music> extender_req
312 %type <music> hyphen_req
313 %type <music> string_request
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 <music> 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_ = 1;
341 THIS->error_level_ = 1;
347 THIS->lexer_->pitchname_tab_ = $1;
349 | chordmodifiers_block {
350 THIS->lexer_->chordmodifier_tab_ = $1;
353 THIS->input_file_->header_ = $1;
356 THIS->input_file_->scores_.push ($1);
359 if (dynamic_cast<Paper_def*> ($1))
360 THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultpaper"), $1->self_scm ());
361 else if (dynamic_cast<Midi_def*> ($1))
362 THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultmidi"), $1->self_scm ());
375 chordmodifiers_block:
376 CHORDMODIFIERS notenames_body { $$ = $2; }
380 PITCHNAMES notenames_body { $$ = $2; }
385 int i = scm_ilength ($1);
387 SCM tab = scm_make_vector (gh_int2scm (i), SCM_EOL);
388 for (SCM s = $1; gh_pair_p (s); s = ly_cdr (s)) {
389 SCM pt = ly_cdar (s);
390 if (!unsmob_pitch (pt))
391 THIS->parser_error ("Need pitch object.");
393 scm_hashq_set_x (tab, ly_caar (s), pt);
400 lilypond_header_body:
402 $$ = ly_make_anonymous_module ();
403 THIS->lexer_->add_scope ($$);
405 | lilypond_header_body assignment {
411 HEADER '{' lilypond_header_body '}' {
412 $$ = THIS->lexer_-> remove_scope();
424 /* cont */ '=' identifier_init {
427 Should find generic way of associating input with objects.
429 Input ip = THIS->pop_spot ();
431 if (! regular_identifier_b ($1))
433 ip.warning (_ ("Identifier should have alphabetic characters only"));
436 THIS->lexer_->set_identifier ($1, $4);
439 TODO: devise standard for protection in parser.
441 The parser stack lives on the C-stack, which means that
442 all objects can be unprotected as soon as they're here.
452 $$ = $1->self_scm ();
453 scm_gc_unprotect_object ($$);
456 $$ = $1->self_scm ();
457 scm_gc_unprotect_object ($$);
459 | translator_spec_block {
463 $$ = $1->self_scm ();
464 scm_gc_unprotect_object ($$);
467 $$ = $1->self_scm ();
468 scm_gc_unprotect_object ($$);
473 | number_expression {
484 translator_spec_block:
485 TRANSLATOR '{' translator_spec_body '}'
491 translator_spec_body:
492 TRANSLATOR_IDENTIFIER {
493 $$ = unsmob_translator_def ($1)->clone_scm ();
494 unsmob_translator_def ($$)-> set_spot (THIS->here_input ());
497 $$ = Translator_def::make_scm ();
498 Translator_def*td = unsmob_translator_def ($$);
499 td->translator_group_type_ = $2;
500 td->set_spot (THIS->here_input ());
502 | translator_spec_body STRING '=' embedded_scm {
503 unsmob_translator_def ($$)->add_property_assign ($2, $4);
505 | translator_spec_body STRING OVERRIDE embedded_scm '=' embedded_scm {
506 unsmob_translator_def ($$)
507 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
509 | translator_spec_body STRING SET embedded_scm '=' embedded_scm {
510 unsmob_translator_def ($$)
511 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
513 | translator_spec_body STRING REVERT embedded_scm {
514 unsmob_translator_def ($$)->add_pop_property (
515 scm_string_to_symbol ($2), $4);
517 | translator_spec_body NAME STRING {
518 unsmob_translator_def ($$)->type_name_ = $3;
520 | translator_spec_body CONSISTS STRING {
521 unsmob_translator_def ($$)->add_element ($3);
523 | translator_spec_body ALIAS STRING {
524 Translator_def*td = unsmob_translator_def ($$);
525 td->type_aliases_ = scm_cons ($3, td->type_aliases_);
527 | translator_spec_body GROBDESCRIPTIONS embedded_scm {
528 Translator_def*td = unsmob_translator_def($$);
529 // td->add_property_assign (ly_symbol2scm ("allGrobDescriptions"), $3);
530 for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p))
531 td->add_property_assign (scm_symbol_to_string (ly_caar (p)), ly_cdar (p));
533 | translator_spec_body CONSISTSEND STRING {
534 unsmob_translator_def ($$)->add_last_element ( $3);
536 | translator_spec_body ACCEPTS STRING {
537 unsmob_translator_def ($$)->set_acceptor ($3,true);
539 | translator_spec_body DENIES STRING {
540 unsmob_translator_def ($$)->set_acceptor ($3,false);
542 | translator_spec_body REMOVE STRING {
543 unsmob_translator_def ($$)->remove_element ($3);
554 /*cont*/ '{' score_body '}' {
557 if (!$$->defs_.size ())
559 Music_output_def *id =
560 unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
561 $$->add_output (id ? id->clone () : new Paper_def );
570 $$->set_spot (THIS->here_input ());
571 SCM m = $1->self_scm ();
572 scm_gc_unprotect_object (m);
577 SCM check_funcs = scm_c_eval_string ("toplevel-music-functions");
578 for (; gh_pair_p (check_funcs); check_funcs = gh_cdr (check_funcs))
579 m = gh_call1 (gh_car (check_funcs), m);
584 $$ = new Score (*unsmob_score ($1));
585 $$->set_spot (THIS->here_input ());
587 | score_body lilypond_header {
590 | score_body output_def {
603 music_output_def_body '}' {
605 THIS-> lexer_-> remove_scope ();
609 music_output_def_body:
611 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultmidi"));
616 p = dynamic_cast<Midi_def*> (id->clone ());
621 THIS->lexer_->add_scope (p->scope_);
624 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
627 p = dynamic_cast<Paper_def*> (id->clone ());
630 THIS-> lexer_->add_scope (p->scope_);
633 | PAPER '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
634 Music_output_def *p = unsmob_music_output_def ($3);
636 THIS->lexer_->add_scope (p->scope_);
639 | MIDI '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
640 Music_output_def *p = unsmob_music_output_def ($3);
643 THIS->lexer_->add_scope (p->scope_);
646 | music_output_def_body assignment {
649 | music_output_def_body translator_spec_block {
650 $$->assign_translator ($2);
652 | music_output_def_body STYLESHEET embedded_scm {
653 dynamic_cast<Paper_def*> ($$)-> style_sheet_ = $3;
655 | music_output_def_body tempo_request {
657 junk this ? there already is tempo stuff in
660 int m = gh_scm2int ( $2->get_mus_property ("metronome-count"));
661 Duration *d = unsmob_duration ($2->get_mus_property ("duration"));
662 Midi_def * md = dynamic_cast<Midi_def*> ($$);
664 md->set_tempo (d->get_length (), m);
666 | music_output_def_body error {
672 TEMPO steno_duration '=' bare_unsigned {
673 $$ = MY_MAKE_MUSIC("TempoEvent");
674 $$->set_mus_property ("duration", $2);
675 $$->set_mus_property ("metronome-count", gh_int2scm ( $4));
680 The representation of a list is the
684 to have efficient append.
686 Music_list: /* empty */ {
687 $$ = scm_cons (SCM_EOL, SCM_EOL);
691 SCM c = scm_cons ($2->self_scm (), SCM_EOL);
692 scm_gc_unprotect_object ($2->self_scm ()); /* UGH */
693 if (gh_pair_p (ly_cdr (s)))
694 gh_set_cdr_x (ly_cdr (s), c); /* append */
696 gh_set_car_x (s, c); /* set first cons */
697 gh_set_cdr_x (s, c) ; /* remember last cell */
713 | ALTERNATIVE '{' Music_list '}' {
719 REPEAT string bare_unsigned Music Alternative_music
723 SCM alts = gh_pair_p ($5) ? gh_car ($5) : SCM_EOL;
724 if (times < scm_ilength (alts)) {
725 unsmob_music (gh_car (alts))
726 ->origin ()->warning (
727 _("More alternatives than repeats. Junking excess alternatives."));
728 alts = ly_truncate_list (times, alts);
734 proc = scm_c_eval_string ("make-repeated-music");
736 SCM mus = scm_call_1 (proc, $2);
737 scm_gc_protect_object (mus); // UGH.
738 Music *r =unsmob_music (mus);
741 r-> set_mus_property ("element", beg->self_scm ());
742 scm_gc_unprotect_object (beg->self_scm ());
744 r->set_mus_property ("repeat-count", gh_int2scm (times >? 1));
746 r-> set_mus_property ("elements",alts);
747 if (gh_equal_p ($2, scm_makfrom0str ("tremolo")))
750 we can not get durations and other stuff correct down the line, so we have to
751 add to the duration log here.
753 SCM func = scm_primitive_eval (ly_symbol2scm ("shift-duration-log"));
755 gh_call3 (func, r->self_scm (), gh_int2scm(-intlog2 ($3*2/3)),gh_int2scm(1));
757 gh_call3 (func, r->self_scm (), gh_int2scm(-intlog2 ($3)), gh_int2scm(0));
759 r->set_spot (*$4->origin ());
766 SEQUENTIAL '{' Music_list '}' {
767 $$ = MY_MAKE_MUSIC("SequentialMusic");
768 $$->set_mus_property ("elements", ly_car ($3));
769 $$->set_spot(THIS->here_input());
771 | '{' Music_list '}' {
772 $$ = MY_MAKE_MUSIC("SequentialMusic");
773 $$->set_mus_property ("elements", ly_car ($2));
774 $$->set_spot(THIS->here_input());
779 SIMULTANEOUS '{' Music_list '}'{
780 $$ = MY_MAKE_MUSIC("SimultaneousMusic");
781 $$->set_mus_property ("elements", ly_car ($3));
782 $$->set_spot(THIS->here_input());
785 | '<' Music_list '>' {
786 $$ = MY_MAKE_MUSIC("SimultaneousMusic");
787 $$->set_mus_property ("elements", ly_car ($2));
788 $$->set_spot(THIS->here_input());
793 request_chord { $$ = $1; }
794 | OUTPUTPROPERTY embedded_scm embedded_scm '=' embedded_scm {
796 if (!gh_symbol_p ($3))
798 THIS->parser_error (_ ("Second argument must be a symbol"));
800 /* Should check # args */
801 if (!gh_procedure_p (pred))
803 THIS->parser_error (_ ("First argument must be a procedure taking one argument"));
806 Music*m = MY_MAKE_MUSIC("OutputPropertySetMusic");
807 m->set_mus_property ("predicate", pred);
808 m->set_mus_property ("grob-property", $3);
809 m->set_mus_property ("grob-value", $5);
814 $$ = unsmob_music ($1)->clone ();
816 $$->set_spot (THIS->here_input());
824 CONTEXT STRING Music {
825 Music*csm =MY_MAKE_MUSIC("ContextSpeccedMusic");
827 csm->set_mus_property ("element", $3->self_scm ());
828 scm_gc_unprotect_object ($3->self_scm ());
830 csm->set_mus_property ("context-type",$2);
831 csm->set_mus_property ("context-id", scm_makfrom0str (""));
835 | AUTOCHANGE STRING Music {
836 Music*chm = MY_MAKE_MUSIC("AutoChangeMusic");
837 chm->set_mus_property ("element", $3->self_scm ());
839 scm_gc_unprotect_object ($3->self_scm ());
840 chm->set_mus_property ("what", $2);
843 chm->set_spot (*$3->origin ());
848 The other version is for easier debugging of
849 Sequential_music_iterator in combination with grace notes.
852 SCM start = THIS->lexer_->lookup_identifier ("startGraceMusic");
853 SCM stop = THIS->lexer_->lookup_identifier ("stopGraceMusic");
854 Music *startm = unsmob_music (start);
855 Music *stopm = unsmob_music (stop);
859 stopm = stopm->clone ();
860 ms = scm_cons (stopm->self_scm (), ms);
861 scm_gc_unprotect_object (stopm->self_scm ());
863 ms = scm_cons ($2->self_scm (), ms);
864 scm_gc_unprotect_object ($2->self_scm());
866 startm = startm->clone ();
867 ms = scm_cons (startm->self_scm () , ms);
868 scm_gc_unprotect_object (startm->self_scm ());
872 Music* seq = MY_MAKE_MUSIC("SequentialMusic");
873 seq->set_mus_property ("elements", ms);
876 $$ = MY_MAKE_MUSIC("GraceMusic");
877 $$->set_mus_property ("element", seq->self_scm ());
878 scm_gc_unprotect_object (seq->self_scm ());
880 $$ = MY_MAKE_MUSIC("GraceMusic");
881 $$->set_mus_property ("element", $2->self_scm ());
882 scm_gc_unprotect_object ($2->self_scm ());
885 | CONTEXT string '=' string Music {
886 Music * csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
888 csm->set_mus_property ("element", $5->self_scm ());
889 scm_gc_unprotect_object ($5->self_scm ());
891 csm->set_mus_property ("context-type", $2);
892 csm->set_mus_property ("context-id", $4);
903 int n = gh_scm2int (ly_car ($3)); int d = gh_scm2int (ly_cdr ($3));
905 $$= MY_MAKE_MUSIC("TimeScaledMusic");
906 $$->set_spot (THIS->pop_spot ());
909 $$->set_mus_property ("element", mp->self_scm ());
910 scm_gc_unprotect_object (mp->self_scm ());
911 $$->set_mus_property ("numerator", gh_int2scm (n));
912 $$->set_mus_property ("denominator", gh_int2scm (d));
913 $$->compress (Moment (Rational (n,d)));
916 | Repeated_music { $$ = $1; }
917 | Simultaneous_music { $$ = $1; }
918 | Sequential_music { $$ = $1; }
919 | TRANSPOSE pitch Music {
920 $$ = MY_MAKE_MUSIC("TransposedMusic");
922 Pitch pit = *unsmob_pitch ($2);
925 $$->set_mus_property ("element", p->self_scm ());
926 scm_gc_unprotect_object (p->self_scm ());
928 | TRANSPOSE steno_tonic_pitch Music {
929 $$ = MY_MAKE_MUSIC("TransposedMusic");
931 Pitch pit = *unsmob_pitch ($2);
934 $$->set_mus_property ("element", p->self_scm ());
935 scm_gc_unprotect_object (p->self_scm ());
938 | APPLY embedded_scm Music {
939 SCM ret = gh_call1 ($2, $3->self_scm ());
940 Music *m = unsmob_music (ret);
942 THIS->parser_error ("\\apply must return a Music");
943 m = MY_MAKE_MUSIC("Music");
948 { THIS->lexer_->push_note_state (); }
951 THIS->lexer_->pop_state ();
954 { THIS->lexer_->push_figuredbass_state (); }
957 Music * chm = MY_MAKE_MUSIC("UntransposableMusic");
958 chm->set_mus_property ("element", $3->self_scm ());
960 scm_gc_unprotect_object ($3->self_scm());
962 THIS->lexer_->pop_state ();
965 { THIS->lexer_->push_chord_state (); }
968 Music * chm = MY_MAKE_MUSIC("UnrelativableMusic");
969 chm->set_mus_property ("element", $3->self_scm ());
970 scm_gc_unprotect_object ($3->self_scm());
973 THIS->lexer_->pop_state ();
976 { THIS->lexer_->push_lyric_state (); }
980 THIS->lexer_->pop_state ();
982 | relative_music { $$ = $1; }
983 | re_rhythmed_music { $$ = $1; }
984 | part_combined_music { $$ = $1; }
988 RELATIVE absolute_pitch Music {
990 Pitch pit = *unsmob_pitch ($2);
991 $$ = MY_MAKE_MUSIC("RelativeOctaveMusic");
993 $$->set_mus_property ("element", p->self_scm ());
994 scm_gc_unprotect_object (p->self_scm ());
996 $$->set_mus_property ("last-pitch", p->to_relative_octave (pit).smobbed_copy ());
1002 ADDLYRICS Music Music {
1003 Music*l =MY_MAKE_MUSIC("LyricCombineMusic");
1004 l->set_mus_property ("elements", gh_list ($2->self_scm (), $3->self_scm (), SCM_UNDEFINED));
1005 scm_gc_unprotect_object ($3->self_scm ());
1006 scm_gc_unprotect_object ($2->self_scm ());
1011 part_combined_music:
1012 PARTCOMBINE STRING Music Music {
1013 Music * p= MY_MAKE_MUSIC("PartCombineMusic");
1014 p->set_mus_property ("what", $2);
1015 p->set_mus_property ("elements", gh_list ($3->self_scm (),$4->self_scm (), SCM_UNDEFINED));
1017 scm_gc_unprotect_object ($3->self_scm ());
1018 scm_gc_unprotect_object ($4->self_scm ());
1025 TRANSLATOR STRING '=' STRING {
1026 Music*t= MY_MAKE_MUSIC("TranslatorChange");
1027 t-> set_mus_property ("change-to-type", $2);
1028 t-> set_mus_property ("change-to-id", $4);
1031 $$->set_spot (THIS->here_input ());
1037 | ONCE simple_property_def {
1039 SCM e = $2->get_mus_property ("element");
1040 unsmob_music (e)->set_mus_property ("once", SCM_BOOL_T);
1044 simple_property_def:
1045 PROPERTY STRING '.' STRING '=' scalar {
1046 Music *t = set_property_music (scm_string_to_symbol ($4), $6);
1047 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1049 csm->set_mus_property ("element", t->self_scm ());
1050 scm_gc_unprotect_object (t->self_scm ());
1053 $$->set_spot (THIS->here_input ());
1055 csm-> set_mus_property ("context-type", $2);
1057 | PROPERTY STRING '.' STRING UNSET {
1059 Music *t = MY_MAKE_MUSIC("PropertyUnset");
1060 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1062 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1063 csm->set_mus_property ("element", t->self_scm ());
1064 scm_gc_unprotect_object (t->self_scm ());
1067 $$->set_spot (THIS->here_input ());
1069 csm-> set_mus_property ("context-type", $2);
1071 | PROPERTY STRING '.' STRING SET embedded_scm '=' embedded_scm {
1073 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1074 bool itc = internal_type_checking_global_b;
1075 Music *t = MY_MAKE_MUSIC("OverrideProperty");
1077 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1078 t->set_mus_property ("pop-first", SCM_BOOL_T);
1080 internal_type_checking_global_b = false;
1081 t->set_mus_property ("grob-property", $6);
1083 internal_type_checking_global_b = itc;
1084 t->set_mus_property ("grob-value", $8);
1086 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1087 csm->set_mus_property ("element", t->self_scm ());
1088 scm_gc_unprotect_object (t->self_scm ());
1090 $$->set_spot (THIS->here_input ());
1092 csm-> set_mus_property ("context-type", $2);
1094 | PROPERTY STRING '.' STRING OVERRIDE
1095 embedded_scm '=' embedded_scm
1101 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1102 bool itc = internal_type_checking_global_b;
1104 Music *t = MY_MAKE_MUSIC("OverrideProperty");
1105 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1107 internal_type_checking_global_b = false;
1108 t->set_mus_property ("grob-property", $6);
1109 t->set_mus_property ("grob-value", $8);
1111 internal_type_checking_global_b = itc;
1113 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1114 csm->set_mus_property ("element", t->self_scm ());
1115 scm_gc_unprotect_object (t->self_scm ());
1118 $$->set_spot (THIS->here_input ());
1120 csm-> set_mus_property ("context-type", $2);
1123 | PROPERTY STRING '.' STRING REVERT embedded_scm {
1124 Music *t = MY_MAKE_MUSIC("RevertProperty");
1126 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1127 bool itc = internal_type_checking_global_b;
1129 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1131 internal_type_checking_global_b = false;
1132 t->set_mus_property ("grob-property", $6);
1134 internal_type_checking_global_b = itc;
1136 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1137 csm->set_mus_property ("element", t->self_scm ());
1138 scm_gc_unprotect_object (t->self_scm ());
1141 $$->set_spot (THIS->here_input ());
1143 csm-> set_mus_property ("context-type", $2);
1150 | bare_int { $$ = gh_int2scm ($1); }
1151 | embedded_scm { $$ = $1; }
1158 } /*cont */ simple_element post_requests {
1159 Music_sequence *l = dynamic_cast<Music_sequence*> ($3);
1162 for (int i=0; i < $1->size (); i++) {
1163 Music * m = $1->elem (i);
1164 l->append_music (m);
1176 $$ = MY_MAKE_MUSIC("RequestChord");
1177 $$->set_mus_property ("elements", scm_cons ($1->self_scm (), SCM_EOL));
1178 scm_gc_unprotect_object ($1->self_scm());
1180 $$-> set_spot (THIS->here_input ());
1181 $1-> set_spot (THIS->here_input ());
1184 Music *l = MY_MAKE_MUSIC("LigatureEvent");
1185 l->set_mus_property ("span-direction", gh_int2scm (START));
1186 l->set_spot (THIS->here_input ());
1188 $$ = MY_MAKE_MUSIC("RequestChord");
1189 $$->set_mus_property ("elements", scm_cons (l->self_scm (), SCM_EOL));
1190 scm_gc_unprotect_object (l->self_scm());
1191 $$->set_spot (THIS->here_input ());
1194 Music *l = MY_MAKE_MUSIC("LigatureEvent");
1195 l->set_mus_property ("span-direction", gh_int2scm (STOP));
1196 l->set_spot (THIS->here_input ());
1198 $$ = MY_MAKE_MUSIC("RequestChord");
1199 $$->set_mus_property ("elements", scm_cons (l->self_scm (), SCM_EOL));
1200 $$->set_spot (THIS->here_input ());
1201 scm_gc_unprotect_object (l->self_scm());
1205 $$ = MY_MAKE_MUSIC("VoiceSeparator");
1206 $$->set_spot (THIS->here_input ());
1210 $$ = MY_MAKE_MUSIC("BarCheck");
1211 $$->set_spot (THIS->here_input ());
1214 Music *t = set_property_music (ly_symbol2scm ("whichBar"), $2);
1216 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1217 csm->set_mus_property ("element", t->self_scm ());
1218 scm_gc_unprotect_object (t->self_scm ());
1221 $$->set_spot (THIS->here_input ());
1223 csm->set_mus_property ("context-type", scm_makfrom0str ("Timing"));
1225 | PARTIAL duration_length {
1226 Moment m = - unsmob_duration ($2)->get_length ();
1227 Music * p = set_property_music (ly_symbol2scm ( "measurePosition"),m.smobbed_copy ());
1229 Music * sp = MY_MAKE_MUSIC("ContextSpeccedMusic");
1230 sp->set_mus_property ("element", p->self_scm ());
1231 scm_gc_unprotect_object (p->self_scm ());
1234 sp-> set_mus_property ("context-type", scm_makfrom0str ("Timing"));
1239 proc = scm_c_eval_string ("make-clef-set");
1241 SCM result = scm_call_1 (proc, $2);
1242 scm_gc_protect_object (result);
1243 $$ = unsmob_music (result);
1246 Music * p1 = set_property_music (ly_symbol2scm ( "timeSignatureFraction"), $2);
1248 int l = gh_scm2int (ly_car ($2));
1249 int o = gh_scm2int (ly_cdr ($2));
1251 Moment one_beat = Moment (1)/Moment (o);
1252 Moment len = Moment (l) * one_beat;
1255 Music *p2 = set_property_music (ly_symbol2scm ("measureLength"), len.smobbed_copy ());
1256 Music *p3 = set_property_music (ly_symbol2scm ("beatLength"), one_beat.smobbed_copy ());
1258 SCM list = scm_list_n (p1->self_scm (), p2->self_scm (), p3->self_scm(), SCM_UNDEFINED);
1259 Music *seq = MY_MAKE_MUSIC("SequentialMusic");
1260 seq->set_mus_property ("elements", list);
1263 Music * sp = MY_MAKE_MUSIC("ContextSpeccedMusic");
1264 sp->set_mus_property ("element", seq->self_scm ());
1266 scm_gc_unprotect_object (p3->self_scm ());
1267 scm_gc_unprotect_object (p2->self_scm ());
1268 scm_gc_unprotect_object (p1->self_scm ());
1269 scm_gc_unprotect_object (seq->self_scm ());
1273 sp-> set_mus_property ("context-type", scm_makfrom0str ( "Timing"));
1278 shorthand_command_req { $$ = $1; }
1279 | verbose_command_req { $$ = $1; }
1282 shorthand_command_req:
1290 $$ = MY_MAKE_MUSIC("TieEvent");
1293 Music *b= MY_MAKE_MUSIC("BeamEvent");
1294 b->set_mus_property ("span-direction", gh_int2scm (START))
1299 THIS->last_beam_start_ = b->self_scm ();
1302 Music *b= MY_MAKE_MUSIC("BeamEvent");
1303 b->set_mus_property ("span-direction", gh_int2scm (STOP));
1307 $$ = MY_MAKE_MUSIC("BreathingSignEvent");
1310 $$ = MY_MAKE_MUSIC("PorrectusEvent");
1314 verbose_command_req:
1315 COMMANDSPANREQUEST bare_int STRING {
1316 Music *sp = make_span_req ($3);
1317 sp->set_mus_property ("span-direction", gh_int2scm (Direction ($2)));
1318 sp->set_spot (THIS->here_input ());
1322 Music * m = MY_MAKE_MUSIC("MarkEvent");
1326 Music *m = MY_MAKE_MUSIC("MarkEvent");
1327 m->set_mus_property ("label", $2);
1331 Music * b = MY_MAKE_MUSIC("BreakEvent");
1333 if (!gh_number_p (s))
1336 b->set_mus_property ("penalty", s);
1337 b->set_spot (THIS->here_input ());
1340 | SKIP duration_length {
1341 Music * skip = MY_MAKE_MUSIC("SkipEvent");
1342 skip->set_mus_property ("duration", $2);
1350 Music *key= MY_MAKE_MUSIC("KeyChangeEvent");
1353 | KEY NOTENAME_PITCH SCM_IDENTIFIER {
1354 Music *key= MY_MAKE_MUSIC("KeyChangeEvent");
1356 key->set_mus_property ("pitch-alist", $3);
1357 ((Music*)key)->transpose (* unsmob_pitch ($2));
1364 $$ = new Link_array<Music>;
1366 | post_requests post_request {
1367 $2->set_spot (THIS->here_input ());
1382 Music * s = MY_MAKE_MUSIC("StringNumberEvent");
1383 s->set_mus_property ("string-number", gh_int2scm($1));
1384 s->set_spot (THIS->here_input ());
1390 request_that_take_dir:
1393 | script_abbreviation {
1394 SCM s = THIS->lexer_->lookup_identifier ("dash" + ly_scm2string ($1));
1395 Music *a = MY_MAKE_MUSIC("ArticulationEvent");
1396 if (gh_string_p (s))
1397 a->set_mus_property ("articulation-type", s);
1398 else THIS->parser_error (_ ("Expecting string as script definition"));
1404 script_dir request_that_take_dir {
1405 $2->set_mus_property ("direction", gh_int2scm ($1));
1411 REQUEST_IDENTIFIER {
1412 $$ = unsmob_music ($1)->clone ();
1413 $$->set_spot (THIS->here_input ());
1415 | DYNAMICSCRIPT embedded_scm {
1417 TODO: junkme, use text-type == dynamic
1419 Music *d = MY_MAKE_MUSIC("TextScriptEvent");
1420 SCM dyn = ly_symbol2scm ("dynamic");
1421 d->set_mus_property ("text-type" , dyn);
1422 d->set_mus_property ("text", $2);
1423 d->set_spot (THIS->here_input ());
1426 | SPANREQUEST bare_int STRING {
1428 Music * sp = make_span_req ($3);
1429 sp->set_mus_property ("span-direction", gh_int2scm ( $2));
1430 sp->set_spot (THIS->here_input ());
1434 Music * a = MY_MAKE_MUSIC("TremoloEvent");
1435 a->set_spot (THIS->here_input ());
1436 a->set_mus_property ("tremolo-type", gh_int2scm ($1));
1440 Music * a = MY_MAKE_MUSIC("ArticulationEvent");
1441 a->set_mus_property ("articulation-type", $2);
1442 a->set_spot (THIS->here_input ());
1447 duh, junk this syntax from the parser, if possible.
1450 Music *a = MY_MAKE_MUSIC("ArpeggioEvent");
1451 a->set_spot (THIS->here_input ());
1455 Music *g = MY_MAKE_MUSIC("GlissandoEvent");
1456 g->set_spot /* No pun intended */ (THIS->here_input ());
1483 | NOTENAME_PITCH sup_quotes {
1484 Pitch p = *unsmob_pitch ($1);
1486 $$ = p.smobbed_copy ();
1488 | NOTENAME_PITCH sub_quotes {
1489 Pitch p =* unsmob_pitch ($1);
1492 $$ = p.smobbed_copy ();
1505 | TONICNAME_PITCH sup_quotes {
1506 Pitch p = *unsmob_pitch ($1);
1508 $$ = p.smobbed_copy ();
1510 | TONICNAME_PITCH sub_quotes {
1511 Pitch p =* unsmob_pitch ($1);
1514 $$ = p.smobbed_copy ();
1529 PITCH embedded_scm {
1531 if (!unsmob_pitch ($2)) {
1532 THIS->parser_error (_f ("Expecting musical-pitch value", 3));
1533 $$ = Pitch ().smobbed_copy ();
1539 DURATION embedded_scm {
1541 if (!unsmob_duration ($2))
1543 THIS->parser_error (_ ("Must have duration object"));
1544 $$ = Duration ().smobbed_copy ();
1551 if (!THIS->lexer_->lyric_state_b ())
1552 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1553 $$ = MY_MAKE_MUSIC("ExtenderEvent");
1559 if (!THIS->lexer_->lyric_state_b ())
1560 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1561 $$ = MY_MAKE_MUSIC("HyphenEvent");
1566 close_request_parens {
1568 dynamic_cast<Music *> ($$)->set_mus_property ("span-direction", gh_int2scm (START))
1573 close_request_parens:
1575 Music * s= MY_MAKE_MUSIC("SlurEvent");
1577 s->set_spot (THIS->here_input());
1580 Music * s= MY_MAKE_MUSIC("PhrasingSlurEvent");
1582 s->set_spot (THIS->here_input());
1585 Music *s =MY_MAKE_MUSIC("CrescendoEvent");
1587 s->set_spot (THIS->here_input());
1590 Music *s =MY_MAKE_MUSIC("DecrescendoEvent");
1592 s->set_spot (THIS->here_input());
1598 open_request_parens {
1600 dynamic_cast<Music *> ($$)->set_mus_property ("span-direction", gh_int2scm (STOP))
1605 open_request_parens:
1607 Music *s = MY_MAKE_MUSIC("CrescendoEvent");
1608 s->set_spot (THIS->here_input());
1613 Music * s= MY_MAKE_MUSIC("SlurEvent");
1615 s->set_spot (THIS->here_input());
1619 Music * s= MY_MAKE_MUSIC("PhrasingSlurEvent");
1621 s->set_mus_property ("span-type", scm_makfrom0str ( "phrasing-slur"));
1622 s->set_spot (THIS->here_input());
1628 Music *t = MY_MAKE_MUSIC("TextScriptEvent");
1629 t->set_mus_property ("text", $1);
1630 t->set_spot (THIS->here_input ());
1634 Music *t = MY_MAKE_MUSIC("TextScriptEvent");
1635 t->set_mus_property ("text", $1);
1636 t->set_spot (THIS->here_input ());
1640 String ds = to_string ($1);
1641 Music * t = MY_MAKE_MUSIC("TextScriptEvent");
1642 SCM finger = ly_symbol2scm ("finger");
1643 t->set_mus_property ("text", scm_makfrom0str (ds.to_str0 ()));
1644 t->set_mus_property ("text-type" , finger);
1645 t->set_spot (THIS->here_input ());
1650 script_abbreviation:
1652 $$ = scm_makfrom0str ("Hat");
1655 $$ = scm_makfrom0str ("Plus");
1658 $$ = scm_makfrom0str ("Dash");
1661 $$ = scm_makfrom0str ("Bar");
1664 $$ = scm_makfrom0str ("Larger");
1667 $$ = scm_makfrom0str ("Dot");
1670 $$ = scm_makfrom0str ("Underscore");
1677 | '-' { $$ = CENTER; }
1682 $$ = new Link_array<Music>;
1684 | pre_requests open_request {
1696 multiplied_duration {
1699 | verbose_duration {
1704 optional_notemode_duration:
1706 Duration dd = THIS->default_duration_;
1707 $$ = dd.smobbed_copy ();
1709 THIS->beam_check ($$);
1711 | multiplied_duration {
1713 THIS->default_duration_ = *unsmob_duration ($$);
1715 THIS->beam_check ($$);
1717 | verbose_duration {
1719 THIS->default_duration_ = *unsmob_duration ($$);
1724 bare_unsigned dots {
1726 if (!is_duration_b ($1))
1727 THIS->parser_error (_f ("not a duration: %d", $1));
1731 $$ = Duration (l, $2).smobbed_copy ();
1733 | DURATION_IDENTIFIER dots {
1734 Duration *d =unsmob_duration ($1);
1735 Duration k (d->duration_log (),d->dot_count () + $2);
1736 $$ = k.smobbed_copy ();
1743 multiplied_duration:
1747 | multiplied_duration '*' bare_unsigned {
1748 $$ = unsmob_duration ($$)->compressed ( $3) .smobbed_copy ();
1750 | multiplied_duration '*' FRACTION {
1751 Rational m (gh_scm2int (ly_car ($3)), gh_scm2int (ly_cdr ($3)));
1753 $$ = unsmob_duration ($$)->compressed (m).smobbed_copy ();
1758 FRACTION { $$ = $1; }
1759 | UNSIGNED '/' UNSIGNED {
1760 $$ = scm_cons (gh_int2scm ($1), gh_int2scm ($3));
1778 | ':' bare_unsigned {
1779 if (!is_duration_b ($2))
1780 THIS->parser_error (_f ("not a duration: %d", $2));
1799 Music *bfr = MY_MAKE_MUSIC("BassFigureEvent");
1800 $$ = bfr->self_scm();
1801 scm_gc_unprotect_object ($$);
1804 Music *bfr = MY_MAKE_MUSIC("BassFigureEvent");
1805 $$ = bfr->self_scm();
1807 bfr->set_mus_property ("figure", gh_int2scm ($1));
1809 scm_gc_unprotect_object ($$);
1811 | bass_figure bass_mod {
1812 Music *m = unsmob_music ($1);
1814 SCM salter =m->get_mus_property ("alteration");
1815 int alter = gh_number_p ( salter) ? gh_scm2int (salter) : 0;
1816 m->set_mus_property ("alteration",
1817 gh_int2scm (alter + $2));
1819 m->set_mus_property ("alteration", gh_int2scm (0));
1827 unsmob_music ($$)->set_mus_property ("bracket-start", SCM_BOOL_T);
1832 | br_bass_figure ']' {
1834 unsmob_music ($1)->set_mus_property ("bracket-stop", SCM_BOOL_T);
1842 | figure_list br_bass_figure {
1843 $$ = scm_cons ($2, $1);
1848 FIGURE_OPEN figure_list FIGURE_CLOSE {
1849 Music * m = MY_MAKE_MUSIC("RequestChord");
1850 $2 = scm_reverse_x ($2, SCM_EOL);
1851 m->set_mus_property ("elements", $2);
1852 $$ = m->self_scm ();
1863 pitch exclamations questions optional_notemode_duration optional_rest {
1865 Input i = THIS->pop_spot ();
1866 if (!THIS->lexer_->note_state_b ())
1867 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1871 n = MY_MAKE_MUSIC("RestEvent");
1873 n = MY_MAKE_MUSIC("NoteEvent");
1875 n->set_mus_property ("pitch", $1);
1876 n->set_mus_property ("duration", $4);
1880 n->set_mus_property ("cautionary", SCM_BOOL_T);
1881 if ($2 % 2 || $3 % 2)
1882 n->set_mus_property ("force-accidental", SCM_BOOL_T);
1884 Music *v = MY_MAKE_MUSIC("RequestChord");
1885 v->set_mus_property ("elements", scm_list_n (n->self_scm (), SCM_UNDEFINED));
1886 scm_gc_unprotect_object (n->self_scm());
1892 | figure_spec optional_notemode_duration {
1893 Music * m = unsmob_music ($1);
1894 Input i = THIS->pop_spot ();
1896 for (SCM s = m->get_mus_property ("elements"); gh_pair_p (s); s = ly_cdr (s))
1898 unsmob_music (ly_car (s))->set_mus_property ("duration", $2);
1902 | RESTNAME optional_notemode_duration {
1904 Input i = THIS->pop_spot ();
1905 SCM e = SCM_UNDEFINED;
1906 if (ly_scm2string ($1) =="s") {
1908 Music * skip = MY_MAKE_MUSIC("SkipEvent");
1909 skip->set_mus_property ("duration" ,$2);
1911 e = skip->self_scm ();
1914 Music * rest_req = MY_MAKE_MUSIC("RestEvent");
1915 rest_req->set_mus_property ("duration", $2);
1916 rest_req->set_spot (i);
1917 e = rest_req->self_scm ();
1919 Music * velt = MY_MAKE_MUSIC("RequestChord");
1920 velt-> set_mus_property ("elements", scm_list_n (e,SCM_UNDEFINED));
1925 | MULTI_MEASURE_REST optional_notemode_duration {
1928 Music * sk = MY_MAKE_MUSIC("SkipEvent");
1929 sk->set_mus_property ("duration", $2);
1930 Music *sp1 = MY_MAKE_MUSIC("MultiMeasureRestEvent");
1931 Music *sp2 = MY_MAKE_MUSIC("MultiMeasureRestEvent");
1932 sp1-> set_mus_property ("span-direction", gh_int2scm (START))
1934 sp2-> set_mus_property ("span-direction", gh_int2scm (STOP))
1936 Music *rqc1 = MY_MAKE_MUSIC("RequestChord");
1937 rqc1->set_mus_property ("elements", scm_list_n (sp1->self_scm (), SCM_UNDEFINED));
1938 Music *rqc2 = MY_MAKE_MUSIC("RequestChord");
1939 rqc2->set_mus_property ("elements", scm_list_n (sk->self_scm (), SCM_UNDEFINED));;
1940 Music *rqc3 = MY_MAKE_MUSIC("RequestChord");
1941 rqc3->set_mus_property ("elements", scm_list_n (sp2->self_scm (), SCM_UNDEFINED));;
1943 SCM ms = scm_list_n (rqc1->self_scm (), rqc2->self_scm (), rqc3->self_scm (), SCM_UNDEFINED);
1945 $$ = MY_MAKE_MUSIC("SequentialMusic");
1946 $$->set_mus_property ("elements", ms);
1948 | STRING optional_notemode_duration {
1949 Input i = THIS->pop_spot ();
1951 Music * lreq = MY_MAKE_MUSIC("LyricEvent");
1952 lreq->set_mus_property ("text", $1);
1953 lreq->set_mus_property ("duration",$2);
1955 Music * velt = MY_MAKE_MUSIC("RequestChord");
1956 velt->set_mus_property ("elements", scm_list_n (lreq->self_scm (), SCM_UNDEFINED));
1963 if (!THIS->lexer_->chord_state_b ())
1964 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1971 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
1972 $$ = Chord::get_chord ($1, $3, $4, $5, $6, $2);
1973 $$->set_spot (THIS->here_input ());
1980 | CHORD_COLON chord_notes {
1989 | chord_notes '.' chord_step {
1990 $$ = gh_append2 ($$, $3);
1998 | CHORD_CARET chord_notes {
2008 | CHORD_SLASH steno_tonic_pitch {
2017 | CHORD_BASS steno_tonic_pitch {
2024 $$ = scm_cons ($1, SCM_EOL);
2026 | CHORDMODIFIER_PITCH {
2027 $$ = scm_cons (unsmob_pitch ($1)->smobbed_copy (), SCM_EOL);
2029 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
2030 $$ = scm_list_n (unsmob_pitch ($1)->smobbed_copy (),
2038 m.notename_ = ($1 - 1) % 7;
2039 m.octave_ = $1 > 7 ? 1 : 0;
2042 $$ = m.smobbed_copy ();
2044 | bare_unsigned '+' {
2046 m.notename_ = ($1 - 1) % 7;
2047 m.octave_ = $1 > 7 ? 1 : 0;
2051 $$ = m.smobbed_copy ();
2053 | bare_unsigned CHORD_MINUS {
2055 m.notename_ = ($1 - 1) % 7;
2056 m.octave_ = $1 > 7 ? 1 : 0;
2059 $$ = m.smobbed_copy ();
2067 number_expression '+' number_term {
2068 $$ = scm_sum ($1, $3);
2070 | number_expression '-' number_term {
2071 $$ = scm_difference ($1, $3);
2080 | number_factor '*' number_factor {
2081 $$ = scm_product ($1, $3);
2083 | number_factor '/' number_factor {
2084 $$ = scm_divide ($1, $3);
2089 '(' number_expression ')' {
2092 | '-' number_factor { /* %prec UNARY_MINUS */
2093 $$ = scm_difference ($2, SCM_UNDEFINED);
2101 $$ = gh_int2scm ($1);
2106 | NUMBER_IDENTIFIER {
2110 $$ = gh_double2scm (gh_scm2double ($1) CM );
2113 $$ = gh_double2scm (gh_scm2double ($1) PT);
2116 $$ = gh_double2scm (gh_scm2double ($1) INCH);
2119 $$ = gh_double2scm (gh_scm2double ($1) MM);
2122 $$ = gh_double2scm (gh_scm2double ($1) CHAR);
2138 if (scm_integer_p ($1) == SCM_BOOL_T)
2140 int k = gh_scm2int ($1);
2144 THIS->parser_error (_ ("need integer number arg"));
2158 | STRING_IDENTIFIER {
2161 | string '+' string {
2162 $$ = scm_string_append (scm_list_n ($1, $3, SCM_UNDEFINED));
2169 | exclamations '!' { $$ ++; }
2174 | questions '?' { $$ ++; }
2181 My_lily_parser::set_yydebug (bool )
2188 extern My_lily_parser * current_parser;
2191 My_lily_parser::do_yyparse ()
2194 current_parser = this;;
2195 yyparse ((void*)this);
2200 Should make this optional? It will also complain when you do
2204 which is entirely legitimate.
2206 Or we can scrap it. Barchecks should detect wrong durations, and
2207 skipTypesetting speeds it up a lot.
2210 My_lily_parser::beam_check (SCM dur)
2212 Duration *d = unsmob_duration (dur);
2213 if (unsmob_music (last_beam_start_) && d->duration_log () <= 2)
2215 Music * m = unsmob_music (last_beam_start_);
2216 m->origin ()->warning (_("Suspect duration found following this beam"));
2218 last_beam_start_ = SCM_EOL;