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);
82 set_property_music (SCM sym, SCM value)
84 Music * p = new Music (SCM_EOL);
85 p->set_mus_property ("symbol", sym);
86 p->set_mus_property ("iterator-ctor",
87 Property_iterator::constructor_proc);
89 p->set_mus_property ("value", value);
96 return t && t == 1 << intlog2 (t);
100 set_music_properties (Music *p, SCM a)
102 for (SCM k = a; gh_pair_p (k); k = ly_cdr (k))
104 p->internal_set_mus_property (ly_caar (k), ly_cdar (k));
114 // needed for bison.simple's malloc () and free ()
116 // #include <malloc.h>
121 #define YYERROR_VERBOSE 1
123 #define YYPARSE_PARAM my_lily_parser
124 #define YYLEX_PARAM my_lily_parser
126 ((My_lily_parser *) my_lily_parser)
128 #define yyerror THIS->parser_error
132 /* We use SCMs to do strings, because it saves us the trouble of
133 deleting them. Let's hope that a stack overflow doesnt trigger a move
134 of the parse stack onto the heap. */
139 Link_array<Request> *reqvec;
141 String *string; // needed by the lexer as temporary scratch area.
144 Scheme_hash_table *scmhash;
145 Music_output_def * outputdef;
157 yylex (YYSTYPE *s, void * v)
159 My_lily_parser *pars = (My_lily_parser*) v;
160 My_lily_lexer * lex = pars->lexer_;
162 lex->lexval = (void*) s;
163 return lex->yylex ();
171 /* tokens which are not keywords */
181 %token CHORDMODIFIERS
189 %token GROBDESCRIPTIONS
195 %token FIGURES FIGURE_OPEN FIGURE_CLOSE
196 %token FIGURE_BRACKET_CLOSE FIGURE_BRACKET_OPEN
206 %token MULTI_MEASURE_REST
219 %token OVERRIDE SET REVERT
232 %token COMMANDSPANREQUEST
234 %token OUTPUTPROPERTY
245 %token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE
246 %token E_LEFTSQUARE E_RIGHTSQUARE E_TILDE
248 %token <i> E_UNSIGNED
249 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET CHORD_SLASH
252 %type <i> exclamations questions dots optional_rest
253 %type <i> bass_number bass_mod
254 %type <scm> br_bass_figure bass_figure figure_list figure_spec
256 %token <scm> NOTENAME_PITCH
257 %token <scm> TONICNAME_PITCH
258 %token <scm> CHORDMODIFIER_PITCH
259 %token <scm> DURATION_IDENTIFIER
260 %token <scm> FRACTION
261 %token <id> IDENTIFIER
264 %token <scm> SCORE_IDENTIFIER
265 %token <scm> MUSIC_OUTPUT_DEF_IDENTIFIER
267 %token <scm> NUMBER_IDENTIFIER
268 %token <scm> REQUEST_IDENTIFIER
269 %token <scm> MUSIC_IDENTIFIER TRANSLATOR_IDENTIFIER
270 %token <scm> STRING_IDENTIFIER SCM_IDENTIFIER
271 %token <scm> RESTNAME
277 %type <outputdef> output_def
278 %type <scm> lilypond_header lilypond_header_body
279 %type <request> open_request_parens close_request_parens open_request close_request
280 %type <request> request_with_dir request_that_take_dir verbose_request
281 %type <i> sub_quotes sup_quotes
282 %type <music> simple_element request_chord command_element Simple_music Composite_music
283 %type <music> Repeated_music
284 %type <scm> Alternative_music
285 %type <i> tremolo_type
286 %type <i> bare_int bare_unsigned
288 %type <scm> identifier_init
290 %type <scm> steno_duration optional_notemode_duration multiplied_duration
291 %type <scm> verbose_duration
293 %type <reqvec> pre_requests post_requests
294 %type <request> gen_text_def
295 %type <scm> steno_pitch pitch absolute_pitch
296 %type <scm> explicit_pitch steno_tonic_pitch
298 %type <scm> chord_additions chord_subtractions chord_notes chord_step
300 %type <scm> chord_note chord_inversion chord_bass
301 %type <scm> duration_length fraction
303 %type <scm> embedded_scm scalar
304 %type <music> Music Sequential_music Simultaneous_music
305 %type <music> relative_music re_rhythmed_music part_combined_music
306 %type <music> property_def translator_change simple_property_def
307 %type <scm> Music_list
308 %type <outputdef> music_output_def_body
309 %type <request> shorthand_command_req
310 %type <request> post_request
311 %type <music> command_req verbose_command_req
312 %type <request> extender_req
313 %type <request> hyphen_req
314 %type <request> string_request
315 %type <scm> string bare_number number_expression number_term number_factor
317 %type <score> score_block score_body
319 %type <scm> translator_spec_block translator_spec_body
320 %type <tempo> tempo_request
321 %type <scm> notenames_body notenames_block chordmodifiers_block
322 %type <scm> script_abbreviation
328 /* We don't assign precedence to / and *, because we might need varied
329 prec levels in different prods */
335 lilypond: /* empty */
336 | lilypond toplevel_expression {}
337 | lilypond assignment { }
339 THIS->error_level_ = 1;
342 THIS->error_level_ = 1;
348 THIS->lexer_->pitchname_tab_ = $1;
350 | chordmodifiers_block {
351 THIS->lexer_->chordmodifier_tab_ = $1;
354 THIS->input_file_->header_ = $1;
357 THIS->input_file_->scores_.push ($1);
360 if (dynamic_cast<Paper_def*> ($1))
361 THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultpaper"), $1->self_scm ());
362 else if (dynamic_cast<Midi_def*> ($1))
363 THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultmidi"), $1->self_scm ());
376 chordmodifiers_block:
377 CHORDMODIFIERS notenames_body { $$ = $2; }
381 PITCHNAMES notenames_body { $$ = $2; }
386 int i = scm_ilength ($1);
388 SCM tab = scm_make_vector (gh_int2scm (i), SCM_EOL);
389 for (SCM s = $1; gh_pair_p (s); s = ly_cdr (s)) {
390 SCM pt = ly_cdar (s);
391 if (!unsmob_pitch (pt))
392 THIS->parser_error ("Need pitch object.");
394 scm_hashq_set_x (tab, ly_caar (s), pt);
401 lilypond_header_body:
403 $$ = ly_make_anonymous_module ();
404 THIS->lexer_->add_scope ($$);
406 | lilypond_header_body assignment {
412 HEADER '{' lilypond_header_body '}' {
413 $$ = THIS->lexer_-> remove_scope();
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_ = scm_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 {
591 | score_body output_def {
604 music_output_def_body '}' {
606 THIS-> lexer_-> remove_scope ();
610 music_output_def_body:
612 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultmidi"));
617 p = dynamic_cast<Midi_def*> (id->clone ());
622 THIS->lexer_->add_scope (p->scope_);
625 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
628 p = dynamic_cast<Paper_def*> (id->clone ());
631 THIS-> lexer_->add_scope (p->scope_);
634 | PAPER '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
635 Music_output_def *p = unsmob_music_output_def ($3);
637 THIS->lexer_->add_scope (p->scope_);
640 | MIDI '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
641 Music_output_def *p = unsmob_music_output_def ($3);
644 THIS->lexer_->add_scope (p->scope_);
647 | music_output_def_body assignment {
650 | music_output_def_body translator_spec_block {
651 $$->assign_translator ($2);
653 | music_output_def_body STYLESHEET embedded_scm {
654 dynamic_cast<Paper_def*> ($$)-> style_sheet_ = $3;
656 | music_output_def_body tempo_request {
658 junk this ? there already is tempo stuff in
661 int m = gh_scm2int ( $2->get_mus_property ("metronome-count"));
662 Duration *d = unsmob_duration ($2->get_mus_property ("duration"));
663 Midi_def * md = dynamic_cast<Midi_def*> ($$);
665 md->set_tempo (d->length_mom (), m);
667 | music_output_def_body error {
673 TEMPO steno_duration '=' bare_unsigned {
675 $$->set_mus_property ("duration", $2);
676 $$->set_mus_property ("metronome-count", gh_int2scm ( $4));
681 The representation of a list is the
685 to have efficient append.
687 Music_list: /* empty */ {
688 $$ = scm_cons (SCM_EOL, SCM_EOL);
692 SCM c = scm_cons ($2->self_scm (), SCM_EOL);
693 scm_gc_unprotect_object ($2->self_scm ()); /* UGH */
694 if (gh_pair_p (ly_cdr (s)))
695 gh_set_cdr_x (ly_cdr (s), c); /* append */
697 gh_set_car_x (s, c); /* set first cons */
698 gh_set_cdr_x (s, c) ; /* remember last cell */
714 | ALTERNATIVE '{' Music_list '}' {
720 REPEAT string bare_unsigned Music Alternative_music
724 SCM alts = gh_pair_p ($5) ? gh_car ($5) : SCM_EOL;
725 if (times < scm_ilength (alts)) {
726 unsmob_music (gh_car (alts))
727 ->origin ()->warning (
728 _("More alternatives than repeats. Junking excess alternatives."));
729 alts = ly_truncate_list (times, alts);
732 Repeated_music * r = new Repeated_music (SCM_EOL);
735 r-> set_mus_property ("element", beg->self_scm ());
736 scm_gc_unprotect_object (beg->self_scm ());
738 r->set_mus_property ("repeat-count", gh_int2scm (times >? 1));
740 r-> set_mus_property ("elements",alts);
741 SCM func = scm_primitive_eval (ly_symbol2scm ("repeat-name-to-ctor"));
742 SCM result = gh_call1 (func, $2);
744 if (gh_equal_p ($2, scm_makfrom0str ("tremolo")))
747 we can not get durations and other stuff correct down the line, so we have to
748 add to the duration log here.
750 SCM func = scm_primitive_eval (ly_symbol2scm ("shift-duration-log"));
752 gh_call3 (func, r->self_scm (), gh_int2scm(-intlog2 ($3*2/3)),gh_int2scm(1));
754 gh_call3 (func, r->self_scm (), gh_int2scm(-intlog2 ($3)), gh_int2scm(0));
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_proc);
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_proc);
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 = scm_cons (stopm->self_scm (), ms);
863 scm_gc_unprotect_object (stopm->self_scm ());
865 ms = scm_cons ($2->self_scm (), ms);
866 scm_gc_unprotect_object ($2->self_scm());
868 startm = startm->clone ();
869 ms = scm_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_proc);
1029 t-> set_mus_property ("change-to-type", $2);
1030 t-> set_mus_property ("change-to-id", $4);
1033 $$->set_spot (THIS->here_input ());
1039 | ONCE simple_property_def {
1041 SCM e = $2->get_mus_property ("element");
1042 unsmob_music (e)->set_mus_property ("once", SCM_BOOL_T);
1046 simple_property_def:
1047 PROPERTY STRING '.' STRING '=' scalar {
1049 Music *t = set_property_music (scm_string_to_symbol ($4), $6);
1050 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1052 csm->set_mus_property ("element", t->self_scm ());
1053 scm_gc_unprotect_object (t->self_scm ());
1056 $$->set_spot (THIS->here_input ());
1058 csm-> set_mus_property ("context-type", $2);
1060 | PROPERTY STRING '.' STRING UNSET {
1061 Music *t = new Music (SCM_EOL);
1063 t->set_mus_property ("iterator-ctor",
1064 Property_unset_iterator::constructor_proc);
1065 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1067 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1068 csm->set_mus_property ("element", t->self_scm ());
1069 scm_gc_unprotect_object (t->self_scm ());
1072 $$->set_spot (THIS->here_input ());
1074 csm-> set_mus_property ("context-type", $2);
1076 | PROPERTY STRING '.' STRING SET embedded_scm '=' embedded_scm {
1078 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1079 bool itc = internal_type_checking_global_b;
1080 Music *t = new Music (SCM_EOL);
1081 t->set_mus_property ("iterator-ctor",
1082 Push_property_iterator::constructor_proc);
1083 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1084 t->set_mus_property ("pop-first", SCM_BOOL_T);
1086 internal_type_checking_global_b = false;
1087 t->set_mus_property ("grob-property", $6);
1089 internal_type_checking_global_b = itc;
1090 t->set_mus_property ("grob-value", $8);
1091 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1092 csm->set_mus_property ("element", t->self_scm ());
1093 scm_gc_unprotect_object (t->self_scm ());
1095 $$->set_spot (THIS->here_input ());
1097 csm-> set_mus_property ("context-type", $2);
1099 | PROPERTY STRING '.' STRING OVERRIDE
1100 embedded_scm '=' embedded_scm
1106 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1107 bool itc = internal_type_checking_global_b;
1109 Music *t = new Music (SCM_EOL);
1110 t->set_mus_property ("iterator-ctor",
1111 Push_property_iterator::constructor_proc);
1112 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1115 internal_type_checking_global_b = false;
1116 t->set_mus_property ("grob-property", $6);
1117 t->set_mus_property ("grob-value", $8);
1119 internal_type_checking_global_b = itc;
1121 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1122 csm->set_mus_property ("element", t->self_scm ());
1123 scm_gc_unprotect_object (t->self_scm ());
1126 $$->set_spot (THIS->here_input ());
1128 csm-> set_mus_property ("context-type", $2);
1131 | PROPERTY STRING '.' STRING REVERT embedded_scm {
1132 Music *t = new Music (SCM_EOL);
1134 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1135 bool itc = internal_type_checking_global_b;
1137 t->set_mus_property ("iterator-ctor",
1138 Pop_property_iterator::constructor_proc);
1139 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1141 internal_type_checking_global_b = false;
1142 t->set_mus_property ("grob-property", $6);
1144 internal_type_checking_global_b = itc;
1146 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1147 csm->set_mus_property ("element", t->self_scm ());
1148 scm_gc_unprotect_object (t->self_scm ());
1151 $$->set_spot (THIS->here_input ());
1153 csm-> set_mus_property ("context-type", $2);
1160 | bare_int { $$ = gh_int2scm ($1); }
1161 | embedded_scm { $$ = $1; }
1168 } /*cont */ simple_element post_requests {
1169 Music_sequence *l = dynamic_cast<Music_sequence*> ($3);
1172 for (int i=0; i < $1->size (); i++) {
1173 Music * m = $1->elem (i);
1174 l->append_music (m);
1186 $$ = new Request_chord (SCM_EOL);
1187 $$->set_mus_property ("elements", scm_cons ($1->self_scm (), SCM_EOL));
1188 scm_gc_unprotect_object ($1->self_scm());
1190 $$-> set_spot (THIS->here_input ());
1191 $1-> set_spot (THIS->here_input ());
1194 Span_req *l = new Span_req;
1195 l->set_span_dir (START);
1196 l->set_mus_property ("span-type", scm_makfrom0str ("ligature"));
1197 l->set_spot (THIS->here_input ());
1199 $$ = new Request_chord (SCM_EOL);
1200 $$->set_mus_property ("elements", scm_cons (l->self_scm (), SCM_EOL));
1201 scm_gc_unprotect_object (l->self_scm());
1202 $$->set_spot (THIS->here_input ());
1205 Span_req *l = new Span_req;
1206 l->set_span_dir (STOP);
1207 l->set_mus_property ("span-type", scm_makfrom0str ("ligature"));
1208 l->set_spot (THIS->here_input ());
1210 $$ = new Request_chord (SCM_EOL);
1211 $$->set_mus_property ("elements", scm_cons (l->self_scm (), SCM_EOL));
1212 $$->set_spot (THIS->here_input ());
1213 scm_gc_unprotect_object (l->self_scm());
1217 $$ = new Music (gh_list (scm_cons (ly_symbol2scm ("name"), ly_symbol2scm ("separator")), SCM_UNDEFINED));
1218 $$->set_spot (THIS->here_input ());
1222 extern Music * get_barcheck();
1223 $$ = get_barcheck ();
1224 $$->set_spot (THIS->here_input ());
1227 Music *t = set_property_music (ly_symbol2scm ("whichBar"), $2);
1229 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1230 csm->set_mus_property ("element", t->self_scm ());
1231 scm_gc_unprotect_object (t->self_scm ());
1234 $$->set_spot (THIS->here_input ());
1236 csm->set_mus_property ("context-type", scm_makfrom0str ("Timing"));
1238 | PARTIAL duration_length {
1239 Moment m = - unsmob_duration ($2)->length_mom ();
1240 Music * p = set_property_music (ly_symbol2scm ( "measurePosition"),m.smobbed_copy ());
1242 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1243 sp->set_mus_property ("element", p->self_scm ());
1244 scm_gc_unprotect_object (p->self_scm ());
1247 sp-> set_mus_property ("context-type", scm_makfrom0str ("Timing"));
1250 SCM func = scm_primitive_eval (ly_symbol2scm ("clef-name-to-properties"));
1251 SCM result = gh_call1 (func, $2);
1254 for (SCM s = result ; gh_pair_p (s); s = ly_cdr (s)) {
1255 Music * p = new Music (SCM_EOL);
1256 set_music_properties (p, ly_car (s));
1257 l = scm_cons (p->self_scm (), l);
1258 scm_gc_unprotect_object (p->self_scm ());
1260 Sequential_music * seq = new Sequential_music (SCM_EOL);
1261 seq->set_mus_property ("elements", l);
1263 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1264 sp->set_mus_property ("element", seq->self_scm ());
1265 scm_gc_unprotect_object (seq->self_scm ());
1268 sp-> set_mus_property ("context-type", scm_makfrom0str ("Staff"));
1271 Music * p1 = set_property_music (ly_symbol2scm ( "timeSignatureFraction"), $2);
1273 int l = gh_scm2int (ly_car ($2));
1274 int o = gh_scm2int (ly_cdr ($2));
1276 Moment one_beat = Moment (1)/Moment (o);
1277 Moment len = Moment (l) * one_beat;
1280 Music *p2 = set_property_music (ly_symbol2scm ("measureLength"), len.smobbed_copy ());
1281 Music *p3 = set_property_music (ly_symbol2scm ("beatLength"), one_beat.smobbed_copy ());
1283 SCM list = scm_list_n (p1->self_scm (), p2->self_scm (), p3->self_scm(), SCM_UNDEFINED);
1284 Sequential_music *seq = new Sequential_music (SCM_EOL);
1285 seq->set_mus_property ("elements", list);
1288 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1289 sp->set_mus_property ("element", seq->self_scm ());
1291 scm_gc_unprotect_object (p3->self_scm ());
1292 scm_gc_unprotect_object (p2->self_scm ());
1293 scm_gc_unprotect_object (p1->self_scm ());
1294 scm_gc_unprotect_object (seq->self_scm ());
1298 sp-> set_mus_property ("context-type", scm_makfrom0str ( "Timing"));
1303 shorthand_command_req { $$ = $1; }
1304 | verbose_command_req { $$ = $1; }
1307 shorthand_command_req:
1318 Span_req*b= new Span_req;
1319 b->set_span_dir (START);
1320 b->set_mus_property ("span-type", scm_makfrom0str ("beam"));
1324 THIS->last_beam_start_ = b->self_scm ();
1327 Span_req*b= new Span_req;
1328 b->set_span_dir ( STOP);
1329 b->set_mus_property ("span-type", scm_makfrom0str ("beam"));
1333 $$ = new Breathing_sign_req;
1336 $$ = new Porrectus_req;
1340 verbose_command_req:
1341 COMMANDSPANREQUEST bare_int STRING { /*TODO: junkme */
1342 Span_req * sp = new Span_req;
1343 sp-> set_span_dir ( Direction ($2));
1344 sp->set_mus_property ("span-type",$3);
1345 sp->set_spot (THIS->here_input ());
1349 Mark_req * m = new Mark_req;
1353 Mark_req *m = new Mark_req;
1354 m->set_mus_property ("label", $2);
1358 Break_req * b = new Break_req;
1360 if (!gh_number_p (s))
1363 b->set_mus_property ("penalty", s);
1364 b->set_spot (THIS->here_input ());
1367 | SKIP duration_length {
1368 Skip_req * skip = new Skip_req;
1369 skip->set_mus_property ("duration", $2);
1377 Key_change_req *key= new Key_change_req;
1380 | KEY NOTENAME_PITCH SCM_IDENTIFIER {
1381 Key_change_req *key= new Key_change_req;
1383 key->set_mus_property ("pitch-alist", $3);
1384 ((Music*)key)->transpose (* unsmob_pitch ($2));
1391 $$ = new Link_array<Request>;
1393 | post_requests post_request {
1394 $2->set_spot (THIS->here_input ());
1409 String_number_req* s = new String_number_req;
1410 s->set_mus_property ("string-number", gh_int2scm($1));
1411 s->set_spot (THIS->here_input ());
1417 request_that_take_dir:
1420 | script_abbreviation {
1421 SCM s = THIS->lexer_->lookup_identifier ("dash" + ly_scm2string ($1));
1422 Articulation_req *a = new Articulation_req;
1423 if (gh_string_p (s))
1424 a->set_mus_property ("articulation-type", s);
1425 else THIS->parser_error (_ ("Expecting string as script definition"));
1431 script_dir request_that_take_dir {
1432 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1433 gs->set_direction (Direction ($1));
1435 $2->origin ()->warning (_ ("Can't specify direction for this request"));
1441 REQUEST_IDENTIFIER {
1442 $$ = dynamic_cast<Request*> (unsmob_music ($1)->clone ());
1443 $$->set_spot (THIS->here_input ());
1445 | DYNAMICSCRIPT embedded_scm {
1447 TODO: junkme, use text-type == dynamic
1449 Text_script_req *d = new Text_script_req;
1450 SCM dyn = ly_symbol2scm ("dynamic");
1451 d->set_mus_property ("text-type" , dyn);
1452 d->set_mus_property ("text", $2);
1453 d->set_spot (THIS->here_input ());
1456 | SPANREQUEST bare_int STRING {
1457 Span_req * sp = new Span_req;
1458 sp->set_span_dir ( Direction ($2));
1459 sp->set_mus_property ("span-type", $3);
1460 sp->set_spot (THIS->here_input ());
1464 Tremolo_req* a = new Tremolo_req;
1465 a->set_spot (THIS->here_input ());
1466 a->set_mus_property ("tremolo-type", gh_int2scm ($1));
1470 Articulation_req * a = new Articulation_req;
1471 a->set_mus_property ("articulation-type", $2);
1472 a->set_spot (THIS->here_input ());
1476 duh, junk this syntax from the parser, if possible.
1479 Arpeggio_req *a = new Arpeggio_req;
1480 a->set_spot (THIS->here_input ());
1484 Glissando_req *g = new Glissando_req;
1485 g->set_spot /* No pun intended */ (THIS->here_input ());
1512 | NOTENAME_PITCH sup_quotes {
1513 Pitch p = *unsmob_pitch ($1);
1515 $$ = p.smobbed_copy ();
1517 | NOTENAME_PITCH sub_quotes {
1518 Pitch p =* unsmob_pitch ($1);
1521 $$ = p.smobbed_copy ();
1534 | TONICNAME_PITCH sup_quotes {
1535 Pitch p = *unsmob_pitch ($1);
1537 $$ = p.smobbed_copy ();
1539 | TONICNAME_PITCH sub_quotes {
1540 Pitch p =* unsmob_pitch ($1);
1543 $$ = p.smobbed_copy ();
1558 PITCH embedded_scm {
1560 if (!unsmob_pitch ($2)) {
1561 THIS->parser_error (_f ("Expecting musical-pitch value", 3));
1562 $$ = Pitch ().smobbed_copy ();
1568 DURATION embedded_scm {
1570 if (!unsmob_duration ($2))
1572 THIS->parser_error (_ ("Must have duration object"));
1573 $$ = Duration ().smobbed_copy ();
1580 if (!THIS->lexer_->lyric_state_b ())
1581 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1582 $$ = new Extender_req;
1588 if (!THIS->lexer_->lyric_state_b ())
1589 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1590 $$ = new Hyphen_req;
1595 close_request_parens {
1597 dynamic_cast<Span_req*> ($$)->set_span_dir ( START);
1601 close_request_parens:
1603 Span_req* s= new Span_req;
1605 s->set_mus_property ("span-type", scm_makfrom0str ( "slur"));
1606 s->set_spot (THIS->here_input());
1609 Span_req* s= new Span_req;
1611 s->set_mus_property ("span-type", scm_makfrom0str ( "phrasing-slur"));
1612 s->set_spot (THIS->here_input());
1615 Span_req*s =new Span_req;
1617 s->set_mus_property ("span-type", scm_makfrom0str ( "crescendo"));
1618 s->set_spot (THIS->here_input());
1621 Span_req*s =new Span_req;
1623 s->set_mus_property ("span-type", scm_makfrom0str ("decrescendo"));
1624 s->set_spot (THIS->here_input());
1630 open_request_parens {
1632 dynamic_cast<Span_req*> ($$)->set_span_dir (STOP);
1636 open_request_parens:
1638 Span_req *s = new Span_req;
1639 s->set_mus_property ("span-type", scm_makfrom0str ( "crescendo"));
1640 s->set_spot (THIS->here_input());
1645 Span_req* s= new Span_req;
1647 s->set_mus_property ("span-type", scm_makfrom0str ( "slur"));
1648 s->set_spot (THIS->here_input());
1652 Span_req* s= new Span_req;
1654 s->set_mus_property ("span-type", scm_makfrom0str ( "phrasing-slur"));
1655 s->set_spot (THIS->here_input());
1661 Text_script_req *t = new Text_script_req;
1662 t->set_mus_property ("text", $1);
1663 t->set_spot (THIS->here_input ());
1667 Text_script_req *t = new Text_script_req;
1668 t->set_mus_property ("text", $1);
1669 t->set_spot (THIS->here_input ());
1673 String ds = to_string ($1);
1674 Text_script_req* t = new Text_script_req;
1675 SCM finger = ly_symbol2scm ("finger");
1676 t->set_mus_property ("text", scm_makfrom0str (ds.to_str0 ()));
1677 t->set_mus_property ("text-type" , finger);
1678 t->set_spot (THIS->here_input ());
1683 script_abbreviation:
1685 $$ = scm_makfrom0str ("Hat");
1688 $$ = scm_makfrom0str ("Plus");
1691 $$ = scm_makfrom0str ("Dash");
1694 $$ = scm_makfrom0str ("Bar");
1697 $$ = scm_makfrom0str ("Larger");
1700 $$ = scm_makfrom0str ("Dot");
1703 $$ = scm_makfrom0str ("Underscore");
1710 | '-' { $$ = CENTER; }
1715 $$ = new Link_array<Request>;
1717 | pre_requests open_request {
1729 multiplied_duration {
1732 | verbose_duration {
1737 optional_notemode_duration:
1739 Duration dd = THIS->default_duration_;
1740 $$ = dd.smobbed_copy ();
1742 THIS->beam_check ($$);
1744 | multiplied_duration {
1746 THIS->default_duration_ = *unsmob_duration ($$);
1748 THIS->beam_check ($$);
1750 | verbose_duration {
1752 THIS->default_duration_ = *unsmob_duration ($$);
1757 bare_unsigned dots {
1759 if (!is_duration_b ($1))
1760 THIS->parser_error (_f ("not a duration: %d", $1));
1764 $$ = Duration (l, $2).smobbed_copy ();
1766 | DURATION_IDENTIFIER dots {
1767 Duration *d =unsmob_duration ($1);
1768 Duration k (d->duration_log (),d->dot_count () + $2);
1769 $$ = k.smobbed_copy ();
1776 multiplied_duration:
1780 | multiplied_duration '*' bare_unsigned {
1781 $$ = unsmob_duration ($$)->compressed ( $3) .smobbed_copy ();
1783 | multiplied_duration '*' FRACTION {
1784 Rational m (gh_scm2int (ly_car ($3)), gh_scm2int (ly_cdr ($3)));
1786 $$ = unsmob_duration ($$)->compressed (m).smobbed_copy ();
1791 FRACTION { $$ = $1; }
1792 | UNSIGNED '/' UNSIGNED {
1793 $$ = scm_cons (gh_int2scm ($1), gh_int2scm ($3));
1811 | ':' bare_unsigned {
1812 if (!is_duration_b ($2))
1813 THIS->parser_error (_f ("not a duration: %d", $2));
1832 Bass_figure_req *bfr = new Bass_figure_req;
1833 $$ = bfr->self_scm();
1834 scm_gc_unprotect_object ($$);
1837 Bass_figure_req *bfr = new Bass_figure_req;
1838 $$ = bfr->self_scm();
1840 bfr->set_mus_property ("figure", gh_int2scm ($1));
1842 scm_gc_unprotect_object ($$);
1844 | bass_figure bass_mod {
1845 Music *m = unsmob_music ($1);
1847 SCM salter =m->get_mus_property ("alteration");
1848 int alter = gh_number_p ( salter) ? gh_scm2int (salter) : 0;
1849 m->set_mus_property ("alteration",
1850 gh_int2scm (alter + $2));
1852 m->set_mus_property ("alteration", gh_int2scm (0));
1860 unsmob_music ($$)->set_mus_property ("bracket-start", SCM_BOOL_T);
1865 | br_bass_figure ']' {
1867 unsmob_music ($1)->set_mus_property ("bracket-stop", SCM_BOOL_T);
1875 | figure_list br_bass_figure {
1876 $$ = scm_cons ($2, $1);
1881 FIGURE_OPEN figure_list FIGURE_CLOSE {
1882 Music * m = new Request_chord (SCM_EOL);
1883 $2 = scm_reverse_x ($2, SCM_EOL);
1884 m->set_mus_property ("elements", $2);
1885 $$ = m->self_scm ();
1896 pitch exclamations questions optional_notemode_duration optional_rest {
1898 Input i = THIS->pop_spot ();
1899 if (!THIS->lexer_->note_state_b ())
1900 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1908 n->set_mus_property ("pitch", $1);
1909 n->set_mus_property ("duration", $4);
1913 n->set_mus_property ("cautionary", SCM_BOOL_T);
1914 if ($2 % 2 || $3 % 2)
1915 n->set_mus_property ("force-accidental", SCM_BOOL_T);
1917 Simultaneous_music*v = new Request_chord (SCM_EOL);
1918 v->set_mus_property ("elements", scm_list_n (n->self_scm (), SCM_UNDEFINED));
1919 scm_gc_unprotect_object (n->self_scm());
1925 | figure_spec optional_notemode_duration {
1926 Music * m = unsmob_music ($1);
1927 Input i = THIS->pop_spot ();
1929 for (SCM s = m->get_mus_property ("elements"); gh_pair_p (s); s = ly_cdr (s))
1931 unsmob_music (ly_car (s))->set_mus_property ("duration", $2);
1935 | RESTNAME optional_notemode_duration {
1937 Input i = THIS->pop_spot ();
1938 SCM e = SCM_UNDEFINED;
1939 if (ly_scm2string ($1) =="s") {
1941 Skip_req * skip = new Skip_req;
1942 skip->set_mus_property ("duration" ,$2);
1944 e = skip->self_scm ();
1947 Rest_req * rest_req = new Rest_req;
1948 rest_req->set_mus_property ("duration", $2);
1949 rest_req->set_spot (i);
1950 e = rest_req->self_scm ();
1952 Simultaneous_music* velt = new Request_chord (SCM_EOL);
1953 velt-> set_mus_property ("elements", scm_list_n (e,SCM_UNDEFINED));
1958 | MULTI_MEASURE_REST optional_notemode_duration {
1961 Skip_req * sk = new Skip_req;
1962 sk->set_mus_property ("duration", $2);
1963 Span_req *sp1 = new Span_req;
1964 Span_req *sp2 = new Span_req;
1965 sp1-> set_span_dir ( START);
1966 sp2-> set_span_dir ( STOP);
1967 SCM r = scm_makfrom0str ("rest");
1968 sp1->set_mus_property ("span-type", r);
1969 sp2->set_mus_property ("span-type", r);
1971 Request_chord * rqc1 = new Request_chord (SCM_EOL);
1972 rqc1->set_mus_property ("elements", scm_list_n (sp1->self_scm (), SCM_UNDEFINED));
1973 Request_chord * rqc2 = new Request_chord (SCM_EOL);
1974 rqc2->set_mus_property ("elements", scm_list_n (sk->self_scm (), SCM_UNDEFINED));;
1975 Request_chord * rqc3 = new Request_chord (SCM_EOL);
1976 rqc3->set_mus_property ("elements", scm_list_n (sp2->self_scm (), SCM_UNDEFINED));;
1978 SCM ms = scm_list_n (rqc1->self_scm (), rqc2->self_scm (), rqc3->self_scm (), SCM_UNDEFINED);
1980 $$ = new Sequential_music (SCM_EOL);
1981 $$->set_mus_property ("elements", ms);
1983 | STRING optional_notemode_duration {
1984 Input i = THIS->pop_spot ();
1986 Lyric_req* lreq = new Lyric_req;
1987 lreq->set_mus_property ("text", $1);
1988 lreq->set_mus_property ("duration",$2);
1990 Simultaneous_music* velt = new Request_chord (SCM_EOL);
1991 velt->set_mus_property ("elements", scm_list_n (lreq->self_scm (), SCM_UNDEFINED));
1996 Input i = THIS->pop_spot ();
1998 if (!THIS->lexer_->chord_state_b ())
1999 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
2006 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
2007 $$ = Chord::get_chord ($1, $3, $4, $5, $6, $2);
2008 $$->set_spot (THIS->here_input ());
2015 | CHORD_COLON chord_notes {
2024 | chord_notes '.' chord_step {
2025 $$ = gh_append2 ($$, $3);
2033 | CHORD_CARET chord_notes {
2043 | CHORD_SLASH steno_tonic_pitch {
2052 | CHORD_BASS steno_tonic_pitch {
2059 $$ = scm_cons ($1, SCM_EOL);
2061 | CHORDMODIFIER_PITCH {
2062 $$ = scm_cons (unsmob_pitch ($1)->smobbed_copy (), SCM_EOL);
2064 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
2065 $$ = scm_list_n (unsmob_pitch ($1)->smobbed_copy (),
2073 m.notename_ = ($1 - 1) % 7;
2074 m.octave_ = $1 > 7 ? 1 : 0;
2077 $$ = m.smobbed_copy ();
2079 | bare_unsigned '+' {
2081 m.notename_ = ($1 - 1) % 7;
2082 m.octave_ = $1 > 7 ? 1 : 0;
2086 $$ = m.smobbed_copy ();
2088 | bare_unsigned CHORD_MINUS {
2090 m.notename_ = ($1 - 1) % 7;
2091 m.octave_ = $1 > 7 ? 1 : 0;
2094 $$ = m.smobbed_copy ();
2102 number_expression '+' number_term {
2103 $$ = scm_sum ($1, $3);
2105 | number_expression '-' number_term {
2106 $$ = scm_difference ($1, $3);
2115 | number_factor '*' number_factor {
2116 $$ = scm_product ($1, $3);
2118 | number_factor '/' number_factor {
2119 $$ = scm_divide ($1, $3);
2124 '(' number_expression ')' {
2127 | '-' number_factor { /* %prec UNARY_MINUS */
2128 $$ = scm_difference ($2, SCM_UNDEFINED);
2136 $$ = gh_int2scm ($1);
2141 | NUMBER_IDENTIFIER {
2145 $$ = gh_double2scm (gh_scm2double ($1) CM );
2148 $$ = gh_double2scm (gh_scm2double ($1) PT);
2151 $$ = gh_double2scm (gh_scm2double ($1) INCH);
2154 $$ = gh_double2scm (gh_scm2double ($1) MM);
2157 $$ = gh_double2scm (gh_scm2double ($1) CHAR);
2173 if (scm_integer_p ($1) == SCM_BOOL_T)
2175 int k = gh_scm2int ($1);
2179 THIS->parser_error (_ ("need integer number arg"));
2193 | STRING_IDENTIFIER {
2196 | string '+' string {
2197 $$ = scm_string_append (scm_list_n ($1, $3, SCM_UNDEFINED));
2204 | exclamations '!' { $$ ++; }
2209 | questions '?' { $$ ++; }
2216 My_lily_parser::set_yydebug (bool )
2223 extern My_lily_parser * current_parser;
2226 My_lily_parser::do_yyparse ()
2229 current_parser = this;;
2230 yyparse ((void*)this);
2235 Should make this optional? It will also complain when you do
2239 which is entirely legitimate.
2241 Or we can scrap it. Barchecks should detect wrong durations, and
2242 skipTypesetting speeds it up a lot.
2245 My_lily_parser::beam_check (SCM dur)
2247 Duration *d = unsmob_duration (dur);
2248 if (unsmob_music (last_beam_start_) && d->duration_log () <= 2)
2250 Music * m = unsmob_music (last_beam_start_);
2251 m->origin ()->warning (_("Suspect duration found following this beam"));
2253 last_beam_start_ = SCM_EOL;