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
30 #include "translator-def.hh"
31 #include "lily-guile.hh"
32 #include "change-iterator.hh"
34 #include "my-lily-lexer.hh"
35 #include "paper-def.hh"
36 #include "midi-def.hh"
38 #include "file-path.hh"
40 #include "dimensions.hh"
41 #include "command-request.hh"
42 #include "musical-request.hh"
43 #include "my-lily-parser.hh"
44 #include "context-specced-music.hh"
46 #include "music-list.hh"
47 #include "output-property-music-iterator.hh"
48 #include "property-iterator.hh"
49 #include "file-results.hh"
51 #include "relative-music.hh"
52 #include "lyric-combine-music.hh"
53 #include "transposed-music.hh"
54 #include "time-scaled-music.hh"
55 #include "repeated-music.hh"
56 #include "untransposable-music.hh"
57 #include "lilypond-input-version.hh"
58 #include "grace-music.hh"
59 #include "part-combine-music.hh"
60 #include "scm-hash.hh"
61 #include "auto-change-iterator.hh"
62 #include "un-relativable-music.hh"
66 regular_identifier_b (SCM id)
68 String str = ly_scm2string (id);
69 char const *s = str.ch_C() ;
74 v = v && isalpha (*s);
82 set_property_music (SCM sym, SCM value)
84 Music * p = new Music (SCM_EOL);
85 p->set_mus_property ("symbol", sym);
86 p->set_mus_property ("iterator-ctor",
87 Property_iterator::constructor_cxx_function);
89 p->set_mus_property ("value", value);
96 return t && t == 1 << intlog2 (t);
100 set_music_properties (Music *p, SCM a)
102 for (SCM k = a; gh_pair_p (k); k = ly_cdr (k))
104 p->internal_set_mus_property (ly_caar (k), ly_cdar (k));
114 // needed for bison.simple's malloc () and free ()
121 #define YYERROR_VERBOSE 1
123 #define YYPARSE_PARAM my_lily_parser_l
124 #define YYLEX_PARAM my_lily_parser_l
126 ((My_lily_parser *) my_lily_parser_l)
128 #define yyerror THIS->parser_error
129 #define ARRAY_SIZE(a,s) if (a.size () != s) THIS->parser_error (_f ("Expecting %d arguments", s))
133 /* We use SCMs to do strings, because it saves us the trouble of
134 deleting them. Let's hope that a stack overflow doesnt trigger a move
135 of the parse stack onto the heap. */
140 Link_array<Request> *reqvec;
142 String *string; // needed by the lexer as temporary scratch area.
145 Scheme_hash_table *scmhash;
146 Music_output_def * outputdef;
158 yylex (YYSTYPE *s, void * v_l)
160 My_lily_parser *pars_l = (My_lily_parser*) v_l;
161 My_lily_lexer * lex_l = pars_l->lexer_p_;
163 lex_l->lexval_l = (void*) s;
164 return lex_l->yylex ();
172 /* tokens which are not keywords */
182 %token CHORDMODIFIERS
190 %token GROBDESCRIPTIONS
196 %token FIGURES FIGURE_OPEN FIGURE_CLOSE
197 %token FIGURE_BRACKET_CLOSE FIGURE_BRACKET_OPEN
207 %token MULTI_MEASURE_REST
219 %token OVERRIDE SET REVERT
232 %token COMMANDSPANREQUEST
234 %token OUTPUTPROPERTY
245 %token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE
246 %token E_LEFTSQUARE E_RIGHTSQUARE E_TILDE
248 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET
252 %type <i> exclamations questions dots optional_rest
253 %type <i> bass_number bass_mod
254 %type <scm> br_bass_figure bass_figure figure_list figure_spec
256 %token <scm> NOTENAME_PITCH
257 %token <scm> TONICNAME_PITCH
258 %token <scm> CHORDMODIFIER_PITCH
259 %token <scm> DURATION_IDENTIFIER
260 %token <scm> FRACTION
261 %token <id> IDENTIFIER
264 %token <scm> SCORE_IDENTIFIER
265 %token <scm> MUSIC_OUTPUT_DEF_IDENTIFIER
267 %token <scm> NUMBER_IDENTIFIER
268 %token <scm> REQUEST_IDENTIFIER
269 %token <scm> MUSIC_IDENTIFIER TRANSLATOR_IDENTIFIER
270 %token <scm> STRING_IDENTIFIER SCM_IDENTIFIER
271 %token <scm> RESTNAME
277 %type <outputdef> output_def
278 %type <scmhash> lilypond_header lilypond_header_body
279 %type <request> open_request_parens close_request_parens open_request close_request
280 %type <request> request_with_dir request_that_take_dir verbose_request
281 %type <i> sub_quotes sup_quotes
282 %type <music> simple_element request_chord command_element Simple_music Composite_music
283 %type <music> Repeated_music
284 %type <scm> Alternative_music
285 %type <i> tremolo_type
286 %type <i> bare_int bare_unsigned
289 %type <scm> identifier_init
291 %type <scm> steno_duration optional_notemode_duration multiplied_duration
292 %type <scm> verbose_duration
294 %type <reqvec> pre_requests post_requests
295 %type <request> gen_text_def
296 %type <scm> steno_pitch pitch absolute_pitch
297 %type <scm> explicit_pitch steno_tonic_pitch
299 %type <scm> chord_additions chord_subtractions chord_notes chord_step
301 %type <scm> chord_note chord_inversion chord_bass
302 %type <scm> duration_length fraction
304 %type <scm> embedded_scm scalar
305 %type <music> Music Sequential_music Simultaneous_music
306 %type <music> relative_music re_rhythmed_music part_combined_music
307 %type <music> property_def translator_change
308 %type <scm> Music_list
309 %type <outputdef> music_output_def_body
310 %type <request> shorthand_command_req
311 %type <request> post_request
312 %type <music> command_req verbose_command_req
313 %type <request> extender_req
314 %type <request> hyphen_req
315 %type <scm> string bare_number number_expression number_term number_factor
317 %type <score> score_block score_body
319 %type <scm> translator_spec_block translator_spec_body
320 %type <tempo> tempo_request
321 %type <scm> notenames_body notenames_block chordmodifiers_block
322 %type <scm> script_abbreviation
328 /* We don't assign precedence to / and *, because we might need varied
329 prec levels in different prods */
335 lilypond: /* empty */
336 | lilypond toplevel_expression {}
337 | lilypond assignment { }
339 THIS->error_level_i_ = 1;
342 THIS->error_level_i_ = 1;
348 THIS->lexer_p_->pitchname_tab_ = $1;
350 | chordmodifiers_block {
351 THIS->lexer_p_->chordmodifier_tab_ = $1;
355 scm_gc_unprotect_object (global_header_p->self_scm ());
356 global_header_p = $1;
359 score_global_array.push ($1);
362 if (dynamic_cast<Paper_def*> ($1))
363 THIS->lexer_p_->set_identifier (gh_str02scm ("$defaultpaper"), $1->self_scm ());
364 else if (dynamic_cast<Midi_def*> ($1))
365 THIS->lexer_p_->set_identifier (gh_str02scm ("$defaultmidi"), $1->self_scm ());
378 chordmodifiers_block:
379 CHORDMODIFIERS notenames_body { $$ = $2; }
383 PITCHNAMES notenames_body { $$ = $2; }
388 int i = scm_ilength ($1);
390 SCM tab = scm_make_vector (gh_int2scm (i), SCM_EOL);
391 for (SCM s = $1; gh_pair_p (s); s = ly_cdr (s)) {
392 SCM pt = ly_cdar (s);
393 if (!unsmob_pitch (pt))
394 THIS->parser_error ("Need pitch object.");
396 scm_hashq_set_x (tab, ly_caar (s), pt);
403 lilypond_header_body:
405 $$ = new Scheme_hash_table;
406 THIS->lexer_p_-> scope_l_arr_.push ($$);
408 | lilypond_header_body assignment {
414 HEADER '{' lilypond_header_body '}' {
416 THIS->lexer_p_->scope_l_arr_.pop ();
428 /* cont */ '=' identifier_init {
431 Should find generic way of associating input with objects.
433 Input ip = THIS->pop_spot ();
435 if (! regular_identifier_b ($1))
437 ip.warning (_ ("Identifier should have alphabetic characters only"));
440 THIS->lexer_p_->set_identifier ($1, $4);
443 TODO: devise standard for protection in parser.
445 The parser stack lives on the C-stack, which means that
446 all objects can be unprotected as soon as they're here.
456 $$ = $1->self_scm ();
457 scm_gc_unprotect_object ($$);
460 $$ = $1->self_scm ();
461 scm_gc_unprotect_object ($$);
463 | translator_spec_block {
467 $$ = $1->self_scm ();
468 scm_gc_unprotect_object ($$);
471 $$ = $1->self_scm ();
472 scm_gc_unprotect_object ($$);
477 | number_expression {
488 translator_spec_block:
489 TRANSLATOR '{' translator_spec_body '}'
495 translator_spec_body:
496 TRANSLATOR_IDENTIFIER {
497 $$ = unsmob_translator_def ($1)->clone_scm ();
498 unsmob_translator_def ($$)-> set_spot (THIS->here_input ());
501 $$ = Translator_def::make_scm ();
502 Translator_def*td = unsmob_translator_def ($$);
503 td->translator_group_type_ = $2;
504 td->set_spot (THIS->here_input ());
506 | translator_spec_body STRING '=' embedded_scm {
507 unsmob_translator_def ($$)->add_property_assign ($2, $4);
509 | translator_spec_body STRING OVERRIDE embedded_scm '=' embedded_scm {
510 unsmob_translator_def ($$)
511 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
513 | translator_spec_body STRING SET embedded_scm '=' embedded_scm {
514 unsmob_translator_def ($$)
515 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
517 | translator_spec_body STRING REVERT embedded_scm {
518 unsmob_translator_def ($$)->add_pop_property (
519 scm_string_to_symbol ($2), $4);
521 | translator_spec_body NAME STRING {
522 unsmob_translator_def ($$)->type_name_ = $3;
524 | translator_spec_body CONSISTS STRING {
525 unsmob_translator_def ($$)->add_element ($3);
527 | translator_spec_body ALIAS STRING {
528 Translator_def*td = unsmob_translator_def ($$);
529 td->type_aliases_ = gh_cons ($3, td->type_aliases_);
531 | translator_spec_body GROBDESCRIPTIONS embedded_scm {
532 Translator_def*td = unsmob_translator_def($$);
533 // td->add_property_assign (ly_symbol2scm ("allGrobDescriptions"), $3);
534 for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p))
535 td->add_property_assign (scm_symbol_to_string (ly_caar (p)), ly_cdar (p));
537 | translator_spec_body CONSISTSEND STRING {
538 unsmob_translator_def ($$)->add_last_element ( $3);
540 | translator_spec_body ACCEPTS STRING {
541 unsmob_translator_def ($$)->set_acceptor ($3,true);
543 | translator_spec_body DENIES STRING {
544 unsmob_translator_def ($$)->set_acceptor ($3,false);
546 | translator_spec_body REMOVE STRING {
547 unsmob_translator_def ($$)->remove_element ($3);
558 /*cont*/ '{' score_body '}' {
561 if (!$$->def_p_arr_.size ())
563 Music_output_def *id =
564 unsmob_music_output_def (THIS->lexer_p_->lookup_identifier ("$defaultpaper"));
565 $$->add_output (id ? id->clone () : new Paper_def );
574 $$->set_spot (THIS->here_input ());
575 SCM m = $1->self_scm ();
576 scm_gc_unprotect_object (m);
581 SCM check_funcs = scm_c_eval_string ("toplevel-music-functions");
582 for (; gh_pair_p (check_funcs); check_funcs = gh_cdr (check_funcs))
583 m = gh_call1 (gh_car (check_funcs), m);
588 $$ = new Score (*unsmob_score ($1));
589 $$->set_spot (THIS->here_input ());
591 | score_body lilypond_header {
592 scm_gc_unprotect_object ($2->self_scm ());
595 | score_body output_def {
608 music_output_def_body '}' {
610 THIS-> lexer_p_-> scope_l_arr_.pop ();
614 music_output_def_body:
616 Music_output_def *id = unsmob_music_output_def (THIS->lexer_p_->lookup_identifier ("$defaultmidi"));
621 p = dynamic_cast<Midi_def*> (id->clone ());
626 THIS->lexer_p_->scope_l_arr_.push (p->variable_tab_);
629 Music_output_def *id = unsmob_music_output_def (THIS->lexer_p_->lookup_identifier ("$defaultpaper"));
632 p = dynamic_cast<Paper_def*> (id->clone ());
635 THIS-> lexer_p_-> scope_l_arr_.push (p->variable_tab_);
638 | PAPER '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
639 Music_output_def *p = unsmob_music_output_def ($3);
641 THIS->lexer_p_->scope_l_arr_.push (p->variable_tab_);
644 | MIDI '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
645 Music_output_def *p = unsmob_music_output_def ($3);
648 THIS->lexer_p_->scope_l_arr_.push (p->variable_tab_);
651 | music_output_def_body assignment {
654 | music_output_def_body translator_spec_block {
655 $$->assign_translator ($2);
657 | music_output_def_body STYLESHEET embedded_scm {
658 dynamic_cast<Paper_def*> ($$)-> style_sheet_ = $3;
660 | music_output_def_body tempo_request {
662 junk this ? there already is tempo stuff in
665 int m = gh_scm2int ( $2->get_mus_property ("metronome-count"));
666 Duration *d = unsmob_duration ($2->get_mus_property ("duration"));
667 Midi_def * md = dynamic_cast<Midi_def*> ($$);
669 md->set_tempo (d->length_mom (), m);
671 | music_output_def_body error {
677 TEMPO steno_duration '=' bare_unsigned {
679 $$->set_mus_property ("duration", $2);
680 $$->set_mus_property ("metronome-count", gh_int2scm ( $4));
685 The representation of a list is the
689 to have efficient append.
691 Music_list: /* empty */ {
692 $$ = gh_cons (SCM_EOL, SCM_EOL);
696 SCM c = gh_cons ($2->self_scm (), SCM_EOL);
697 scm_gc_unprotect_object ($2->self_scm ()); /* UGH */
698 if (gh_pair_p (ly_cdr (s)))
699 gh_set_cdr_x (ly_cdr (s), c); /* append */
701 gh_set_car_x (s, c); /* set first cons */
702 gh_set_cdr_x (s, c) ; /* remember last cell */
718 | ALTERNATIVE '{' Music_list '}' {
724 REPEAT string bare_unsigned Music Alternative_music
728 SCM alts = gh_pair_p ($5) ? gh_car ($5) : SCM_EOL;
729 if (times < scm_ilength (alts)) {
730 unsmob_music (gh_car (alts))
731 ->origin ()->warning (
732 _("More alternatives than repeats. Junking excess alternatives."));
733 alts = ly_truncate_list (times, alts);
736 Repeated_music * r = new Repeated_music (SCM_EOL);
739 r-> set_mus_property ("element", beg->self_scm ());
740 scm_gc_unprotect_object (beg->self_scm ());
742 r->set_mus_property ("repeat-count", gh_int2scm (times >? 1));
744 r-> set_mus_property ("elements",alts);
745 SCM func = scm_primitive_eval (ly_symbol2scm ("repeat-name-to-ctor"));
746 SCM result = gh_call1 (func, $2);
748 if (gh_equal_p ($2, ly_str02scm ("tremolo")))
751 we can not get durations and other stuff correct down the line, so we have to
752 add to the duration log here.
756 SCM func = scm_primitive_eval (ly_symbol2scm ("shift-duration-log"));
757 gh_call2 (func, r->self_scm (), gh_int2scm(-intlog2 ($3)));
760 set_music_properties (r, result);
762 r->set_spot (*$4->origin ());
769 SEQUENTIAL '{' Music_list '}' {
770 $$ = new Sequential_music (SCM_EOL);
771 $$->set_mus_property ("elements", ly_car ($3));
772 $$->set_spot(THIS->here_input());
774 | '{' Music_list '}' {
775 $$ = new Sequential_music (SCM_EOL);
776 $$->set_mus_property ("elements", ly_car ($2));
777 $$->set_spot(THIS->here_input());
782 SIMULTANEOUS '{' Music_list '}'{
783 $$ = new Simultaneous_music (SCM_EOL);
784 $$->set_mus_property ("elements", ly_car ($3));
785 $$->set_spot(THIS->here_input());
788 | '<' Music_list '>' {
789 $$ = new Simultaneous_music (SCM_EOL);
790 $$->set_mus_property ("elements", ly_car ($2));
791 $$->set_spot(THIS->here_input());
796 request_chord { $$ = $1; }
797 | OUTPUTPROPERTY embedded_scm embedded_scm '=' embedded_scm {
799 if (!gh_symbol_p ($3))
801 THIS->parser_error (_ ("Second argument must be a symbol"));
803 /*hould check # args */
804 if (!gh_procedure_p (pred))
806 THIS->parser_error (_ ("First argument must be a procedure taking 1 argument"));
809 Music *m = new Music (SCM_EOL);
810 m->set_mus_property ("predicate", pred);
811 m->set_mus_property ("grob-property", $3);
812 m->set_mus_property ("grob-value", $5);
813 m->set_mus_property ("iterator-ctor",
814 Output_property_music_iterator::constructor_cxx_function);
819 $$ = unsmob_music ($1)->clone ();
821 $$->set_spot (THIS->here_input());
829 CONTEXT STRING Music {
830 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
831 csm->set_mus_property ("element", $3->self_scm ());
832 scm_gc_unprotect_object ($3->self_scm ());
834 csm->set_mus_property ("context-type",$2);
835 csm->set_mus_property ("context-id", ly_str02scm (""));
839 | AUTOCHANGE STRING Music {
840 Music * chm = new Music_wrapper (SCM_EOL);
841 chm->set_mus_property ("element", $3->self_scm ());
842 chm->set_mus_property ("iterator-ctor", Auto_change_iterator::constructor_cxx_function);
844 scm_gc_unprotect_object ($3->self_scm ());
845 chm->set_mus_property ("what", $2);
848 chm->set_spot (*$3->origin ());
853 The other version is for easier debugging of
854 Sequential_music_iterator in combination with grace notes.
857 SCM start = THIS->lexer_p_->lookup_identifier ("startGraceMusic");
858 SCM stop = THIS->lexer_p_->lookup_identifier ("stopGraceMusic");
859 Music *startm = unsmob_music (start);
860 Music *stopm = unsmob_music (stop);
864 stopm = stopm->clone ();
865 ms = gh_cons (stopm->self_scm (), ms);
866 scm_gc_unprotect_object (stopm->self_scm ());
868 ms = gh_cons ($2->self_scm (), ms);
869 scm_gc_unprotect_object ($2->self_scm());
871 startm = startm->clone ();
872 ms = gh_cons (startm->self_scm () , ms);
873 scm_gc_unprotect_object (startm->self_scm ());
876 Music* seq = new Sequential_music (SCM_EOL);
877 seq->set_mus_property ("elements", ms);
879 $$ = new Grace_music (SCM_EOL);
880 $$->set_mus_property ("element", seq->self_scm ());
881 scm_gc_unprotect_object (seq->self_scm ());
883 $$ = new Grace_music (SCM_EOL);
884 $$->set_mus_property ("element", $2->self_scm ());
885 scm_gc_unprotect_object ($2->self_scm ());
888 | CONTEXT string '=' string Music {
889 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
890 csm->set_mus_property ("element", $5->self_scm ());
891 scm_gc_unprotect_object ($5->self_scm ());
893 csm->set_mus_property ("context-type", $2);
894 csm->set_mus_property ("context-id", $4);
905 int n = gh_scm2int (ly_car ($3)); int d = gh_scm2int (ly_cdr ($3));
907 $$ = new Time_scaled_music (SCM_EOL);
908 $$->set_spot (THIS->pop_spot ());
911 $$->set_mus_property ("element", mp->self_scm ());
912 scm_gc_unprotect_object (mp->self_scm ());
913 $$->set_mus_property ("numerator", gh_int2scm (n));
914 $$->set_mus_property ("denominator", gh_int2scm (d));
915 $$->compress (Moment (Rational (n,d)));
918 | Repeated_music { $$ = $1; }
919 | Simultaneous_music { $$ = $1; }
920 | Sequential_music { $$ = $1; }
921 | TRANSPOSE pitch Music {
922 $$ = new Transposed_music (SCM_EOL);
924 Pitch pit = *unsmob_pitch ($2);
927 $$->set_mus_property ("element", p->self_scm ());
928 scm_gc_unprotect_object (p->self_scm ());
930 | TRANSPOSE steno_tonic_pitch Music {
931 $$ = new Transposed_music (SCM_EOL);
933 Pitch pit = *unsmob_pitch ($2);
936 $$->set_mus_property ("element", p->self_scm ());
937 scm_gc_unprotect_object (p->self_scm ());
940 | APPLY embedded_scm Music {
941 SCM ret = gh_call1 ($2, $3->self_scm ());
942 Music *m = unsmob_music (ret);
944 THIS->parser_error ("\\apply must return a Music");
945 m = new Music (SCM_EOL);
950 { THIS->lexer_p_->push_note_state (); }
953 THIS->lexer_p_->pop_state ();
956 { THIS->lexer_p_->push_figuredbass_state (); }
959 Music * chm = new Untransposable_music () ;
960 chm->set_mus_property ("element", $3->self_scm ());
962 scm_gc_unprotect_object ($3->self_scm());
964 THIS->lexer_p_->pop_state ();
967 { THIS->lexer_p_->push_chord_state (); }
970 Music * chm = new Un_relativable_music ;
971 chm->set_mus_property ("element", $3->self_scm ());
972 scm_gc_unprotect_object ($3->self_scm());
975 THIS->lexer_p_->pop_state ();
978 { THIS->lexer_p_->push_lyric_state (); }
982 THIS->lexer_p_->pop_state ();
984 | relative_music { $$ = $1; }
985 | re_rhythmed_music { $$ = $1; }
986 | part_combined_music { $$ = $1; }
990 RELATIVE absolute_pitch Music {
992 Pitch pit = *unsmob_pitch ($2);
993 $$ = new Relative_octave_music (SCM_EOL);
995 $$->set_mus_property ("element", p->self_scm ());
996 scm_gc_unprotect_object (p->self_scm ());
998 $$->set_mus_property ("last-pitch", p->to_relative_octave (pit).smobbed_copy ());
1004 ADDLYRICS Music Music {
1005 Lyric_combine_music * l = new Lyric_combine_music (SCM_EOL);
1006 l->set_mus_property ("elements", gh_list ($2->self_scm (), $3->self_scm (), SCM_UNDEFINED));
1007 scm_gc_unprotect_object ($3->self_scm ());
1008 scm_gc_unprotect_object ($2->self_scm ());
1013 part_combined_music:
1014 PARTCOMBINE STRING Music Music {
1015 Part_combine_music * p = new Part_combine_music (SCM_EOL);
1017 p->set_mus_property ("what", $2);
1018 p->set_mus_property ("elements", gh_list ($3->self_scm (),$4->self_scm (), SCM_UNDEFINED));
1020 scm_gc_unprotect_object ($3->self_scm ());
1021 scm_gc_unprotect_object ($4->self_scm ());
1028 TRANSLATOR STRING '=' STRING {
1029 Music * t = new Music (SCM_EOL);
1030 t->set_mus_property ("iterator-ctor",
1031 Change_iterator::constructor_cxx_function);
1032 t-> set_mus_property ("change-to-type", $2);
1033 t-> set_mus_property ("change-to-id", $4);
1036 $$->set_spot (THIS->here_input ());
1041 PROPERTY STRING '.' STRING '=' scalar {
1043 Music *t = set_property_music (scm_string_to_symbol ($4), $6);
1044 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1046 csm->set_mus_property ("element", t->self_scm ());
1047 scm_gc_unprotect_object (t->self_scm ());
1050 $$->set_spot (THIS->here_input ());
1052 csm-> set_mus_property ("context-type", $2);
1054 | PROPERTY STRING '.' STRING UNSET {
1055 Music *t = new Music (SCM_EOL);
1057 t->set_mus_property ("iterator-ctor",
1058 Property_unset_iterator::constructor_cxx_function);
1059 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1061 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1062 csm->set_mus_property ("element", t->self_scm ());
1063 scm_gc_unprotect_object (t->self_scm ());
1066 $$->set_spot (THIS->here_input ());
1068 csm-> set_mus_property ("context-type", $2);
1070 | PROPERTY STRING '.' STRING SET embedded_scm '=' embedded_scm {
1071 Music *t = new Music (SCM_EOL);
1072 t->set_mus_property ("iterator-ctor",
1073 Push_property_iterator::constructor_cxx_function);
1074 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1075 t->set_mus_property ("pop-first", SCM_BOOL_T);
1076 t->set_mus_property ("grob-property", $6);
1077 t->set_mus_property ("grob-value", $8);
1078 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1079 csm->set_mus_property ("element", t->self_scm ());
1080 scm_gc_unprotect_object (t->self_scm ());
1082 $$->set_spot (THIS->here_input ());
1084 csm-> set_mus_property ("context-type", $2);
1086 | PROPERTY STRING '.' STRING OVERRIDE embedded_scm '=' embedded_scm {
1087 Music *t = new Music (SCM_EOL);
1088 t->set_mus_property ("iterator-ctor",
1089 Push_property_iterator::constructor_cxx_function);
1090 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1091 t->set_mus_property ("grob-property", $6);
1092 t->set_mus_property ("grob-value", $8);
1093 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1094 csm->set_mus_property ("element", t->self_scm ());
1095 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 REVERT embedded_scm {
1103 Music *t = new Music (SCM_EOL);
1104 t->set_mus_property ("iterator-ctor",
1105 Pop_property_iterator::constructor_cxx_function);
1106 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1107 t->set_mus_property ("grob-property", $6);
1109 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1110 csm->set_mus_property ("element", t->self_scm ());
1111 scm_gc_unprotect_object (t->self_scm ());
1114 $$->set_spot (THIS->here_input ());
1116 csm-> set_mus_property ("context-type", $2);
1123 | bare_int { $$ = gh_int2scm ($1); }
1124 | embedded_scm { $$ = $1; }
1131 } /*cont */ simple_element post_requests {
1132 Music_sequence *l = dynamic_cast<Music_sequence*> ($3);
1135 for (int i=0; i < $1->size (); i++) {
1136 Music * m = $1->elem (i);
1137 l->append_music (m);
1149 $$ = new Request_chord (SCM_EOL);
1150 $$->set_mus_property ("elements", gh_cons ($1->self_scm (), SCM_EOL));
1151 scm_gc_unprotect_object ($1->self_scm());
1153 $$-> set_spot (THIS->here_input ());
1154 $1-> set_spot (THIS->here_input ());
1157 Span_req *l = new Span_req;
1158 l->set_span_dir (START);
1159 l->set_mus_property ("span-type", ly_str02scm ("ligature"));
1160 l->set_spot (THIS->here_input ());
1162 $$ = new Request_chord (SCM_EOL);
1163 $$->set_mus_property ("elements", gh_cons (l->self_scm (), SCM_EOL));
1164 scm_gc_unprotect_object (l->self_scm());
1165 $$->set_spot (THIS->here_input ());
1168 Span_req *l = new Span_req;
1169 l->set_span_dir (STOP);
1170 l->set_mus_property ("span-type", ly_str02scm ("ligature"));
1171 l->set_spot (THIS->here_input ());
1173 $$ = new Request_chord (SCM_EOL);
1174 $$->set_mus_property ("elements", gh_cons (l->self_scm (), SCM_EOL));
1175 $$->set_spot (THIS->here_input ());
1176 scm_gc_unprotect_object (l->self_scm());
1180 $$ = new Music (gh_list (gh_cons (ly_symbol2scm ("name"), ly_symbol2scm ("separator")), SCM_UNDEFINED));
1181 $$->set_spot (THIS->here_input ());
1185 extern Music * get_barcheck();
1186 $$ = get_barcheck ();
1187 $$->set_spot (THIS->here_input ());
1190 Music *t = set_property_music (ly_symbol2scm ("whichBar"), $2);
1192 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1193 csm->set_mus_property ("element", t->self_scm ());
1194 scm_gc_unprotect_object (t->self_scm ());
1197 $$->set_spot (THIS->here_input ());
1199 csm->set_mus_property ("context-type", ly_str02scm ("Score"));
1201 | PARTIAL duration_length {
1202 Moment m = - unsmob_duration ($2)->length_mom ();
1203 Music * p = set_property_music (ly_symbol2scm ( "measurePosition"),m.smobbed_copy ());
1205 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1206 sp->set_mus_property ("element", p->self_scm ());
1207 scm_gc_unprotect_object (p->self_scm ());
1210 sp-> set_mus_property ("context-type", ly_str02scm ( "Score"));
1213 SCM func = scm_primitive_eval (ly_symbol2scm ("clef-name-to-properties"));
1214 SCM result = gh_call1 (func, $2);
1217 for (SCM s = result ; gh_pair_p (s); s = ly_cdr (s)) {
1218 Music * p = new Music (SCM_EOL);
1219 set_music_properties (p, ly_car (s));
1220 l = gh_cons (p->self_scm (), l);
1221 scm_gc_unprotect_object (p->self_scm ());
1223 Sequential_music * seq = new Sequential_music (SCM_EOL);
1224 seq->set_mus_property ("elements", l);
1226 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1227 sp->set_mus_property ("element", seq->self_scm ());
1228 scm_gc_unprotect_object (seq->self_scm ());
1231 sp-> set_mus_property ("context-type", ly_str02scm ("Staff"));
1234 Music * p1 = set_property_music (ly_symbol2scm ( "timeSignatureFraction"), $2);
1236 int l = gh_scm2int (ly_car ($2));
1237 int o = gh_scm2int (ly_cdr ($2));
1239 Moment one_beat = Moment (1)/Moment (o);
1240 Moment len = Moment (l) * one_beat;
1243 Music *p2 = set_property_music (ly_symbol2scm ("measureLength"), len.smobbed_copy ());
1244 Music *p3 = set_property_music (ly_symbol2scm ("beatLength"), one_beat.smobbed_copy ());
1246 SCM list = scm_list_n (p1->self_scm (), p2->self_scm (), p3->self_scm(), SCM_UNDEFINED);
1247 Sequential_music *seq = new Sequential_music (SCM_EOL);
1248 seq->set_mus_property ("elements", list);
1251 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1252 sp->set_mus_property ("element", seq->self_scm ());
1256 scm_gc_unprotect_object (p3->self_scm ());
1257 scm_gc_unprotect_object (p2->self_scm ());
1258 scm_gc_unprotect_object (p1->self_scm ());
1259 scm_gc_unprotect_object (seq->self_scm ());
1264 TODO: should make alias TimingContext for Score
1267 sp-> set_mus_property ("context-type", ly_str02scm ( "Score"));
1272 shorthand_command_req { $$ = $1; }
1273 | verbose_command_req { $$ = $1; }
1276 shorthand_command_req:
1287 Span_req*b= new Span_req;
1288 b->set_span_dir (START);
1289 b->set_mus_property ("span-type", ly_str02scm ("beam"));
1293 THIS->last_beam_start_ = b->self_scm ();
1296 Span_req*b= new Span_req;
1297 b->set_span_dir ( STOP);
1298 b->set_mus_property ("span-type", ly_str02scm ("beam"));
1302 $$ = new Breathing_sign_req;
1305 $$ = new Porrectus_req;
1309 verbose_command_req:
1310 COMMANDSPANREQUEST bare_int STRING { /*TODO: junkme */
1311 Span_req * sp_p = new Span_req;
1312 sp_p-> set_span_dir ( Direction ($2));
1313 sp_p->set_mus_property ("span-type",$3);
1314 sp_p->set_spot (THIS->here_input ());
1318 Mark_req * m = new Mark_req;
1322 Mark_req *m = new Mark_req;
1323 m->set_mus_property ("label", $2);
1326 | MARK bare_unsigned {
1327 String s(to_str ($2));
1329 Mark_req *m = new Mark_req;
1330 m->set_mus_property ("label", gh_int2scm ($2));
1334 Break_req * b = new Break_req;
1336 if (!gh_number_p (s))
1339 b->set_mus_property ("penalty", s);
1340 b->set_spot (THIS->here_input ());
1343 | SKIP duration_length {
1344 Skip_req * skip_p = new Skip_req;
1345 skip_p->set_mus_property ("duration", $2);
1353 Key_change_req *key_p= new Key_change_req;
1356 | KEY NOTENAME_PITCH SCM_IDENTIFIER {
1357 Key_change_req *key_p= new Key_change_req;
1359 key_p->set_mus_property ("pitch-alist", $3);
1360 ((Music*)key_p)->transpose (* unsmob_pitch ($2));
1367 $$ = new Link_array<Request>;
1369 | post_requests post_request {
1370 $2->set_spot (THIS->here_input ());
1382 request_that_take_dir:
1385 | script_abbreviation {
1386 SCM s = THIS->lexer_p_->lookup_identifier ("dash" + ly_scm2string ($1));
1387 Articulation_req *a = new Articulation_req;
1388 if (gh_string_p (s))
1389 a->set_mus_property ("articulation-type", s);
1390 else THIS->parser_error (_ ("Expecting string as script definition"));
1396 script_dir request_that_take_dir {
1397 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1398 gs->set_direction (Direction ($1));
1400 $2->origin ()->warning (_ ("Can't specify direction for this request"));
1406 REQUEST_IDENTIFIER {
1407 $$ = dynamic_cast<Request*> (unsmob_music ($1)->clone ());
1408 $$->set_spot (THIS->here_input ());
1410 | DYNAMICSCRIPT embedded_scm {
1412 TODO: junkme, use text-type == dynamic
1414 Text_script_req *d = new Text_script_req;
1415 SCM dyn = ly_symbol2scm ("dynamic");
1416 d->set_mus_property ("text-type" , dyn);
1417 d->set_mus_property ("text", $2);
1418 d->set_spot (THIS->here_input ());
1421 | SPANREQUEST bare_int STRING {
1422 Span_req * sp_p = new Span_req;
1423 sp_p->set_span_dir ( Direction ($2));
1424 sp_p->set_mus_property ("span-type", $3);
1425 sp_p->set_spot (THIS->here_input ());
1429 Tremolo_req* a = new Tremolo_req;
1430 a->set_spot (THIS->here_input ());
1431 a->set_mus_property ("tremolo-type", gh_int2scm ($1));
1435 Articulation_req * a = new Articulation_req;
1436 a->set_mus_property ("articulation-type", $2);
1437 a->set_spot (THIS->here_input ());
1441 duh, junk this syntax from the parser, if possible.
1444 Arpeggio_req *a = new Arpeggio_req;
1445 a->set_spot (THIS->here_input ());
1449 Glissando_req *g = new Glissando_req;
1450 g->set_spot /* No pun intended */ (THIS->here_input ());
1477 | NOTENAME_PITCH sup_quotes {
1478 Pitch p = *unsmob_pitch ($1);
1480 $$ = p.smobbed_copy ();
1482 | NOTENAME_PITCH sub_quotes {
1483 Pitch p =* unsmob_pitch ($1);
1486 $$ = p.smobbed_copy ();
1499 | TONICNAME_PITCH sup_quotes {
1500 Pitch p = *unsmob_pitch ($1);
1502 $$ = p.smobbed_copy ();
1504 | TONICNAME_PITCH sub_quotes {
1505 Pitch p =* unsmob_pitch ($1);
1508 $$ = p.smobbed_copy ();
1523 PITCH embedded_scm {
1525 if (!unsmob_pitch ($2)) {
1526 THIS->parser_error (_f ("Expecting musical-pitch value", 3));
1527 $$ = Pitch ().smobbed_copy ();
1533 DURATION embedded_scm {
1535 if (!unsmob_duration ($2))
1537 THIS->parser_error (_ ("Must have duration object"));
1538 $$ = Duration ().smobbed_copy ();
1545 if (!THIS->lexer_p_->lyric_state_b ())
1546 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1547 $$ = new Extender_req;
1553 if (!THIS->lexer_p_->lyric_state_b ())
1554 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1555 $$ = new Hyphen_req;
1560 close_request_parens {
1562 dynamic_cast<Span_req*> ($$)->set_span_dir ( START);
1566 close_request_parens:
1568 Span_req* s= new Span_req;
1570 s->set_mus_property ("span-type", ly_str02scm ( "slur"));
1571 s->set_spot (THIS->here_input());
1574 Span_req* s= new Span_req;
1576 s->set_mus_property ("span-type", ly_str02scm ( "phrasing-slur"));
1577 s->set_spot (THIS->here_input());
1580 Span_req*s =new Span_req;
1582 s->set_mus_property ("span-type", ly_str02scm ( "crescendo"));
1583 s->set_spot (THIS->here_input());
1586 Span_req*s =new Span_req;
1588 s->set_mus_property ("span-type", ly_str02scm ("decrescendo"));
1589 s->set_spot (THIS->here_input());
1595 open_request_parens {
1597 dynamic_cast<Span_req*> ($$)->set_span_dir (STOP);
1601 open_request_parens:
1603 Span_req *s = new Span_req;
1604 s->set_mus_property ("span-type", ly_str02scm ( "crescendo"));
1605 s->set_spot (THIS->here_input());
1610 Span_req* s= new Span_req;
1612 s->set_mus_property ("span-type", ly_str02scm ( "slur"));
1613 s->set_spot (THIS->here_input());
1617 Span_req* s= new Span_req;
1619 s->set_mus_property ("span-type", ly_str02scm ( "phrasing-slur"));
1620 s->set_spot (THIS->here_input());
1626 Text_script_req *t = new Text_script_req;
1627 t->set_mus_property ("text", $1);
1628 t->set_spot (THIS->here_input ());
1632 Text_script_req *t = new Text_script_req;
1633 t->set_mus_property ("text", $1);
1634 t->set_spot (THIS->here_input ());
1638 String ds = to_str ($1);
1639 Text_script_req* t = new Text_script_req;
1640 SCM finger = ly_symbol2scm ("finger");
1641 t->set_mus_property ("text", ly_str02scm (ds.ch_C ()));
1642 t->set_mus_property ("text-type" , finger);
1643 t->set_spot (THIS->here_input ());
1648 script_abbreviation:
1650 $$ = gh_str02scm ("Hat");
1653 $$ = gh_str02scm ("Plus");
1656 $$ = gh_str02scm ("Dash");
1659 $$ = gh_str02scm ("Bar");
1662 $$ = gh_str02scm ("Larger");
1665 $$ = gh_str02scm ("Dot");
1672 | '-' { $$ = CENTER; }
1677 $$ = new Link_array<Request>;
1679 | pre_requests open_request {
1691 multiplied_duration {
1694 | verbose_duration {
1699 optional_notemode_duration:
1701 Duration dd = THIS->default_duration_;
1702 $$ = dd.smobbed_copy ();
1704 THIS->beam_check ($$);
1706 | multiplied_duration {
1708 THIS->default_duration_ = *unsmob_duration ($$);
1710 THIS->beam_check ($$);
1712 | verbose_duration {
1714 THIS->default_duration_ = *unsmob_duration ($$);
1719 bare_unsigned dots {
1721 if (!is_duration_b ($1))
1722 THIS->parser_error (_f ("not a duration: %d", $1));
1726 $$ = Duration (l, $2).smobbed_copy ();
1728 | DURATION_IDENTIFIER dots {
1729 Duration *d =unsmob_duration ($1);
1730 Duration k (d->duration_log (),d->dot_count () + $2);
1731 $$ = k.smobbed_copy ();
1738 multiplied_duration:
1742 | multiplied_duration '*' bare_unsigned {
1743 $$ = unsmob_duration ($$)->compressed ( $3) .smobbed_copy ();
1745 | multiplied_duration '*' FRACTION {
1746 Rational m (gh_scm2int (ly_car ($3)), gh_scm2int (ly_cdr ($3)));
1748 $$ = unsmob_duration ($$)->compressed (m).smobbed_copy ();
1753 FRACTION { $$ = $1; }
1754 | UNSIGNED '/' UNSIGNED {
1755 $$ = gh_cons (gh_int2scm ($1), gh_int2scm ($3));
1773 | ':' bare_unsigned {
1774 if (!is_duration_b ($2))
1775 THIS->parser_error (_f ("not a duration: %d", $2));
1794 Bass_figure_req *bfr = new Bass_figure_req;
1795 $$ = bfr->self_scm();
1796 scm_gc_unprotect_object ($$);
1799 Bass_figure_req *bfr = new Bass_figure_req;
1800 $$ = bfr->self_scm();
1802 bfr->set_mus_property ("figure", gh_int2scm ($1));
1804 scm_gc_unprotect_object ($$);
1806 | bass_figure bass_mod {
1807 Music *m = unsmob_music ($1);
1809 SCM salter =m->get_mus_property ("alteration");
1810 int alter = gh_number_p( salter) ? gh_scm2int (salter) : 0;
1811 m->set_mus_property ("alteration",
1812 gh_int2scm (alter + $2));
1814 m->set_mus_property ("alteration", gh_int2scm (0));
1822 unsmob_music ($$)->set_mus_property ("bracket-start", SCM_BOOL_T);
1827 | br_bass_figure ']' {
1829 unsmob_music ($1)->set_mus_property ("bracket-stop", SCM_BOOL_T);
1837 | figure_list br_bass_figure {
1838 $$ = gh_cons ($2, $1);
1843 FIGURE_OPEN figure_list FIGURE_CLOSE {
1844 Music * m = new Request_chord (SCM_EOL);
1845 $2 = scm_reverse_x ($2, SCM_EOL);
1846 m->set_mus_property ("elements", $2);
1847 $$ = m->self_scm ();
1858 pitch exclamations questions optional_notemode_duration optional_rest {
1860 Input i = THIS->pop_spot ();
1861 if (!THIS->lexer_p_->note_state_b ())
1862 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1870 n->set_mus_property ("pitch", $1);
1871 n->set_mus_property ("duration", $4);
1875 n->set_mus_property ("cautionary", SCM_BOOL_T);
1876 if ($2 % 2 || $3 % 2)
1877 n->set_mus_property ("force-accidental", SCM_BOOL_T);
1879 Simultaneous_music*v = new Request_chord (SCM_EOL);
1880 v->set_mus_property ("elements", scm_list_n (n->self_scm (), SCM_UNDEFINED));
1881 scm_gc_unprotect_object (n->self_scm());
1887 | figure_spec optional_notemode_duration {
1888 Music * m = unsmob_music ($1);
1889 Input i = THIS->pop_spot ();
1891 for (SCM s = m->get_mus_property ("elements"); gh_pair_p (s); s = ly_cdr (s))
1893 unsmob_music (ly_car (s))->set_mus_property ("duration", $2);
1897 | RESTNAME optional_notemode_duration {
1899 Input i = THIS->pop_spot ();
1900 SCM e = SCM_UNDEFINED;
1901 if (ly_scm2string ($1) =="s") {
1903 Skip_req * skip_p = new Skip_req;
1904 skip_p->set_mus_property ("duration" ,$2);
1905 skip_p->set_spot (i);
1906 e = skip_p->self_scm ();
1909 Rest_req * rest_req_p = new Rest_req;
1910 rest_req_p->set_mus_property ("duration", $2);
1911 rest_req_p->set_spot (i);
1912 e = rest_req_p->self_scm ();
1914 Simultaneous_music* velt_p = new Request_chord (SCM_EOL);
1915 velt_p-> set_mus_property ("elements", scm_list_n (e,SCM_UNDEFINED));
1916 velt_p->set_spot (i);
1920 | MULTI_MEASURE_REST optional_notemode_duration {
1921 Input i = THIS->pop_spot ();
1923 Skip_req * sk = new Skip_req;
1924 sk->set_mus_property ("duration", $2);
1925 Span_req *sp1 = new Span_req;
1926 Span_req *sp2 = new Span_req;
1927 sp1-> set_span_dir ( START);
1928 sp2-> set_span_dir ( STOP);
1929 SCM r = ly_str02scm ("rest");
1930 sp1->set_mus_property ("span-type", r);
1931 sp2->set_mus_property ("span-type", r);
1933 Request_chord * rqc1 = new Request_chord (SCM_EOL);
1934 rqc1->set_mus_property ("elements", scm_list_n (sp1->self_scm (), SCM_UNDEFINED));
1935 Request_chord * rqc2 = new Request_chord (SCM_EOL);
1936 rqc2->set_mus_property ("elements", scm_list_n (sk->self_scm (), SCM_UNDEFINED));;
1937 Request_chord * rqc3 = new Request_chord (SCM_EOL);
1938 rqc3->set_mus_property ("elements", scm_list_n (sp2->self_scm (), SCM_UNDEFINED));;
1940 SCM ms = scm_list_n (rqc1->self_scm (), rqc2->self_scm (), rqc3->self_scm (), SCM_UNDEFINED);
1942 $$ = new Sequential_music (SCM_EOL);
1943 $$->set_mus_property ("elements", ms);
1945 | STRING optional_notemode_duration {
1946 Input i = THIS->pop_spot ();
1948 Lyric_req* lreq_p = new Lyric_req;
1949 lreq_p->set_mus_property ("text", $1);
1950 lreq_p->set_mus_property ("duration",$2);
1951 lreq_p->set_spot (i);
1952 Simultaneous_music* velt_p = new Request_chord (SCM_EOL);
1953 velt_p->set_mus_property ("elements", scm_list_n (lreq_p->self_scm (), SCM_UNDEFINED));
1958 Input i = THIS->pop_spot ();
1960 if (!THIS->lexer_p_->chord_state_b ())
1961 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1968 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
1969 $$ = Chord::get_chord ($1, $3, $4, $5, $6, $2);
1970 $$->set_spot (THIS->here_input ());
1977 | CHORD_COLON chord_notes {
1986 | chord_notes '.' chord_step {
1987 $$ = gh_append2 ($$, $3);
1995 | CHORD_CARET chord_notes {
2005 | '/' steno_tonic_pitch {
2014 | CHORD_BASS steno_tonic_pitch {
2021 $$ = gh_cons ($1, SCM_EOL);
2023 | CHORDMODIFIER_PITCH {
2024 $$ = gh_cons (unsmob_pitch ($1)->smobbed_copy (), SCM_EOL);
2026 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
2027 $$ = scm_list_n (unsmob_pitch ($1)->smobbed_copy (),
2035 m.notename_i_ = ($1 - 1) % 7;
2036 m.octave_i_ = $1 > 7 ? 1 : 0;
2037 m.alteration_i_ = 0;
2039 $$ = m.smobbed_copy ();
2041 | bare_unsigned '+' {
2043 m.notename_i_ = ($1 - 1) % 7;
2044 m.octave_i_ = $1 > 7 ? 1 : 0;
2045 m.alteration_i_ = 1;
2048 $$ = m.smobbed_copy ();
2050 | bare_unsigned CHORD_MINUS {
2052 m.notename_i_ = ($1 - 1) % 7;
2053 m.octave_i_ = $1 > 7 ? 1 : 0;
2054 m.alteration_i_ = -1;
2056 $$ = m.smobbed_copy ();
2064 number_expression '+' number_term {
2065 $$ = scm_sum ($1, $3);
2067 | number_expression '-' number_term {
2068 $$ = scm_difference ($1, $3);
2077 | number_factor '*' number_factor {
2078 $$ = scm_product ($1, $3);
2080 | number_factor '/' number_factor {
2081 $$ = scm_divide ($1, $3);
2086 '(' number_expression ')' {
2089 | '-' number_factor { /* %prec UNARY_MINUS */
2090 $$ = scm_difference ($2, SCM_UNDEFINED);
2098 $$ = gh_int2scm ($1);
2103 | NUMBER_IDENTIFIER {
2107 $$ = gh_double2scm (gh_scm2double ($1) CM );
2110 $$ = gh_double2scm (gh_scm2double ($1) PT);
2113 $$ = gh_double2scm (gh_scm2double ($1) INCH);
2116 $$ = gh_double2scm (gh_scm2double ($1) MM);
2119 $$ = gh_double2scm (gh_scm2double ($1) CHAR);
2135 if (scm_integer_p ($1) == SCM_BOOL_T)
2137 int k = gh_scm2int ($1);
2141 THIS->parser_error (_ ("need integer number arg"));
2155 | STRING_IDENTIFIER {
2158 | string '+' string {
2159 $$ = scm_string_append (scm_list_n ($1, $3, SCM_UNDEFINED));
2166 | exclamations '!' { $$ ++; }
2171 | questions '?' { $$ ++; }
2178 My_lily_parser::set_yydebug (bool )
2185 extern My_lily_parser * current_parser;
2188 My_lily_parser::do_yyparse ()
2191 current_parser = this;;
2192 yyparse ((void*)this);
2197 Should make this optional? It will also complain when you do
2201 which is entirely legitimate.
2203 Or we can scrap it. Barchecks should detect wrong durations, and
2204 skipTypesetting speeds it up a lot.
2207 My_lily_parser::beam_check (SCM dur)
2209 Duration *d = unsmob_duration (dur);
2210 if (unsmob_music (last_beam_start_) && d->duration_log () <= 2)
2212 Music * m = unsmob_music (last_beam_start_);
2213 m->origin ()->warning (_("Suspect duration found following this beam"));
2215 last_beam_start_ = SCM_EOL;