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
130 /* We use SCMs to do strings, because it saves us the trouble of
131 deleting them. Let's hope that a stack overflow doesnt trigger a move
132 of the parse stack onto the heap. */
137 Link_array<Request> *reqvec;
139 String *string; // needed by the lexer as temporary scratch area.
142 Scheme_hash_table *scmhash;
143 Music_output_def * outputdef;
155 yylex (YYSTYPE *s, void * v)
157 My_lily_parser *pars = (My_lily_parser*) v;
158 My_lily_lexer * lex = pars->lexer_;
160 lex->lexval = (void*) s;
161 return lex->yylex ();
169 /* tokens which are not keywords */
179 %token CHORDMODIFIERS
187 %token GROBDESCRIPTIONS
193 %token FIGURES FIGURE_OPEN FIGURE_CLOSE
194 %token FIGURE_BRACKET_CLOSE FIGURE_BRACKET_OPEN
204 %token MULTI_MEASURE_REST
216 %token OVERRIDE SET REVERT
229 %token COMMANDSPANREQUEST
231 %token OUTPUTPROPERTY
242 %token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE
243 %token E_LEFTSQUARE E_RIGHTSQUARE E_TILDE
245 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET
249 %type <i> exclamations questions dots optional_rest
250 %type <i> bass_number bass_mod
251 %type <scm> br_bass_figure bass_figure figure_list figure_spec
253 %token <scm> NOTENAME_PITCH
254 %token <scm> TONICNAME_PITCH
255 %token <scm> CHORDMODIFIER_PITCH
256 %token <scm> DURATION_IDENTIFIER
257 %token <scm> FRACTION
258 %token <id> IDENTIFIER
261 %token <scm> SCORE_IDENTIFIER
262 %token <scm> MUSIC_OUTPUT_DEF_IDENTIFIER
264 %token <scm> NUMBER_IDENTIFIER
265 %token <scm> REQUEST_IDENTIFIER
266 %token <scm> MUSIC_IDENTIFIER TRANSLATOR_IDENTIFIER
267 %token <scm> STRING_IDENTIFIER SCM_IDENTIFIER
268 %token <scm> RESTNAME
274 %type <outputdef> output_def
275 %type <scmhash> lilypond_header lilypond_header_body
276 %type <request> open_request_parens close_request_parens open_request close_request
277 %type <request> request_with_dir request_that_take_dir verbose_request
278 %type <i> sub_quotes sup_quotes
279 %type <music> simple_element request_chord command_element Simple_music Composite_music
280 %type <music> Repeated_music
281 %type <scm> Alternative_music
282 %type <i> tremolo_type
283 %type <i> bare_int bare_unsigned
286 %type <scm> identifier_init
288 %type <scm> steno_duration optional_notemode_duration multiplied_duration
289 %type <scm> verbose_duration
291 %type <reqvec> pre_requests post_requests
292 %type <request> gen_text_def
293 %type <scm> steno_pitch pitch absolute_pitch
294 %type <scm> explicit_pitch steno_tonic_pitch
296 %type <scm> chord_additions chord_subtractions chord_notes chord_step
298 %type <scm> chord_note chord_inversion chord_bass
299 %type <scm> duration_length fraction
301 %type <scm> embedded_scm scalar
302 %type <music> Music Sequential_music Simultaneous_music
303 %type <music> relative_music re_rhythmed_music part_combined_music
304 %type <music> property_def translator_change
305 %type <scm> Music_list
306 %type <outputdef> music_output_def_body
307 %type <request> shorthand_command_req
308 %type <request> post_request
309 %type <music> command_req verbose_command_req
310 %type <request> extender_req
311 %type <request> hyphen_req
312 %type <scm> string bare_number number_expression number_term number_factor
314 %type <score> score_block score_body
316 %type <scm> translator_spec_block translator_spec_body
317 %type <tempo> tempo_request
318 %type <scm> notenames_body notenames_block chordmodifiers_block
319 %type <scm> script_abbreviation
325 /* We don't assign precedence to / and *, because we might need varied
326 prec levels in different prods */
332 lilypond: /* empty */
333 | lilypond toplevel_expression {}
334 | lilypond assignment { }
336 THIS->error_level_ = 1;
339 THIS->error_level_ = 1;
345 THIS->lexer_->pitchname_tab_ = $1;
347 | chordmodifiers_block {
348 THIS->lexer_->chordmodifier_tab_ = $1;
351 if (THIS->input_file_->header_)
352 scm_gc_unprotect_object (THIS->input_file_->header_->self_scm ());
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 $$ = new Scheme_hash_table;
403 THIS->lexer_-> scopes_.push ($$);
405 | lilypond_header_body assignment {
411 HEADER '{' lilypond_header_body '}' {
413 THIS->lexer_->scopes_.pop ();
425 /* cont */ '=' identifier_init {
428 Should find generic way of associating input with objects.
430 Input ip = THIS->pop_spot ();
432 if (! regular_identifier_b ($1))
434 ip.warning (_ ("Identifier should have alphabetic characters only"));
437 THIS->lexer_->set_identifier ($1, $4);
440 TODO: devise standard for protection in parser.
442 The parser stack lives on the C-stack, which means that
443 all objects can be unprotected as soon as they're here.
453 $$ = $1->self_scm ();
454 scm_gc_unprotect_object ($$);
457 $$ = $1->self_scm ();
458 scm_gc_unprotect_object ($$);
460 | translator_spec_block {
464 $$ = $1->self_scm ();
465 scm_gc_unprotect_object ($$);
468 $$ = $1->self_scm ();
469 scm_gc_unprotect_object ($$);
474 | number_expression {
485 translator_spec_block:
486 TRANSLATOR '{' translator_spec_body '}'
492 translator_spec_body:
493 TRANSLATOR_IDENTIFIER {
494 $$ = unsmob_translator_def ($1)->clone_scm ();
495 unsmob_translator_def ($$)-> set_spot (THIS->here_input ());
498 $$ = Translator_def::make_scm ();
499 Translator_def*td = unsmob_translator_def ($$);
500 td->translator_group_type_ = $2;
501 td->set_spot (THIS->here_input ());
503 | translator_spec_body STRING '=' embedded_scm {
504 unsmob_translator_def ($$)->add_property_assign ($2, $4);
506 | translator_spec_body STRING OVERRIDE embedded_scm '=' embedded_scm {
507 unsmob_translator_def ($$)
508 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
510 | translator_spec_body STRING SET embedded_scm '=' embedded_scm {
511 unsmob_translator_def ($$)
512 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
514 | translator_spec_body STRING REVERT embedded_scm {
515 unsmob_translator_def ($$)->add_pop_property (
516 scm_string_to_symbol ($2), $4);
518 | translator_spec_body NAME STRING {
519 unsmob_translator_def ($$)->type_name_ = $3;
521 | translator_spec_body CONSISTS STRING {
522 unsmob_translator_def ($$)->add_element ($3);
524 | translator_spec_body ALIAS STRING {
525 Translator_def*td = unsmob_translator_def ($$);
526 td->type_aliases_ = gh_cons ($3, td->type_aliases_);
528 | translator_spec_body GROBDESCRIPTIONS embedded_scm {
529 Translator_def*td = unsmob_translator_def($$);
530 // td->add_property_assign (ly_symbol2scm ("allGrobDescriptions"), $3);
531 for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p))
532 td->add_property_assign (scm_symbol_to_string (ly_caar (p)), ly_cdar (p));
534 | translator_spec_body CONSISTSEND STRING {
535 unsmob_translator_def ($$)->add_last_element ( $3);
537 | translator_spec_body ACCEPTS STRING {
538 unsmob_translator_def ($$)->set_acceptor ($3,true);
540 | translator_spec_body DENIES STRING {
541 unsmob_translator_def ($$)->set_acceptor ($3,false);
543 | translator_spec_body REMOVE STRING {
544 unsmob_translator_def ($$)->remove_element ($3);
555 /*cont*/ '{' score_body '}' {
558 if (!$$->defs_.size ())
560 Music_output_def *id =
561 unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
562 $$->add_output (id ? id->clone () : new Paper_def );
571 $$->set_spot (THIS->here_input ());
572 SCM m = $1->self_scm ();
573 scm_gc_unprotect_object (m);
578 SCM check_funcs = scm_c_eval_string ("toplevel-music-functions");
579 for (; gh_pair_p (check_funcs); check_funcs = gh_cdr (check_funcs))
580 m = gh_call1 (gh_car (check_funcs), m);
585 $$ = new Score (*unsmob_score ($1));
586 $$->set_spot (THIS->here_input ());
588 | score_body lilypond_header {
589 scm_gc_unprotect_object ($2->self_scm ());
592 | score_body output_def {
605 music_output_def_body '}' {
607 THIS-> lexer_-> scopes_.pop ();
611 music_output_def_body:
613 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultmidi"));
618 p = dynamic_cast<Midi_def*> (id->clone ());
623 THIS->lexer_->scopes_.push (p->variable_tab_);
626 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
629 p = dynamic_cast<Paper_def*> (id->clone ());
632 THIS-> lexer_-> scopes_.push (p->variable_tab_);
635 | PAPER '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
636 Music_output_def *p = unsmob_music_output_def ($3);
638 THIS->lexer_->scopes_.push (p->variable_tab_);
641 | MIDI '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
642 Music_output_def *p = unsmob_music_output_def ($3);
645 THIS->lexer_->scopes_.push (p->variable_tab_);
648 | music_output_def_body assignment {
651 | music_output_def_body translator_spec_block {
652 $$->assign_translator ($2);
654 | music_output_def_body STYLESHEET embedded_scm {
655 dynamic_cast<Paper_def*> ($$)-> style_sheet_ = $3;
657 | music_output_def_body tempo_request {
659 junk this ? there already is tempo stuff in
662 int m = gh_scm2int ( $2->get_mus_property ("metronome-count"));
663 Duration *d = unsmob_duration ($2->get_mus_property ("duration"));
664 Midi_def * md = dynamic_cast<Midi_def*> ($$);
666 md->set_tempo (d->length_mom (), m);
668 | music_output_def_body error {
674 TEMPO steno_duration '=' bare_unsigned {
676 $$->set_mus_property ("duration", $2);
677 $$->set_mus_property ("metronome-count", gh_int2scm ( $4));
682 The representation of a list is the
686 to have efficient append.
688 Music_list: /* empty */ {
689 $$ = gh_cons (SCM_EOL, SCM_EOL);
693 SCM c = gh_cons ($2->self_scm (), SCM_EOL);
694 scm_gc_unprotect_object ($2->self_scm ()); /* UGH */
695 if (gh_pair_p (ly_cdr (s)))
696 gh_set_cdr_x (ly_cdr (s), c); /* append */
698 gh_set_car_x (s, c); /* set first cons */
699 gh_set_cdr_x (s, c) ; /* remember last cell */
715 | ALTERNATIVE '{' Music_list '}' {
721 REPEAT string bare_unsigned Music Alternative_music
725 SCM alts = gh_pair_p ($5) ? gh_car ($5) : SCM_EOL;
726 if (times < scm_ilength (alts)) {
727 unsmob_music (gh_car (alts))
728 ->origin ()->warning (
729 _("More alternatives than repeats. Junking excess alternatives."));
730 alts = ly_truncate_list (times, alts);
733 Repeated_music * r = new Repeated_music (SCM_EOL);
736 r-> set_mus_property ("element", beg->self_scm ());
737 scm_gc_unprotect_object (beg->self_scm ());
739 r->set_mus_property ("repeat-count", gh_int2scm (times >? 1));
741 r-> set_mus_property ("elements",alts);
742 SCM func = scm_primitive_eval (ly_symbol2scm ("repeat-name-to-ctor"));
743 SCM result = gh_call1 (func, $2);
745 if (gh_equal_p ($2, scm_makfrom0str ("tremolo")))
748 we can not get durations and other stuff correct down the line, so we have to
749 add to the duration log here.
753 SCM func = scm_primitive_eval (ly_symbol2scm ("shift-duration-log"));
754 gh_call2 (func, r->self_scm (), gh_int2scm(-intlog2 ($3)));
757 set_music_properties (r, result);
759 r->set_spot (*$4->origin ());
766 SEQUENTIAL '{' Music_list '}' {
767 $$ = new Sequential_music (SCM_EOL);
768 $$->set_mus_property ("elements", ly_car ($3));
769 $$->set_spot(THIS->here_input());
771 | '{' Music_list '}' {
772 $$ = new Sequential_music (SCM_EOL);
773 $$->set_mus_property ("elements", ly_car ($2));
774 $$->set_spot(THIS->here_input());
779 SIMULTANEOUS '{' Music_list '}'{
780 $$ = new Simultaneous_music (SCM_EOL);
781 $$->set_mus_property ("elements", ly_car ($3));
782 $$->set_spot(THIS->here_input());
785 | '<' Music_list '>' {
786 $$ = new Simultaneous_music (SCM_EOL);
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 = new Music (SCM_EOL);
807 m->set_mus_property ("predicate", pred);
808 m->set_mus_property ("grob-property", $3);
809 m->set_mus_property ("grob-value", $5);
810 m->set_mus_property ("iterator-ctor",
811 Output_property_music_iterator::constructor_cxx_function);
816 $$ = unsmob_music ($1)->clone ();
818 $$->set_spot (THIS->here_input());
826 CONTEXT STRING Music {
827 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
828 csm->set_mus_property ("element", $3->self_scm ());
829 scm_gc_unprotect_object ($3->self_scm ());
831 csm->set_mus_property ("context-type",$2);
832 csm->set_mus_property ("context-id", scm_makfrom0str (""));
836 | AUTOCHANGE STRING Music {
837 Music * chm = new Music_wrapper (SCM_EOL);
838 chm->set_mus_property ("element", $3->self_scm ());
839 chm->set_mus_property ("iterator-ctor", Auto_change_iterator::constructor_cxx_function);
841 scm_gc_unprotect_object ($3->self_scm ());
842 chm->set_mus_property ("what", $2);
845 chm->set_spot (*$3->origin ());
850 The other version is for easier debugging of
851 Sequential_music_iterator in combination with grace notes.
854 SCM start = THIS->lexer_->lookup_identifier ("startGraceMusic");
855 SCM stop = THIS->lexer_->lookup_identifier ("stopGraceMusic");
856 Music *startm = unsmob_music (start);
857 Music *stopm = unsmob_music (stop);
861 stopm = stopm->clone ();
862 ms = gh_cons (stopm->self_scm (), ms);
863 scm_gc_unprotect_object (stopm->self_scm ());
865 ms = gh_cons ($2->self_scm (), ms);
866 scm_gc_unprotect_object ($2->self_scm());
868 startm = startm->clone ();
869 ms = gh_cons (startm->self_scm () , ms);
870 scm_gc_unprotect_object (startm->self_scm ());
873 Music* seq = new Sequential_music (SCM_EOL);
874 seq->set_mus_property ("elements", ms);
876 $$ = new Grace_music (SCM_EOL);
877 $$->set_mus_property ("element", seq->self_scm ());
878 scm_gc_unprotect_object (seq->self_scm ());
880 $$ = new Grace_music (SCM_EOL);
881 $$->set_mus_property ("element", $2->self_scm ());
882 scm_gc_unprotect_object ($2->self_scm ());
885 | CONTEXT string '=' string Music {
886 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
887 csm->set_mus_property ("element", $5->self_scm ());
888 scm_gc_unprotect_object ($5->self_scm ());
890 csm->set_mus_property ("context-type", $2);
891 csm->set_mus_property ("context-id", $4);
902 int n = gh_scm2int (ly_car ($3)); int d = gh_scm2int (ly_cdr ($3));
904 $$ = new Time_scaled_music (SCM_EOL);
905 $$->set_spot (THIS->pop_spot ());
908 $$->set_mus_property ("element", mp->self_scm ());
909 scm_gc_unprotect_object (mp->self_scm ());
910 $$->set_mus_property ("numerator", gh_int2scm (n));
911 $$->set_mus_property ("denominator", gh_int2scm (d));
912 $$->compress (Moment (Rational (n,d)));
915 | Repeated_music { $$ = $1; }
916 | Simultaneous_music { $$ = $1; }
917 | Sequential_music { $$ = $1; }
918 | TRANSPOSE pitch Music {
919 $$ = new Transposed_music (SCM_EOL);
921 Pitch pit = *unsmob_pitch ($2);
924 $$->set_mus_property ("element", p->self_scm ());
925 scm_gc_unprotect_object (p->self_scm ());
927 | TRANSPOSE steno_tonic_pitch Music {
928 $$ = new Transposed_music (SCM_EOL);
930 Pitch pit = *unsmob_pitch ($2);
933 $$->set_mus_property ("element", p->self_scm ());
934 scm_gc_unprotect_object (p->self_scm ());
937 | APPLY embedded_scm Music {
938 SCM ret = gh_call1 ($2, $3->self_scm ());
939 Music *m = unsmob_music (ret);
941 THIS->parser_error ("\\apply must return a Music");
942 m = new Music (SCM_EOL);
947 { THIS->lexer_->push_note_state (); }
950 THIS->lexer_->pop_state ();
953 { THIS->lexer_->push_figuredbass_state (); }
956 Music * chm = new Untransposable_music () ;
957 chm->set_mus_property ("element", $3->self_scm ());
959 scm_gc_unprotect_object ($3->self_scm());
961 THIS->lexer_->pop_state ();
964 { THIS->lexer_->push_chord_state (); }
967 Music * chm = new Un_relativable_music ;
968 chm->set_mus_property ("element", $3->self_scm ());
969 scm_gc_unprotect_object ($3->self_scm());
972 THIS->lexer_->pop_state ();
975 { THIS->lexer_->push_lyric_state (); }
979 THIS->lexer_->pop_state ();
981 | relative_music { $$ = $1; }
982 | re_rhythmed_music { $$ = $1; }
983 | part_combined_music { $$ = $1; }
987 RELATIVE absolute_pitch Music {
989 Pitch pit = *unsmob_pitch ($2);
990 $$ = new Relative_octave_music (SCM_EOL);
992 $$->set_mus_property ("element", p->self_scm ());
993 scm_gc_unprotect_object (p->self_scm ());
995 $$->set_mus_property ("last-pitch", p->to_relative_octave (pit).smobbed_copy ());
1001 ADDLYRICS Music Music {
1002 Lyric_combine_music * l = new Lyric_combine_music (SCM_EOL);
1003 l->set_mus_property ("elements", gh_list ($2->self_scm (), $3->self_scm (), SCM_UNDEFINED));
1004 scm_gc_unprotect_object ($3->self_scm ());
1005 scm_gc_unprotect_object ($2->self_scm ());
1010 part_combined_music:
1011 PARTCOMBINE STRING Music Music {
1012 Part_combine_music * p = new Part_combine_music (SCM_EOL);
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 = new Music (SCM_EOL);
1027 t->set_mus_property ("iterator-ctor",
1028 Change_iterator::constructor_cxx_function);
1029 t-> set_mus_property ("change-to-type", $2);
1030 t-> set_mus_property ("change-to-id", $4);
1033 $$->set_spot (THIS->here_input ());
1038 PROPERTY STRING '.' STRING '=' scalar {
1040 Music *t = set_property_music (scm_string_to_symbol ($4), $6);
1041 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1043 csm->set_mus_property ("element", t->self_scm ());
1044 scm_gc_unprotect_object (t->self_scm ());
1047 $$->set_spot (THIS->here_input ());
1049 csm-> set_mus_property ("context-type", $2);
1051 | PROPERTY STRING '.' STRING UNSET {
1052 Music *t = new Music (SCM_EOL);
1054 t->set_mus_property ("iterator-ctor",
1055 Property_unset_iterator::constructor_cxx_function);
1056 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1058 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1059 csm->set_mus_property ("element", t->self_scm ());
1060 scm_gc_unprotect_object (t->self_scm ());
1063 $$->set_spot (THIS->here_input ());
1065 csm-> set_mus_property ("context-type", $2);
1067 | PROPERTY STRING '.' STRING SET embedded_scm '=' embedded_scm {
1068 Music *t = new Music (SCM_EOL);
1069 t->set_mus_property ("iterator-ctor",
1070 Push_property_iterator::constructor_cxx_function);
1071 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1072 t->set_mus_property ("pop-first", SCM_BOOL_T);
1073 t->set_mus_property ("grob-property", $6);
1074 t->set_mus_property ("grob-value", $8);
1075 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1076 csm->set_mus_property ("element", t->self_scm ());
1077 scm_gc_unprotect_object (t->self_scm ());
1079 $$->set_spot (THIS->here_input ());
1081 csm-> set_mus_property ("context-type", $2);
1083 | PROPERTY STRING '.' STRING OVERRIDE embedded_scm '=' embedded_scm {
1084 Music *t = new Music (SCM_EOL);
1085 t->set_mus_property ("iterator-ctor",
1086 Push_property_iterator::constructor_cxx_function);
1087 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1088 t->set_mus_property ("grob-property", $6);
1089 t->set_mus_property ("grob-value", $8);
1090 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1091 csm->set_mus_property ("element", t->self_scm ());
1092 scm_gc_unprotect_object (t->self_scm ());
1095 $$->set_spot (THIS->here_input ());
1097 csm-> set_mus_property ("context-type", $2);
1099 | PROPERTY STRING '.' STRING REVERT embedded_scm {
1100 Music *t = new Music (SCM_EOL);
1101 t->set_mus_property ("iterator-ctor",
1102 Pop_property_iterator::constructor_cxx_function);
1103 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1104 t->set_mus_property ("grob-property", $6);
1106 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1107 csm->set_mus_property ("element", t->self_scm ());
1108 scm_gc_unprotect_object (t->self_scm ());
1111 $$->set_spot (THIS->here_input ());
1113 csm-> set_mus_property ("context-type", $2);
1120 | bare_int { $$ = gh_int2scm ($1); }
1121 | embedded_scm { $$ = $1; }
1128 } /*cont */ simple_element post_requests {
1129 Music_sequence *l = dynamic_cast<Music_sequence*> ($3);
1132 for (int i=0; i < $1->size (); i++) {
1133 Music * m = $1->elem (i);
1134 l->append_music (m);
1146 $$ = new Request_chord (SCM_EOL);
1147 $$->set_mus_property ("elements", gh_cons ($1->self_scm (), SCM_EOL));
1148 scm_gc_unprotect_object ($1->self_scm());
1150 $$-> set_spot (THIS->here_input ());
1151 $1-> set_spot (THIS->here_input ());
1154 Span_req *l = new Span_req;
1155 l->set_span_dir (START);
1156 l->set_mus_property ("span-type", scm_makfrom0str ("ligature"));
1157 l->set_spot (THIS->here_input ());
1159 $$ = new Request_chord (SCM_EOL);
1160 $$->set_mus_property ("elements", gh_cons (l->self_scm (), SCM_EOL));
1161 scm_gc_unprotect_object (l->self_scm());
1162 $$->set_spot (THIS->here_input ());
1165 Span_req *l = new Span_req;
1166 l->set_span_dir (STOP);
1167 l->set_mus_property ("span-type", scm_makfrom0str ("ligature"));
1168 l->set_spot (THIS->here_input ());
1170 $$ = new Request_chord (SCM_EOL);
1171 $$->set_mus_property ("elements", gh_cons (l->self_scm (), SCM_EOL));
1172 $$->set_spot (THIS->here_input ());
1173 scm_gc_unprotect_object (l->self_scm());
1177 $$ = new Music (gh_list (gh_cons (ly_symbol2scm ("name"), ly_symbol2scm ("separator")), SCM_UNDEFINED));
1178 $$->set_spot (THIS->here_input ());
1182 extern Music * get_barcheck();
1183 $$ = get_barcheck ();
1184 $$->set_spot (THIS->here_input ());
1187 Music *t = set_property_music (ly_symbol2scm ("whichBar"), $2);
1189 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1190 csm->set_mus_property ("element", t->self_scm ());
1191 scm_gc_unprotect_object (t->self_scm ());
1194 $$->set_spot (THIS->here_input ());
1196 csm->set_mus_property ("context-type", scm_makfrom0str ("Score"));
1198 | PARTIAL duration_length {
1199 Moment m = - unsmob_duration ($2)->length_mom ();
1200 Music * p = set_property_music (ly_symbol2scm ( "measurePosition"),m.smobbed_copy ());
1202 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1203 sp->set_mus_property ("element", p->self_scm ());
1204 scm_gc_unprotect_object (p->self_scm ());
1207 sp-> set_mus_property ("context-type", scm_makfrom0str ( "Score"));
1210 SCM func = scm_primitive_eval (ly_symbol2scm ("clef-name-to-properties"));
1211 SCM result = gh_call1 (func, $2);
1214 for (SCM s = result ; gh_pair_p (s); s = ly_cdr (s)) {
1215 Music * p = new Music (SCM_EOL);
1216 set_music_properties (p, ly_car (s));
1217 l = gh_cons (p->self_scm (), l);
1218 scm_gc_unprotect_object (p->self_scm ());
1220 Sequential_music * seq = new Sequential_music (SCM_EOL);
1221 seq->set_mus_property ("elements", l);
1223 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1224 sp->set_mus_property ("element", seq->self_scm ());
1225 scm_gc_unprotect_object (seq->self_scm ());
1228 sp-> set_mus_property ("context-type", scm_makfrom0str ("Staff"));
1231 Music * p1 = set_property_music (ly_symbol2scm ( "timeSignatureFraction"), $2);
1233 int l = gh_scm2int (ly_car ($2));
1234 int o = gh_scm2int (ly_cdr ($2));
1236 Moment one_beat = Moment (1)/Moment (o);
1237 Moment len = Moment (l) * one_beat;
1240 Music *p2 = set_property_music (ly_symbol2scm ("measureLength"), len.smobbed_copy ());
1241 Music *p3 = set_property_music (ly_symbol2scm ("beatLength"), one_beat.smobbed_copy ());
1243 SCM list = scm_list_n (p1->self_scm (), p2->self_scm (), p3->self_scm(), SCM_UNDEFINED);
1244 Sequential_music *seq = new Sequential_music (SCM_EOL);
1245 seq->set_mus_property ("elements", list);
1248 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1249 sp->set_mus_property ("element", seq->self_scm ());
1253 scm_gc_unprotect_object (p3->self_scm ());
1254 scm_gc_unprotect_object (p2->self_scm ());
1255 scm_gc_unprotect_object (p1->self_scm ());
1256 scm_gc_unprotect_object (seq->self_scm ());
1261 TODO: should make alias TimingContext for Score
1264 sp-> set_mus_property ("context-type", scm_makfrom0str ( "Score"));
1269 shorthand_command_req { $$ = $1; }
1270 | verbose_command_req { $$ = $1; }
1273 shorthand_command_req:
1284 Span_req*b= new Span_req;
1285 b->set_span_dir (START);
1286 b->set_mus_property ("span-type", scm_makfrom0str ("beam"));
1290 THIS->last_beam_start_ = b->self_scm ();
1293 Span_req*b= new Span_req;
1294 b->set_span_dir ( STOP);
1295 b->set_mus_property ("span-type", scm_makfrom0str ("beam"));
1299 $$ = new Breathing_sign_req;
1302 $$ = new Porrectus_req;
1306 verbose_command_req:
1307 COMMANDSPANREQUEST bare_int STRING { /*TODO: junkme */
1308 Span_req * sp = new Span_req;
1309 sp-> set_span_dir ( Direction ($2));
1310 sp->set_mus_property ("span-type",$3);
1311 sp->set_spot (THIS->here_input ());
1315 Mark_req * m = new Mark_req;
1319 Mark_req *m = new Mark_req;
1320 m->set_mus_property ("label", $2);
1324 Break_req * b = new Break_req;
1326 if (!gh_number_p (s))
1329 b->set_mus_property ("penalty", s);
1330 b->set_spot (THIS->here_input ());
1333 | SKIP duration_length {
1334 Skip_req * skip = new Skip_req;
1335 skip->set_mus_property ("duration", $2);
1343 Key_change_req *key= new Key_change_req;
1346 | KEY NOTENAME_PITCH SCM_IDENTIFIER {
1347 Key_change_req *key= new Key_change_req;
1349 key->set_mus_property ("pitch-alist", $3);
1350 ((Music*)key)->transpose (* unsmob_pitch ($2));
1357 $$ = new Link_array<Request>;
1359 | post_requests post_request {
1360 $2->set_spot (THIS->here_input ());
1372 request_that_take_dir:
1375 | script_abbreviation {
1376 SCM s = THIS->lexer_->lookup_identifier ("dash" + ly_scm2string ($1));
1377 Articulation_req *a = new Articulation_req;
1378 if (gh_string_p (s))
1379 a->set_mus_property ("articulation-type", s);
1380 else THIS->parser_error (_ ("Expecting string as script definition"));
1386 script_dir request_that_take_dir {
1387 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1388 gs->set_direction (Direction ($1));
1390 $2->origin ()->warning (_ ("Can't specify direction for this request"));
1396 REQUEST_IDENTIFIER {
1397 $$ = dynamic_cast<Request*> (unsmob_music ($1)->clone ());
1398 $$->set_spot (THIS->here_input ());
1400 | DYNAMICSCRIPT embedded_scm {
1402 TODO: junkme, use text-type == dynamic
1404 Text_script_req *d = new Text_script_req;
1405 SCM dyn = ly_symbol2scm ("dynamic");
1406 d->set_mus_property ("text-type" , dyn);
1407 d->set_mus_property ("text", $2);
1408 d->set_spot (THIS->here_input ());
1411 | SPANREQUEST bare_int STRING {
1412 Span_req * sp = new Span_req;
1413 sp->set_span_dir ( Direction ($2));
1414 sp->set_mus_property ("span-type", $3);
1415 sp->set_spot (THIS->here_input ());
1419 Tremolo_req* a = new Tremolo_req;
1420 a->set_spot (THIS->here_input ());
1421 a->set_mus_property ("tremolo-type", gh_int2scm ($1));
1425 Articulation_req * a = new Articulation_req;
1426 a->set_mus_property ("articulation-type", $2);
1427 a->set_spot (THIS->here_input ());
1431 duh, junk this syntax from the parser, if possible.
1434 Arpeggio_req *a = new Arpeggio_req;
1435 a->set_spot (THIS->here_input ());
1439 Glissando_req *g = new Glissando_req;
1440 g->set_spot /* No pun intended */ (THIS->here_input ());
1467 | NOTENAME_PITCH sup_quotes {
1468 Pitch p = *unsmob_pitch ($1);
1470 $$ = p.smobbed_copy ();
1472 | NOTENAME_PITCH sub_quotes {
1473 Pitch p =* unsmob_pitch ($1);
1476 $$ = p.smobbed_copy ();
1489 | TONICNAME_PITCH sup_quotes {
1490 Pitch p = *unsmob_pitch ($1);
1492 $$ = p.smobbed_copy ();
1494 | TONICNAME_PITCH sub_quotes {
1495 Pitch p =* unsmob_pitch ($1);
1498 $$ = p.smobbed_copy ();
1513 PITCH embedded_scm {
1515 if (!unsmob_pitch ($2)) {
1516 THIS->parser_error (_f ("Expecting musical-pitch value", 3));
1517 $$ = Pitch ().smobbed_copy ();
1523 DURATION embedded_scm {
1525 if (!unsmob_duration ($2))
1527 THIS->parser_error (_ ("Must have duration object"));
1528 $$ = Duration ().smobbed_copy ();
1535 if (!THIS->lexer_->lyric_state_b ())
1536 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1537 $$ = new Extender_req;
1543 if (!THIS->lexer_->lyric_state_b ())
1544 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1545 $$ = new Hyphen_req;
1550 close_request_parens {
1552 dynamic_cast<Span_req*> ($$)->set_span_dir ( START);
1556 close_request_parens:
1558 Span_req* s= new Span_req;
1560 s->set_mus_property ("span-type", scm_makfrom0str ( "slur"));
1561 s->set_spot (THIS->here_input());
1564 Span_req* s= new Span_req;
1566 s->set_mus_property ("span-type", scm_makfrom0str ( "phrasing-slur"));
1567 s->set_spot (THIS->here_input());
1570 Span_req*s =new Span_req;
1572 s->set_mus_property ("span-type", scm_makfrom0str ( "crescendo"));
1573 s->set_spot (THIS->here_input());
1576 Span_req*s =new Span_req;
1578 s->set_mus_property ("span-type", scm_makfrom0str ("decrescendo"));
1579 s->set_spot (THIS->here_input());
1585 open_request_parens {
1587 dynamic_cast<Span_req*> ($$)->set_span_dir (STOP);
1591 open_request_parens:
1593 Span_req *s = new Span_req;
1594 s->set_mus_property ("span-type", scm_makfrom0str ( "crescendo"));
1595 s->set_spot (THIS->here_input());
1600 Span_req* s= new Span_req;
1602 s->set_mus_property ("span-type", scm_makfrom0str ( "slur"));
1603 s->set_spot (THIS->here_input());
1607 Span_req* s= new Span_req;
1609 s->set_mus_property ("span-type", scm_makfrom0str ( "phrasing-slur"));
1610 s->set_spot (THIS->here_input());
1616 Text_script_req *t = new Text_script_req;
1617 t->set_mus_property ("text", $1);
1618 t->set_spot (THIS->here_input ());
1622 Text_script_req *t = new Text_script_req;
1623 t->set_mus_property ("text", $1);
1624 t->set_spot (THIS->here_input ());
1628 String ds = to_string ($1);
1629 Text_script_req* t = new Text_script_req;
1630 SCM finger = ly_symbol2scm ("finger");
1631 t->set_mus_property ("text", scm_makfrom0str (ds.to_str0 ()));
1632 t->set_mus_property ("text-type" , finger);
1633 t->set_spot (THIS->here_input ());
1638 script_abbreviation:
1640 $$ = scm_makfrom0str ("Hat");
1643 $$ = scm_makfrom0str ("Plus");
1646 $$ = scm_makfrom0str ("Dash");
1649 $$ = scm_makfrom0str ("Bar");
1652 $$ = scm_makfrom0str ("Larger");
1655 $$ = scm_makfrom0str ("Dot");
1662 | '-' { $$ = CENTER; }
1667 $$ = new Link_array<Request>;
1669 | pre_requests open_request {
1681 multiplied_duration {
1684 | verbose_duration {
1689 optional_notemode_duration:
1691 Duration dd = THIS->default_duration_;
1692 $$ = dd.smobbed_copy ();
1694 THIS->beam_check ($$);
1696 | multiplied_duration {
1698 THIS->default_duration_ = *unsmob_duration ($$);
1700 THIS->beam_check ($$);
1702 | verbose_duration {
1704 THIS->default_duration_ = *unsmob_duration ($$);
1709 bare_unsigned dots {
1711 if (!is_duration_b ($1))
1712 THIS->parser_error (_f ("not a duration: %d", $1));
1716 $$ = Duration (l, $2).smobbed_copy ();
1718 | DURATION_IDENTIFIER dots {
1719 Duration *d =unsmob_duration ($1);
1720 Duration k (d->duration_log (),d->dot_count () + $2);
1721 $$ = k.smobbed_copy ();
1728 multiplied_duration:
1732 | multiplied_duration '*' bare_unsigned {
1733 $$ = unsmob_duration ($$)->compressed ( $3) .smobbed_copy ();
1735 | multiplied_duration '*' FRACTION {
1736 Rational m (gh_scm2int (ly_car ($3)), gh_scm2int (ly_cdr ($3)));
1738 $$ = unsmob_duration ($$)->compressed (m).smobbed_copy ();
1743 FRACTION { $$ = $1; }
1744 | UNSIGNED '/' UNSIGNED {
1745 $$ = gh_cons (gh_int2scm ($1), gh_int2scm ($3));
1763 | ':' bare_unsigned {
1764 if (!is_duration_b ($2))
1765 THIS->parser_error (_f ("not a duration: %d", $2));
1784 Bass_figure_req *bfr = new Bass_figure_req;
1785 $$ = bfr->self_scm();
1786 scm_gc_unprotect_object ($$);
1789 Bass_figure_req *bfr = new Bass_figure_req;
1790 $$ = bfr->self_scm();
1792 bfr->set_mus_property ("figure", gh_int2scm ($1));
1794 scm_gc_unprotect_object ($$);
1796 | bass_figure bass_mod {
1797 Music *m = unsmob_music ($1);
1799 SCM salter =m->get_mus_property ("alteration");
1800 int alter = gh_number_p ( salter) ? gh_scm2int (salter) : 0;
1801 m->set_mus_property ("alteration",
1802 gh_int2scm (alter + $2));
1804 m->set_mus_property ("alteration", gh_int2scm (0));
1812 unsmob_music ($$)->set_mus_property ("bracket-start", SCM_BOOL_T);
1817 | br_bass_figure ']' {
1819 unsmob_music ($1)->set_mus_property ("bracket-stop", SCM_BOOL_T);
1827 | figure_list br_bass_figure {
1828 $$ = gh_cons ($2, $1);
1833 FIGURE_OPEN figure_list FIGURE_CLOSE {
1834 Music * m = new Request_chord (SCM_EOL);
1835 $2 = scm_reverse_x ($2, SCM_EOL);
1836 m->set_mus_property ("elements", $2);
1837 $$ = m->self_scm ();
1848 pitch exclamations questions optional_notemode_duration optional_rest {
1850 Input i = THIS->pop_spot ();
1851 if (!THIS->lexer_->note_state_b ())
1852 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1860 n->set_mus_property ("pitch", $1);
1861 n->set_mus_property ("duration", $4);
1865 n->set_mus_property ("cautionary", SCM_BOOL_T);
1866 if ($2 % 2 || $3 % 2)
1867 n->set_mus_property ("force-accidental", SCM_BOOL_T);
1869 Simultaneous_music*v = new Request_chord (SCM_EOL);
1870 v->set_mus_property ("elements", scm_list_n (n->self_scm (), SCM_UNDEFINED));
1871 scm_gc_unprotect_object (n->self_scm());
1877 | figure_spec optional_notemode_duration {
1878 Music * m = unsmob_music ($1);
1879 Input i = THIS->pop_spot ();
1881 for (SCM s = m->get_mus_property ("elements"); gh_pair_p (s); s = ly_cdr (s))
1883 unsmob_music (ly_car (s))->set_mus_property ("duration", $2);
1887 | RESTNAME optional_notemode_duration {
1889 Input i = THIS->pop_spot ();
1890 SCM e = SCM_UNDEFINED;
1891 if (ly_scm2string ($1) =="s") {
1893 Skip_req * skip = new Skip_req;
1894 skip->set_mus_property ("duration" ,$2);
1896 e = skip->self_scm ();
1899 Rest_req * rest_req = new Rest_req;
1900 rest_req->set_mus_property ("duration", $2);
1901 rest_req->set_spot (i);
1902 e = rest_req->self_scm ();
1904 Simultaneous_music* velt = new Request_chord (SCM_EOL);
1905 velt-> set_mus_property ("elements", scm_list_n (e,SCM_UNDEFINED));
1910 | MULTI_MEASURE_REST optional_notemode_duration {
1911 Input i = THIS->pop_spot ();
1913 Skip_req * sk = new Skip_req;
1914 sk->set_mus_property ("duration", $2);
1915 Span_req *sp1 = new Span_req;
1916 Span_req *sp2 = new Span_req;
1917 sp1-> set_span_dir ( START);
1918 sp2-> set_span_dir ( STOP);
1919 SCM r = scm_makfrom0str ("rest");
1920 sp1->set_mus_property ("span-type", r);
1921 sp2->set_mus_property ("span-type", r);
1923 Request_chord * rqc1 = new Request_chord (SCM_EOL);
1924 rqc1->set_mus_property ("elements", scm_list_n (sp1->self_scm (), SCM_UNDEFINED));
1925 Request_chord * rqc2 = new Request_chord (SCM_EOL);
1926 rqc2->set_mus_property ("elements", scm_list_n (sk->self_scm (), SCM_UNDEFINED));;
1927 Request_chord * rqc3 = new Request_chord (SCM_EOL);
1928 rqc3->set_mus_property ("elements", scm_list_n (sp2->self_scm (), SCM_UNDEFINED));;
1930 SCM ms = scm_list_n (rqc1->self_scm (), rqc2->self_scm (), rqc3->self_scm (), SCM_UNDEFINED);
1932 $$ = new Sequential_music (SCM_EOL);
1933 $$->set_mus_property ("elements", ms);
1935 | STRING optional_notemode_duration {
1936 Input i = THIS->pop_spot ();
1938 Lyric_req* lreq = new Lyric_req;
1939 lreq->set_mus_property ("text", $1);
1940 lreq->set_mus_property ("duration",$2);
1942 Simultaneous_music* velt = new Request_chord (SCM_EOL);
1943 velt->set_mus_property ("elements", scm_list_n (lreq->self_scm (), SCM_UNDEFINED));
1948 Input i = THIS->pop_spot ();
1950 if (!THIS->lexer_->chord_state_b ())
1951 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1958 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
1959 $$ = Chord::get_chord ($1, $3, $4, $5, $6, $2);
1960 $$->set_spot (THIS->here_input ());
1967 | CHORD_COLON chord_notes {
1976 | chord_notes '.' chord_step {
1977 $$ = gh_append2 ($$, $3);
1985 | CHORD_CARET chord_notes {
1995 | '/' steno_tonic_pitch {
2004 | CHORD_BASS steno_tonic_pitch {
2011 $$ = gh_cons ($1, SCM_EOL);
2013 | CHORDMODIFIER_PITCH {
2014 $$ = gh_cons (unsmob_pitch ($1)->smobbed_copy (), SCM_EOL);
2016 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
2017 $$ = scm_list_n (unsmob_pitch ($1)->smobbed_copy (),
2025 m.notename_ = ($1 - 1) % 7;
2026 m.octave_ = $1 > 7 ? 1 : 0;
2029 $$ = m.smobbed_copy ();
2031 | bare_unsigned '+' {
2033 m.notename_ = ($1 - 1) % 7;
2034 m.octave_ = $1 > 7 ? 1 : 0;
2038 $$ = m.smobbed_copy ();
2040 | bare_unsigned CHORD_MINUS {
2042 m.notename_ = ($1 - 1) % 7;
2043 m.octave_ = $1 > 7 ? 1 : 0;
2046 $$ = m.smobbed_copy ();
2054 number_expression '+' number_term {
2055 $$ = scm_sum ($1, $3);
2057 | number_expression '-' number_term {
2058 $$ = scm_difference ($1, $3);
2067 | number_factor '*' number_factor {
2068 $$ = scm_product ($1, $3);
2070 | number_factor '/' number_factor {
2071 $$ = scm_divide ($1, $3);
2076 '(' number_expression ')' {
2079 | '-' number_factor { /* %prec UNARY_MINUS */
2080 $$ = scm_difference ($2, SCM_UNDEFINED);
2088 $$ = gh_int2scm ($1);
2093 | NUMBER_IDENTIFIER {
2097 $$ = gh_double2scm (gh_scm2double ($1) CM );
2100 $$ = gh_double2scm (gh_scm2double ($1) PT);
2103 $$ = gh_double2scm (gh_scm2double ($1) INCH);
2106 $$ = gh_double2scm (gh_scm2double ($1) MM);
2109 $$ = gh_double2scm (gh_scm2double ($1) CHAR);
2125 if (scm_integer_p ($1) == SCM_BOOL_T)
2127 int k = gh_scm2int ($1);
2131 THIS->parser_error (_ ("need integer number arg"));
2145 | STRING_IDENTIFIER {
2148 | string '+' string {
2149 $$ = scm_string_append (scm_list_n ($1, $3, SCM_UNDEFINED));
2156 | exclamations '!' { $$ ++; }
2161 | questions '?' { $$ ++; }
2168 My_lily_parser::set_yydebug (bool )
2175 extern My_lily_parser * current_parser;
2178 My_lily_parser::do_yyparse ()
2181 current_parser = this;;
2182 yyparse ((void*)this);
2187 Should make this optional? It will also complain when you do
2191 which is entirely legitimate.
2193 Or we can scrap it. Barchecks should detect wrong durations, and
2194 skipTypesetting speeds it up a lot.
2197 My_lily_parser::beam_check (SCM dur)
2199 Duration *d = unsmob_duration (dur);
2200 if (unsmob_music (last_beam_start_) && d->duration_log () <= 2)
2202 Music * m = unsmob_music (last_beam_start_);
2203 m->origin ()->warning (_("Suspect duration found following this beam"));
2205 last_beam_start_ = SCM_EOL;