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"
65 regular_identifier_b (SCM id)
67 String str = ly_scm2string (id);
68 char const *s = str.to_str0 () ;
73 v = v && isalpha (*s);
81 set_property_music (SCM sym, SCM value)
83 Music * p = new Music (SCM_EOL);
84 p->set_mus_property ("symbol", sym);
85 p->set_mus_property ("iterator-ctor",
86 Property_iterator::constructor_proc);
88 p->set_mus_property ("value", value);
95 return t && t == 1 << intlog2 (t);
99 set_music_properties (Music *p, SCM a)
101 for (SCM k = a; gh_pair_p (k); k = ly_cdr (k))
103 p->internal_set_mus_property (ly_caar (k), ly_cdar (k));
113 // needed for bison.simple's malloc () and free ()
115 // #include <malloc.h>
120 #define YYERROR_VERBOSE 1
122 #define YYPARSE_PARAM my_lily_parser
123 #define YYLEX_PARAM my_lily_parser
125 ((My_lily_parser *) my_lily_parser)
127 #define yyerror THIS->parser_error
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
218 %token OVERRIDE SET REVERT
231 %token COMMANDSPANREQUEST
233 %token OUTPUTPROPERTY
244 %token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE
245 %token E_LEFTSQUARE E_RIGHTSQUARE E_TILDE
247 %token <i> E_UNSIGNED
248 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET CHORD_SLASH
251 %type <i> exclamations questions dots optional_rest
252 %type <i> bass_number bass_mod
253 %type <scm> br_bass_figure bass_figure figure_list figure_spec
255 %token <scm> NOTENAME_PITCH
256 %token <scm> TONICNAME_PITCH
257 %token <scm> CHORDMODIFIER_PITCH
258 %token <scm> DURATION_IDENTIFIER
259 %token <scm> FRACTION
260 %token <id> IDENTIFIER
263 %token <scm> SCORE_IDENTIFIER
264 %token <scm> MUSIC_OUTPUT_DEF_IDENTIFIER
266 %token <scm> NUMBER_IDENTIFIER
267 %token <scm> REQUEST_IDENTIFIER
268 %token <scm> MUSIC_IDENTIFIER TRANSLATOR_IDENTIFIER
269 %token <scm> STRING_IDENTIFIER SCM_IDENTIFIER
270 %token <scm> RESTNAME
276 %type <outputdef> output_def
277 %type <scmhash> lilypond_header lilypond_header_body
278 %type <request> open_request_parens close_request_parens open_request close_request
279 %type <request> request_with_dir request_that_take_dir verbose_request
280 %type <i> sub_quotes sup_quotes
281 %type <music> simple_element request_chord command_element Simple_music Composite_music
282 %type <music> Repeated_music
283 %type <scm> Alternative_music
284 %type <i> tremolo_type
285 %type <i> bare_int bare_unsigned
287 %type <scm> identifier_init
289 %type <scm> steno_duration optional_notemode_duration multiplied_duration
290 %type <scm> verbose_duration
292 %type <reqvec> pre_requests post_requests
293 %type <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 simple_property_def
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 <request> string_request
314 %type <scm> string bare_number number_expression number_term number_factor
316 %type <score> score_block score_body
318 %type <scm> translator_spec_block translator_spec_body
319 %type <tempo> tempo_request
320 %type <scm> notenames_body notenames_block chordmodifiers_block
321 %type <scm> script_abbreviation
327 /* We don't assign precedence to / and *, because we might need varied
328 prec levels in different prods */
334 lilypond: /* empty */
335 | lilypond toplevel_expression {}
336 | lilypond assignment { }
338 THIS->error_level_ = 1;
341 THIS->error_level_ = 1;
347 THIS->lexer_->pitchname_tab_ = $1;
349 | chordmodifiers_block {
350 THIS->lexer_->chordmodifier_tab_ = $1;
353 if (THIS->input_file_->header_)
354 scm_gc_unprotect_object (THIS->input_file_->header_->self_scm ());
355 THIS->input_file_->header_ = $1;
358 THIS->input_file_->scores_.push ($1);
361 if (dynamic_cast<Paper_def*> ($1))
362 THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultpaper"), $1->self_scm ());
363 else if (dynamic_cast<Midi_def*> ($1))
364 THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultmidi"), $1->self_scm ());
377 chordmodifiers_block:
378 CHORDMODIFIERS notenames_body { $$ = $2; }
382 PITCHNAMES notenames_body { $$ = $2; }
387 int i = scm_ilength ($1);
389 SCM tab = scm_make_vector (gh_int2scm (i), SCM_EOL);
390 for (SCM s = $1; gh_pair_p (s); s = ly_cdr (s)) {
391 SCM pt = ly_cdar (s);
392 if (!unsmob_pitch (pt))
393 THIS->parser_error ("Need pitch object.");
395 scm_hashq_set_x (tab, ly_caar (s), pt);
402 lilypond_header_body:
404 $$ = new Scheme_hash_table;
405 THIS->lexer_-> scopes_.push ($$);
407 | lilypond_header_body assignment {
413 HEADER '{' lilypond_header_body '}' {
415 THIS->lexer_->scopes_.pop ();
427 /* cont */ '=' identifier_init {
430 Should find generic way of associating input with objects.
432 Input ip = THIS->pop_spot ();
434 if (! regular_identifier_b ($1))
436 ip.warning (_ ("Identifier should have alphabetic characters only"));
439 THIS->lexer_->set_identifier ($1, $4);
442 TODO: devise standard for protection in parser.
444 The parser stack lives on the C-stack, which means that
445 all objects can be unprotected as soon as they're here.
455 $$ = $1->self_scm ();
456 scm_gc_unprotect_object ($$);
459 $$ = $1->self_scm ();
460 scm_gc_unprotect_object ($$);
462 | translator_spec_block {
466 $$ = $1->self_scm ();
467 scm_gc_unprotect_object ($$);
470 $$ = $1->self_scm ();
471 scm_gc_unprotect_object ($$);
476 | number_expression {
487 translator_spec_block:
488 TRANSLATOR '{' translator_spec_body '}'
494 translator_spec_body:
495 TRANSLATOR_IDENTIFIER {
496 $$ = unsmob_translator_def ($1)->clone_scm ();
497 unsmob_translator_def ($$)-> set_spot (THIS->here_input ());
500 $$ = Translator_def::make_scm ();
501 Translator_def*td = unsmob_translator_def ($$);
502 td->translator_group_type_ = $2;
503 td->set_spot (THIS->here_input ());
505 | translator_spec_body STRING '=' embedded_scm {
506 unsmob_translator_def ($$)->add_property_assign ($2, $4);
508 | translator_spec_body STRING OVERRIDE embedded_scm '=' embedded_scm {
509 unsmob_translator_def ($$)
510 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
512 | translator_spec_body STRING SET embedded_scm '=' embedded_scm {
513 unsmob_translator_def ($$)
514 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
516 | translator_spec_body STRING REVERT embedded_scm {
517 unsmob_translator_def ($$)->add_pop_property (
518 scm_string_to_symbol ($2), $4);
520 | translator_spec_body NAME STRING {
521 unsmob_translator_def ($$)->type_name_ = $3;
523 | translator_spec_body CONSISTS STRING {
524 unsmob_translator_def ($$)->add_element ($3);
526 | translator_spec_body ALIAS STRING {
527 Translator_def*td = unsmob_translator_def ($$);
528 td->type_aliases_ = scm_cons ($3, td->type_aliases_);
530 | translator_spec_body GROBDESCRIPTIONS embedded_scm {
531 Translator_def*td = unsmob_translator_def($$);
532 // td->add_property_assign (ly_symbol2scm ("allGrobDescriptions"), $3);
533 for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p))
534 td->add_property_assign (scm_symbol_to_string (ly_caar (p)), ly_cdar (p));
536 | translator_spec_body CONSISTSEND STRING {
537 unsmob_translator_def ($$)->add_last_element ( $3);
539 | translator_spec_body ACCEPTS STRING {
540 unsmob_translator_def ($$)->set_acceptor ($3,true);
542 | translator_spec_body DENIES STRING {
543 unsmob_translator_def ($$)->set_acceptor ($3,false);
545 | translator_spec_body REMOVE STRING {
546 unsmob_translator_def ($$)->remove_element ($3);
557 /*cont*/ '{' score_body '}' {
560 if (!$$->defs_.size ())
562 Music_output_def *id =
563 unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
564 $$->add_output (id ? id->clone () : new Paper_def );
573 $$->set_spot (THIS->here_input ());
574 SCM m = $1->self_scm ();
575 scm_gc_unprotect_object (m);
580 SCM check_funcs = scm_c_eval_string ("toplevel-music-functions");
581 for (; gh_pair_p (check_funcs); check_funcs = gh_cdr (check_funcs))
582 m = gh_call1 (gh_car (check_funcs), m);
587 $$ = new Score (*unsmob_score ($1));
588 $$->set_spot (THIS->here_input ());
590 | score_body lilypond_header {
591 scm_gc_unprotect_object ($2->self_scm ());
594 | score_body output_def {
607 music_output_def_body '}' {
609 THIS-> lexer_-> scopes_.pop ();
613 music_output_def_body:
615 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultmidi"));
620 p = dynamic_cast<Midi_def*> (id->clone ());
625 THIS->lexer_->scopes_.push (p->variable_tab_);
628 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
631 p = dynamic_cast<Paper_def*> (id->clone ());
634 THIS-> lexer_-> scopes_.push (p->variable_tab_);
637 | PAPER '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
638 Music_output_def *p = unsmob_music_output_def ($3);
640 THIS->lexer_->scopes_.push (p->variable_tab_);
643 | MIDI '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
644 Music_output_def *p = unsmob_music_output_def ($3);
647 THIS->lexer_->scopes_.push (p->variable_tab_);
650 | music_output_def_body assignment {
653 | music_output_def_body translator_spec_block {
654 $$->assign_translator ($2);
656 | music_output_def_body STYLESHEET embedded_scm {
657 dynamic_cast<Paper_def*> ($$)-> style_sheet_ = $3;
659 | music_output_def_body tempo_request {
661 junk this ? there already is tempo stuff in
664 int m = gh_scm2int ( $2->get_mus_property ("metronome-count"));
665 Duration *d = unsmob_duration ($2->get_mus_property ("duration"));
666 Midi_def * md = dynamic_cast<Midi_def*> ($$);
668 md->set_tempo (d->length_mom (), m);
670 | music_output_def_body error {
676 TEMPO steno_duration '=' bare_unsigned {
678 $$->set_mus_property ("duration", $2);
679 $$->set_mus_property ("metronome-count", gh_int2scm ( $4));
684 The representation of a list is the
688 to have efficient append.
690 Music_list: /* empty */ {
691 $$ = scm_cons (SCM_EOL, SCM_EOL);
695 SCM c = scm_cons ($2->self_scm (), SCM_EOL);
696 scm_gc_unprotect_object ($2->self_scm ()); /* UGH */
697 if (gh_pair_p (ly_cdr (s)))
698 gh_set_cdr_x (ly_cdr (s), c); /* append */
700 gh_set_car_x (s, c); /* set first cons */
701 gh_set_cdr_x (s, c) ; /* remember last cell */
717 | ALTERNATIVE '{' Music_list '}' {
723 REPEAT string bare_unsigned Music Alternative_music
727 SCM alts = gh_pair_p ($5) ? gh_car ($5) : SCM_EOL;
728 if (times < scm_ilength (alts)) {
729 unsmob_music (gh_car (alts))
730 ->origin ()->warning (
731 _("More alternatives than repeats. Junking excess alternatives."));
732 alts = ly_truncate_list (times, alts);
735 Repeated_music * r = new Repeated_music (SCM_EOL);
738 r-> set_mus_property ("element", beg->self_scm ());
739 scm_gc_unprotect_object (beg->self_scm ());
741 r->set_mus_property ("repeat-count", gh_int2scm (times >? 1));
743 r-> set_mus_property ("elements",alts);
744 SCM func = scm_primitive_eval (ly_symbol2scm ("repeat-name-to-ctor"));
745 SCM result = gh_call1 (func, $2);
747 if (gh_equal_p ($2, scm_makfrom0str ("tremolo")))
750 we can not get durations and other stuff correct down the line, so we have to
751 add to the duration log here.
753 SCM func = scm_primitive_eval (ly_symbol2scm ("shift-duration-log"));
755 gh_call3 (func, r->self_scm (), gh_int2scm(-intlog2 ($3*2/3)),gh_int2scm(1));
757 gh_call3 (func, r->self_scm (), gh_int2scm(-intlog2 ($3)), gh_int2scm(0));
760 set_music_properties (r, result);
762 r->set_spot (*$4->origin ());
769 SEQUENTIAL '{' Music_list '}' {
770 $$ = new Sequential_music (SCM_EOL);
771 $$->set_mus_property ("elements", ly_car ($3));
772 $$->set_spot(THIS->here_input());
774 | '{' Music_list '}' {
775 $$ = new Sequential_music (SCM_EOL);
776 $$->set_mus_property ("elements", ly_car ($2));
777 $$->set_spot(THIS->here_input());
782 SIMULTANEOUS '{' Music_list '}'{
783 $$ = new Simultaneous_music (SCM_EOL);
784 $$->set_mus_property ("elements", ly_car ($3));
785 $$->set_spot(THIS->here_input());
788 | '<' Music_list '>' {
789 $$ = new Simultaneous_music (SCM_EOL);
790 $$->set_mus_property ("elements", ly_car ($2));
791 $$->set_spot(THIS->here_input());
796 request_chord { $$ = $1; }
797 | OUTPUTPROPERTY embedded_scm embedded_scm '=' embedded_scm {
799 if (!gh_symbol_p ($3))
801 THIS->parser_error (_ ("Second argument must be a symbol"));
803 /* Should check # args */
804 if (!gh_procedure_p (pred))
806 THIS->parser_error (_ ("First argument must be a procedure taking one argument"));
809 Music *m = new Music (SCM_EOL);
810 m->set_mus_property ("predicate", pred);
811 m->set_mus_property ("grob-property", $3);
812 m->set_mus_property ("grob-value", $5);
813 m->set_mus_property ("iterator-ctor",
814 Output_property_music_iterator::constructor_proc);
819 $$ = unsmob_music ($1)->clone ();
821 $$->set_spot (THIS->here_input());
829 CONTEXT STRING Music {
830 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
831 csm->set_mus_property ("element", $3->self_scm ());
832 scm_gc_unprotect_object ($3->self_scm ());
834 csm->set_mus_property ("context-type",$2);
835 csm->set_mus_property ("context-id", scm_makfrom0str (""));
839 | AUTOCHANGE STRING Music {
840 Music * chm = new Music_wrapper (SCM_EOL);
841 chm->set_mus_property ("element", $3->self_scm ());
842 chm->set_mus_property ("iterator-ctor", Auto_change_iterator::constructor_proc);
844 scm_gc_unprotect_object ($3->self_scm ());
845 chm->set_mus_property ("what", $2);
848 chm->set_spot (*$3->origin ());
853 The other version is for easier debugging of
854 Sequential_music_iterator in combination with grace notes.
857 SCM start = THIS->lexer_->lookup_identifier ("startGraceMusic");
858 SCM stop = THIS->lexer_->lookup_identifier ("stopGraceMusic");
859 Music *startm = unsmob_music (start);
860 Music *stopm = unsmob_music (stop);
864 stopm = stopm->clone ();
865 ms = scm_cons (stopm->self_scm (), ms);
866 scm_gc_unprotect_object (stopm->self_scm ());
868 ms = scm_cons ($2->self_scm (), ms);
869 scm_gc_unprotect_object ($2->self_scm());
871 startm = startm->clone ();
872 ms = scm_cons (startm->self_scm () , ms);
873 scm_gc_unprotect_object (startm->self_scm ());
876 Music* seq = new Sequential_music (SCM_EOL);
877 seq->set_mus_property ("elements", ms);
879 $$ = new Grace_music (SCM_EOL);
880 $$->set_mus_property ("element", seq->self_scm ());
881 scm_gc_unprotect_object (seq->self_scm ());
883 $$ = new Grace_music (SCM_EOL);
884 $$->set_mus_property ("element", $2->self_scm ());
885 scm_gc_unprotect_object ($2->self_scm ());
888 | CONTEXT string '=' string Music {
889 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
890 csm->set_mus_property ("element", $5->self_scm ());
891 scm_gc_unprotect_object ($5->self_scm ());
893 csm->set_mus_property ("context-type", $2);
894 csm->set_mus_property ("context-id", $4);
905 int n = gh_scm2int (ly_car ($3)); int d = gh_scm2int (ly_cdr ($3));
907 $$ = new Time_scaled_music (SCM_EOL);
908 $$->set_spot (THIS->pop_spot ());
911 $$->set_mus_property ("element", mp->self_scm ());
912 scm_gc_unprotect_object (mp->self_scm ());
913 $$->set_mus_property ("numerator", gh_int2scm (n));
914 $$->set_mus_property ("denominator", gh_int2scm (d));
915 $$->compress (Moment (Rational (n,d)));
918 | Repeated_music { $$ = $1; }
919 | Simultaneous_music { $$ = $1; }
920 | Sequential_music { $$ = $1; }
921 | TRANSPOSE pitch Music {
922 $$ = new Transposed_music (SCM_EOL);
924 Pitch pit = *unsmob_pitch ($2);
927 $$->set_mus_property ("element", p->self_scm ());
928 scm_gc_unprotect_object (p->self_scm ());
930 | TRANSPOSE steno_tonic_pitch Music {
931 $$ = new Transposed_music (SCM_EOL);
933 Pitch pit = *unsmob_pitch ($2);
936 $$->set_mus_property ("element", p->self_scm ());
937 scm_gc_unprotect_object (p->self_scm ());
940 | APPLY embedded_scm Music {
941 SCM ret = gh_call1 ($2, $3->self_scm ());
942 Music *m = unsmob_music (ret);
944 THIS->parser_error ("\\apply must return a Music");
945 m = new Music (SCM_EOL);
950 { THIS->lexer_->push_note_state (); }
953 THIS->lexer_->pop_state ();
956 { THIS->lexer_->push_figuredbass_state (); }
959 Music * chm = new Untransposable_music () ;
960 chm->set_mus_property ("element", $3->self_scm ());
962 scm_gc_unprotect_object ($3->self_scm());
964 THIS->lexer_->pop_state ();
967 { THIS->lexer_->push_chord_state (); }
970 Music * chm = new Un_relativable_music ;
971 chm->set_mus_property ("element", $3->self_scm ());
972 scm_gc_unprotect_object ($3->self_scm());
975 THIS->lexer_->pop_state ();
978 { THIS->lexer_->push_lyric_state (); }
982 THIS->lexer_->pop_state ();
984 | relative_music { $$ = $1; }
985 | re_rhythmed_music { $$ = $1; }
986 | part_combined_music { $$ = $1; }
990 RELATIVE absolute_pitch Music {
992 Pitch pit = *unsmob_pitch ($2);
993 $$ = new Relative_octave_music (SCM_EOL);
995 $$->set_mus_property ("element", p->self_scm ());
996 scm_gc_unprotect_object (p->self_scm ());
998 $$->set_mus_property ("last-pitch", p->to_relative_octave (pit).smobbed_copy ());
1004 ADDLYRICS Music Music {
1005 Lyric_combine_music * l = new Lyric_combine_music (SCM_EOL);
1006 l->set_mus_property ("elements", gh_list ($2->self_scm (), $3->self_scm (), SCM_UNDEFINED));
1007 scm_gc_unprotect_object ($3->self_scm ());
1008 scm_gc_unprotect_object ($2->self_scm ());
1013 part_combined_music:
1014 PARTCOMBINE STRING Music Music {
1015 Part_combine_music * p = new Part_combine_music (SCM_EOL);
1017 p->set_mus_property ("what", $2);
1018 p->set_mus_property ("elements", gh_list ($3->self_scm (),$4->self_scm (), SCM_UNDEFINED));
1020 scm_gc_unprotect_object ($3->self_scm ());
1021 scm_gc_unprotect_object ($4->self_scm ());
1028 TRANSLATOR STRING '=' STRING {
1029 Music * t = new Music (SCM_EOL);
1030 t->set_mus_property ("iterator-ctor",
1031 Change_iterator::constructor_proc);
1032 t-> set_mus_property ("change-to-type", $2);
1033 t-> set_mus_property ("change-to-id", $4);
1036 $$->set_spot (THIS->here_input ());
1042 | ONCE simple_property_def {
1044 SCM e = $2->get_mus_property ("element");
1045 unsmob_music (e)->set_mus_property ("once", SCM_BOOL_T);
1049 simple_property_def:
1050 PROPERTY STRING '.' STRING '=' scalar {
1052 Music *t = set_property_music (scm_string_to_symbol ($4), $6);
1053 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1055 csm->set_mus_property ("element", t->self_scm ());
1056 scm_gc_unprotect_object (t->self_scm ());
1059 $$->set_spot (THIS->here_input ());
1061 csm-> set_mus_property ("context-type", $2);
1063 | PROPERTY STRING '.' STRING UNSET {
1064 Music *t = new Music (SCM_EOL);
1066 t->set_mus_property ("iterator-ctor",
1067 Property_unset_iterator::constructor_proc);
1068 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1070 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1071 csm->set_mus_property ("element", t->self_scm ());
1072 scm_gc_unprotect_object (t->self_scm ());
1075 $$->set_spot (THIS->here_input ());
1077 csm-> set_mus_property ("context-type", $2);
1079 | PROPERTY STRING '.' STRING SET embedded_scm '=' embedded_scm {
1081 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1082 bool itc = internal_type_checking_global_b;
1083 Music *t = new Music (SCM_EOL);
1084 t->set_mus_property ("iterator-ctor",
1085 Push_property_iterator::constructor_proc);
1086 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1087 t->set_mus_property ("pop-first", SCM_BOOL_T);
1089 internal_type_checking_global_b = false;
1090 t->set_mus_property ("grob-property", $6);
1092 internal_type_checking_global_b = itc;
1093 t->set_mus_property ("grob-value", $8);
1094 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1095 csm->set_mus_property ("element", t->self_scm ());
1096 scm_gc_unprotect_object (t->self_scm ());
1098 $$->set_spot (THIS->here_input ());
1100 csm-> set_mus_property ("context-type", $2);
1102 | PROPERTY STRING '.' STRING OVERRIDE
1103 embedded_scm '=' embedded_scm
1109 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1110 bool itc = internal_type_checking_global_b;
1112 Music *t = new Music (SCM_EOL);
1113 t->set_mus_property ("iterator-ctor",
1114 Push_property_iterator::constructor_proc);
1115 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1118 internal_type_checking_global_b = false;
1119 t->set_mus_property ("grob-property", $6);
1120 t->set_mus_property ("grob-value", $8);
1122 internal_type_checking_global_b = itc;
1124 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1125 csm->set_mus_property ("element", t->self_scm ());
1126 scm_gc_unprotect_object (t->self_scm ());
1129 $$->set_spot (THIS->here_input ());
1131 csm-> set_mus_property ("context-type", $2);
1134 | PROPERTY STRING '.' STRING REVERT embedded_scm {
1135 Music *t = new Music (SCM_EOL);
1137 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1138 bool itc = internal_type_checking_global_b;
1140 t->set_mus_property ("iterator-ctor",
1141 Pop_property_iterator::constructor_proc);
1142 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1144 internal_type_checking_global_b = false;
1145 t->set_mus_property ("grob-property", $6);
1147 internal_type_checking_global_b = itc;
1149 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1150 csm->set_mus_property ("element", t->self_scm ());
1151 scm_gc_unprotect_object (t->self_scm ());
1154 $$->set_spot (THIS->here_input ());
1156 csm-> set_mus_property ("context-type", $2);
1163 | bare_int { $$ = gh_int2scm ($1); }
1164 | embedded_scm { $$ = $1; }
1171 } /*cont */ simple_element post_requests {
1172 Music_sequence *l = dynamic_cast<Music_sequence*> ($3);
1175 for (int i=0; i < $1->size (); i++) {
1176 Music * m = $1->elem (i);
1177 l->append_music (m);
1189 $$ = new Request_chord (SCM_EOL);
1190 $$->set_mus_property ("elements", scm_cons ($1->self_scm (), SCM_EOL));
1191 scm_gc_unprotect_object ($1->self_scm());
1193 $$-> set_spot (THIS->here_input ());
1194 $1-> set_spot (THIS->here_input ());
1197 Span_req *l = new Span_req;
1198 l->set_span_dir (START);
1199 l->set_mus_property ("span-type", scm_makfrom0str ("ligature"));
1200 l->set_spot (THIS->here_input ());
1202 $$ = new Request_chord (SCM_EOL);
1203 $$->set_mus_property ("elements", scm_cons (l->self_scm (), SCM_EOL));
1204 scm_gc_unprotect_object (l->self_scm());
1205 $$->set_spot (THIS->here_input ());
1208 Span_req *l = new Span_req;
1209 l->set_span_dir (STOP);
1210 l->set_mus_property ("span-type", scm_makfrom0str ("ligature"));
1211 l->set_spot (THIS->here_input ());
1213 $$ = new Request_chord (SCM_EOL);
1214 $$->set_mus_property ("elements", scm_cons (l->self_scm (), SCM_EOL));
1215 $$->set_spot (THIS->here_input ());
1216 scm_gc_unprotect_object (l->self_scm());
1220 $$ = new Music (gh_list (scm_cons (ly_symbol2scm ("name"), ly_symbol2scm ("separator")), SCM_UNDEFINED));
1221 $$->set_spot (THIS->here_input ());
1225 extern Music * get_barcheck();
1226 $$ = get_barcheck ();
1227 $$->set_spot (THIS->here_input ());
1230 Music *t = set_property_music (ly_symbol2scm ("whichBar"), $2);
1232 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1233 csm->set_mus_property ("element", t->self_scm ());
1234 scm_gc_unprotect_object (t->self_scm ());
1237 $$->set_spot (THIS->here_input ());
1239 csm->set_mus_property ("context-type", scm_makfrom0str ("Timing"));
1241 | PARTIAL duration_length {
1242 Moment m = - unsmob_duration ($2)->length_mom ();
1243 Music * p = set_property_music (ly_symbol2scm ( "measurePosition"),m.smobbed_copy ());
1245 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1246 sp->set_mus_property ("element", p->self_scm ());
1247 scm_gc_unprotect_object (p->self_scm ());
1250 sp-> set_mus_property ("context-type", scm_makfrom0str ("Timing"));
1253 SCM func = scm_primitive_eval (ly_symbol2scm ("clef-name-to-properties"));
1254 SCM result = gh_call1 (func, $2);
1257 for (SCM s = result ; gh_pair_p (s); s = ly_cdr (s)) {
1258 Music * p = new Music (SCM_EOL);
1259 set_music_properties (p, ly_car (s));
1260 l = scm_cons (p->self_scm (), l);
1261 scm_gc_unprotect_object (p->self_scm ());
1263 Sequential_music * seq = new Sequential_music (SCM_EOL);
1264 seq->set_mus_property ("elements", l);
1266 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1267 sp->set_mus_property ("element", seq->self_scm ());
1268 scm_gc_unprotect_object (seq->self_scm ());
1271 sp-> set_mus_property ("context-type", scm_makfrom0str ("Staff"));
1274 Music * p1 = set_property_music (ly_symbol2scm ( "timeSignatureFraction"), $2);
1276 int l = gh_scm2int (ly_car ($2));
1277 int o = gh_scm2int (ly_cdr ($2));
1279 Moment one_beat = Moment (1)/Moment (o);
1280 Moment len = Moment (l) * one_beat;
1283 Music *p2 = set_property_music (ly_symbol2scm ("measureLength"), len.smobbed_copy ());
1284 Music *p3 = set_property_music (ly_symbol2scm ("beatLength"), one_beat.smobbed_copy ());
1286 SCM list = scm_list_n (p1->self_scm (), p2->self_scm (), p3->self_scm(), SCM_UNDEFINED);
1287 Sequential_music *seq = new Sequential_music (SCM_EOL);
1288 seq->set_mus_property ("elements", list);
1291 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1292 sp->set_mus_property ("element", seq->self_scm ());
1294 scm_gc_unprotect_object (p3->self_scm ());
1295 scm_gc_unprotect_object (p2->self_scm ());
1296 scm_gc_unprotect_object (p1->self_scm ());
1297 scm_gc_unprotect_object (seq->self_scm ());
1301 sp-> set_mus_property ("context-type", scm_makfrom0str ( "Timing"));
1306 shorthand_command_req { $$ = $1; }
1307 | verbose_command_req { $$ = $1; }
1310 shorthand_command_req:
1321 Span_req*b= new Span_req;
1322 b->set_span_dir (START);
1323 b->set_mus_property ("span-type", scm_makfrom0str ("beam"));
1327 THIS->last_beam_start_ = b->self_scm ();
1330 Span_req*b= new Span_req;
1331 b->set_span_dir ( STOP);
1332 b->set_mus_property ("span-type", scm_makfrom0str ("beam"));
1336 $$ = new Breathing_sign_req;
1339 $$ = new Porrectus_req;
1343 verbose_command_req:
1344 COMMANDSPANREQUEST bare_int STRING { /*TODO: junkme */
1345 Span_req * sp = new Span_req;
1346 sp-> set_span_dir ( Direction ($2));
1347 sp->set_mus_property ("span-type",$3);
1348 sp->set_spot (THIS->here_input ());
1352 Mark_req * m = new Mark_req;
1356 Mark_req *m = new Mark_req;
1357 m->set_mus_property ("label", $2);
1361 Break_req * b = new Break_req;
1363 if (!gh_number_p (s))
1366 b->set_mus_property ("penalty", s);
1367 b->set_spot (THIS->here_input ());
1370 | SKIP duration_length {
1371 Skip_req * skip = new Skip_req;
1372 skip->set_mus_property ("duration", $2);
1380 Key_change_req *key= new Key_change_req;
1383 | KEY NOTENAME_PITCH SCM_IDENTIFIER {
1384 Key_change_req *key= new Key_change_req;
1386 key->set_mus_property ("pitch-alist", $3);
1387 ((Music*)key)->transpose (* unsmob_pitch ($2));
1394 $$ = new Link_array<Request>;
1396 | post_requests post_request {
1397 $2->set_spot (THIS->here_input ());
1412 String_number_req* s = new String_number_req;
1413 s->set_mus_property ("string-number", gh_int2scm($1));
1414 s->set_spot (THIS->here_input ());
1420 request_that_take_dir:
1423 | script_abbreviation {
1424 SCM s = THIS->lexer_->lookup_identifier ("dash" + ly_scm2string ($1));
1425 Articulation_req *a = new Articulation_req;
1426 if (gh_string_p (s))
1427 a->set_mus_property ("articulation-type", s);
1428 else THIS->parser_error (_ ("Expecting string as script definition"));
1434 script_dir request_that_take_dir {
1435 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1436 gs->set_direction (Direction ($1));
1438 $2->origin ()->warning (_ ("Can't specify direction for this request"));
1444 REQUEST_IDENTIFIER {
1445 $$ = dynamic_cast<Request*> (unsmob_music ($1)->clone ());
1446 $$->set_spot (THIS->here_input ());
1448 | DYNAMICSCRIPT embedded_scm {
1450 TODO: junkme, use text-type == dynamic
1452 Text_script_req *d = new Text_script_req;
1453 SCM dyn = ly_symbol2scm ("dynamic");
1454 d->set_mus_property ("text-type" , dyn);
1455 d->set_mus_property ("text", $2);
1456 d->set_spot (THIS->here_input ());
1459 | SPANREQUEST bare_int STRING {
1460 Span_req * sp = new Span_req;
1461 sp->set_span_dir ( Direction ($2));
1462 sp->set_mus_property ("span-type", $3);
1463 sp->set_spot (THIS->here_input ());
1467 Tremolo_req* a = new Tremolo_req;
1468 a->set_spot (THIS->here_input ());
1469 a->set_mus_property ("tremolo-type", gh_int2scm ($1));
1473 Articulation_req * a = new Articulation_req;
1474 a->set_mus_property ("articulation-type", $2);
1475 a->set_spot (THIS->here_input ());
1479 duh, junk this syntax from the parser, if possible.
1482 Arpeggio_req *a = new Arpeggio_req;
1483 a->set_spot (THIS->here_input ());
1487 Glissando_req *g = new Glissando_req;
1488 g->set_spot /* No pun intended */ (THIS->here_input ());
1515 | NOTENAME_PITCH sup_quotes {
1516 Pitch p = *unsmob_pitch ($1);
1518 $$ = p.smobbed_copy ();
1520 | NOTENAME_PITCH sub_quotes {
1521 Pitch p =* unsmob_pitch ($1);
1524 $$ = p.smobbed_copy ();
1537 | TONICNAME_PITCH sup_quotes {
1538 Pitch p = *unsmob_pitch ($1);
1540 $$ = p.smobbed_copy ();
1542 | TONICNAME_PITCH sub_quotes {
1543 Pitch p =* unsmob_pitch ($1);
1546 $$ = p.smobbed_copy ();
1561 PITCH embedded_scm {
1563 if (!unsmob_pitch ($2)) {
1564 THIS->parser_error (_f ("Expecting musical-pitch value", 3));
1565 $$ = Pitch ().smobbed_copy ();
1571 DURATION embedded_scm {
1573 if (!unsmob_duration ($2))
1575 THIS->parser_error (_ ("Must have duration object"));
1576 $$ = Duration ().smobbed_copy ();
1583 if (!THIS->lexer_->lyric_state_b ())
1584 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1585 $$ = new Extender_req;
1591 if (!THIS->lexer_->lyric_state_b ())
1592 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1593 $$ = new Hyphen_req;
1598 close_request_parens {
1600 dynamic_cast<Span_req*> ($$)->set_span_dir ( START);
1604 close_request_parens:
1606 Span_req* s= new Span_req;
1608 s->set_mus_property ("span-type", scm_makfrom0str ( "slur"));
1609 s->set_spot (THIS->here_input());
1612 Span_req* s= new Span_req;
1614 s->set_mus_property ("span-type", scm_makfrom0str ( "phrasing-slur"));
1615 s->set_spot (THIS->here_input());
1618 Span_req*s =new Span_req;
1620 s->set_mus_property ("span-type", scm_makfrom0str ( "crescendo"));
1621 s->set_spot (THIS->here_input());
1624 Span_req*s =new Span_req;
1626 s->set_mus_property ("span-type", scm_makfrom0str ("decrescendo"));
1627 s->set_spot (THIS->here_input());
1633 open_request_parens {
1635 dynamic_cast<Span_req*> ($$)->set_span_dir (STOP);
1639 open_request_parens:
1641 Span_req *s = new Span_req;
1642 s->set_mus_property ("span-type", scm_makfrom0str ( "crescendo"));
1643 s->set_spot (THIS->here_input());
1648 Span_req* s= new Span_req;
1650 s->set_mus_property ("span-type", scm_makfrom0str ( "slur"));
1651 s->set_spot (THIS->here_input());
1655 Span_req* s= new Span_req;
1657 s->set_mus_property ("span-type", scm_makfrom0str ( "phrasing-slur"));
1658 s->set_spot (THIS->here_input());
1664 Text_script_req *t = new Text_script_req;
1665 t->set_mus_property ("text", $1);
1666 t->set_spot (THIS->here_input ());
1670 Text_script_req *t = new Text_script_req;
1671 t->set_mus_property ("text", $1);
1672 t->set_spot (THIS->here_input ());
1676 String ds = to_string ($1);
1677 Text_script_req* t = new Text_script_req;
1678 SCM finger = ly_symbol2scm ("finger");
1679 t->set_mus_property ("text", scm_makfrom0str (ds.to_str0 ()));
1680 t->set_mus_property ("text-type" , finger);
1681 t->set_spot (THIS->here_input ());
1686 script_abbreviation:
1688 $$ = scm_makfrom0str ("Hat");
1691 $$ = scm_makfrom0str ("Plus");
1694 $$ = scm_makfrom0str ("Dash");
1697 $$ = scm_makfrom0str ("Bar");
1700 $$ = scm_makfrom0str ("Larger");
1703 $$ = scm_makfrom0str ("Dot");
1706 $$ = scm_makfrom0str ("Underscore");
1713 | '-' { $$ = CENTER; }
1718 $$ = new Link_array<Request>;
1720 | pre_requests open_request {
1732 multiplied_duration {
1735 | verbose_duration {
1740 optional_notemode_duration:
1742 Duration dd = THIS->default_duration_;
1743 $$ = dd.smobbed_copy ();
1745 THIS->beam_check ($$);
1747 | multiplied_duration {
1749 THIS->default_duration_ = *unsmob_duration ($$);
1751 THIS->beam_check ($$);
1753 | verbose_duration {
1755 THIS->default_duration_ = *unsmob_duration ($$);
1760 bare_unsigned dots {
1762 if (!is_duration_b ($1))
1763 THIS->parser_error (_f ("not a duration: %d", $1));
1767 $$ = Duration (l, $2).smobbed_copy ();
1769 | DURATION_IDENTIFIER dots {
1770 Duration *d =unsmob_duration ($1);
1771 Duration k (d->duration_log (),d->dot_count () + $2);
1772 $$ = k.smobbed_copy ();
1779 multiplied_duration:
1783 | multiplied_duration '*' bare_unsigned {
1784 $$ = unsmob_duration ($$)->compressed ( $3) .smobbed_copy ();
1786 | multiplied_duration '*' FRACTION {
1787 Rational m (gh_scm2int (ly_car ($3)), gh_scm2int (ly_cdr ($3)));
1789 $$ = unsmob_duration ($$)->compressed (m).smobbed_copy ();
1794 FRACTION { $$ = $1; }
1795 | UNSIGNED '/' UNSIGNED {
1796 $$ = scm_cons (gh_int2scm ($1), gh_int2scm ($3));
1814 | ':' bare_unsigned {
1815 if (!is_duration_b ($2))
1816 THIS->parser_error (_f ("not a duration: %d", $2));
1835 Bass_figure_req *bfr = new Bass_figure_req;
1836 $$ = bfr->self_scm();
1837 scm_gc_unprotect_object ($$);
1840 Bass_figure_req *bfr = new Bass_figure_req;
1841 $$ = bfr->self_scm();
1843 bfr->set_mus_property ("figure", gh_int2scm ($1));
1845 scm_gc_unprotect_object ($$);
1847 | bass_figure bass_mod {
1848 Music *m = unsmob_music ($1);
1850 SCM salter =m->get_mus_property ("alteration");
1851 int alter = gh_number_p ( salter) ? gh_scm2int (salter) : 0;
1852 m->set_mus_property ("alteration",
1853 gh_int2scm (alter + $2));
1855 m->set_mus_property ("alteration", gh_int2scm (0));
1863 unsmob_music ($$)->set_mus_property ("bracket-start", SCM_BOOL_T);
1868 | br_bass_figure ']' {
1870 unsmob_music ($1)->set_mus_property ("bracket-stop", SCM_BOOL_T);
1878 | figure_list br_bass_figure {
1879 $$ = scm_cons ($2, $1);
1884 FIGURE_OPEN figure_list FIGURE_CLOSE {
1885 Music * m = new Request_chord (SCM_EOL);
1886 $2 = scm_reverse_x ($2, SCM_EOL);
1887 m->set_mus_property ("elements", $2);
1888 $$ = m->self_scm ();
1899 pitch exclamations questions optional_notemode_duration optional_rest {
1901 Input i = THIS->pop_spot ();
1902 if (!THIS->lexer_->note_state_b ())
1903 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1911 n->set_mus_property ("pitch", $1);
1912 n->set_mus_property ("duration", $4);
1916 n->set_mus_property ("cautionary", SCM_BOOL_T);
1917 if ($2 % 2 || $3 % 2)
1918 n->set_mus_property ("force-accidental", SCM_BOOL_T);
1920 Simultaneous_music*v = new Request_chord (SCM_EOL);
1921 v->set_mus_property ("elements", scm_list_n (n->self_scm (), SCM_UNDEFINED));
1922 scm_gc_unprotect_object (n->self_scm());
1928 | figure_spec optional_notemode_duration {
1929 Music * m = unsmob_music ($1);
1930 Input i = THIS->pop_spot ();
1932 for (SCM s = m->get_mus_property ("elements"); gh_pair_p (s); s = ly_cdr (s))
1934 unsmob_music (ly_car (s))->set_mus_property ("duration", $2);
1938 | RESTNAME optional_notemode_duration {
1940 Input i = THIS->pop_spot ();
1941 SCM e = SCM_UNDEFINED;
1942 if (ly_scm2string ($1) =="s") {
1944 Skip_req * skip = new Skip_req;
1945 skip->set_mus_property ("duration" ,$2);
1947 e = skip->self_scm ();
1950 Rest_req * rest_req = new Rest_req;
1951 rest_req->set_mus_property ("duration", $2);
1952 rest_req->set_spot (i);
1953 e = rest_req->self_scm ();
1955 Simultaneous_music* velt = new Request_chord (SCM_EOL);
1956 velt-> set_mus_property ("elements", scm_list_n (e,SCM_UNDEFINED));
1961 | MULTI_MEASURE_REST optional_notemode_duration {
1962 Input i = THIS->pop_spot ();
1964 Skip_req * sk = new Skip_req;
1965 sk->set_mus_property ("duration", $2);
1966 Span_req *sp1 = new Span_req;
1967 Span_req *sp2 = new Span_req;
1968 sp1-> set_span_dir ( START);
1969 sp2-> set_span_dir ( STOP);
1970 SCM r = scm_makfrom0str ("rest");
1971 sp1->set_mus_property ("span-type", r);
1972 sp2->set_mus_property ("span-type", r);
1974 Request_chord * rqc1 = new Request_chord (SCM_EOL);
1975 rqc1->set_mus_property ("elements", scm_list_n (sp1->self_scm (), SCM_UNDEFINED));
1976 Request_chord * rqc2 = new Request_chord (SCM_EOL);
1977 rqc2->set_mus_property ("elements", scm_list_n (sk->self_scm (), SCM_UNDEFINED));;
1978 Request_chord * rqc3 = new Request_chord (SCM_EOL);
1979 rqc3->set_mus_property ("elements", scm_list_n (sp2->self_scm (), SCM_UNDEFINED));;
1981 SCM ms = scm_list_n (rqc1->self_scm (), rqc2->self_scm (), rqc3->self_scm (), SCM_UNDEFINED);
1983 $$ = new Sequential_music (SCM_EOL);
1984 $$->set_mus_property ("elements", ms);
1986 | STRING optional_notemode_duration {
1987 Input i = THIS->pop_spot ();
1989 Lyric_req* lreq = new Lyric_req;
1990 lreq->set_mus_property ("text", $1);
1991 lreq->set_mus_property ("duration",$2);
1993 Simultaneous_music* velt = new Request_chord (SCM_EOL);
1994 velt->set_mus_property ("elements", scm_list_n (lreq->self_scm (), SCM_UNDEFINED));
1999 Input i = THIS->pop_spot ();
2001 if (!THIS->lexer_->chord_state_b ())
2002 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
2009 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
2010 $$ = Chord::get_chord ($1, $3, $4, $5, $6, $2);
2011 $$->set_spot (THIS->here_input ());
2018 | CHORD_COLON chord_notes {
2027 | chord_notes '.' chord_step {
2028 $$ = gh_append2 ($$, $3);
2036 | CHORD_CARET chord_notes {
2046 | CHORD_SLASH steno_tonic_pitch {
2055 | CHORD_BASS steno_tonic_pitch {
2062 $$ = scm_cons ($1, SCM_EOL);
2064 | CHORDMODIFIER_PITCH {
2065 $$ = scm_cons (unsmob_pitch ($1)->smobbed_copy (), SCM_EOL);
2067 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
2068 $$ = scm_list_n (unsmob_pitch ($1)->smobbed_copy (),
2076 m.notename_ = ($1 - 1) % 7;
2077 m.octave_ = $1 > 7 ? 1 : 0;
2080 $$ = m.smobbed_copy ();
2082 | bare_unsigned '+' {
2084 m.notename_ = ($1 - 1) % 7;
2085 m.octave_ = $1 > 7 ? 1 : 0;
2089 $$ = m.smobbed_copy ();
2091 | bare_unsigned CHORD_MINUS {
2093 m.notename_ = ($1 - 1) % 7;
2094 m.octave_ = $1 > 7 ? 1 : 0;
2097 $$ = m.smobbed_copy ();
2105 number_expression '+' number_term {
2106 $$ = scm_sum ($1, $3);
2108 | number_expression '-' number_term {
2109 $$ = scm_difference ($1, $3);
2118 | number_factor '*' number_factor {
2119 $$ = scm_product ($1, $3);
2121 | number_factor '/' number_factor {
2122 $$ = scm_divide ($1, $3);
2127 '(' number_expression ')' {
2130 | '-' number_factor { /* %prec UNARY_MINUS */
2131 $$ = scm_difference ($2, SCM_UNDEFINED);
2139 $$ = gh_int2scm ($1);
2144 | NUMBER_IDENTIFIER {
2148 $$ = gh_double2scm (gh_scm2double ($1) CM );
2151 $$ = gh_double2scm (gh_scm2double ($1) PT);
2154 $$ = gh_double2scm (gh_scm2double ($1) INCH);
2157 $$ = gh_double2scm (gh_scm2double ($1) MM);
2160 $$ = gh_double2scm (gh_scm2double ($1) CHAR);
2176 if (scm_integer_p ($1) == SCM_BOOL_T)
2178 int k = gh_scm2int ($1);
2182 THIS->parser_error (_ ("need integer number arg"));
2196 | STRING_IDENTIFIER {
2199 | string '+' string {
2200 $$ = scm_string_append (scm_list_n ($1, $3, SCM_UNDEFINED));
2207 | exclamations '!' { $$ ++; }
2212 | questions '?' { $$ ++; }
2219 My_lily_parser::set_yydebug (bool )
2226 extern My_lily_parser * current_parser;
2229 My_lily_parser::do_yyparse ()
2232 current_parser = this;;
2233 yyparse ((void*)this);
2238 Should make this optional? It will also complain when you do
2242 which is entirely legitimate.
2244 Or we can scrap it. Barchecks should detect wrong durations, and
2245 skipTypesetting speeds it up a lot.
2248 My_lily_parser::beam_check (SCM dur)
2250 Duration *d = unsmob_duration (dur);
2251 if (unsmob_music (last_beam_start_) && d->duration_log () <= 2)
2253 Music * m = unsmob_music (last_beam_start_);
2254 m->origin ()->warning (_("Suspect duration found following this beam"));
2256 last_beam_start_ = SCM_EOL;