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
28 #include "translator-def.hh"
29 #include "lily-guile.hh"
30 #include "change-iterator.hh"
32 #include "my-lily-lexer.hh"
33 #include "paper-def.hh"
34 #include "midi-def.hh"
36 #include "file-path.hh"
38 #include "dimensions.hh"
39 #include "command-request.hh"
40 #include "musical-request.hh"
41 #include "my-lily-parser.hh"
42 #include "context-specced-music.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 "part-combine-music.hh"
58 #include "scm-hash.hh"
59 #include "auto-change-iterator.hh"
60 #include "un-relativable-music.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);
80 set_property_music (SCM sym, SCM value)
82 Music * p = new Music (SCM_EOL);
83 p->set_mus_property ("symbol", sym);
84 p->set_mus_property ("iterator-ctor",
85 Property_iterator::constructor_cxx_function);
87 p->set_mus_property ("value", value);
94 return t && t == 1 << intlog2 (t);
98 set_music_properties (Music *p, SCM a)
100 for (SCM k = a; gh_pair_p (k); k = ly_cdr (k))
102 p->internal_set_mus_property (ly_caar (k), ly_cdar (k));
112 // needed for bison.simple's malloc () and free ()
119 #define YYERROR_VERBOSE 1
121 #define YYPARSE_PARAM my_lily_parser
122 #define YYLEX_PARAM my_lily_parser
124 ((My_lily_parser *) my_lily_parser)
126 #define yyerror THIS->parser_error
127 #define ARRAY_SIZE(a,s) if (a.size () != s) THIS->parser_error (_f ("Expecting %d arguments", s))
131 /* We use SCMs to do strings, because it saves us the trouble of
132 deleting them. Let's hope that a stack overflow doesnt trigger a move
133 of the parse stack onto the heap. */
138 Link_array<Request> *reqvec;
140 String *string; // needed by the lexer as temporary scratch area.
143 Scheme_hash_table *scmhash;
144 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
217 %token OVERRIDE SET REVERT
230 %token COMMANDSPANREQUEST
232 %token OUTPUTPROPERTY
243 %token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE
244 %token E_LEFTSQUARE E_RIGHTSQUARE E_TILDE
246 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET
250 %type <i> exclamations questions dots optional_rest
251 %type <i> bass_number bass_mod
252 %type <scm> br_bass_figure bass_figure figure_list figure_spec
254 %token <scm> NOTENAME_PITCH
255 %token <scm> TONICNAME_PITCH
256 %token <scm> CHORDMODIFIER_PITCH
257 %token <scm> DURATION_IDENTIFIER
258 %token <scm> FRACTION
259 %token <id> IDENTIFIER
262 %token <scm> SCORE_IDENTIFIER
263 %token <scm> MUSIC_OUTPUT_DEF_IDENTIFIER
265 %token <scm> NUMBER_IDENTIFIER
266 %token <scm> REQUEST_IDENTIFIER
267 %token <scm> MUSIC_IDENTIFIER TRANSLATOR_IDENTIFIER
268 %token <scm> STRING_IDENTIFIER SCM_IDENTIFIER
269 %token <scm> RESTNAME
275 %type <outputdef> output_def
276 %type <scmhash> lilypond_header lilypond_header_body
277 %type <request> open_request_parens close_request_parens open_request close_request
278 %type <request> request_with_dir request_that_take_dir verbose_request
279 %type <i> sub_quotes sup_quotes
280 %type <music> simple_element request_chord command_element Simple_music Composite_music
281 %type <music> Repeated_music
282 %type <scm> Alternative_music
283 %type <i> tremolo_type
284 %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 <request> 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
306 %type <scm> Music_list
307 %type <outputdef> music_output_def_body
308 %type <request> shorthand_command_req
309 %type <request> post_request
310 %type <music> command_req verbose_command_req
311 %type <request> extender_req
312 %type <request> hyphen_req
313 %type <scm> string bare_number number_expression number_term number_factor
315 %type <score> score_block score_body
317 %type <scm> translator_spec_block translator_spec_body
318 %type <tempo> tempo_request
319 %type <scm> notenames_body notenames_block chordmodifiers_block
320 %type <scm> script_abbreviation
326 /* We don't assign precedence to / and *, because we might need varied
327 prec levels in different prods */
333 lilypond: /* empty */
334 | lilypond toplevel_expression {}
335 | lilypond assignment { }
337 THIS->error_level_ = 1;
340 THIS->error_level_ = 1;
346 THIS->lexer_->pitchname_tab_ = $1;
348 | chordmodifiers_block {
349 THIS->lexer_->chordmodifier_tab_ = $1;
352 if (THIS->input_file_->header_)
353 scm_gc_unprotect_object (THIS->input_file_->header_->self_scm ());
354 THIS->input_file_->header_ = $1;
357 THIS->input_file_->scores_.push ($1);
360 if (dynamic_cast<Paper_def*> ($1))
361 THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultpaper"), $1->self_scm ());
362 else if (dynamic_cast<Midi_def*> ($1))
363 THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultmidi"), $1->self_scm ());
376 chordmodifiers_block:
377 CHORDMODIFIERS notenames_body { $$ = $2; }
381 PITCHNAMES notenames_body { $$ = $2; }
386 int i = scm_ilength ($1);
388 SCM tab = scm_make_vector (gh_int2scm (i), SCM_EOL);
389 for (SCM s = $1; gh_pair_p (s); s = ly_cdr (s)) {
390 SCM pt = ly_cdar (s);
391 if (!unsmob_pitch (pt))
392 THIS->parser_error ("Need pitch object.");
394 scm_hashq_set_x (tab, ly_caar (s), pt);
401 lilypond_header_body:
403 $$ = new Scheme_hash_table;
404 THIS->lexer_-> scopes_.push ($$);
406 | lilypond_header_body assignment {
412 HEADER '{' lilypond_header_body '}' {
414 THIS->lexer_->scopes_.pop ();
426 /* cont */ '=' identifier_init {
429 Should find generic way of associating input with objects.
431 Input ip = THIS->pop_spot ();
433 if (! regular_identifier_b ($1))
435 ip.warning (_ ("Identifier should have alphabetic characters only"));
438 THIS->lexer_->set_identifier ($1, $4);
441 TODO: devise standard for protection in parser.
443 The parser stack lives on the C-stack, which means that
444 all objects can be unprotected as soon as they're here.
454 $$ = $1->self_scm ();
455 scm_gc_unprotect_object ($$);
458 $$ = $1->self_scm ();
459 scm_gc_unprotect_object ($$);
461 | translator_spec_block {
465 $$ = $1->self_scm ();
466 scm_gc_unprotect_object ($$);
469 $$ = $1->self_scm ();
470 scm_gc_unprotect_object ($$);
475 | number_expression {
486 translator_spec_block:
487 TRANSLATOR '{' translator_spec_body '}'
493 translator_spec_body:
494 TRANSLATOR_IDENTIFIER {
495 $$ = unsmob_translator_def ($1)->clone_scm ();
496 unsmob_translator_def ($$)-> set_spot (THIS->here_input ());
499 $$ = Translator_def::make_scm ();
500 Translator_def*td = unsmob_translator_def ($$);
501 td->translator_group_type_ = $2;
502 td->set_spot (THIS->here_input ());
504 | translator_spec_body STRING '=' embedded_scm {
505 unsmob_translator_def ($$)->add_property_assign ($2, $4);
507 | translator_spec_body STRING OVERRIDE embedded_scm '=' embedded_scm {
508 unsmob_translator_def ($$)
509 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
511 | translator_spec_body STRING SET embedded_scm '=' embedded_scm {
512 unsmob_translator_def ($$)
513 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
515 | translator_spec_body STRING REVERT embedded_scm {
516 unsmob_translator_def ($$)->add_pop_property (
517 scm_string_to_symbol ($2), $4);
519 | translator_spec_body NAME STRING {
520 unsmob_translator_def ($$)->type_name_ = $3;
522 | translator_spec_body CONSISTS STRING {
523 unsmob_translator_def ($$)->add_element ($3);
525 | translator_spec_body ALIAS STRING {
526 Translator_def*td = unsmob_translator_def ($$);
527 td->type_aliases_ = gh_cons ($3, td->type_aliases_);
529 | translator_spec_body GROBDESCRIPTIONS embedded_scm {
530 Translator_def*td = unsmob_translator_def($$);
531 // td->add_property_assign (ly_symbol2scm ("allGrobDescriptions"), $3);
532 for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p))
533 td->add_property_assign (scm_symbol_to_string (ly_caar (p)), ly_cdar (p));
535 | translator_spec_body CONSISTSEND STRING {
536 unsmob_translator_def ($$)->add_last_element ( $3);
538 | translator_spec_body ACCEPTS STRING {
539 unsmob_translator_def ($$)->set_acceptor ($3,true);
541 | translator_spec_body DENIES STRING {
542 unsmob_translator_def ($$)->set_acceptor ($3,false);
544 | translator_spec_body REMOVE STRING {
545 unsmob_translator_def ($$)->remove_element ($3);
556 /*cont*/ '{' score_body '}' {
559 if (!$$->defs_.size ())
561 Music_output_def *id =
562 unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
563 $$->add_output (id ? id->clone () : new Paper_def );
572 $$->set_spot (THIS->here_input ());
573 SCM m = $1->self_scm ();
574 scm_gc_unprotect_object (m);
579 SCM check_funcs = scm_c_eval_string ("toplevel-music-functions");
580 for (; gh_pair_p (check_funcs); check_funcs = gh_cdr (check_funcs))
581 m = gh_call1 (gh_car (check_funcs), m);
586 $$ = new Score (*unsmob_score ($1));
587 $$->set_spot (THIS->here_input ());
589 | score_body lilypond_header {
590 scm_gc_unprotect_object ($2->self_scm ());
593 | score_body output_def {
606 music_output_def_body '}' {
608 THIS-> lexer_-> scopes_.pop ();
612 music_output_def_body:
614 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultmidi"));
619 p = dynamic_cast<Midi_def*> (id->clone ());
624 THIS->lexer_->scopes_.push (p->variable_tab_);
627 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
630 p = dynamic_cast<Paper_def*> (id->clone ());
633 THIS-> lexer_-> scopes_.push (p->variable_tab_);
636 | PAPER '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
637 Music_output_def *p = unsmob_music_output_def ($3);
639 THIS->lexer_->scopes_.push (p->variable_tab_);
642 | MIDI '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
643 Music_output_def *p = unsmob_music_output_def ($3);
646 THIS->lexer_->scopes_.push (p->variable_tab_);
649 | music_output_def_body assignment {
652 | music_output_def_body translator_spec_block {
653 $$->assign_translator ($2);
655 | music_output_def_body STYLESHEET embedded_scm {
656 dynamic_cast<Paper_def*> ($$)-> style_sheet_ = $3;
658 | music_output_def_body tempo_request {
660 junk this ? there already is tempo stuff in
663 int m = gh_scm2int ( $2->get_mus_property ("metronome-count"));
664 Duration *d = unsmob_duration ($2->get_mus_property ("duration"));
665 Midi_def * md = dynamic_cast<Midi_def*> ($$);
667 md->set_tempo (d->length_mom (), m);
669 | music_output_def_body error {
675 TEMPO steno_duration '=' bare_unsigned {
677 $$->set_mus_property ("duration", $2);
678 $$->set_mus_property ("metronome-count", gh_int2scm ( $4));
683 The representation of a list is the
687 to have efficient append.
689 Music_list: /* empty */ {
690 $$ = gh_cons (SCM_EOL, SCM_EOL);
694 SCM c = gh_cons ($2->self_scm (), SCM_EOL);
695 scm_gc_unprotect_object ($2->self_scm ()); /* UGH */
696 if (gh_pair_p (ly_cdr (s)))
697 gh_set_cdr_x (ly_cdr (s), c); /* append */
699 gh_set_car_x (s, c); /* set first cons */
700 gh_set_cdr_x (s, c) ; /* remember last cell */
716 | ALTERNATIVE '{' Music_list '}' {
722 REPEAT string bare_unsigned Music Alternative_music
726 SCM alts = gh_pair_p ($5) ? gh_car ($5) : SCM_EOL;
727 if (times < scm_ilength (alts)) {
728 unsmob_music (gh_car (alts))
729 ->origin ()->warning (
730 _("More alternatives than repeats. Junking excess alternatives."));
731 alts = ly_truncate_list (times, alts);
734 Repeated_music * r = new Repeated_music (SCM_EOL);
737 r-> set_mus_property ("element", beg->self_scm ());
738 scm_gc_unprotect_object (beg->self_scm ());
740 r->set_mus_property ("repeat-count", gh_int2scm (times >? 1));
742 r-> set_mus_property ("elements",alts);
743 SCM func = scm_primitive_eval (ly_symbol2scm ("repeat-name-to-ctor"));
744 SCM result = gh_call1 (func, $2);
746 if (gh_equal_p ($2, scm_makfrom0str ("tremolo")))
749 we can not get durations and other stuff correct down the line, so we have to
750 add to the duration log here.
754 SCM func = scm_primitive_eval (ly_symbol2scm ("shift-duration-log"));
755 gh_call2 (func, r->self_scm (), gh_int2scm(-intlog2 ($3)));
758 set_music_properties (r, result);
760 r->set_spot (*$4->origin ());
767 SEQUENTIAL '{' Music_list '}' {
768 $$ = new Sequential_music (SCM_EOL);
769 $$->set_mus_property ("elements", ly_car ($3));
770 $$->set_spot(THIS->here_input());
772 | '{' Music_list '}' {
773 $$ = new Sequential_music (SCM_EOL);
774 $$->set_mus_property ("elements", ly_car ($2));
775 $$->set_spot(THIS->here_input());
780 SIMULTANEOUS '{' Music_list '}'{
781 $$ = new Simultaneous_music (SCM_EOL);
782 $$->set_mus_property ("elements", ly_car ($3));
783 $$->set_spot(THIS->here_input());
786 | '<' Music_list '>' {
787 $$ = new Simultaneous_music (SCM_EOL);
788 $$->set_mus_property ("elements", ly_car ($2));
789 $$->set_spot(THIS->here_input());
794 request_chord { $$ = $1; }
795 | OUTPUTPROPERTY embedded_scm embedded_scm '=' embedded_scm {
797 if (!gh_symbol_p ($3))
799 THIS->parser_error (_ ("Second argument must be a symbol"));
801 /*hould check # args */
802 if (!gh_procedure_p (pred))
804 THIS->parser_error (_ ("First argument must be a procedure taking 1 argument"));
807 Music *m = new Music (SCM_EOL);
808 m->set_mus_property ("predicate", pred);
809 m->set_mus_property ("grob-property", $3);
810 m->set_mus_property ("grob-value", $5);
811 m->set_mus_property ("iterator-ctor",
812 Output_property_music_iterator::constructor_cxx_function);
817 $$ = unsmob_music ($1)->clone ();
819 $$->set_spot (THIS->here_input());
827 CONTEXT STRING Music {
828 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
829 csm->set_mus_property ("element", $3->self_scm ());
830 scm_gc_unprotect_object ($3->self_scm ());
832 csm->set_mus_property ("context-type",$2);
833 csm->set_mus_property ("context-id", scm_makfrom0str (""));
837 | AUTOCHANGE STRING Music {
838 Music * chm = new Music_wrapper (SCM_EOL);
839 chm->set_mus_property ("element", $3->self_scm ());
840 chm->set_mus_property ("iterator-ctor", Auto_change_iterator::constructor_cxx_function);
842 scm_gc_unprotect_object ($3->self_scm ());
843 chm->set_mus_property ("what", $2);
846 chm->set_spot (*$3->origin ());
851 The other version is for easier debugging of
852 Sequential_music_iterator in combination with grace notes.
855 SCM start = THIS->lexer_->lookup_identifier ("startGraceMusic");
856 SCM stop = THIS->lexer_->lookup_identifier ("stopGraceMusic");
857 Music *startm = unsmob_music (start);
858 Music *stopm = unsmob_music (stop);
862 stopm = stopm->clone ();
863 ms = gh_cons (stopm->self_scm (), ms);
864 scm_gc_unprotect_object (stopm->self_scm ());
866 ms = gh_cons ($2->self_scm (), ms);
867 scm_gc_unprotect_object ($2->self_scm());
869 startm = startm->clone ();
870 ms = gh_cons (startm->self_scm () , ms);
871 scm_gc_unprotect_object (startm->self_scm ());
874 Music* seq = new Sequential_music (SCM_EOL);
875 seq->set_mus_property ("elements", ms);
877 $$ = new Grace_music (SCM_EOL);
878 $$->set_mus_property ("element", seq->self_scm ());
879 scm_gc_unprotect_object (seq->self_scm ());
881 $$ = new Grace_music (SCM_EOL);
882 $$->set_mus_property ("element", $2->self_scm ());
883 scm_gc_unprotect_object ($2->self_scm ());
886 | CONTEXT string '=' string Music {
887 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
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 $$ = new Time_scaled_music (SCM_EOL);
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 $$ = new Transposed_music (SCM_EOL);
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 $$ = new Transposed_music (SCM_EOL);
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 = new Music (SCM_EOL);
948 { THIS->lexer_->push_note_state (); }
951 THIS->lexer_->pop_state ();
954 { THIS->lexer_->push_figuredbass_state (); }
957 Music * chm = new Untransposable_music () ;
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 = new Un_relativable_music ;
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 $$ = new Relative_octave_music (SCM_EOL);
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 Lyric_combine_music * l = new Lyric_combine_music (SCM_EOL);
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 Part_combine_music * p = new Part_combine_music (SCM_EOL);
1015 p->set_mus_property ("what", $2);
1016 p->set_mus_property ("elements", gh_list ($3->self_scm (),$4->self_scm (), SCM_UNDEFINED));
1018 scm_gc_unprotect_object ($3->self_scm ());
1019 scm_gc_unprotect_object ($4->self_scm ());
1026 TRANSLATOR STRING '=' STRING {
1027 Music * t = new Music (SCM_EOL);
1028 t->set_mus_property ("iterator-ctor",
1029 Change_iterator::constructor_cxx_function);
1030 t-> set_mus_property ("change-to-type", $2);
1031 t-> set_mus_property ("change-to-id", $4);
1034 $$->set_spot (THIS->here_input ());
1039 PROPERTY STRING '.' STRING '=' scalar {
1041 Music *t = set_property_music (scm_string_to_symbol ($4), $6);
1042 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1044 csm->set_mus_property ("element", t->self_scm ());
1045 scm_gc_unprotect_object (t->self_scm ());
1048 $$->set_spot (THIS->here_input ());
1050 csm-> set_mus_property ("context-type", $2);
1052 | PROPERTY STRING '.' STRING UNSET {
1053 Music *t = new Music (SCM_EOL);
1055 t->set_mus_property ("iterator-ctor",
1056 Property_unset_iterator::constructor_cxx_function);
1057 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
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 ());
1064 $$->set_spot (THIS->here_input ());
1066 csm-> set_mus_property ("context-type", $2);
1068 | PROPERTY STRING '.' STRING SET embedded_scm '=' embedded_scm {
1069 Music *t = new Music (SCM_EOL);
1070 t->set_mus_property ("iterator-ctor",
1071 Push_property_iterator::constructor_cxx_function);
1072 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1073 t->set_mus_property ("pop-first", SCM_BOOL_T);
1074 t->set_mus_property ("grob-property", $6);
1075 t->set_mus_property ("grob-value", $8);
1076 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1077 csm->set_mus_property ("element", t->self_scm ());
1078 scm_gc_unprotect_object (t->self_scm ());
1080 $$->set_spot (THIS->here_input ());
1082 csm-> set_mus_property ("context-type", $2);
1084 | PROPERTY STRING '.' STRING OVERRIDE embedded_scm '=' embedded_scm {
1085 Music *t = new Music (SCM_EOL);
1086 t->set_mus_property ("iterator-ctor",
1087 Push_property_iterator::constructor_cxx_function);
1088 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1089 t->set_mus_property ("grob-property", $6);
1090 t->set_mus_property ("grob-value", $8);
1091 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1092 csm->set_mus_property ("element", t->self_scm ());
1093 scm_gc_unprotect_object (t->self_scm ());
1096 $$->set_spot (THIS->here_input ());
1098 csm-> set_mus_property ("context-type", $2);
1100 | PROPERTY STRING '.' STRING REVERT embedded_scm {
1101 Music *t = new Music (SCM_EOL);
1102 t->set_mus_property ("iterator-ctor",
1103 Pop_property_iterator::constructor_cxx_function);
1104 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1105 t->set_mus_property ("grob-property", $6);
1107 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1108 csm->set_mus_property ("element", t->self_scm ());
1109 scm_gc_unprotect_object (t->self_scm ());
1112 $$->set_spot (THIS->here_input ());
1114 csm-> set_mus_property ("context-type", $2);
1121 | bare_int { $$ = gh_int2scm ($1); }
1122 | embedded_scm { $$ = $1; }
1129 } /*cont */ simple_element post_requests {
1130 Music_sequence *l = dynamic_cast<Music_sequence*> ($3);
1133 for (int i=0; i < $1->size (); i++) {
1134 Music * m = $1->elem (i);
1135 l->append_music (m);
1147 $$ = new Request_chord (SCM_EOL);
1148 $$->set_mus_property ("elements", gh_cons ($1->self_scm (), SCM_EOL));
1149 scm_gc_unprotect_object ($1->self_scm());
1151 $$-> set_spot (THIS->here_input ());
1152 $1-> set_spot (THIS->here_input ());
1155 Span_req *l = new Span_req;
1156 l->set_span_dir (START);
1157 l->set_mus_property ("span-type", scm_makfrom0str ("ligature"));
1158 l->set_spot (THIS->here_input ());
1160 $$ = new Request_chord (SCM_EOL);
1161 $$->set_mus_property ("elements", gh_cons (l->self_scm (), SCM_EOL));
1162 scm_gc_unprotect_object (l->self_scm());
1163 $$->set_spot (THIS->here_input ());
1166 Span_req *l = new Span_req;
1167 l->set_span_dir (STOP);
1168 l->set_mus_property ("span-type", scm_makfrom0str ("ligature"));
1169 l->set_spot (THIS->here_input ());
1171 $$ = new Request_chord (SCM_EOL);
1172 $$->set_mus_property ("elements", gh_cons (l->self_scm (), SCM_EOL));
1173 $$->set_spot (THIS->here_input ());
1174 scm_gc_unprotect_object (l->self_scm());
1178 $$ = new Music (gh_list (gh_cons (ly_symbol2scm ("name"), ly_symbol2scm ("separator")), SCM_UNDEFINED));
1179 $$->set_spot (THIS->here_input ());
1183 extern Music * get_barcheck();
1184 $$ = get_barcheck ();
1185 $$->set_spot (THIS->here_input ());
1188 Music *t = set_property_music (ly_symbol2scm ("whichBar"), $2);
1190 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1191 csm->set_mus_property ("element", t->self_scm ());
1192 scm_gc_unprotect_object (t->self_scm ());
1195 $$->set_spot (THIS->here_input ());
1197 csm->set_mus_property ("context-type", scm_makfrom0str ("Score"));
1199 | PARTIAL duration_length {
1200 Moment m = - unsmob_duration ($2)->length_mom ();
1201 Music * p = set_property_music (ly_symbol2scm ( "measurePosition"),m.smobbed_copy ());
1203 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1204 sp->set_mus_property ("element", p->self_scm ());
1205 scm_gc_unprotect_object (p->self_scm ());
1208 sp-> set_mus_property ("context-type", scm_makfrom0str ( "Score"));
1211 SCM func = scm_primitive_eval (ly_symbol2scm ("clef-name-to-properties"));
1212 SCM result = gh_call1 (func, $2);
1215 for (SCM s = result ; gh_pair_p (s); s = ly_cdr (s)) {
1216 Music * p = new Music (SCM_EOL);
1217 set_music_properties (p, ly_car (s));
1218 l = gh_cons (p->self_scm (), l);
1219 scm_gc_unprotect_object (p->self_scm ());
1221 Sequential_music * seq = new Sequential_music (SCM_EOL);
1222 seq->set_mus_property ("elements", l);
1224 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1225 sp->set_mus_property ("element", seq->self_scm ());
1226 scm_gc_unprotect_object (seq->self_scm ());
1229 sp-> set_mus_property ("context-type", scm_makfrom0str ("Staff"));
1232 Music * p1 = set_property_music (ly_symbol2scm ( "timeSignatureFraction"), $2);
1234 int l = gh_scm2int (ly_car ($2));
1235 int o = gh_scm2int (ly_cdr ($2));
1237 Moment one_beat = Moment (1)/Moment (o);
1238 Moment len = Moment (l) * one_beat;
1241 Music *p2 = set_property_music (ly_symbol2scm ("measureLength"), len.smobbed_copy ());
1242 Music *p3 = set_property_music (ly_symbol2scm ("beatLength"), one_beat.smobbed_copy ());
1244 SCM list = scm_list_n (p1->self_scm (), p2->self_scm (), p3->self_scm(), SCM_UNDEFINED);
1245 Sequential_music *seq = new Sequential_music (SCM_EOL);
1246 seq->set_mus_property ("elements", list);
1249 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1250 sp->set_mus_property ("element", seq->self_scm ());
1254 scm_gc_unprotect_object (p3->self_scm ());
1255 scm_gc_unprotect_object (p2->self_scm ());
1256 scm_gc_unprotect_object (p1->self_scm ());
1257 scm_gc_unprotect_object (seq->self_scm ());
1262 TODO: should make alias TimingContext for Score
1265 sp-> set_mus_property ("context-type", scm_makfrom0str ( "Score"));
1270 shorthand_command_req { $$ = $1; }
1271 | verbose_command_req { $$ = $1; }
1274 shorthand_command_req:
1285 Span_req*b= new Span_req;
1286 b->set_span_dir (START);
1287 b->set_mus_property ("span-type", scm_makfrom0str ("beam"));
1291 THIS->last_beam_start_ = b->self_scm ();
1294 Span_req*b= new Span_req;
1295 b->set_span_dir ( STOP);
1296 b->set_mus_property ("span-type", scm_makfrom0str ("beam"));
1300 $$ = new Breathing_sign_req;
1303 $$ = new Porrectus_req;
1307 verbose_command_req:
1308 COMMANDSPANREQUEST bare_int STRING { /*TODO: junkme */
1309 Span_req * sp = new Span_req;
1310 sp-> set_span_dir ( Direction ($2));
1311 sp->set_mus_property ("span-type",$3);
1312 sp->set_spot (THIS->here_input ());
1316 Mark_req * m = new Mark_req;
1320 Mark_req *m = new Mark_req;
1321 m->set_mus_property ("label", $2);
1325 Break_req * b = new Break_req;
1327 if (!gh_number_p (s))
1330 b->set_mus_property ("penalty", s);
1331 b->set_spot (THIS->here_input ());
1334 | SKIP duration_length {
1335 Skip_req * skip = new Skip_req;
1336 skip->set_mus_property ("duration", $2);
1344 Key_change_req *key= new Key_change_req;
1347 | KEY NOTENAME_PITCH SCM_IDENTIFIER {
1348 Key_change_req *key= new Key_change_req;
1350 key->set_mus_property ("pitch-alist", $3);
1351 ((Music*)key)->transpose (* unsmob_pitch ($2));
1358 $$ = new Link_array<Request>;
1360 | post_requests post_request {
1361 $2->set_spot (THIS->here_input ());
1373 request_that_take_dir:
1376 | script_abbreviation {
1377 SCM s = THIS->lexer_->lookup_identifier ("dash" + ly_scm2string ($1));
1378 Articulation_req *a = new Articulation_req;
1379 if (gh_string_p (s))
1380 a->set_mus_property ("articulation-type", s);
1381 else THIS->parser_error (_ ("Expecting string as script definition"));
1387 script_dir request_that_take_dir {
1388 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1389 gs->set_direction (Direction ($1));
1391 $2->origin ()->warning (_ ("Can't specify direction for this request"));
1397 REQUEST_IDENTIFIER {
1398 $$ = dynamic_cast<Request*> (unsmob_music ($1)->clone ());
1399 $$->set_spot (THIS->here_input ());
1401 | DYNAMICSCRIPT embedded_scm {
1403 TODO: junkme, use text-type == dynamic
1405 Text_script_req *d = new Text_script_req;
1406 SCM dyn = ly_symbol2scm ("dynamic");
1407 d->set_mus_property ("text-type" , dyn);
1408 d->set_mus_property ("text", $2);
1409 d->set_spot (THIS->here_input ());
1412 | SPANREQUEST bare_int STRING {
1413 Span_req * sp = new Span_req;
1414 sp->set_span_dir ( Direction ($2));
1415 sp->set_mus_property ("span-type", $3);
1416 sp->set_spot (THIS->here_input ());
1420 Tremolo_req* a = new Tremolo_req;
1421 a->set_spot (THIS->here_input ());
1422 a->set_mus_property ("tremolo-type", gh_int2scm ($1));
1426 Articulation_req * a = new Articulation_req;
1427 a->set_mus_property ("articulation-type", $2);
1428 a->set_spot (THIS->here_input ());
1432 duh, junk this syntax from the parser, if possible.
1435 Arpeggio_req *a = new Arpeggio_req;
1436 a->set_spot (THIS->here_input ());
1440 Glissando_req *g = new Glissando_req;
1441 g->set_spot /* No pun intended */ (THIS->here_input ());
1468 | NOTENAME_PITCH sup_quotes {
1469 Pitch p = *unsmob_pitch ($1);
1471 $$ = p.smobbed_copy ();
1473 | NOTENAME_PITCH sub_quotes {
1474 Pitch p =* unsmob_pitch ($1);
1477 $$ = p.smobbed_copy ();
1490 | TONICNAME_PITCH sup_quotes {
1491 Pitch p = *unsmob_pitch ($1);
1493 $$ = p.smobbed_copy ();
1495 | TONICNAME_PITCH sub_quotes {
1496 Pitch p =* unsmob_pitch ($1);
1499 $$ = p.smobbed_copy ();
1514 PITCH embedded_scm {
1516 if (!unsmob_pitch ($2)) {
1517 THIS->parser_error (_f ("Expecting musical-pitch value", 3));
1518 $$ = Pitch ().smobbed_copy ();
1524 DURATION embedded_scm {
1526 if (!unsmob_duration ($2))
1528 THIS->parser_error (_ ("Must have duration object"));
1529 $$ = Duration ().smobbed_copy ();
1536 if (!THIS->lexer_->lyric_state_b ())
1537 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1538 $$ = new Extender_req;
1544 if (!THIS->lexer_->lyric_state_b ())
1545 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1546 $$ = new Hyphen_req;
1551 close_request_parens {
1553 dynamic_cast<Span_req*> ($$)->set_span_dir ( START);
1557 close_request_parens:
1559 Span_req* s= new Span_req;
1561 s->set_mus_property ("span-type", scm_makfrom0str ( "slur"));
1562 s->set_spot (THIS->here_input());
1565 Span_req* s= new Span_req;
1567 s->set_mus_property ("span-type", scm_makfrom0str ( "phrasing-slur"));
1568 s->set_spot (THIS->here_input());
1571 Span_req*s =new Span_req;
1573 s->set_mus_property ("span-type", scm_makfrom0str ( "crescendo"));
1574 s->set_spot (THIS->here_input());
1577 Span_req*s =new Span_req;
1579 s->set_mus_property ("span-type", scm_makfrom0str ("decrescendo"));
1580 s->set_spot (THIS->here_input());
1586 open_request_parens {
1588 dynamic_cast<Span_req*> ($$)->set_span_dir (STOP);
1592 open_request_parens:
1594 Span_req *s = new Span_req;
1595 s->set_mus_property ("span-type", scm_makfrom0str ( "crescendo"));
1596 s->set_spot (THIS->here_input());
1601 Span_req* s= new Span_req;
1603 s->set_mus_property ("span-type", scm_makfrom0str ( "slur"));
1604 s->set_spot (THIS->here_input());
1608 Span_req* s= new Span_req;
1610 s->set_mus_property ("span-type", scm_makfrom0str ( "phrasing-slur"));
1611 s->set_spot (THIS->here_input());
1617 Text_script_req *t = new Text_script_req;
1618 t->set_mus_property ("text", $1);
1619 t->set_spot (THIS->here_input ());
1623 Text_script_req *t = new Text_script_req;
1624 t->set_mus_property ("text", $1);
1625 t->set_spot (THIS->here_input ());
1629 String ds = to_string ($1);
1630 Text_script_req* t = new Text_script_req;
1631 SCM finger = ly_symbol2scm ("finger");
1632 t->set_mus_property ("text", scm_makfrom0str (ds.to_str0 ()));
1633 t->set_mus_property ("text-type" , finger);
1634 t->set_spot (THIS->here_input ());
1639 script_abbreviation:
1641 $$ = scm_makfrom0str ("Hat");
1644 $$ = scm_makfrom0str ("Plus");
1647 $$ = scm_makfrom0str ("Dash");
1650 $$ = scm_makfrom0str ("Bar");
1653 $$ = scm_makfrom0str ("Larger");
1656 $$ = scm_makfrom0str ("Dot");
1663 | '-' { $$ = CENTER; }
1668 $$ = new Link_array<Request>;
1670 | pre_requests open_request {
1682 multiplied_duration {
1685 | verbose_duration {
1690 optional_notemode_duration:
1692 Duration dd = THIS->default_duration_;
1693 $$ = dd.smobbed_copy ();
1695 THIS->beam_check ($$);
1697 | multiplied_duration {
1699 THIS->default_duration_ = *unsmob_duration ($$);
1701 THIS->beam_check ($$);
1703 | verbose_duration {
1705 THIS->default_duration_ = *unsmob_duration ($$);
1710 bare_unsigned dots {
1712 if (!is_duration_b ($1))
1713 THIS->parser_error (_f ("not a duration: %d", $1));
1717 $$ = Duration (l, $2).smobbed_copy ();
1719 | DURATION_IDENTIFIER dots {
1720 Duration *d =unsmob_duration ($1);
1721 Duration k (d->duration_log (),d->dot_count () + $2);
1722 $$ = k.smobbed_copy ();
1729 multiplied_duration:
1733 | multiplied_duration '*' bare_unsigned {
1734 $$ = unsmob_duration ($$)->compressed ( $3) .smobbed_copy ();
1736 | multiplied_duration '*' FRACTION {
1737 Rational m (gh_scm2int (ly_car ($3)), gh_scm2int (ly_cdr ($3)));
1739 $$ = unsmob_duration ($$)->compressed (m).smobbed_copy ();
1744 FRACTION { $$ = $1; }
1745 | UNSIGNED '/' UNSIGNED {
1746 $$ = gh_cons (gh_int2scm ($1), gh_int2scm ($3));
1764 | ':' bare_unsigned {
1765 if (!is_duration_b ($2))
1766 THIS->parser_error (_f ("not a duration: %d", $2));
1785 Bass_figure_req *bfr = new Bass_figure_req;
1786 $$ = bfr->self_scm();
1787 scm_gc_unprotect_object ($$);
1790 Bass_figure_req *bfr = new Bass_figure_req;
1791 $$ = bfr->self_scm();
1793 bfr->set_mus_property ("figure", gh_int2scm ($1));
1795 scm_gc_unprotect_object ($$);
1797 | bass_figure bass_mod {
1798 Music *m = unsmob_music ($1);
1800 SCM salter =m->get_mus_property ("alteration");
1801 int alter = gh_number_p ( salter) ? gh_scm2int (salter) : 0;
1802 m->set_mus_property ("alteration",
1803 gh_int2scm (alter + $2));
1805 m->set_mus_property ("alteration", gh_int2scm (0));
1813 unsmob_music ($$)->set_mus_property ("bracket-start", SCM_BOOL_T);
1818 | br_bass_figure ']' {
1820 unsmob_music ($1)->set_mus_property ("bracket-stop", SCM_BOOL_T);
1828 | figure_list br_bass_figure {
1829 $$ = gh_cons ($2, $1);
1834 FIGURE_OPEN figure_list FIGURE_CLOSE {
1835 Music * m = new Request_chord (SCM_EOL);
1836 $2 = scm_reverse_x ($2, SCM_EOL);
1837 m->set_mus_property ("elements", $2);
1838 $$ = m->self_scm ();
1849 pitch exclamations questions optional_notemode_duration optional_rest {
1851 Input i = THIS->pop_spot ();
1852 if (!THIS->lexer_->note_state_b ())
1853 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1861 n->set_mus_property ("pitch", $1);
1862 n->set_mus_property ("duration", $4);
1866 n->set_mus_property ("cautionary", SCM_BOOL_T);
1867 if ($2 % 2 || $3 % 2)
1868 n->set_mus_property ("force-accidental", SCM_BOOL_T);
1870 Simultaneous_music*v = new Request_chord (SCM_EOL);
1871 v->set_mus_property ("elements", scm_list_n (n->self_scm (), SCM_UNDEFINED));
1872 scm_gc_unprotect_object (n->self_scm());
1878 | figure_spec optional_notemode_duration {
1879 Music * m = unsmob_music ($1);
1880 Input i = THIS->pop_spot ();
1882 for (SCM s = m->get_mus_property ("elements"); gh_pair_p (s); s = ly_cdr (s))
1884 unsmob_music (ly_car (s))->set_mus_property ("duration", $2);
1888 | RESTNAME optional_notemode_duration {
1890 Input i = THIS->pop_spot ();
1891 SCM e = SCM_UNDEFINED;
1892 if (ly_scm2string ($1) =="s") {
1894 Skip_req * skip = new Skip_req;
1895 skip->set_mus_property ("duration" ,$2);
1897 e = skip->self_scm ();
1900 Rest_req * rest_req = new Rest_req;
1901 rest_req->set_mus_property ("duration", $2);
1902 rest_req->set_spot (i);
1903 e = rest_req->self_scm ();
1905 Simultaneous_music* velt = new Request_chord (SCM_EOL);
1906 velt-> set_mus_property ("elements", scm_list_n (e,SCM_UNDEFINED));
1911 | MULTI_MEASURE_REST optional_notemode_duration {
1912 Input i = THIS->pop_spot ();
1914 Skip_req * sk = new Skip_req;
1915 sk->set_mus_property ("duration", $2);
1916 Span_req *sp1 = new Span_req;
1917 Span_req *sp2 = new Span_req;
1918 sp1-> set_span_dir ( START);
1919 sp2-> set_span_dir ( STOP);
1920 SCM r = scm_makfrom0str ("rest");
1921 sp1->set_mus_property ("span-type", r);
1922 sp2->set_mus_property ("span-type", r);
1924 Request_chord * rqc1 = new Request_chord (SCM_EOL);
1925 rqc1->set_mus_property ("elements", scm_list_n (sp1->self_scm (), SCM_UNDEFINED));
1926 Request_chord * rqc2 = new Request_chord (SCM_EOL);
1927 rqc2->set_mus_property ("elements", scm_list_n (sk->self_scm (), SCM_UNDEFINED));;
1928 Request_chord * rqc3 = new Request_chord (SCM_EOL);
1929 rqc3->set_mus_property ("elements", scm_list_n (sp2->self_scm (), SCM_UNDEFINED));;
1931 SCM ms = scm_list_n (rqc1->self_scm (), rqc2->self_scm (), rqc3->self_scm (), SCM_UNDEFINED);
1933 $$ = new Sequential_music (SCM_EOL);
1934 $$->set_mus_property ("elements", ms);
1936 | STRING optional_notemode_duration {
1937 Input i = THIS->pop_spot ();
1939 Lyric_req* lreq = new Lyric_req;
1940 lreq->set_mus_property ("text", $1);
1941 lreq->set_mus_property ("duration",$2);
1943 Simultaneous_music* velt = new Request_chord (SCM_EOL);
1944 velt->set_mus_property ("elements", scm_list_n (lreq->self_scm (), SCM_UNDEFINED));
1949 Input i = THIS->pop_spot ();
1951 if (!THIS->lexer_->chord_state_b ())
1952 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1959 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
1960 $$ = Chord::get_chord ($1, $3, $4, $5, $6, $2);
1961 $$->set_spot (THIS->here_input ());
1968 | CHORD_COLON chord_notes {
1977 | chord_notes '.' chord_step {
1978 $$ = gh_append2 ($$, $3);
1986 | CHORD_CARET chord_notes {
1996 | '/' steno_tonic_pitch {
2005 | CHORD_BASS steno_tonic_pitch {
2012 $$ = gh_cons ($1, SCM_EOL);
2014 | CHORDMODIFIER_PITCH {
2015 $$ = gh_cons (unsmob_pitch ($1)->smobbed_copy (), SCM_EOL);
2017 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
2018 $$ = scm_list_n (unsmob_pitch ($1)->smobbed_copy (),
2026 m.notename_ = ($1 - 1) % 7;
2027 m.octave_ = $1 > 7 ? 1 : 0;
2030 $$ = m.smobbed_copy ();
2032 | bare_unsigned '+' {
2034 m.notename_ = ($1 - 1) % 7;
2035 m.octave_ = $1 > 7 ? 1 : 0;
2039 $$ = m.smobbed_copy ();
2041 | bare_unsigned CHORD_MINUS {
2043 m.notename_ = ($1 - 1) % 7;
2044 m.octave_ = $1 > 7 ? 1 : 0;
2047 $$ = m.smobbed_copy ();
2055 number_expression '+' number_term {
2056 $$ = scm_sum ($1, $3);
2058 | number_expression '-' number_term {
2059 $$ = scm_difference ($1, $3);
2068 | number_factor '*' number_factor {
2069 $$ = scm_product ($1, $3);
2071 | number_factor '/' number_factor {
2072 $$ = scm_divide ($1, $3);
2077 '(' number_expression ')' {
2080 | '-' number_factor { /* %prec UNARY_MINUS */
2081 $$ = scm_difference ($2, SCM_UNDEFINED);
2089 $$ = gh_int2scm ($1);
2094 | NUMBER_IDENTIFIER {
2098 $$ = gh_double2scm (gh_scm2double ($1) CM );
2101 $$ = gh_double2scm (gh_scm2double ($1) PT);
2104 $$ = gh_double2scm (gh_scm2double ($1) INCH);
2107 $$ = gh_double2scm (gh_scm2double ($1) MM);
2110 $$ = gh_double2scm (gh_scm2double ($1) CHAR);
2126 if (scm_integer_p ($1) == SCM_BOOL_T)
2128 int k = gh_scm2int ($1);
2132 THIS->parser_error (_ ("need integer number arg"));
2146 | STRING_IDENTIFIER {
2149 | string '+' string {
2150 $$ = scm_string_append (scm_list_n ($1, $3, SCM_UNDEFINED));
2157 | exclamations '!' { $$ ++; }
2162 | questions '?' { $$ ++; }
2169 My_lily_parser::set_yydebug (bool )
2176 extern My_lily_parser * current_parser;
2179 My_lily_parser::do_yyparse ()
2182 current_parser = this;;
2183 yyparse ((void*)this);
2188 Should make this optional? It will also complain when you do
2192 which is entirely legitimate.
2194 Or we can scrap it. Barchecks should detect wrong durations, and
2195 skipTypesetting speeds it up a lot.
2198 My_lily_parser::beam_check (SCM dur)
2200 Duration *d = unsmob_duration (dur);
2201 if (unsmob_music (last_beam_start_) && d->duration_log () <= 2)
2203 Music * m = unsmob_music (last_beam_start_);
2204 m->origin ()->warning (_("Suspect duration found following this beam"));
2206 last_beam_start_ = SCM_EOL;