1 %{ // -*-Fundamental-*-
4 parser.yy -- Bison/C++ parser for lilypond
6 source file of the GNU LilyPond music typesetter
8 (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 Jan Nieuwenhuizen <janneke@gnu.org>
13 Two shift/reduce problems:
20 the rules for who is protecting what are very shady. TODO: uniformise
29 #include "translator-def.hh"
30 #include "lily-guile.hh"
31 #include "change-iterator.hh"
33 #include "my-lily-lexer.hh"
34 #include "paper-def.hh"
35 #include "midi-def.hh"
37 #include "file-path.hh"
39 #include "dimensions.hh"
40 #include "command-request.hh"
41 #include "musical-request.hh"
42 #include "my-lily-parser.hh"
43 #include "context-specced-music.hh"
45 #include "music-list.hh"
46 #include "output-property-music-iterator.hh"
47 #include "property-iterator.hh"
48 #include "input-file-results.hh"
50 #include "relative-music.hh"
51 #include "lyric-combine-music.hh"
52 #include "transposed-music.hh"
53 #include "time-scaled-music.hh"
54 #include "repeated-music.hh"
55 #include "untransposable-music.hh"
56 #include "lilypond-input-version.hh"
57 #include "grace-music.hh"
58 #include "part-combine-music.hh"
59 #include "scm-hash.hh"
60 #include "auto-change-iterator.hh"
61 #include "un-relativable-music.hh"
63 #include "ly-modules.hh"
66 regular_identifier_b (SCM id)
68 String str = ly_scm2string (id);
69 char const *s = str.to_str0 () ;
74 v = v && isalpha (*s);
84 return t && t == 1 << intlog2 (t);
88 set_music_properties (Music *p, SCM a)
90 for (SCM k = a; gh_pair_p (k); k = ly_cdr (k))
92 p->internal_set_mus_property (ly_caar (k), ly_cdar (k));
98 #define MY_MAKE_MUSIC(x) make_music_by_name (ly_symbol2scm (x))
101 set_property_music (SCM sym, SCM value)
103 Music * p = MY_MAKE_MUSIC("PropertySet");
104 p->set_mus_property ("symbol", sym);
105 p->set_mus_property ("value", value);
110 // needed for bison.simple's malloc () and free ()
112 // #include <malloc.h>
117 #define YYERROR_VERBOSE 1
119 #define YYPARSE_PARAM my_lily_parser
120 #define YYLEX_PARAM my_lily_parser
122 ((My_lily_parser *) my_lily_parser)
124 #define yyerror THIS->parser_error
128 /* We use SCMs to do strings, because it saves us the trouble of
129 deleting them. Let's hope that a stack overflow doesnt trigger a move
130 of the parse stack onto the heap. */
135 Link_array<Music> *reqvec;
137 String *string; // needed by the lexer as temporary scratch area.
140 Scheme_hash_table *scmhash;
141 Music_output_def * outputdef;
148 yylex (YYSTYPE *s, void * v)
150 My_lily_parser *pars = (My_lily_parser*) v;
151 My_lily_lexer * lex = pars->lexer_;
153 lex->lexval = (void*) s;
154 return lex->yylex ();
162 /* tokens which are not keywords */
172 %token CHORDMODIFIERS
180 %token GROBDESCRIPTIONS
186 %token FIGURES FIGURE_OPEN FIGURE_CLOSE
187 %token FIGURE_BRACKET_CLOSE FIGURE_BRACKET_OPEN
197 %token MULTI_MEASURE_REST
210 %token OVERRIDE SET REVERT
223 %token COMMANDSPANREQUEST
225 %token OUTPUTPROPERTY
236 %token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE
237 %token E_LEFTSQUARE E_RIGHTSQUARE E_TILDE
239 %token <i> E_UNSIGNED
240 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET CHORD_SLASH
243 %type <i> exclamations questions dots optional_rest
244 %type <i> bass_number bass_mod
245 %type <scm> br_bass_figure bass_figure figure_list figure_spec
247 %token <scm> NOTENAME_PITCH
248 %token <scm> TONICNAME_PITCH
249 %token <scm> CHORDMODIFIER_PITCH
250 %token <scm> DURATION_IDENTIFIER
251 %token <scm> FRACTION
252 %token <id> IDENTIFIER
255 %token <scm> SCORE_IDENTIFIER
256 %token <scm> MUSIC_OUTPUT_DEF_IDENTIFIER
258 %token <scm> NUMBER_IDENTIFIER
259 %token <scm> REQUEST_IDENTIFIER
260 %token <scm> MUSIC_IDENTIFIER TRANSLATOR_IDENTIFIER
261 %token <scm> STRING_IDENTIFIER SCM_IDENTIFIER
262 %token <scm> RESTNAME
268 %type <outputdef> output_def
269 %type <scm> lilypond_header lilypond_header_body
270 %type <music> open_request_parens close_request_parens open_request close_request
271 %type <music> request_with_dir request_that_take_dir verbose_request
272 %type <i> sub_quotes sup_quotes
273 %type <music> simple_element request_chord command_element Simple_music Composite_music
274 %type <music> Repeated_music
275 %type <scm> Alternative_music
276 %type <i> tremolo_type
277 %type <i> bare_int bare_unsigned
279 %type <scm> identifier_init
281 %type <scm> steno_duration optional_notemode_duration multiplied_duration
282 %type <scm> verbose_duration
284 %type <reqvec> pre_requests post_requests
285 %type <music> gen_text_def
286 %type <scm> steno_pitch pitch absolute_pitch
287 %type <scm> explicit_pitch steno_tonic_pitch
289 %type <scm> chord_additions chord_subtractions chord_notes chord_step
291 %type <scm> chord_note chord_inversion chord_bass
292 %type <scm> duration_length fraction
294 %type <scm> embedded_scm scalar
295 %type <music> Music Sequential_music Simultaneous_music
296 %type <music> relative_music re_rhythmed_music part_combined_music
297 %type <music> property_def translator_change simple_property_def
298 %type <scm> Music_list
299 %type <outputdef> music_output_def_body
300 %type <music> shorthand_command_req
301 %type <music> post_request
302 %type <music> command_req verbose_command_req
303 %type <music> extender_req
304 %type <music> hyphen_req
305 %type <music> string_request
306 %type <scm> string bare_number number_expression number_term number_factor
308 %type <score> score_block score_body
310 %type <scm> translator_spec_block translator_spec_body
311 %type <music> tempo_request
312 %type <scm> notenames_body notenames_block chordmodifiers_block
313 %type <scm> script_abbreviation
319 /* We don't assign precedence to / and *, because we might need varied
320 prec levels in different prods */
326 lilypond: /* empty */
327 | lilypond toplevel_expression {}
328 | lilypond assignment { }
330 THIS->error_level_ = 1;
333 THIS->error_level_ = 1;
339 THIS->lexer_->pitchname_tab_ = $1;
341 | chordmodifiers_block {
342 THIS->lexer_->chordmodifier_tab_ = $1;
345 THIS->input_file_->header_ = $1;
348 THIS->input_file_->scores_.push ($1);
351 if (dynamic_cast<Paper_def*> ($1))
352 THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultpaper"), $1->self_scm ());
353 else if (dynamic_cast<Midi_def*> ($1))
354 THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultmidi"), $1->self_scm ());
367 chordmodifiers_block:
368 CHORDMODIFIERS notenames_body { $$ = $2; }
372 PITCHNAMES notenames_body { $$ = $2; }
377 int i = scm_ilength ($1);
379 SCM tab = scm_make_vector (gh_int2scm (i), SCM_EOL);
380 for (SCM s = $1; gh_pair_p (s); s = ly_cdr (s)) {
381 SCM pt = ly_cdar (s);
382 if (!unsmob_pitch (pt))
383 THIS->parser_error ("Need pitch object.");
385 scm_hashq_set_x (tab, ly_caar (s), pt);
392 lilypond_header_body:
394 $$ = ly_make_anonymous_module ();
395 THIS->lexer_->add_scope ($$);
397 | lilypond_header_body assignment {
403 HEADER '{' lilypond_header_body '}' {
404 $$ = THIS->lexer_-> remove_scope();
416 /* cont */ '=' identifier_init {
419 Should find generic way of associating input with objects.
421 Input ip = THIS->pop_spot ();
423 if (! regular_identifier_b ($1))
425 ip.warning (_ ("Identifier should have alphabetic characters only"));
428 THIS->lexer_->set_identifier ($1, $4);
431 TODO: devise standard for protection in parser.
433 The parser stack lives on the C-stack, which means that
434 all objects can be unprotected as soon as they're here.
444 $$ = $1->self_scm ();
445 scm_gc_unprotect_object ($$);
448 $$ = $1->self_scm ();
449 scm_gc_unprotect_object ($$);
451 | translator_spec_block {
455 $$ = $1->self_scm ();
456 scm_gc_unprotect_object ($$);
459 $$ = $1->self_scm ();
460 scm_gc_unprotect_object ($$);
465 | number_expression {
476 translator_spec_block:
477 TRANSLATOR '{' translator_spec_body '}'
483 translator_spec_body:
484 TRANSLATOR_IDENTIFIER {
485 $$ = unsmob_translator_def ($1)->clone_scm ();
486 unsmob_translator_def ($$)-> set_spot (THIS->here_input ());
489 $$ = Translator_def::make_scm ();
490 Translator_def*td = unsmob_translator_def ($$);
491 td->translator_group_type_ = $2;
492 td->set_spot (THIS->here_input ());
494 | translator_spec_body STRING '=' embedded_scm {
495 unsmob_translator_def ($$)->add_property_assign ($2, $4);
497 | translator_spec_body STRING OVERRIDE embedded_scm '=' embedded_scm {
498 unsmob_translator_def ($$)
499 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
501 | translator_spec_body STRING SET embedded_scm '=' embedded_scm {
502 unsmob_translator_def ($$)
503 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
505 | translator_spec_body STRING REVERT embedded_scm {
506 unsmob_translator_def ($$)->add_pop_property (
507 scm_string_to_symbol ($2), $4);
509 | translator_spec_body NAME STRING {
510 unsmob_translator_def ($$)->type_name_ = $3;
512 | translator_spec_body CONSISTS STRING {
513 unsmob_translator_def ($$)->add_element ($3);
515 | translator_spec_body ALIAS STRING {
516 Translator_def*td = unsmob_translator_def ($$);
517 td->type_aliases_ = scm_cons ($3, td->type_aliases_);
519 | translator_spec_body GROBDESCRIPTIONS embedded_scm {
520 Translator_def*td = unsmob_translator_def($$);
521 // td->add_property_assign (ly_symbol2scm ("allGrobDescriptions"), $3);
522 for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p))
523 td->add_property_assign (scm_symbol_to_string (ly_caar (p)), ly_cdar (p));
525 | translator_spec_body CONSISTSEND STRING {
526 unsmob_translator_def ($$)->add_last_element ( $3);
528 | translator_spec_body ACCEPTS STRING {
529 unsmob_translator_def ($$)->set_acceptor ($3,true);
531 | translator_spec_body DENIES STRING {
532 unsmob_translator_def ($$)->set_acceptor ($3,false);
534 | translator_spec_body REMOVE STRING {
535 unsmob_translator_def ($$)->remove_element ($3);
546 /*cont*/ '{' score_body '}' {
549 if (!$$->defs_.size ())
551 Music_output_def *id =
552 unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
553 $$->add_output (id ? id->clone () : new Paper_def );
562 $$->set_spot (THIS->here_input ());
563 SCM m = $1->self_scm ();
564 scm_gc_unprotect_object (m);
569 SCM check_funcs = scm_c_eval_string ("toplevel-music-functions");
570 for (; gh_pair_p (check_funcs); check_funcs = gh_cdr (check_funcs))
571 m = gh_call1 (gh_car (check_funcs), m);
576 $$ = new Score (*unsmob_score ($1));
577 $$->set_spot (THIS->here_input ());
579 | score_body lilypond_header {
582 | score_body output_def {
595 music_output_def_body '}' {
597 THIS-> lexer_-> remove_scope ();
601 music_output_def_body:
603 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultmidi"));
608 p = dynamic_cast<Midi_def*> (id->clone ());
613 THIS->lexer_->add_scope (p->scope_);
616 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
619 p = dynamic_cast<Paper_def*> (id->clone ());
622 THIS-> lexer_->add_scope (p->scope_);
625 | PAPER '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
626 Music_output_def *p = unsmob_music_output_def ($3);
628 THIS->lexer_->add_scope (p->scope_);
631 | MIDI '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
632 Music_output_def *p = unsmob_music_output_def ($3);
635 THIS->lexer_->add_scope (p->scope_);
638 | music_output_def_body assignment {
641 | music_output_def_body translator_spec_block {
642 $$->assign_translator ($2);
644 | music_output_def_body STYLESHEET embedded_scm {
645 dynamic_cast<Paper_def*> ($$)-> style_sheet_ = $3;
647 | music_output_def_body tempo_request {
649 junk this ? there already is tempo stuff in
652 int m = gh_scm2int ( $2->get_mus_property ("metronome-count"));
653 Duration *d = unsmob_duration ($2->get_mus_property ("duration"));
654 Midi_def * md = dynamic_cast<Midi_def*> ($$);
656 md->set_tempo (d->length_mom (), m);
658 | music_output_def_body error {
664 TEMPO steno_duration '=' bare_unsigned {
665 $$ = MY_MAKE_MUSIC("TempoEvent");
666 $$->set_mus_property ("duration", $2);
667 $$->set_mus_property ("metronome-count", gh_int2scm ( $4));
672 The representation of a list is the
676 to have efficient append.
678 Music_list: /* empty */ {
679 $$ = scm_cons (SCM_EOL, SCM_EOL);
683 SCM c = scm_cons ($2->self_scm (), SCM_EOL);
684 scm_gc_unprotect_object ($2->self_scm ()); /* UGH */
685 if (gh_pair_p (ly_cdr (s)))
686 gh_set_cdr_x (ly_cdr (s), c); /* append */
688 gh_set_car_x (s, c); /* set first cons */
689 gh_set_cdr_x (s, c) ; /* remember last cell */
705 | ALTERNATIVE '{' Music_list '}' {
711 REPEAT string bare_unsigned Music Alternative_music
715 SCM alts = gh_pair_p ($5) ? gh_car ($5) : SCM_EOL;
716 if (times < scm_ilength (alts)) {
717 unsmob_music (gh_car (alts))
718 ->origin ()->warning (
719 _("More alternatives than repeats. Junking excess alternatives."));
720 alts = ly_truncate_list (times, alts);
723 Music *r = MY_MAKE_MUSIC("RepeatedMusic");
726 r-> set_mus_property ("element", beg->self_scm ());
727 scm_gc_unprotect_object (beg->self_scm ());
729 r->set_mus_property ("repeat-count", gh_int2scm (times >? 1));
731 r-> set_mus_property ("elements",alts);
732 SCM func = scm_primitive_eval (ly_symbol2scm ("repeat-name-to-ctor"));
733 SCM result = gh_call1 (func, $2);
735 if (gh_equal_p ($2, scm_makfrom0str ("tremolo")))
738 we can not get durations and other stuff correct down the line, so we have to
739 add to the duration log here.
741 SCM func = scm_primitive_eval (ly_symbol2scm ("shift-duration-log"));
743 gh_call3 (func, r->self_scm (), gh_int2scm(-intlog2 ($3*2/3)),gh_int2scm(1));
745 gh_call3 (func, r->self_scm (), gh_int2scm(-intlog2 ($3)), gh_int2scm(0));
748 set_music_properties (r, result);
750 r->set_spot (*$4->origin ());
757 SEQUENTIAL '{' Music_list '}' {
758 $$ = MY_MAKE_MUSIC("SequentialMusic");
759 $$->set_mus_property ("elements", ly_car ($3));
760 $$->set_spot(THIS->here_input());
762 | '{' Music_list '}' {
763 $$ = MY_MAKE_MUSIC("SequentialMusic");
764 $$->set_mus_property ("elements", ly_car ($2));
765 $$->set_spot(THIS->here_input());
770 SIMULTANEOUS '{' Music_list '}'{
771 $$ = MY_MAKE_MUSIC("SimultaneousMusic");
772 $$->set_mus_property ("elements", ly_car ($3));
773 $$->set_spot(THIS->here_input());
776 | '<' Music_list '>' {
777 $$ = MY_MAKE_MUSIC("SimultaneousMusic");
778 $$->set_mus_property ("elements", ly_car ($2));
779 $$->set_spot(THIS->here_input());
784 request_chord { $$ = $1; }
785 | OUTPUTPROPERTY embedded_scm embedded_scm '=' embedded_scm {
787 if (!gh_symbol_p ($3))
789 THIS->parser_error (_ ("Second argument must be a symbol"));
791 /* Should check # args */
792 if (!gh_procedure_p (pred))
794 THIS->parser_error (_ ("First argument must be a procedure taking one argument"));
797 Music*m = MY_MAKE_MUSIC("OutputPropertySetMusic");
798 m->set_mus_property ("predicate", pred);
799 m->set_mus_property ("grob-property", $3);
800 m->set_mus_property ("grob-value", $5);
805 $$ = unsmob_music ($1)->clone ();
807 $$->set_spot (THIS->here_input());
815 CONTEXT STRING Music {
816 Music*csm =MY_MAKE_MUSIC("ContextSpeccedMusic");
818 csm->set_mus_property ("element", $3->self_scm ());
819 scm_gc_unprotect_object ($3->self_scm ());
821 csm->set_mus_property ("context-type",$2);
822 csm->set_mus_property ("context-id", scm_makfrom0str (""));
826 | AUTOCHANGE STRING Music {
827 Music*chm = MY_MAKE_MUSIC("AutoChangeMusic");
828 chm->set_mus_property ("element", $3->self_scm ());
830 scm_gc_unprotect_object ($3->self_scm ());
831 chm->set_mus_property ("what", $2);
834 chm->set_spot (*$3->origin ());
839 The other version is for easier debugging of
840 Sequential_music_iterator in combination with grace notes.
843 SCM start = THIS->lexer_->lookup_identifier ("startGraceMusic");
844 SCM stop = THIS->lexer_->lookup_identifier ("stopGraceMusic");
845 Music *startm = unsmob_music (start);
846 Music *stopm = unsmob_music (stop);
850 stopm = stopm->clone ();
851 ms = scm_cons (stopm->self_scm (), ms);
852 scm_gc_unprotect_object (stopm->self_scm ());
854 ms = scm_cons ($2->self_scm (), ms);
855 scm_gc_unprotect_object ($2->self_scm());
857 startm = startm->clone ();
858 ms = scm_cons (startm->self_scm () , ms);
859 scm_gc_unprotect_object (startm->self_scm ());
863 Music* seq = MY_MAKE_MUSIC("SequentialMusic");
864 seq->set_mus_property ("elements", ms);
867 $$ = MY_MAKE_MUSIC("GraceMusic");
868 $$->set_mus_property ("element", seq->self_scm ());
869 scm_gc_unprotect_object (seq->self_scm ());
871 $$ = MY_MAKE_MUSIC("GraceMusic");
872 $$->set_mus_property ("element", $2->self_scm ());
873 scm_gc_unprotect_object ($2->self_scm ());
876 | CONTEXT string '=' string Music {
877 Music * csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
879 csm->set_mus_property ("element", $5->self_scm ());
880 scm_gc_unprotect_object ($5->self_scm ());
882 csm->set_mus_property ("context-type", $2);
883 csm->set_mus_property ("context-id", $4);
894 int n = gh_scm2int (ly_car ($3)); int d = gh_scm2int (ly_cdr ($3));
896 $$= MY_MAKE_MUSIC("TimeScaledMusic");
897 $$->set_spot (THIS->pop_spot ());
900 $$->set_mus_property ("element", mp->self_scm ());
901 scm_gc_unprotect_object (mp->self_scm ());
902 $$->set_mus_property ("numerator", gh_int2scm (n));
903 $$->set_mus_property ("denominator", gh_int2scm (d));
904 $$->compress (Moment (Rational (n,d)));
907 | Repeated_music { $$ = $1; }
908 | Simultaneous_music { $$ = $1; }
909 | Sequential_music { $$ = $1; }
910 | TRANSPOSE pitch Music {
911 $$ = MY_MAKE_MUSIC("TransposedMusic");
913 Pitch pit = *unsmob_pitch ($2);
916 $$->set_mus_property ("element", p->self_scm ());
917 scm_gc_unprotect_object (p->self_scm ());
919 | TRANSPOSE steno_tonic_pitch Music {
920 $$ = MY_MAKE_MUSIC("TransposedMusic");
922 Pitch pit = *unsmob_pitch ($2);
925 $$->set_mus_property ("element", p->self_scm ());
926 scm_gc_unprotect_object (p->self_scm ());
929 | APPLY embedded_scm Music {
930 SCM ret = gh_call1 ($2, $3->self_scm ());
931 Music *m = unsmob_music (ret);
933 THIS->parser_error ("\\apply must return a Music");
934 m = MY_MAKE_MUSIC("Music");
939 { THIS->lexer_->push_note_state (); }
942 THIS->lexer_->pop_state ();
945 { THIS->lexer_->push_figuredbass_state (); }
948 Music * chm = MY_MAKE_MUSIC("UntransposableMusic");
949 chm->set_mus_property ("element", $3->self_scm ());
951 scm_gc_unprotect_object ($3->self_scm());
953 THIS->lexer_->pop_state ();
956 { THIS->lexer_->push_chord_state (); }
959 Music * chm = MY_MAKE_MUSIC("UnrelativableMusic");
960 chm->set_mus_property ("element", $3->self_scm ());
961 scm_gc_unprotect_object ($3->self_scm());
964 THIS->lexer_->pop_state ();
967 { THIS->lexer_->push_lyric_state (); }
971 THIS->lexer_->pop_state ();
973 | relative_music { $$ = $1; }
974 | re_rhythmed_music { $$ = $1; }
975 | part_combined_music { $$ = $1; }
979 RELATIVE absolute_pitch Music {
981 Pitch pit = *unsmob_pitch ($2);
982 $$ = MY_MAKE_MUSIC("RelativeOctaveMusic");
984 $$->set_mus_property ("element", p->self_scm ());
985 scm_gc_unprotect_object (p->self_scm ());
987 $$->set_mus_property ("last-pitch", p->to_relative_octave (pit).smobbed_copy ());
993 ADDLYRICS Music Music {
994 Music*l =MY_MAKE_MUSIC("LyricCombineMusic");
995 l->set_mus_property ("elements", gh_list ($2->self_scm (), $3->self_scm (), SCM_UNDEFINED));
996 scm_gc_unprotect_object ($3->self_scm ());
997 scm_gc_unprotect_object ($2->self_scm ());
1002 part_combined_music:
1003 PARTCOMBINE STRING Music Music {
1004 Music * p= MY_MAKE_MUSIC("PartCombineMusic");
1005 p->set_mus_property ("what", $2);
1006 p->set_mus_property ("elements", gh_list ($3->self_scm (),$4->self_scm (), SCM_UNDEFINED));
1008 scm_gc_unprotect_object ($3->self_scm ());
1009 scm_gc_unprotect_object ($4->self_scm ());
1016 TRANSLATOR STRING '=' STRING {
1017 Music*t= MY_MAKE_MUSIC("TranslatorChange");
1018 t-> set_mus_property ("change-to-type", $2);
1019 t-> set_mus_property ("change-to-id", $4);
1022 $$->set_spot (THIS->here_input ());
1028 | ONCE simple_property_def {
1030 SCM e = $2->get_mus_property ("element");
1031 unsmob_music (e)->set_mus_property ("once", SCM_BOOL_T);
1035 simple_property_def:
1036 PROPERTY STRING '.' STRING '=' scalar {
1037 Music *t = set_property_music (scm_string_to_symbol ($4), $6);
1038 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1040 csm->set_mus_property ("element", t->self_scm ());
1041 scm_gc_unprotect_object (t->self_scm ());
1044 $$->set_spot (THIS->here_input ());
1046 csm-> set_mus_property ("context-type", $2);
1048 | PROPERTY STRING '.' STRING UNSET {
1050 Music *t = MY_MAKE_MUSIC("PropertyUnset");
1051 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1053 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1054 csm->set_mus_property ("element", t->self_scm ());
1055 scm_gc_unprotect_object (t->self_scm ());
1058 $$->set_spot (THIS->here_input ());
1060 csm-> set_mus_property ("context-type", $2);
1062 | PROPERTY STRING '.' STRING SET embedded_scm '=' embedded_scm {
1064 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1065 bool itc = internal_type_checking_global_b;
1066 Music *t = MY_MAKE_MUSIC("OverrideProperty");
1068 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1069 t->set_mus_property ("pop-first", SCM_BOOL_T);
1071 internal_type_checking_global_b = false;
1072 t->set_mus_property ("grob-property", $6);
1074 internal_type_checking_global_b = itc;
1075 t->set_mus_property ("grob-value", $8);
1077 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1078 csm->set_mus_property ("element", t->self_scm ());
1079 scm_gc_unprotect_object (t->self_scm ());
1081 $$->set_spot (THIS->here_input ());
1083 csm-> set_mus_property ("context-type", $2);
1085 | PROPERTY STRING '.' STRING OVERRIDE
1086 embedded_scm '=' embedded_scm
1092 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1093 bool itc = internal_type_checking_global_b;
1095 Music *t = MY_MAKE_MUSIC("OverrideProperty");
1096 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1098 internal_type_checking_global_b = false;
1099 t->set_mus_property ("grob-property", $6);
1100 t->set_mus_property ("grob-value", $8);
1102 internal_type_checking_global_b = itc;
1104 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1105 csm->set_mus_property ("element", t->self_scm ());
1106 scm_gc_unprotect_object (t->self_scm ());
1109 $$->set_spot (THIS->here_input ());
1111 csm-> set_mus_property ("context-type", $2);
1114 | PROPERTY STRING '.' STRING REVERT embedded_scm {
1115 Music *t = MY_MAKE_MUSIC("RevertProperty");
1117 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1118 bool itc = internal_type_checking_global_b;
1120 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1122 internal_type_checking_global_b = false;
1123 t->set_mus_property ("grob-property", $6);
1125 internal_type_checking_global_b = itc;
1127 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1128 csm->set_mus_property ("element", t->self_scm ());
1129 scm_gc_unprotect_object (t->self_scm ());
1132 $$->set_spot (THIS->here_input ());
1134 csm-> set_mus_property ("context-type", $2);
1141 | bare_int { $$ = gh_int2scm ($1); }
1142 | embedded_scm { $$ = $1; }
1149 } /*cont */ simple_element post_requests {
1150 Music_sequence *l = dynamic_cast<Music_sequence*> ($3);
1153 for (int i=0; i < $1->size (); i++) {
1154 Music * m = $1->elem (i);
1155 l->append_music (m);
1167 $$ = MY_MAKE_MUSIC("RequestChord");
1168 $$->set_mus_property ("elements", scm_cons ($1->self_scm (), SCM_EOL));
1169 scm_gc_unprotect_object ($1->self_scm());
1171 $$-> set_spot (THIS->here_input ());
1172 $1-> set_spot (THIS->here_input ());
1175 Music *l = MY_MAKE_MUSIC("LigatureEvent");
1176 l->set_mus_property ("span-direction", gh_int2scm (START));
1177 l->set_spot (THIS->here_input ());
1179 $$ = MY_MAKE_MUSIC("RequestChord");
1180 $$->set_mus_property ("elements", scm_cons (l->self_scm (), SCM_EOL));
1181 scm_gc_unprotect_object (l->self_scm());
1182 $$->set_spot (THIS->here_input ());
1185 Music *l = MY_MAKE_MUSIC("LigatureEvent");
1186 l->set_mus_property ("span-direction", gh_int2scm (STOP));
1187 l->set_spot (THIS->here_input ());
1189 $$ = MY_MAKE_MUSIC("RequestChord");
1190 $$->set_mus_property ("elements", scm_cons (l->self_scm (), SCM_EOL));
1191 $$->set_spot (THIS->here_input ());
1192 scm_gc_unprotect_object (l->self_scm());
1196 $$ = MY_MAKE_MUSIC("VoiceSeparator");
1197 $$->set_spot (THIS->here_input ());
1201 $$ = MY_MAKE_MUSIC("BarCheck");
1202 $$->set_spot (THIS->here_input ());
1205 Music *t = set_property_music (ly_symbol2scm ("whichBar"), $2);
1207 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1208 csm->set_mus_property ("element", t->self_scm ());
1209 scm_gc_unprotect_object (t->self_scm ());
1212 $$->set_spot (THIS->here_input ());
1214 csm->set_mus_property ("context-type", scm_makfrom0str ("Timing"));
1216 | PARTIAL duration_length {
1217 Moment m = - unsmob_duration ($2)->length_mom ();
1218 Music * p = set_property_music (ly_symbol2scm ( "measurePosition"),m.smobbed_copy ());
1220 Music * sp = MY_MAKE_MUSIC("ContextSpeccedMusic");
1221 sp->set_mus_property ("element", p->self_scm ());
1222 scm_gc_unprotect_object (p->self_scm ());
1225 sp-> set_mus_property ("context-type", scm_makfrom0str ("Timing"));
1228 SCM func = scm_primitive_eval (ly_symbol2scm ("clef-name-to-properties"));
1229 SCM result = gh_call1 (func, $2);
1232 for (SCM s = result ; gh_pair_p (s); s = ly_cdr (s)) {
1233 Music * p = MY_MAKE_MUSIC("Music");
1234 set_music_properties (p, ly_car (s));
1235 l = scm_cons (p->self_scm (), l);
1236 scm_gc_unprotect_object (p->self_scm ());
1238 Music * seq = MY_MAKE_MUSIC("SequentialMusic");
1239 seq->set_mus_property ("elements", l);
1241 Music * sp = MY_MAKE_MUSIC("ContextSpeccedMusic");
1242 sp->set_mus_property ("element", seq->self_scm ());
1243 scm_gc_unprotect_object (seq->self_scm ());
1246 sp-> set_mus_property ("context-type", scm_makfrom0str ("Staff"));
1249 Music * p1 = set_property_music (ly_symbol2scm ( "timeSignatureFraction"), $2);
1251 int l = gh_scm2int (ly_car ($2));
1252 int o = gh_scm2int (ly_cdr ($2));
1254 Moment one_beat = Moment (1)/Moment (o);
1255 Moment len = Moment (l) * one_beat;
1258 Music *p2 = set_property_music (ly_symbol2scm ("measureLength"), len.smobbed_copy ());
1259 Music *p3 = set_property_music (ly_symbol2scm ("beatLength"), one_beat.smobbed_copy ());
1261 SCM list = scm_list_n (p1->self_scm (), p2->self_scm (), p3->self_scm(), SCM_UNDEFINED);
1262 Music *seq = MY_MAKE_MUSIC("SequentialMusic");
1263 seq->set_mus_property ("elements", list);
1266 Music * sp = MY_MAKE_MUSIC("ContextSpeccedMusic");
1267 sp->set_mus_property ("element", seq->self_scm ());
1269 scm_gc_unprotect_object (p3->self_scm ());
1270 scm_gc_unprotect_object (p2->self_scm ());
1271 scm_gc_unprotect_object (p1->self_scm ());
1272 scm_gc_unprotect_object (seq->self_scm ());
1276 sp-> set_mus_property ("context-type", scm_makfrom0str ( "Timing"));
1281 shorthand_command_req { $$ = $1; }
1282 | verbose_command_req { $$ = $1; }
1285 shorthand_command_req:
1293 $$ = MY_MAKE_MUSIC("TieEvent");
1296 Music *b= MY_MAKE_MUSIC("BeamEvent");
1297 b->set_mus_property ("span-direction", gh_int2scm (START))
1302 THIS->last_beam_start_ = b->self_scm ();
1305 Music *b= MY_MAKE_MUSIC("BeamEvent");
1306 b->set_mus_property ("span-direction", gh_int2scm (STOP));
1310 $$ = MY_MAKE_MUSIC("BreathingSignEvent");
1313 $$ = MY_MAKE_MUSIC("PorrectusEvent");
1317 verbose_command_req:
1318 COMMANDSPANREQUEST bare_int STRING { /*TODO: junkme */
1319 Music * sp = MY_MAKE_MUSIC("SpanEvent");
1320 sp->set_mus_property ("span-direction", gh_int2scm (Direction ($2)));
1321 sp->set_mus_property ("span-type",$3);
1322 sp->set_spot (THIS->here_input ());
1326 Music * m = MY_MAKE_MUSIC("MarkEvent");
1330 Music *m = MY_MAKE_MUSIC("MarkEvent");
1331 m->set_mus_property ("label", $2);
1335 Music * b = MY_MAKE_MUSIC("BreakEvent");
1337 if (!gh_number_p (s))
1340 b->set_mus_property ("penalty", s);
1341 b->set_spot (THIS->here_input ());
1344 | SKIP duration_length {
1345 Music * skip = MY_MAKE_MUSIC("SkipEvent");
1346 skip->set_mus_property ("duration", $2);
1354 Music *key= MY_MAKE_MUSIC("KeyChangeEvent");
1357 | KEY NOTENAME_PITCH SCM_IDENTIFIER {
1358 Music *key= MY_MAKE_MUSIC("KeyChangeEvent");
1360 key->set_mus_property ("pitch-alist", $3);
1361 ((Music*)key)->transpose (* unsmob_pitch ($2));
1368 $$ = new Link_array<Music>;
1370 | post_requests post_request {
1371 $2->set_spot (THIS->here_input ());
1386 Music * s = MY_MAKE_MUSIC("StringNumberEvent");
1387 s->set_mus_property ("string-number", gh_int2scm($1));
1388 s->set_spot (THIS->here_input ());
1394 request_that_take_dir:
1397 | script_abbreviation {
1398 SCM s = THIS->lexer_->lookup_identifier ("dash" + ly_scm2string ($1));
1399 Music *a = MY_MAKE_MUSIC("ArticulationEvent");
1400 if (gh_string_p (s))
1401 a->set_mus_property ("articulation-type", s);
1402 else THIS->parser_error (_ ("Expecting string as script definition"));
1408 script_dir request_that_take_dir {
1409 $2->set_mus_property ("direction", gh_int2scm ($1));
1415 REQUEST_IDENTIFIER {
1416 $$ = unsmob_music ($1)->clone ();
1417 $$->set_spot (THIS->here_input ());
1419 | DYNAMICSCRIPT embedded_scm {
1421 TODO: junkme, use text-type == dynamic
1423 Music *d = MY_MAKE_MUSIC("TextScriptEvent");
1424 SCM dyn = ly_symbol2scm ("dynamic");
1425 d->set_mus_property ("text-type" , dyn);
1426 d->set_mus_property ("text", $2);
1427 d->set_spot (THIS->here_input ());
1430 | SPANREQUEST bare_int STRING {
1431 Music * sp = MY_MAKE_MUSIC("SpanEvent");
1432 sp->set_mus_property ("span-direction", gh_int2scm ( $2));
1433 sp->set_mus_property ("span-type", $3);
1434 sp->set_spot (THIS->here_input ());
1438 Music * a = MY_MAKE_MUSIC("TremoloEvent");
1439 a->set_spot (THIS->here_input ());
1440 a->set_mus_property ("tremolo-type", gh_int2scm ($1));
1444 Music * a = MY_MAKE_MUSIC("ArticulationEvent");
1445 a->set_mus_property ("articulation-type", $2);
1446 a->set_spot (THIS->here_input ());
1451 duh, junk this syntax from the parser, if possible.
1454 Music *a = MY_MAKE_MUSIC("ArpeggioEvent");
1455 a->set_spot (THIS->here_input ());
1459 Music *g = MY_MAKE_MUSIC("GlissandoEvent");
1460 g->set_spot /* No pun intended */ (THIS->here_input ());
1487 | NOTENAME_PITCH sup_quotes {
1488 Pitch p = *unsmob_pitch ($1);
1490 $$ = p.smobbed_copy ();
1492 | NOTENAME_PITCH sub_quotes {
1493 Pitch p =* unsmob_pitch ($1);
1496 $$ = p.smobbed_copy ();
1509 | TONICNAME_PITCH sup_quotes {
1510 Pitch p = *unsmob_pitch ($1);
1512 $$ = p.smobbed_copy ();
1514 | TONICNAME_PITCH sub_quotes {
1515 Pitch p =* unsmob_pitch ($1);
1518 $$ = p.smobbed_copy ();
1533 PITCH embedded_scm {
1535 if (!unsmob_pitch ($2)) {
1536 THIS->parser_error (_f ("Expecting musical-pitch value", 3));
1537 $$ = Pitch ().smobbed_copy ();
1543 DURATION embedded_scm {
1545 if (!unsmob_duration ($2))
1547 THIS->parser_error (_ ("Must have duration object"));
1548 $$ = Duration ().smobbed_copy ();
1555 if (!THIS->lexer_->lyric_state_b ())
1556 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1557 $$ = MY_MAKE_MUSIC("ExtenderEvent");
1563 if (!THIS->lexer_->lyric_state_b ())
1564 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1565 $$ = MY_MAKE_MUSIC("HyphenEvent");
1570 close_request_parens {
1572 dynamic_cast<Music *> ($$)->set_mus_property ("span-direction", gh_int2scm (START))
1577 close_request_parens:
1579 Music * s= MY_MAKE_MUSIC("SpanEvent");
1581 s->set_mus_property ("span-type", scm_makfrom0str ( "slur"));
1582 s->set_spot (THIS->here_input());
1585 Music * s= MY_MAKE_MUSIC("SpanEvent");
1587 s->set_mus_property ("span-type", scm_makfrom0str ( "phrasing-slur"));
1588 s->set_spot (THIS->here_input());
1591 Music *s =MY_MAKE_MUSIC("CrescendoEvent");
1593 s->set_spot (THIS->here_input());
1596 Music *s =MY_MAKE_MUSIC("DecrescendoEvent");
1598 s->set_spot (THIS->here_input());
1604 open_request_parens {
1606 dynamic_cast<Music *> ($$)->set_mus_property ("span-direction", gh_int2scm (STOP))
1611 open_request_parens:
1613 Music *s = MY_MAKE_MUSIC("CrescendoEvent");
1614 s->set_spot (THIS->here_input());
1619 Music * s= MY_MAKE_MUSIC("SpanEvent");
1621 s->set_mus_property ("span-type", scm_makfrom0str ( "slur"));
1622 s->set_spot (THIS->here_input());
1626 Music * s= MY_MAKE_MUSIC("SpanEvent");
1628 s->set_mus_property ("span-type", scm_makfrom0str ( "phrasing-slur"));
1629 s->set_spot (THIS->here_input());
1635 Music *t = MY_MAKE_MUSIC("TextScriptEvent");
1636 t->set_mus_property ("text", $1);
1637 t->set_spot (THIS->here_input ());
1641 Music *t = MY_MAKE_MUSIC("TextScriptEvent");
1642 t->set_mus_property ("text", $1);
1643 t->set_spot (THIS->here_input ());
1647 String ds = to_string ($1);
1648 Music * t = MY_MAKE_MUSIC("TextScriptEvent");
1649 SCM finger = ly_symbol2scm ("finger");
1650 t->set_mus_property ("text", scm_makfrom0str (ds.to_str0 ()));
1651 t->set_mus_property ("text-type" , finger);
1652 t->set_spot (THIS->here_input ());
1657 script_abbreviation:
1659 $$ = scm_makfrom0str ("Hat");
1662 $$ = scm_makfrom0str ("Plus");
1665 $$ = scm_makfrom0str ("Dash");
1668 $$ = scm_makfrom0str ("Bar");
1671 $$ = scm_makfrom0str ("Larger");
1674 $$ = scm_makfrom0str ("Dot");
1677 $$ = scm_makfrom0str ("Underscore");
1684 | '-' { $$ = CENTER; }
1689 $$ = new Link_array<Music>;
1691 | pre_requests open_request {
1703 multiplied_duration {
1706 | verbose_duration {
1711 optional_notemode_duration:
1713 Duration dd = THIS->default_duration_;
1714 $$ = dd.smobbed_copy ();
1716 THIS->beam_check ($$);
1718 | multiplied_duration {
1720 THIS->default_duration_ = *unsmob_duration ($$);
1722 THIS->beam_check ($$);
1724 | verbose_duration {
1726 THIS->default_duration_ = *unsmob_duration ($$);
1731 bare_unsigned dots {
1733 if (!is_duration_b ($1))
1734 THIS->parser_error (_f ("not a duration: %d", $1));
1738 $$ = Duration (l, $2).smobbed_copy ();
1740 | DURATION_IDENTIFIER dots {
1741 Duration *d =unsmob_duration ($1);
1742 Duration k (d->duration_log (),d->dot_count () + $2);
1743 $$ = k.smobbed_copy ();
1750 multiplied_duration:
1754 | multiplied_duration '*' bare_unsigned {
1755 $$ = unsmob_duration ($$)->compressed ( $3) .smobbed_copy ();
1757 | multiplied_duration '*' FRACTION {
1758 Rational m (gh_scm2int (ly_car ($3)), gh_scm2int (ly_cdr ($3)));
1760 $$ = unsmob_duration ($$)->compressed (m).smobbed_copy ();
1765 FRACTION { $$ = $1; }
1766 | UNSIGNED '/' UNSIGNED {
1767 $$ = scm_cons (gh_int2scm ($1), gh_int2scm ($3));
1785 | ':' bare_unsigned {
1786 if (!is_duration_b ($2))
1787 THIS->parser_error (_f ("not a duration: %d", $2));
1806 Music *bfr = MY_MAKE_MUSIC("BassFigureEvent");
1807 $$ = bfr->self_scm();
1808 scm_gc_unprotect_object ($$);
1811 Music *bfr = MY_MAKE_MUSIC("BassFigureEvent");
1812 $$ = bfr->self_scm();
1814 bfr->set_mus_property ("figure", gh_int2scm ($1));
1816 scm_gc_unprotect_object ($$);
1818 | bass_figure bass_mod {
1819 Music *m = unsmob_music ($1);
1821 SCM salter =m->get_mus_property ("alteration");
1822 int alter = gh_number_p ( salter) ? gh_scm2int (salter) : 0;
1823 m->set_mus_property ("alteration",
1824 gh_int2scm (alter + $2));
1826 m->set_mus_property ("alteration", gh_int2scm (0));
1834 unsmob_music ($$)->set_mus_property ("bracket-start", SCM_BOOL_T);
1839 | br_bass_figure ']' {
1841 unsmob_music ($1)->set_mus_property ("bracket-stop", SCM_BOOL_T);
1849 | figure_list br_bass_figure {
1850 $$ = scm_cons ($2, $1);
1855 FIGURE_OPEN figure_list FIGURE_CLOSE {
1856 Music * m = MY_MAKE_MUSIC("RequestChord");
1857 $2 = scm_reverse_x ($2, SCM_EOL);
1858 m->set_mus_property ("elements", $2);
1859 $$ = m->self_scm ();
1870 pitch exclamations questions optional_notemode_duration optional_rest {
1872 Input i = THIS->pop_spot ();
1873 if (!THIS->lexer_->note_state_b ())
1874 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1878 n = MY_MAKE_MUSIC("RestEvent");
1880 n = MY_MAKE_MUSIC("NoteEvent");
1882 n->set_mus_property ("pitch", $1);
1883 n->set_mus_property ("duration", $4);
1887 n->set_mus_property ("cautionary", SCM_BOOL_T);
1888 if ($2 % 2 || $3 % 2)
1889 n->set_mus_property ("force-accidental", SCM_BOOL_T);
1891 Music *v = MY_MAKE_MUSIC("RequestChord");
1892 v->set_mus_property ("elements", scm_list_n (n->self_scm (), SCM_UNDEFINED));
1893 scm_gc_unprotect_object (n->self_scm());
1899 | figure_spec optional_notemode_duration {
1900 Music * m = unsmob_music ($1);
1901 Input i = THIS->pop_spot ();
1903 for (SCM s = m->get_mus_property ("elements"); gh_pair_p (s); s = ly_cdr (s))
1905 unsmob_music (ly_car (s))->set_mus_property ("duration", $2);
1909 | RESTNAME optional_notemode_duration {
1911 Input i = THIS->pop_spot ();
1912 SCM e = SCM_UNDEFINED;
1913 if (ly_scm2string ($1) =="s") {
1915 Music * skip = MY_MAKE_MUSIC("SkipEvent");
1916 skip->set_mus_property ("duration" ,$2);
1918 e = skip->self_scm ();
1921 Music * rest_req = MY_MAKE_MUSIC("RestEvent");
1922 rest_req->set_mus_property ("duration", $2);
1923 rest_req->set_spot (i);
1924 e = rest_req->self_scm ();
1926 Music * velt = MY_MAKE_MUSIC("RequestChord");
1927 velt-> set_mus_property ("elements", scm_list_n (e,SCM_UNDEFINED));
1932 | MULTI_MEASURE_REST optional_notemode_duration {
1935 Music * sk = MY_MAKE_MUSIC("SkipEvent");
1936 sk->set_mus_property ("duration", $2);
1937 Music *sp1 = MY_MAKE_MUSIC("SpanEvent");
1938 Music *sp2 = MY_MAKE_MUSIC("SpanEvent");
1939 sp1-> set_mus_property ("span-direction", gh_int2scm (START))
1941 sp2-> set_mus_property ("span-direction", gh_int2scm (STOP))
1943 SCM r = scm_makfrom0str ("rest");
1944 sp1->set_mus_property ("span-type", r);
1945 sp2->set_mus_property ("span-type", r);
1947 Music *rqc1 = MY_MAKE_MUSIC("RequestChord");
1948 rqc1->set_mus_property ("elements", scm_list_n (sp1->self_scm (), SCM_UNDEFINED));
1949 Music *rqc2 = MY_MAKE_MUSIC("RequestChord");
1950 rqc2->set_mus_property ("elements", scm_list_n (sk->self_scm (), SCM_UNDEFINED));;
1951 Music *rqc3 = MY_MAKE_MUSIC("RequestChord");
1952 rqc3->set_mus_property ("elements", scm_list_n (sp2->self_scm (), SCM_UNDEFINED));;
1954 SCM ms = scm_list_n (rqc1->self_scm (), rqc2->self_scm (), rqc3->self_scm (), SCM_UNDEFINED);
1956 $$ = MY_MAKE_MUSIC("SequentialMusic");
1957 $$->set_mus_property ("elements", ms);
1959 | STRING optional_notemode_duration {
1960 Input i = THIS->pop_spot ();
1962 Music * lreq = MY_MAKE_MUSIC("LyricEvent");
1963 lreq->set_mus_property ("text", $1);
1964 lreq->set_mus_property ("duration",$2);
1966 Music * velt = MY_MAKE_MUSIC("RequestChord");
1967 velt->set_mus_property ("elements", scm_list_n (lreq->self_scm (), SCM_UNDEFINED));
1974 if (!THIS->lexer_->chord_state_b ())
1975 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1982 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
1983 $$ = Chord::get_chord ($1, $3, $4, $5, $6, $2);
1984 $$->set_spot (THIS->here_input ());
1991 | CHORD_COLON chord_notes {
2000 | chord_notes '.' chord_step {
2001 $$ = gh_append2 ($$, $3);
2009 | CHORD_CARET chord_notes {
2019 | CHORD_SLASH steno_tonic_pitch {
2028 | CHORD_BASS steno_tonic_pitch {
2035 $$ = scm_cons ($1, SCM_EOL);
2037 | CHORDMODIFIER_PITCH {
2038 $$ = scm_cons (unsmob_pitch ($1)->smobbed_copy (), SCM_EOL);
2040 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
2041 $$ = scm_list_n (unsmob_pitch ($1)->smobbed_copy (),
2049 m.notename_ = ($1 - 1) % 7;
2050 m.octave_ = $1 > 7 ? 1 : 0;
2053 $$ = m.smobbed_copy ();
2055 | bare_unsigned '+' {
2057 m.notename_ = ($1 - 1) % 7;
2058 m.octave_ = $1 > 7 ? 1 : 0;
2062 $$ = m.smobbed_copy ();
2064 | bare_unsigned CHORD_MINUS {
2066 m.notename_ = ($1 - 1) % 7;
2067 m.octave_ = $1 > 7 ? 1 : 0;
2070 $$ = m.smobbed_copy ();
2078 number_expression '+' number_term {
2079 $$ = scm_sum ($1, $3);
2081 | number_expression '-' number_term {
2082 $$ = scm_difference ($1, $3);
2091 | number_factor '*' number_factor {
2092 $$ = scm_product ($1, $3);
2094 | number_factor '/' number_factor {
2095 $$ = scm_divide ($1, $3);
2100 '(' number_expression ')' {
2103 | '-' number_factor { /* %prec UNARY_MINUS */
2104 $$ = scm_difference ($2, SCM_UNDEFINED);
2112 $$ = gh_int2scm ($1);
2117 | NUMBER_IDENTIFIER {
2121 $$ = gh_double2scm (gh_scm2double ($1) CM );
2124 $$ = gh_double2scm (gh_scm2double ($1) PT);
2127 $$ = gh_double2scm (gh_scm2double ($1) INCH);
2130 $$ = gh_double2scm (gh_scm2double ($1) MM);
2133 $$ = gh_double2scm (gh_scm2double ($1) CHAR);
2149 if (scm_integer_p ($1) == SCM_BOOL_T)
2151 int k = gh_scm2int ($1);
2155 THIS->parser_error (_ ("need integer number arg"));
2169 | STRING_IDENTIFIER {
2172 | string '+' string {
2173 $$ = scm_string_append (scm_list_n ($1, $3, SCM_UNDEFINED));
2180 | exclamations '!' { $$ ++; }
2185 | questions '?' { $$ ++; }
2192 My_lily_parser::set_yydebug (bool )
2199 extern My_lily_parser * current_parser;
2202 My_lily_parser::do_yyparse ()
2205 current_parser = this;;
2206 yyparse ((void*)this);
2211 Should make this optional? It will also complain when you do
2215 which is entirely legitimate.
2217 Or we can scrap it. Barchecks should detect wrong durations, and
2218 skipTypesetting speeds it up a lot.
2221 My_lily_parser::beam_check (SCM dur)
2223 Duration *d = unsmob_duration (dur);
2224 if (unsmob_music (last_beam_start_) && d->duration_log () <= 2)
2226 Music * m = unsmob_music (last_beam_start_);
2227 m->origin ()->warning (_("Suspect duration found following this beam"));
2229 last_beam_start_ = SCM_EOL;