1 %{ // -*-Fundamental-*-
4 parser.yy -- Bison/C++ parser for lilypond
6 source file of the GNU LilyPond music typesetter
8 (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 Jan Nieuwenhuizen <janneke@gnu.org>
13 Two shift/reduce problems:
20 the rules for who is protecting what are very shady. TODO: uniformise
28 #include "translator-def.hh"
29 #include "lily-guile.hh"
30 #include "change-iterator.hh"
32 #include "my-lily-lexer.hh"
33 #include "paper-def.hh"
34 #include "midi-def.hh"
36 #include "file-path.hh"
38 #include "dimensions.hh"
39 #include "command-request.hh"
40 #include "musical-request.hh"
41 #include "my-lily-parser.hh"
42 #include "context-specced-music.hh"
44 #include "music-list.hh"
45 #include "output-property-music-iterator.hh"
46 #include "property-iterator.hh"
47 #include "input-file-results.hh"
49 #include "relative-music.hh"
50 #include "lyric-combine-music.hh"
51 #include "transposed-music.hh"
52 #include "time-scaled-music.hh"
53 #include "repeated-music.hh"
54 #include "untransposable-music.hh"
55 #include "lilypond-input-version.hh"
56 #include "grace-music.hh"
57 #include "part-combine-music.hh"
58 #include "scm-hash.hh"
59 #include "auto-change-iterator.hh"
60 #include "un-relativable-music.hh"
64 regular_identifier_b (SCM id)
66 String str = ly_scm2string (id);
67 char const *s = str.to_str0 () ;
72 v = v && isalpha (*s);
80 set_property_music (SCM sym, SCM value)
82 Music * p = new Music (SCM_EOL);
83 p->set_mus_property ("symbol", sym);
84 p->set_mus_property ("iterator-ctor",
85 Property_iterator::constructor_cxx_function);
87 p->set_mus_property ("value", value);
94 return t && t == 1 << intlog2 (t);
98 set_music_properties (Music *p, SCM a)
100 for (SCM k = a; gh_pair_p (k); k = ly_cdr (k))
102 p->internal_set_mus_property (ly_caar (k), ly_cdar (k));
112 // needed for bison.simple's malloc () and free ()
119 #define YYERROR_VERBOSE 1
121 #define YYPARSE_PARAM my_lily_parser
122 #define YYLEX_PARAM my_lily_parser
124 ((My_lily_parser *) my_lily_parser)
126 #define yyerror THIS->parser_error
130 /* We use SCMs to do strings, because it saves us the trouble of
131 deleting them. Let's hope that a stack overflow doesnt trigger a move
132 of the parse stack onto the heap. */
137 Link_array<Request> *reqvec;
139 String *string; // needed by the lexer as temporary scratch area.
142 Scheme_hash_table *scmhash;
143 Music_output_def * outputdef;
155 yylex (YYSTYPE *s, void * v)
157 My_lily_parser *pars = (My_lily_parser*) v;
158 My_lily_lexer * lex = pars->lexer_;
160 lex->lexval = (void*) s;
161 return lex->yylex ();
169 /* tokens which are not keywords */
179 %token CHORDMODIFIERS
187 %token GROBDESCRIPTIONS
193 %token FIGURES FIGURE_OPEN FIGURE_CLOSE
194 %token FIGURE_BRACKET_CLOSE FIGURE_BRACKET_OPEN
204 %token MULTI_MEASURE_REST
216 %token OVERRIDE SET REVERT
229 %token COMMANDSPANREQUEST
231 %token OUTPUTPROPERTY
242 %token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE
243 %token E_LEFTSQUARE E_RIGHTSQUARE E_TILDE
245 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET
249 %type <i> exclamations questions dots optional_rest
250 %type <i> bass_number bass_mod
251 %type <scm> br_bass_figure bass_figure figure_list figure_spec
253 %token <scm> NOTENAME_PITCH
254 %token <scm> TONICNAME_PITCH
255 %token <scm> CHORDMODIFIER_PITCH
256 %token <scm> DURATION_IDENTIFIER
257 %token <scm> FRACTION
258 %token <id> IDENTIFIER
261 %token <scm> SCORE_IDENTIFIER
262 %token <scm> MUSIC_OUTPUT_DEF_IDENTIFIER
264 %token <scm> NUMBER_IDENTIFIER
265 %token <scm> REQUEST_IDENTIFIER
266 %token <scm> MUSIC_IDENTIFIER TRANSLATOR_IDENTIFIER
267 %token <scm> STRING_IDENTIFIER SCM_IDENTIFIER
268 %token <scm> RESTNAME
274 %type <outputdef> output_def
275 %type <scmhash> lilypond_header lilypond_header_body
276 %type <request> open_request_parens close_request_parens open_request close_request
277 %type <request> request_with_dir request_that_take_dir verbose_request
278 %type <i> sub_quotes sup_quotes
279 %type <music> simple_element request_chord command_element Simple_music Composite_music
280 %type <music> Repeated_music
281 %type <scm> Alternative_music
282 %type <i> tremolo_type
283 %type <i> bare_int bare_unsigned
286 %type <scm> identifier_init
288 %type <scm> steno_duration optional_notemode_duration multiplied_duration
289 %type <scm> verbose_duration
291 %type <reqvec> pre_requests post_requests
292 %type <request> gen_text_def
293 %type <scm> steno_pitch pitch absolute_pitch
294 %type <scm> explicit_pitch steno_tonic_pitch
296 %type <scm> chord_additions chord_subtractions chord_notes chord_step
298 %type <scm> chord_note chord_inversion chord_bass
299 %type <scm> duration_length fraction
301 %type <scm> embedded_scm scalar
302 %type <music> Music Sequential_music Simultaneous_music
303 %type <music> relative_music re_rhythmed_music part_combined_music
304 %type <music> property_def translator_change
305 %type <scm> Music_list
306 %type <outputdef> music_output_def_body
307 %type <request> shorthand_command_req
308 %type <request> post_request
309 %type <music> command_req verbose_command_req
310 %type <request> extender_req
311 %type <request> hyphen_req
312 %type <scm> string bare_number number_expression number_term number_factor
314 %type <score> score_block score_body
316 %type <scm> translator_spec_block translator_spec_body
317 %type <tempo> tempo_request
318 %type <scm> notenames_body notenames_block chordmodifiers_block
319 %type <scm> script_abbreviation
325 /* We don't assign precedence to / and *, because we might need varied
326 prec levels in different prods */
332 lilypond: /* empty */
333 | lilypond toplevel_expression {}
334 | lilypond assignment { }
336 THIS->error_level_ = 1;
339 THIS->error_level_ = 1;
345 THIS->lexer_->pitchname_tab_ = $1;
347 | chordmodifiers_block {
348 THIS->lexer_->chordmodifier_tab_ = $1;
351 if (THIS->input_file_->header_)
352 scm_gc_unprotect_object (THIS->input_file_->header_->self_scm ());
353 THIS->input_file_->header_ = $1;
356 THIS->input_file_->scores_.push ($1);
359 if (dynamic_cast<Paper_def*> ($1))
360 THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultpaper"), $1->self_scm ());
361 else if (dynamic_cast<Midi_def*> ($1))
362 THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultmidi"), $1->self_scm ());
375 chordmodifiers_block:
376 CHORDMODIFIERS notenames_body { $$ = $2; }
380 PITCHNAMES notenames_body { $$ = $2; }
385 int i = scm_ilength ($1);
387 SCM tab = scm_make_vector (gh_int2scm (i), SCM_EOL);
388 for (SCM s = $1; gh_pair_p (s); s = ly_cdr (s)) {
389 SCM pt = ly_cdar (s);
390 if (!unsmob_pitch (pt))
391 THIS->parser_error ("Need pitch object.");
393 scm_hashq_set_x (tab, ly_caar (s), pt);
400 lilypond_header_body:
402 $$ = new Scheme_hash_table;
403 THIS->lexer_-> scopes_.push ($$);
405 | lilypond_header_body assignment {
411 HEADER '{' lilypond_header_body '}' {
413 THIS->lexer_->scopes_.pop ();
425 /* cont */ '=' identifier_init {
428 Should find generic way of associating input with objects.
430 Input ip = THIS->pop_spot ();
432 if (! regular_identifier_b ($1))
434 ip.warning (_ ("Identifier should have alphabetic characters only"));
437 THIS->lexer_->set_identifier ($1, $4);
440 TODO: devise standard for protection in parser.
442 The parser stack lives on the C-stack, which means that
443 all objects can be unprotected as soon as they're here.
453 $$ = $1->self_scm ();
454 scm_gc_unprotect_object ($$);
457 $$ = $1->self_scm ();
458 scm_gc_unprotect_object ($$);
460 | translator_spec_block {
464 $$ = $1->self_scm ();
465 scm_gc_unprotect_object ($$);
468 $$ = $1->self_scm ();
469 scm_gc_unprotect_object ($$);
474 | number_expression {
485 translator_spec_block:
486 TRANSLATOR '{' translator_spec_body '}'
492 translator_spec_body:
493 TRANSLATOR_IDENTIFIER {
494 $$ = unsmob_translator_def ($1)->clone_scm ();
495 unsmob_translator_def ($$)-> set_spot (THIS->here_input ());
498 $$ = Translator_def::make_scm ();
499 Translator_def*td = unsmob_translator_def ($$);
500 td->translator_group_type_ = $2;
501 td->set_spot (THIS->here_input ());
503 | translator_spec_body STRING '=' embedded_scm {
504 unsmob_translator_def ($$)->add_property_assign ($2, $4);
506 | translator_spec_body STRING OVERRIDE embedded_scm '=' embedded_scm {
507 unsmob_translator_def ($$)
508 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
510 | translator_spec_body STRING SET embedded_scm '=' embedded_scm {
511 unsmob_translator_def ($$)
512 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
514 | translator_spec_body STRING REVERT embedded_scm {
515 unsmob_translator_def ($$)->add_pop_property (
516 scm_string_to_symbol ($2), $4);
518 | translator_spec_body NAME STRING {
519 unsmob_translator_def ($$)->type_name_ = $3;
521 | translator_spec_body CONSISTS STRING {
522 unsmob_translator_def ($$)->add_element ($3);
524 | translator_spec_body ALIAS STRING {
525 Translator_def*td = unsmob_translator_def ($$);
526 td->type_aliases_ = gh_cons ($3, td->type_aliases_);
528 | translator_spec_body GROBDESCRIPTIONS embedded_scm {
529 Translator_def*td = unsmob_translator_def($$);
530 // td->add_property_assign (ly_symbol2scm ("allGrobDescriptions"), $3);
531 for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p))
532 td->add_property_assign (scm_symbol_to_string (ly_caar (p)), ly_cdar (p));
534 | translator_spec_body CONSISTSEND STRING {
535 unsmob_translator_def ($$)->add_last_element ( $3);
537 | translator_spec_body ACCEPTS STRING {
538 unsmob_translator_def ($$)->set_acceptor ($3,true);
540 | translator_spec_body DENIES STRING {
541 unsmob_translator_def ($$)->set_acceptor ($3,false);
543 | translator_spec_body REMOVE STRING {
544 unsmob_translator_def ($$)->remove_element ($3);
555 /*cont*/ '{' score_body '}' {
558 if (!$$->defs_.size ())
560 Music_output_def *id =
561 unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
562 $$->add_output (id ? id->clone () : new Paper_def );
571 $$->set_spot (THIS->here_input ());
572 SCM m = $1->self_scm ();
573 scm_gc_unprotect_object (m);
578 SCM check_funcs = scm_c_eval_string ("toplevel-music-functions");
579 for (; gh_pair_p (check_funcs); check_funcs = gh_cdr (check_funcs))
580 m = gh_call1 (gh_car (check_funcs), m);
585 $$ = new Score (*unsmob_score ($1));
586 $$->set_spot (THIS->here_input ());
588 | score_body lilypond_header {
589 scm_gc_unprotect_object ($2->self_scm ());
592 | score_body output_def {
605 music_output_def_body '}' {
607 THIS-> lexer_-> scopes_.pop ();
611 music_output_def_body:
613 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultmidi"));
618 p = dynamic_cast<Midi_def*> (id->clone ());
623 THIS->lexer_->scopes_.push (p->variable_tab_);
626 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
629 p = dynamic_cast<Paper_def*> (id->clone ());
632 THIS-> lexer_-> scopes_.push (p->variable_tab_);
635 | PAPER '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
636 Music_output_def *p = unsmob_music_output_def ($3);
638 THIS->lexer_->scopes_.push (p->variable_tab_);
641 | MIDI '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
642 Music_output_def *p = unsmob_music_output_def ($3);
645 THIS->lexer_->scopes_.push (p->variable_tab_);
648 | music_output_def_body assignment {
651 | music_output_def_body translator_spec_block {
652 $$->assign_translator ($2);
654 | music_output_def_body STYLESHEET embedded_scm {
655 dynamic_cast<Paper_def*> ($$)-> style_sheet_ = $3;
657 | music_output_def_body tempo_request {
659 junk this ? there already is tempo stuff in
662 int m = gh_scm2int ( $2->get_mus_property ("metronome-count"));
663 Duration *d = unsmob_duration ($2->get_mus_property ("duration"));
664 Midi_def * md = dynamic_cast<Midi_def*> ($$);
666 md->set_tempo (d->length_mom (), m);
668 | music_output_def_body error {
674 TEMPO steno_duration '=' bare_unsigned {
676 $$->set_mus_property ("duration", $2);
677 $$->set_mus_property ("metronome-count", gh_int2scm ( $4));
682 The representation of a list is the
686 to have efficient append.
688 Music_list: /* empty */ {
689 $$ = gh_cons (SCM_EOL, SCM_EOL);
693 SCM c = gh_cons ($2->self_scm (), SCM_EOL);
694 scm_gc_unprotect_object ($2->self_scm ()); /* UGH */
695 if (gh_pair_p (ly_cdr (s)))
696 gh_set_cdr_x (ly_cdr (s), c); /* append */
698 gh_set_car_x (s, c); /* set first cons */
699 gh_set_cdr_x (s, c) ; /* remember last cell */
715 | ALTERNATIVE '{' Music_list '}' {
721 REPEAT string bare_unsigned Music Alternative_music
725 SCM alts = gh_pair_p ($5) ? gh_car ($5) : SCM_EOL;
726 if (times < scm_ilength (alts)) {
727 unsmob_music (gh_car (alts))
728 ->origin ()->warning (
729 _("More alternatives than repeats. Junking excess alternatives."));
730 alts = ly_truncate_list (times, alts);
733 Repeated_music * r = new Repeated_music (SCM_EOL);
736 r-> set_mus_property ("element", beg->self_scm ());
737 scm_gc_unprotect_object (beg->self_scm ());
739 r->set_mus_property ("repeat-count", gh_int2scm (times >? 1));
741 r-> set_mus_property ("elements",alts);
742 SCM func = scm_primitive_eval (ly_symbol2scm ("repeat-name-to-ctor"));
743 SCM result = gh_call1 (func, $2);
745 if (gh_equal_p ($2, scm_makfrom0str ("tremolo")))
748 we can not get durations and other stuff correct down the line, so we have to
749 add to the duration log here.
753 SCM func = scm_primitive_eval (ly_symbol2scm ("shift-duration-log"));
754 gh_call2 (func, r->self_scm (), gh_int2scm(-intlog2 ($3)));
757 set_music_properties (r, result);
759 r->set_spot (*$4->origin ());
766 SEQUENTIAL '{' Music_list '}' {
767 $$ = new Sequential_music (SCM_EOL);
768 $$->set_mus_property ("elements", ly_car ($3));
769 $$->set_spot(THIS->here_input());
771 | '{' Music_list '}' {
772 $$ = new Sequential_music (SCM_EOL);
773 $$->set_mus_property ("elements", ly_car ($2));
774 $$->set_spot(THIS->here_input());
779 SIMULTANEOUS '{' Music_list '}'{
780 $$ = new Simultaneous_music (SCM_EOL);
781 $$->set_mus_property ("elements", ly_car ($3));
782 $$->set_spot(THIS->here_input());
785 | '<' Music_list '>' {
786 $$ = new Simultaneous_music (SCM_EOL);
787 $$->set_mus_property ("elements", ly_car ($2));
788 $$->set_spot(THIS->here_input());
793 request_chord { $$ = $1; }
794 | OUTPUTPROPERTY embedded_scm embedded_scm '=' embedded_scm {
796 if (!gh_symbol_p ($3))
798 THIS->parser_error (_ ("Second argument must be a symbol"));
800 /* Should check # args */
801 if (!gh_procedure_p (pred))
803 THIS->parser_error (_ ("First argument must be a procedure taking one argument"));
806 Music *m = new Music (SCM_EOL);
807 m->set_mus_property ("predicate", pred);
808 m->set_mus_property ("grob-property", $3);
809 m->set_mus_property ("grob-value", $5);
810 m->set_mus_property ("iterator-ctor",
811 Output_property_music_iterator::constructor_cxx_function);
816 $$ = unsmob_music ($1)->clone ();
818 $$->set_spot (THIS->here_input());
826 CONTEXT STRING Music {
827 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
828 csm->set_mus_property ("element", $3->self_scm ());
829 scm_gc_unprotect_object ($3->self_scm ());
831 csm->set_mus_property ("context-type",$2);
832 csm->set_mus_property ("context-id", scm_makfrom0str (""));
836 | AUTOCHANGE STRING Music {
837 Music * chm = new Music_wrapper (SCM_EOL);
838 chm->set_mus_property ("element", $3->self_scm ());
839 chm->set_mus_property ("iterator-ctor", Auto_change_iterator::constructor_cxx_function);
841 scm_gc_unprotect_object ($3->self_scm ());
842 chm->set_mus_property ("what", $2);
845 chm->set_spot (*$3->origin ());
850 The other version is for easier debugging of
851 Sequential_music_iterator in combination with grace notes.
854 SCM start = THIS->lexer_->lookup_identifier ("startGraceMusic");
855 SCM stop = THIS->lexer_->lookup_identifier ("stopGraceMusic");
856 Music *startm = unsmob_music (start);
857 Music *stopm = unsmob_music (stop);
861 stopm = stopm->clone ();
862 ms = gh_cons (stopm->self_scm (), ms);
863 scm_gc_unprotect_object (stopm->self_scm ());
865 ms = gh_cons ($2->self_scm (), ms);
866 scm_gc_unprotect_object ($2->self_scm());
868 startm = startm->clone ();
869 ms = gh_cons (startm->self_scm () , ms);
870 scm_gc_unprotect_object (startm->self_scm ());
873 Music* seq = new Sequential_music (SCM_EOL);
874 seq->set_mus_property ("elements", ms);
876 $$ = new Grace_music (SCM_EOL);
877 $$->set_mus_property ("element", seq->self_scm ());
878 scm_gc_unprotect_object (seq->self_scm ());
880 $$ = new Grace_music (SCM_EOL);
881 $$->set_mus_property ("element", $2->self_scm ());
882 scm_gc_unprotect_object ($2->self_scm ());
885 | CONTEXT string '=' string Music {
886 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
887 csm->set_mus_property ("element", $5->self_scm ());
888 scm_gc_unprotect_object ($5->self_scm ());
890 csm->set_mus_property ("context-type", $2);
891 csm->set_mus_property ("context-id", $4);
902 int n = gh_scm2int (ly_car ($3)); int d = gh_scm2int (ly_cdr ($3));
904 $$ = new Time_scaled_music (SCM_EOL);
905 $$->set_spot (THIS->pop_spot ());
908 $$->set_mus_property ("element", mp->self_scm ());
909 scm_gc_unprotect_object (mp->self_scm ());
910 $$->set_mus_property ("numerator", gh_int2scm (n));
911 $$->set_mus_property ("denominator", gh_int2scm (d));
912 $$->compress (Moment (Rational (n,d)));
915 | Repeated_music { $$ = $1; }
916 | Simultaneous_music { $$ = $1; }
917 | Sequential_music { $$ = $1; }
918 | TRANSPOSE pitch Music {
919 $$ = new Transposed_music (SCM_EOL);
921 Pitch pit = *unsmob_pitch ($2);
924 $$->set_mus_property ("element", p->self_scm ());
925 scm_gc_unprotect_object (p->self_scm ());
927 | TRANSPOSE steno_tonic_pitch Music {
928 $$ = new Transposed_music (SCM_EOL);
930 Pitch pit = *unsmob_pitch ($2);
933 $$->set_mus_property ("element", p->self_scm ());
934 scm_gc_unprotect_object (p->self_scm ());
937 | APPLY embedded_scm Music {
938 SCM ret = gh_call1 ($2, $3->self_scm ());
939 Music *m = unsmob_music (ret);
941 THIS->parser_error ("\\apply must return a Music");
942 m = new Music (SCM_EOL);
947 { THIS->lexer_->push_note_state (); }
950 THIS->lexer_->pop_state ();
953 { THIS->lexer_->push_figuredbass_state (); }
956 Music * chm = new Untransposable_music () ;
957 chm->set_mus_property ("element", $3->self_scm ());
959 scm_gc_unprotect_object ($3->self_scm());
961 THIS->lexer_->pop_state ();
964 { THIS->lexer_->push_chord_state (); }
967 Music * chm = new Un_relativable_music ;
968 chm->set_mus_property ("element", $3->self_scm ());
969 scm_gc_unprotect_object ($3->self_scm());
972 THIS->lexer_->pop_state ();
975 { THIS->lexer_->push_lyric_state (); }
979 THIS->lexer_->pop_state ();
981 | relative_music { $$ = $1; }
982 | re_rhythmed_music { $$ = $1; }
983 | part_combined_music { $$ = $1; }
987 RELATIVE absolute_pitch Music {
989 Pitch pit = *unsmob_pitch ($2);
990 $$ = new Relative_octave_music (SCM_EOL);
992 $$->set_mus_property ("element", p->self_scm ());
993 scm_gc_unprotect_object (p->self_scm ());
995 $$->set_mus_property ("last-pitch", p->to_relative_octave (pit).smobbed_copy ());
1001 ADDLYRICS Music Music {
1002 Lyric_combine_music * l = new Lyric_combine_music (SCM_EOL);
1003 l->set_mus_property ("elements", gh_list ($2->self_scm (), $3->self_scm (), SCM_UNDEFINED));
1004 scm_gc_unprotect_object ($3->self_scm ());
1005 scm_gc_unprotect_object ($2->self_scm ());
1010 part_combined_music:
1011 PARTCOMBINE STRING Music Music {
1012 Part_combine_music * p = new Part_combine_music (SCM_EOL);
1014 p->set_mus_property ("what", $2);
1015 p->set_mus_property ("elements", gh_list ($3->self_scm (),$4->self_scm (), SCM_UNDEFINED));
1017 scm_gc_unprotect_object ($3->self_scm ());
1018 scm_gc_unprotect_object ($4->self_scm ());
1025 TRANSLATOR STRING '=' STRING {
1026 Music * t = new Music (SCM_EOL);
1027 t->set_mus_property ("iterator-ctor",
1028 Change_iterator::constructor_cxx_function);
1029 t-> set_mus_property ("change-to-type", $2);
1030 t-> set_mus_property ("change-to-id", $4);
1033 $$->set_spot (THIS->here_input ());
1038 PROPERTY STRING '.' STRING '=' scalar {
1040 Music *t = set_property_music (scm_string_to_symbol ($4), $6);
1041 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1043 csm->set_mus_property ("element", t->self_scm ());
1044 scm_gc_unprotect_object (t->self_scm ());
1047 $$->set_spot (THIS->here_input ());
1049 csm-> set_mus_property ("context-type", $2);
1051 | PROPERTY STRING '.' STRING UNSET {
1052 Music *t = new Music (SCM_EOL);
1054 t->set_mus_property ("iterator-ctor",
1055 Property_unset_iterator::constructor_cxx_function);
1056 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1058 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1059 csm->set_mus_property ("element", t->self_scm ());
1060 scm_gc_unprotect_object (t->self_scm ());
1063 $$->set_spot (THIS->here_input ());
1065 csm-> set_mus_property ("context-type", $2);
1067 | PROPERTY STRING '.' STRING SET embedded_scm '=' embedded_scm {
1069 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1070 bool itc = internal_type_checking_global_b;
1071 Music *t = new Music (SCM_EOL);
1072 t->set_mus_property ("iterator-ctor",
1073 Push_property_iterator::constructor_cxx_function);
1074 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1075 t->set_mus_property ("pop-first", SCM_BOOL_T);
1077 internal_type_checking_global_b = false;
1078 t->set_mus_property ("grob-property", $6);
1080 internal_type_checking_global_b = itc;
1081 t->set_mus_property ("grob-value", $8);
1082 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1083 csm->set_mus_property ("element", t->self_scm ());
1084 scm_gc_unprotect_object (t->self_scm ());
1086 $$->set_spot (THIS->here_input ());
1088 csm-> set_mus_property ("context-type", $2);
1090 | PROPERTY STRING '.' STRING OVERRIDE embedded_scm '=' embedded_scm {
1095 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1096 bool itc = internal_type_checking_global_b;
1098 Music *t = new Music (SCM_EOL);
1099 t->set_mus_property ("iterator-ctor",
1100 Push_property_iterator::constructor_cxx_function);
1101 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1104 internal_type_checking_global_b = false;
1105 t->set_mus_property ("grob-property", $6);
1106 t->set_mus_property ("grob-value", $8);
1108 internal_type_checking_global_b = itc;
1110 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1111 csm->set_mus_property ("element", t->self_scm ());
1112 scm_gc_unprotect_object (t->self_scm ());
1115 $$->set_spot (THIS->here_input ());
1117 csm-> set_mus_property ("context-type", $2);
1119 | PROPERTY STRING '.' STRING REVERT embedded_scm {
1120 Music *t = new Music (SCM_EOL);
1122 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1123 bool itc = internal_type_checking_global_b;
1125 t->set_mus_property ("iterator-ctor",
1126 Pop_property_iterator::constructor_cxx_function);
1127 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1129 internal_type_checking_global_b = false;
1130 t->set_mus_property ("grob-property", $6);
1132 internal_type_checking_global_b = itc;
1134 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1135 csm->set_mus_property ("element", t->self_scm ());
1136 scm_gc_unprotect_object (t->self_scm ());
1139 $$->set_spot (THIS->here_input ());
1141 csm-> set_mus_property ("context-type", $2);
1148 | bare_int { $$ = gh_int2scm ($1); }
1149 | embedded_scm { $$ = $1; }
1156 } /*cont */ simple_element post_requests {
1157 Music_sequence *l = dynamic_cast<Music_sequence*> ($3);
1160 for (int i=0; i < $1->size (); i++) {
1161 Music * m = $1->elem (i);
1162 l->append_music (m);
1174 $$ = new Request_chord (SCM_EOL);
1175 $$->set_mus_property ("elements", gh_cons ($1->self_scm (), SCM_EOL));
1176 scm_gc_unprotect_object ($1->self_scm());
1178 $$-> set_spot (THIS->here_input ());
1179 $1-> set_spot (THIS->here_input ());
1182 Span_req *l = new Span_req;
1183 l->set_span_dir (START);
1184 l->set_mus_property ("span-type", scm_makfrom0str ("ligature"));
1185 l->set_spot (THIS->here_input ());
1187 $$ = new Request_chord (SCM_EOL);
1188 $$->set_mus_property ("elements", gh_cons (l->self_scm (), SCM_EOL));
1189 scm_gc_unprotect_object (l->self_scm());
1190 $$->set_spot (THIS->here_input ());
1193 Span_req *l = new Span_req;
1194 l->set_span_dir (STOP);
1195 l->set_mus_property ("span-type", scm_makfrom0str ("ligature"));
1196 l->set_spot (THIS->here_input ());
1198 $$ = new Request_chord (SCM_EOL);
1199 $$->set_mus_property ("elements", gh_cons (l->self_scm (), SCM_EOL));
1200 $$->set_spot (THIS->here_input ());
1201 scm_gc_unprotect_object (l->self_scm());
1205 $$ = new Music (gh_list (gh_cons (ly_symbol2scm ("name"), ly_symbol2scm ("separator")), SCM_UNDEFINED));
1206 $$->set_spot (THIS->here_input ());
1210 extern Music * get_barcheck();
1211 $$ = get_barcheck ();
1212 $$->set_spot (THIS->here_input ());
1215 Music *t = set_property_music (ly_symbol2scm ("whichBar"), $2);
1217 Context_specced_music *csm = new Context_specced_music (SCM_EOL);
1218 csm->set_mus_property ("element", t->self_scm ());
1219 scm_gc_unprotect_object (t->self_scm ());
1222 $$->set_spot (THIS->here_input ());
1224 csm->set_mus_property ("context-type", scm_makfrom0str ("Score"));
1226 | PARTIAL duration_length {
1227 Moment m = - unsmob_duration ($2)->length_mom ();
1228 Music * p = set_property_music (ly_symbol2scm ( "measurePosition"),m.smobbed_copy ());
1230 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1231 sp->set_mus_property ("element", p->self_scm ());
1232 scm_gc_unprotect_object (p->self_scm ());
1235 sp-> set_mus_property ("context-type", scm_makfrom0str ( "Score"));
1238 SCM func = scm_primitive_eval (ly_symbol2scm ("clef-name-to-properties"));
1239 SCM result = gh_call1 (func, $2);
1242 for (SCM s = result ; gh_pair_p (s); s = ly_cdr (s)) {
1243 Music * p = new Music (SCM_EOL);
1244 set_music_properties (p, ly_car (s));
1245 l = gh_cons (p->self_scm (), l);
1246 scm_gc_unprotect_object (p->self_scm ());
1248 Sequential_music * seq = new Sequential_music (SCM_EOL);
1249 seq->set_mus_property ("elements", l);
1251 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1252 sp->set_mus_property ("element", seq->self_scm ());
1253 scm_gc_unprotect_object (seq->self_scm ());
1256 sp-> set_mus_property ("context-type", scm_makfrom0str ("Staff"));
1259 Music * p1 = set_property_music (ly_symbol2scm ( "timeSignatureFraction"), $2);
1261 int l = gh_scm2int (ly_car ($2));
1262 int o = gh_scm2int (ly_cdr ($2));
1264 Moment one_beat = Moment (1)/Moment (o);
1265 Moment len = Moment (l) * one_beat;
1268 Music *p2 = set_property_music (ly_symbol2scm ("measureLength"), len.smobbed_copy ());
1269 Music *p3 = set_property_music (ly_symbol2scm ("beatLength"), one_beat.smobbed_copy ());
1271 SCM list = scm_list_n (p1->self_scm (), p2->self_scm (), p3->self_scm(), SCM_UNDEFINED);
1272 Sequential_music *seq = new Sequential_music (SCM_EOL);
1273 seq->set_mus_property ("elements", list);
1276 Context_specced_music * sp = new Context_specced_music (SCM_EOL);
1277 sp->set_mus_property ("element", seq->self_scm ());
1281 scm_gc_unprotect_object (p3->self_scm ());
1282 scm_gc_unprotect_object (p2->self_scm ());
1283 scm_gc_unprotect_object (p1->self_scm ());
1284 scm_gc_unprotect_object (seq->self_scm ());
1289 TODO: should make alias TimingContext for Score
1292 sp-> set_mus_property ("context-type", scm_makfrom0str ( "Score"));
1297 shorthand_command_req { $$ = $1; }
1298 | verbose_command_req { $$ = $1; }
1301 shorthand_command_req:
1312 Span_req*b= new Span_req;
1313 b->set_span_dir (START);
1314 b->set_mus_property ("span-type", scm_makfrom0str ("beam"));
1318 THIS->last_beam_start_ = b->self_scm ();
1321 Span_req*b= new Span_req;
1322 b->set_span_dir ( STOP);
1323 b->set_mus_property ("span-type", scm_makfrom0str ("beam"));
1327 $$ = new Breathing_sign_req;
1330 $$ = new Porrectus_req;
1334 verbose_command_req:
1335 COMMANDSPANREQUEST bare_int STRING { /*TODO: junkme */
1336 Span_req * sp = new Span_req;
1337 sp-> set_span_dir ( Direction ($2));
1338 sp->set_mus_property ("span-type",$3);
1339 sp->set_spot (THIS->here_input ());
1343 Mark_req * m = new Mark_req;
1347 Mark_req *m = new Mark_req;
1348 m->set_mus_property ("label", $2);
1352 Break_req * b = new Break_req;
1354 if (!gh_number_p (s))
1357 b->set_mus_property ("penalty", s);
1358 b->set_spot (THIS->here_input ());
1361 | SKIP duration_length {
1362 Skip_req * skip = new Skip_req;
1363 skip->set_mus_property ("duration", $2);
1371 Key_change_req *key= new Key_change_req;
1374 | KEY NOTENAME_PITCH SCM_IDENTIFIER {
1375 Key_change_req *key= new Key_change_req;
1377 key->set_mus_property ("pitch-alist", $3);
1378 ((Music*)key)->transpose (* unsmob_pitch ($2));
1385 $$ = new Link_array<Request>;
1387 | post_requests post_request {
1388 $2->set_spot (THIS->here_input ());
1400 request_that_take_dir:
1403 | script_abbreviation {
1404 SCM s = THIS->lexer_->lookup_identifier ("dash" + ly_scm2string ($1));
1405 Articulation_req *a = new Articulation_req;
1406 if (gh_string_p (s))
1407 a->set_mus_property ("articulation-type", s);
1408 else THIS->parser_error (_ ("Expecting string as script definition"));
1414 script_dir request_that_take_dir {
1415 if (Script_req * gs = dynamic_cast<Script_req*> ($2))
1416 gs->set_direction (Direction ($1));
1418 $2->origin ()->warning (_ ("Can't specify direction for this request"));
1424 REQUEST_IDENTIFIER {
1425 $$ = dynamic_cast<Request*> (unsmob_music ($1)->clone ());
1426 $$->set_spot (THIS->here_input ());
1428 | DYNAMICSCRIPT embedded_scm {
1430 TODO: junkme, use text-type == dynamic
1432 Text_script_req *d = new Text_script_req;
1433 SCM dyn = ly_symbol2scm ("dynamic");
1434 d->set_mus_property ("text-type" , dyn);
1435 d->set_mus_property ("text", $2);
1436 d->set_spot (THIS->here_input ());
1439 | SPANREQUEST bare_int STRING {
1440 Span_req * sp = new Span_req;
1441 sp->set_span_dir ( Direction ($2));
1442 sp->set_mus_property ("span-type", $3);
1443 sp->set_spot (THIS->here_input ());
1447 Tremolo_req* a = new Tremolo_req;
1448 a->set_spot (THIS->here_input ());
1449 a->set_mus_property ("tremolo-type", gh_int2scm ($1));
1453 Articulation_req * a = new Articulation_req;
1454 a->set_mus_property ("articulation-type", $2);
1455 a->set_spot (THIS->here_input ());
1459 duh, junk this syntax from the parser, if possible.
1462 Arpeggio_req *a = new Arpeggio_req;
1463 a->set_spot (THIS->here_input ());
1467 Glissando_req *g = new Glissando_req;
1468 g->set_spot /* No pun intended */ (THIS->here_input ());
1495 | NOTENAME_PITCH sup_quotes {
1496 Pitch p = *unsmob_pitch ($1);
1498 $$ = p.smobbed_copy ();
1500 | NOTENAME_PITCH sub_quotes {
1501 Pitch p =* unsmob_pitch ($1);
1504 $$ = p.smobbed_copy ();
1517 | TONICNAME_PITCH sup_quotes {
1518 Pitch p = *unsmob_pitch ($1);
1520 $$ = p.smobbed_copy ();
1522 | TONICNAME_PITCH sub_quotes {
1523 Pitch p =* unsmob_pitch ($1);
1526 $$ = p.smobbed_copy ();
1541 PITCH embedded_scm {
1543 if (!unsmob_pitch ($2)) {
1544 THIS->parser_error (_f ("Expecting musical-pitch value", 3));
1545 $$ = Pitch ().smobbed_copy ();
1551 DURATION embedded_scm {
1553 if (!unsmob_duration ($2))
1555 THIS->parser_error (_ ("Must have duration object"));
1556 $$ = Duration ().smobbed_copy ();
1563 if (!THIS->lexer_->lyric_state_b ())
1564 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1565 $$ = new Extender_req;
1571 if (!THIS->lexer_->lyric_state_b ())
1572 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1573 $$ = new Hyphen_req;
1578 close_request_parens {
1580 dynamic_cast<Span_req*> ($$)->set_span_dir ( START);
1584 close_request_parens:
1586 Span_req* s= new Span_req;
1588 s->set_mus_property ("span-type", scm_makfrom0str ( "slur"));
1589 s->set_spot (THIS->here_input());
1592 Span_req* s= new Span_req;
1594 s->set_mus_property ("span-type", scm_makfrom0str ( "phrasing-slur"));
1595 s->set_spot (THIS->here_input());
1598 Span_req*s =new Span_req;
1600 s->set_mus_property ("span-type", scm_makfrom0str ( "crescendo"));
1601 s->set_spot (THIS->here_input());
1604 Span_req*s =new Span_req;
1606 s->set_mus_property ("span-type", scm_makfrom0str ("decrescendo"));
1607 s->set_spot (THIS->here_input());
1613 open_request_parens {
1615 dynamic_cast<Span_req*> ($$)->set_span_dir (STOP);
1619 open_request_parens:
1621 Span_req *s = new Span_req;
1622 s->set_mus_property ("span-type", scm_makfrom0str ( "crescendo"));
1623 s->set_spot (THIS->here_input());
1628 Span_req* s= new Span_req;
1630 s->set_mus_property ("span-type", scm_makfrom0str ( "slur"));
1631 s->set_spot (THIS->here_input());
1635 Span_req* s= new Span_req;
1637 s->set_mus_property ("span-type", scm_makfrom0str ( "phrasing-slur"));
1638 s->set_spot (THIS->here_input());
1644 Text_script_req *t = new Text_script_req;
1645 t->set_mus_property ("text", $1);
1646 t->set_spot (THIS->here_input ());
1650 Text_script_req *t = new Text_script_req;
1651 t->set_mus_property ("text", $1);
1652 t->set_spot (THIS->here_input ());
1656 String ds = to_string ($1);
1657 Text_script_req* t = new Text_script_req;
1658 SCM finger = ly_symbol2scm ("finger");
1659 t->set_mus_property ("text", scm_makfrom0str (ds.to_str0 ()));
1660 t->set_mus_property ("text-type" , finger);
1661 t->set_spot (THIS->here_input ());
1666 script_abbreviation:
1668 $$ = scm_makfrom0str ("Hat");
1671 $$ = scm_makfrom0str ("Plus");
1674 $$ = scm_makfrom0str ("Dash");
1677 $$ = scm_makfrom0str ("Bar");
1680 $$ = scm_makfrom0str ("Larger");
1683 $$ = scm_makfrom0str ("Dot");
1686 $$ = scm_makfrom0str ("Underscore");
1693 | '-' { $$ = CENTER; }
1698 $$ = new Link_array<Request>;
1700 | pre_requests open_request {
1712 multiplied_duration {
1715 | verbose_duration {
1720 optional_notemode_duration:
1722 Duration dd = THIS->default_duration_;
1723 $$ = dd.smobbed_copy ();
1725 THIS->beam_check ($$);
1727 | multiplied_duration {
1729 THIS->default_duration_ = *unsmob_duration ($$);
1731 THIS->beam_check ($$);
1733 | verbose_duration {
1735 THIS->default_duration_ = *unsmob_duration ($$);
1740 bare_unsigned dots {
1742 if (!is_duration_b ($1))
1743 THIS->parser_error (_f ("not a duration: %d", $1));
1747 $$ = Duration (l, $2).smobbed_copy ();
1749 | DURATION_IDENTIFIER dots {
1750 Duration *d =unsmob_duration ($1);
1751 Duration k (d->duration_log (),d->dot_count () + $2);
1752 $$ = k.smobbed_copy ();
1759 multiplied_duration:
1763 | multiplied_duration '*' bare_unsigned {
1764 $$ = unsmob_duration ($$)->compressed ( $3) .smobbed_copy ();
1766 | multiplied_duration '*' FRACTION {
1767 Rational m (gh_scm2int (ly_car ($3)), gh_scm2int (ly_cdr ($3)));
1769 $$ = unsmob_duration ($$)->compressed (m).smobbed_copy ();
1774 FRACTION { $$ = $1; }
1775 | UNSIGNED '/' UNSIGNED {
1776 $$ = gh_cons (gh_int2scm ($1), gh_int2scm ($3));
1794 | ':' bare_unsigned {
1795 if (!is_duration_b ($2))
1796 THIS->parser_error (_f ("not a duration: %d", $2));
1815 Bass_figure_req *bfr = new Bass_figure_req;
1816 $$ = bfr->self_scm();
1817 scm_gc_unprotect_object ($$);
1820 Bass_figure_req *bfr = new Bass_figure_req;
1821 $$ = bfr->self_scm();
1823 bfr->set_mus_property ("figure", gh_int2scm ($1));
1825 scm_gc_unprotect_object ($$);
1827 | bass_figure bass_mod {
1828 Music *m = unsmob_music ($1);
1830 SCM salter =m->get_mus_property ("alteration");
1831 int alter = gh_number_p ( salter) ? gh_scm2int (salter) : 0;
1832 m->set_mus_property ("alteration",
1833 gh_int2scm (alter + $2));
1835 m->set_mus_property ("alteration", gh_int2scm (0));
1843 unsmob_music ($$)->set_mus_property ("bracket-start", SCM_BOOL_T);
1848 | br_bass_figure ']' {
1850 unsmob_music ($1)->set_mus_property ("bracket-stop", SCM_BOOL_T);
1858 | figure_list br_bass_figure {
1859 $$ = gh_cons ($2, $1);
1864 FIGURE_OPEN figure_list FIGURE_CLOSE {
1865 Music * m = new Request_chord (SCM_EOL);
1866 $2 = scm_reverse_x ($2, SCM_EOL);
1867 m->set_mus_property ("elements", $2);
1868 $$ = m->self_scm ();
1879 pitch exclamations questions optional_notemode_duration optional_rest {
1881 Input i = THIS->pop_spot ();
1882 if (!THIS->lexer_->note_state_b ())
1883 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1891 n->set_mus_property ("pitch", $1);
1892 n->set_mus_property ("duration", $4);
1896 n->set_mus_property ("cautionary", SCM_BOOL_T);
1897 if ($2 % 2 || $3 % 2)
1898 n->set_mus_property ("force-accidental", SCM_BOOL_T);
1900 Simultaneous_music*v = new Request_chord (SCM_EOL);
1901 v->set_mus_property ("elements", scm_list_n (n->self_scm (), SCM_UNDEFINED));
1902 scm_gc_unprotect_object (n->self_scm());
1908 | figure_spec optional_notemode_duration {
1909 Music * m = unsmob_music ($1);
1910 Input i = THIS->pop_spot ();
1912 for (SCM s = m->get_mus_property ("elements"); gh_pair_p (s); s = ly_cdr (s))
1914 unsmob_music (ly_car (s))->set_mus_property ("duration", $2);
1918 | RESTNAME optional_notemode_duration {
1920 Input i = THIS->pop_spot ();
1921 SCM e = SCM_UNDEFINED;
1922 if (ly_scm2string ($1) =="s") {
1924 Skip_req * skip = new Skip_req;
1925 skip->set_mus_property ("duration" ,$2);
1927 e = skip->self_scm ();
1930 Rest_req * rest_req = new Rest_req;
1931 rest_req->set_mus_property ("duration", $2);
1932 rest_req->set_spot (i);
1933 e = rest_req->self_scm ();
1935 Simultaneous_music* velt = new Request_chord (SCM_EOL);
1936 velt-> set_mus_property ("elements", scm_list_n (e,SCM_UNDEFINED));
1941 | MULTI_MEASURE_REST optional_notemode_duration {
1942 Input i = THIS->pop_spot ();
1944 Skip_req * sk = new Skip_req;
1945 sk->set_mus_property ("duration", $2);
1946 Span_req *sp1 = new Span_req;
1947 Span_req *sp2 = new Span_req;
1948 sp1-> set_span_dir ( START);
1949 sp2-> set_span_dir ( STOP);
1950 SCM r = scm_makfrom0str ("rest");
1951 sp1->set_mus_property ("span-type", r);
1952 sp2->set_mus_property ("span-type", r);
1954 Request_chord * rqc1 = new Request_chord (SCM_EOL);
1955 rqc1->set_mus_property ("elements", scm_list_n (sp1->self_scm (), SCM_UNDEFINED));
1956 Request_chord * rqc2 = new Request_chord (SCM_EOL);
1957 rqc2->set_mus_property ("elements", scm_list_n (sk->self_scm (), SCM_UNDEFINED));;
1958 Request_chord * rqc3 = new Request_chord (SCM_EOL);
1959 rqc3->set_mus_property ("elements", scm_list_n (sp2->self_scm (), SCM_UNDEFINED));;
1961 SCM ms = scm_list_n (rqc1->self_scm (), rqc2->self_scm (), rqc3->self_scm (), SCM_UNDEFINED);
1963 $$ = new Sequential_music (SCM_EOL);
1964 $$->set_mus_property ("elements", ms);
1966 | STRING optional_notemode_duration {
1967 Input i = THIS->pop_spot ();
1969 Lyric_req* lreq = new Lyric_req;
1970 lreq->set_mus_property ("text", $1);
1971 lreq->set_mus_property ("duration",$2);
1973 Simultaneous_music* velt = new Request_chord (SCM_EOL);
1974 velt->set_mus_property ("elements", scm_list_n (lreq->self_scm (), SCM_UNDEFINED));
1979 Input i = THIS->pop_spot ();
1981 if (!THIS->lexer_->chord_state_b ())
1982 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1989 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
1990 $$ = Chord::get_chord ($1, $3, $4, $5, $6, $2);
1991 $$->set_spot (THIS->here_input ());
1998 | CHORD_COLON chord_notes {
2007 | chord_notes '.' chord_step {
2008 $$ = gh_append2 ($$, $3);
2016 | CHORD_CARET chord_notes {
2026 | '/' steno_tonic_pitch {
2035 | CHORD_BASS steno_tonic_pitch {
2042 $$ = gh_cons ($1, SCM_EOL);
2044 | CHORDMODIFIER_PITCH {
2045 $$ = gh_cons (unsmob_pitch ($1)->smobbed_copy (), SCM_EOL);
2047 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
2048 $$ = scm_list_n (unsmob_pitch ($1)->smobbed_copy (),
2056 m.notename_ = ($1 - 1) % 7;
2057 m.octave_ = $1 > 7 ? 1 : 0;
2060 $$ = m.smobbed_copy ();
2062 | bare_unsigned '+' {
2064 m.notename_ = ($1 - 1) % 7;
2065 m.octave_ = $1 > 7 ? 1 : 0;
2069 $$ = m.smobbed_copy ();
2071 | bare_unsigned CHORD_MINUS {
2073 m.notename_ = ($1 - 1) % 7;
2074 m.octave_ = $1 > 7 ? 1 : 0;
2077 $$ = m.smobbed_copy ();
2085 number_expression '+' number_term {
2086 $$ = scm_sum ($1, $3);
2088 | number_expression '-' number_term {
2089 $$ = scm_difference ($1, $3);
2098 | number_factor '*' number_factor {
2099 $$ = scm_product ($1, $3);
2101 | number_factor '/' number_factor {
2102 $$ = scm_divide ($1, $3);
2107 '(' number_expression ')' {
2110 | '-' number_factor { /* %prec UNARY_MINUS */
2111 $$ = scm_difference ($2, SCM_UNDEFINED);
2119 $$ = gh_int2scm ($1);
2124 | NUMBER_IDENTIFIER {
2128 $$ = gh_double2scm (gh_scm2double ($1) CM );
2131 $$ = gh_double2scm (gh_scm2double ($1) PT);
2134 $$ = gh_double2scm (gh_scm2double ($1) INCH);
2137 $$ = gh_double2scm (gh_scm2double ($1) MM);
2140 $$ = gh_double2scm (gh_scm2double ($1) CHAR);
2156 if (scm_integer_p ($1) == SCM_BOOL_T)
2158 int k = gh_scm2int ($1);
2162 THIS->parser_error (_ ("need integer number arg"));
2176 | STRING_IDENTIFIER {
2179 | string '+' string {
2180 $$ = scm_string_append (scm_list_n ($1, $3, SCM_UNDEFINED));
2187 | exclamations '!' { $$ ++; }
2192 | questions '?' { $$ ++; }
2199 My_lily_parser::set_yydebug (bool )
2206 extern My_lily_parser * current_parser;
2209 My_lily_parser::do_yyparse ()
2212 current_parser = this;;
2213 yyparse ((void*)this);
2218 Should make this optional? It will also complain when you do
2222 which is entirely legitimate.
2224 Or we can scrap it. Barchecks should detect wrong durations, and
2225 skipTypesetting speeds it up a lot.
2228 My_lily_parser::beam_check (SCM dur)
2230 Duration *d = unsmob_duration (dur);
2231 if (unsmob_music (last_beam_start_) && d->duration_log () <= 2)
2233 Music * m = unsmob_music (last_beam_start_);
2234 m->origin ()->warning (_("Suspect duration found following this beam"));
2236 last_beam_start_ = SCM_EOL;