1 %{ // -*-Fundamental-*-
4 parser.yy -- Bison/C++ parser for lilypond
6 source file of the GNU LilyPond music typesetter
8 (c) 1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 Jan Nieuwenhuizen <janneke@gnu.org>
13 Two shift/reduce problems:
17 "bar" -> String -> Lyric -> Music -> music-assignment
19 "bar" -> String -> string-assignment
23 \repeat .. \alternative
26 \repeat { \repeat .. \alternative }
30 \repeat { \repeat } \alternative
42 * The rules for who is protecting what are very shady. Uniformise
45 * There are too many lexical modes.
52 #include "translator-def.hh"
53 #include "lily-guile.hh"
55 #include "my-lily-lexer.hh"
56 #include "paper-def.hh"
57 #include "midi-def.hh"
59 #include "file-path.hh"
61 #include "dimensions.hh"
62 #include "my-lily-parser.hh"
64 #include "input-file-results.hh"
66 #include "lilypond-input-version.hh"
67 #include "scm-hash.hh"
68 #include "auto-change-iterator.hh"
70 #include "ly-modules.hh"
71 #include "music-sequence.hh"
72 #include "input-smob.hh"
74 #include "text-item.hh"
77 regular_identifier_b (SCM id)
79 String str = ly_scm2string (id);
80 char const *s = str.to_str0 () ;
85 v = v && isalpha (*s);
92 make_simple_markup (SCM a)
96 simple = scm_c_eval_string ("simple-markup");
98 return scm_list_n (simple, a, SCM_UNDEFINED);
103 is_duration_b (int t)
105 return t && t == 1 << intlog2 (t);
109 set_music_properties (Music *p, SCM a)
111 for (SCM k = a; gh_pair_p (k); k = ly_cdr (k))
113 p->internal_set_mus_property (ly_caar (k), ly_cdar (k));
119 #define MY_MAKE_MUSIC(x) make_music_by_name (ly_symbol2scm (x))
122 set_property_music (SCM sym, SCM value)
124 Music * p = MY_MAKE_MUSIC("PropertySet");
125 p->set_mus_property ("symbol", sym);
126 p->set_mus_property ("value", value);
131 // needed for bison.simple's malloc () and free ()
133 // #include <malloc.h>
138 #define YYERROR_VERBOSE 1
140 My_lily_parser* my_lily_parser;
141 #define YYPARSE_PARAM my_lily_parser
142 #define YYLEX_PARAM my_lily_parser
144 ((My_lily_parser *) my_lily_parser)
146 #define yyerror THIS->parser_error
150 /* We use SCMs to do strings, because it saves us the trouble of
151 deleting them. Let's hope that a stack overflow doesnt trigger a move
152 of the parse stack onto the heap. */
159 Music_output_def * outputdef;
166 yylex (YYSTYPE *s, void * v)
168 My_lily_parser *pars = (My_lily_parser*) v;
169 My_lily_lexer * lex = pars->lexer_;
171 lex->lexval = (void*) s;
172 lex->prepare_for_next_token();
173 return lex->yylex ();
181 /* tokens which are not keywords */
190 %token CHORDMODIFIERS
196 %token GROBDESCRIPTIONS
201 %token FIGURES FIGURE_OPEN FIGURE_CLOSE
202 %token FIGURE_BRACKET_CLOSE FIGURE_BRACKET_OPEN
210 %token MULTI_MEASURE_REST
221 %token OVERRIDE SET REVERT
231 %token COMMANDSPANREQUEST
233 %token OUTPUTPROPERTY
248 %token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE
249 %token E_LEFTSQUARE E_RIGHTSQUARE E_TILDE
251 %token <i> E_UNSIGNED
252 %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET CHORD_SLASH
255 %type <i> exclamations questions dots optional_rest
256 %type <i> bass_number bass_mod
257 %type <scm> br_bass_figure bass_figure figure_list figure_spec
259 %token <scm> NOTENAME_PITCH
260 %token <scm> TONICNAME_PITCH
261 %token <scm> CHORDMODIFIER_PITCH
262 %token <scm> DURATION_IDENTIFIER
263 %token <scm> FRACTION
264 %token <id> IDENTIFIER
267 %token <scm> SCORE_IDENTIFIER
268 %token <scm> MUSIC_OUTPUT_DEF_IDENTIFIER
269 %token <scm> NUMBER_IDENTIFIER
270 %token <scm> EVENT_IDENTIFIER
271 %token <scm> MUSIC_IDENTIFIER TRANSLATOR_IDENTIFIER
272 %token <scm> STRING_IDENTIFIER SCM_IDENTIFIER
273 %token <scm> RESTNAME
280 %token <scm> MARKUP_HEAD_MARKUP0
281 %token <scm> MARKUP_HEAD_MARKUP0_MARKUP1
282 %token <scm> MARKUP_HEAD_SCM0
283 %token <scm> MARKUP_HEAD_SCM0_MARKUP1
284 %token <scm> MARKUP_HEAD_SCM0_SCM1
285 %token <scm> MARKUP_HEAD_SCM0_SCM1_MARKUP2
287 %token <scm> MARKUP_IDENTIFIER MARKUP_HEAD_LIST0
288 %type <scm> markup markup_line markup_list markup_list_body full_markup
290 %type <outputdef> output_def
291 %type <scm> lilypond_header lilypond_header_body
292 %type <music> open_event_parens close_event_parens open_event close_event
293 %type <music> event_with_dir event_that_take_dir verbose_event
294 %type <i> sub_quotes sup_quotes
295 %type <music> simple_element event_chord command_element Simple_music Composite_music
296 %type <music> Repeated_music
297 %type <scm> Alternative_music
298 %type <i> tremolo_type
299 %type <i> bare_int bare_unsigned
301 %type <scm> identifier_init
303 %type <music> note_chord_element chord_body chord_body_element
304 %type <scm> chord_body_elements
305 %type <scm> steno_duration optional_notemode_duration multiplied_duration
306 %type <scm> verbose_duration
308 %type <scm> pre_events post_events
309 %type <music> gen_text_def
310 %type <scm> steno_pitch pitch absolute_pitch pitch_also_in_chords
311 %type <scm> explicit_pitch steno_tonic_pitch
313 %type <scm> chord_additions chord_subtractions chord_notes chord_step
315 %type <scm> chord_note chord_inversion chord_bass
316 %type <scm> duration_length fraction
318 %type <scm> embedded_scm scalar
319 %type <music> Music Sequential_music Simultaneous_music
320 %type <music> relative_music re_rhythmed_music part_combined_music
321 %type <music> property_def translator_change simple_property_def
322 %type <scm> Music_list
323 %type <outputdef> music_output_def_body
324 %type <music> shorthand_command_req
325 %type <music> post_event
326 %type <music> command_req verbose_command_req
327 %type <music> extender_req
328 %type <music> hyphen_req
329 %type <music> string_event
330 %type <scm> string bare_number number_expression number_term number_factor
331 %type <score> score_block score_body
333 %type <scm> translator_spec_block translator_spec_body
334 %type <music> tempo_event
335 %type <scm> notenames_body notenames_block chordmodifiers_block
336 %type <scm> script_abbreviation
342 /* We don't assign precedence to / and *, because we might need varied
343 prec levels in different prods */
349 lilypond: /* empty */
350 | lilypond toplevel_expression {}
351 | lilypond assignment { }
353 THIS->error_level_ = 1;
356 THIS->error_level_ = 1;
362 THIS->lexer_->pitchname_tab_ = $1;
364 | chordmodifiers_block {
365 THIS->lexer_->chordmodifier_tab_ = $1;
368 THIS->input_file_->header_ = $1;
371 THIS->input_file_->scores_.push ($1);
374 if (dynamic_cast<Paper_def*> ($1))
375 THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultpaper"), $1->self_scm ());
376 else if (dynamic_cast<Midi_def*> ($1))
377 THIS->lexer_->set_identifier (scm_makfrom0str ("$defaultmidi"), $1->self_scm ());
387 chordmodifiers_block:
388 CHORDMODIFIERS notenames_body { $$ = $2; }
392 PITCHNAMES notenames_body { $$ = $2; }
397 int i = scm_ilength ($1);
399 SCM tab = scm_make_vector (gh_int2scm (i), SCM_EOL);
400 for (SCM s = $1; gh_pair_p (s); s = ly_cdr (s)) {
401 SCM pt = ly_cdar (s);
402 if (!unsmob_pitch (pt))
403 THIS->parser_error ("Need pitch object.");
405 scm_hashq_set_x (tab, ly_caar (s), pt);
412 lilypond_header_body:
414 $$ = ly_make_anonymous_module ();
415 THIS->lexer_->add_scope ($$);
417 | lilypond_header_body assignment {
423 HEADER '{' lilypond_header_body '}' {
424 $$ = THIS->lexer_-> remove_scope();
436 /* cont */ '=' identifier_init {
439 Should find generic way of associating input with objects.
441 Input ip = THIS->pop_spot ();
443 if (! regular_identifier_b ($1))
445 ip.warning (_ ("Identifier should have alphabetic characters only"));
448 THIS->lexer_->set_identifier ($1, $4);
451 TODO: devise standard for protection in parser.
453 The parser stack lives on the C-stack, which means that
454 all objects can be unprotected as soon as they're here.
465 $$ = $1->self_scm ();
466 scm_gc_unprotect_object ($$);
472 $$ = $1->self_scm ();
473 scm_gc_unprotect_object ($$);
475 | translator_spec_block {
479 $$ = $1->self_scm ();
480 scm_gc_unprotect_object ($$);
483 $$ = $1->self_scm ();
484 scm_gc_unprotect_object ($$);
489 | number_expression {
500 translator_spec_block:
501 TRANSLATOR '{' translator_spec_body '}'
507 translator_spec_body:
508 TRANSLATOR_IDENTIFIER {
510 unsmob_translator_def ($$)-> set_spot (THIS->here_input ());
513 $$ = Translator_def::make_scm ();
514 Translator_def*td = unsmob_translator_def ($$);
515 td->translator_group_type_ = $2;
516 td->set_spot (THIS->here_input ());
518 | translator_spec_body STRING '=' embedded_scm {
519 unsmob_translator_def ($$)->add_property_assign ($2, $4);
521 | translator_spec_body STRING OVERRIDE embedded_scm '=' embedded_scm {
522 unsmob_translator_def ($$)
523 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
525 | translator_spec_body STRING SET embedded_scm '=' embedded_scm {
526 unsmob_translator_def ($$)
527 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
529 | translator_spec_body STRING REVERT embedded_scm {
530 unsmob_translator_def ($$)->add_pop_property (
531 scm_string_to_symbol ($2), $4);
533 | translator_spec_body NAME STRING {
534 unsmob_translator_def ($$)->type_name_ = $3;
536 | translator_spec_body CONSISTS STRING {
537 unsmob_translator_def ($$)->add_element ($3);
539 | translator_spec_body ALIAS STRING {
540 Translator_def*td = unsmob_translator_def ($$);
541 td->type_aliases_ = scm_cons ($3, td->type_aliases_);
543 | translator_spec_body GROBDESCRIPTIONS embedded_scm {
544 Translator_def*td = unsmob_translator_def($$);
545 // td->add_property_assign (ly_symbol2scm ("allGrobDescriptions"), $3);
546 for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p))
547 td->add_property_assign (scm_symbol_to_string (ly_caar (p)), ly_cdar (p));
549 | translator_spec_body CONSISTSEND STRING {
550 unsmob_translator_def ($$)->add_last_element ( $3);
552 | translator_spec_body ACCEPTS STRING {
553 unsmob_translator_def ($$)->set_acceptor ($3,true);
555 | translator_spec_body DENIES STRING {
556 unsmob_translator_def ($$)->set_acceptor ($3,false);
558 | translator_spec_body REMOVE STRING {
559 unsmob_translator_def ($$)->remove_element ($3);
570 /*cont*/ '{' score_body '}' {
573 if (!$$->defs_.size ())
575 Music_output_def *id =
576 unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
577 $$->add_output (id ? id->clone () : new Paper_def );
586 $$->set_spot (THIS->here_input ());
587 SCM m = $1->self_scm ();
588 scm_gc_unprotect_object (m);
593 SCM check_funcs = scm_c_eval_string ("toplevel-music-functions");
594 for (; gh_pair_p (check_funcs); check_funcs = gh_cdr (check_funcs))
595 m = gh_call1 (gh_car (check_funcs), m);
600 $$ = unsmob_score ($1);
601 $$->set_spot (THIS->here_input ());
603 | score_body lilypond_header {
606 | score_body output_def {
619 music_output_def_body '}' {
621 THIS-> lexer_-> remove_scope ();
625 music_output_def_body:
627 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultmidi"));
632 p = dynamic_cast<Midi_def*> (id->clone ());
637 THIS->lexer_->add_scope (p->scope_);
640 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
643 p = dynamic_cast<Paper_def*> (id->clone ());
647 THIS->lexer_->add_scope (p->scope_);
650 | PAPER '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
651 Music_output_def * o = unsmob_music_output_def ($3);
654 THIS->lexer_->add_scope (o->scope_);
656 | MIDI '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
657 Music_output_def * o = unsmob_music_output_def ($3);
660 THIS->lexer_->add_scope (o->scope_);
662 | music_output_def_body assignment {
665 | music_output_def_body translator_spec_block {
666 $$->assign_translator ($2);
668 | music_output_def_body tempo_event {
670 junk this ? there already is tempo stuff in
673 int m = gh_scm2int ( $2->get_mus_property ("metronome-count"));
674 Duration *d = unsmob_duration ($2->get_mus_property ("tempo-unit"));
675 Midi_def * md = dynamic_cast<Midi_def*> ($$);
677 md->set_tempo (d->get_length (), m);
679 | music_output_def_body error {
685 TEMPO steno_duration '=' bare_unsigned {
686 $$ = MY_MAKE_MUSIC("TempoEvent");
687 $$->set_mus_property ("tempo-unit", $2);
688 $$->set_mus_property ("metronome-count", gh_int2scm ( $4));
693 The representation of a list is the
697 to have efficient append.
701 $$ = scm_cons (SCM_EOL, SCM_EOL);
705 SCM c = scm_cons ($2->self_scm (), SCM_EOL);
706 scm_gc_unprotect_object ($2->self_scm ()); /* UGH */
707 if (gh_pair_p (ly_cdr (s)))
708 gh_set_cdr_x (ly_cdr (s), c); /* append */
710 gh_set_car_x (s, c); /* set first cons */
711 gh_set_cdr_x (s, c) ; /* remember last cell */
727 | ALTERNATIVE '{' Music_list '}' {
733 REPEAT string bare_unsigned Music Alternative_music
737 SCM alts = gh_pair_p ($5) ? gh_car ($5) : SCM_EOL;
738 if (times < scm_ilength (alts)) {
739 unsmob_music (gh_car (alts))
740 ->origin ()->warning (
741 _("More alternatives than repeats. Junking excess alternatives."));
742 alts = ly_truncate_list (times, alts);
748 proc = scm_c_eval_string ("make-repeated-music");
750 SCM mus = scm_call_1 (proc, $2);
751 scm_gc_protect_object (mus); // UGH.
752 Music *r =unsmob_music (mus);
755 r-> set_mus_property ("element", beg->self_scm ());
756 scm_gc_unprotect_object (beg->self_scm ());
758 r->set_mus_property ("repeat-count", gh_int2scm (times >? 1));
760 r-> set_mus_property ("elements",alts);
761 if (gh_equal_p ($2, scm_makfrom0str ("tremolo")))
764 we can not get durations and other stuff correct down the line, so we have to
765 add to the duration log here.
767 SCM func = scm_primitive_eval (ly_symbol2scm ("shift-duration-log"));
769 gh_call3 (func, r->self_scm (), gh_int2scm(-intlog2 ($3*2/3)),gh_int2scm(1));
771 gh_call3 (func, r->self_scm (), gh_int2scm(-intlog2 ($3)), gh_int2scm(0));
773 r->set_spot (*$4->origin ());
780 SEQUENTIAL '{' Music_list '}' {
781 $$ = MY_MAKE_MUSIC("SequentialMusic");
782 $$->set_mus_property ("elements", ly_car ($3));
783 $$->set_spot(THIS->here_input());
785 | '{' Music_list '}' {
786 $$ = MY_MAKE_MUSIC("SequentialMusic");
787 $$->set_mus_property ("elements", ly_car ($2));
788 $$->set_spot(THIS->here_input());
793 SIMULTANEOUS '{' Music_list '}'{
794 $$ = MY_MAKE_MUSIC("SimultaneousMusic");
795 $$->set_mus_property ("elements", ly_car ($3));
796 $$->set_spot(THIS->here_input());
799 | '<' Music_list '>' {
800 $$ = MY_MAKE_MUSIC("SimultaneousMusic");
801 $$->set_mus_property ("elements", ly_car ($2));
802 $$->set_spot(THIS->here_input());
807 event_chord { $$ = $1; }
808 | APPLYCONTEXT embedded_scm {
809 if (!gh_procedure_p ($2))
810 THIS->parser_error (_ ("\applycontext takes function argument"));
811 $$ = MY_MAKE_MUSIC ("ApplyContext");
812 $$->set_mus_property ("procedure", $2);
813 $$->set_spot (THIS->here_input());
815 | OUTPUTPROPERTY embedded_scm embedded_scm '=' embedded_scm {
817 if (!gh_symbol_p ($3))
819 THIS->parser_error (_ ("Second argument must be a symbol"));
821 /* Should check # args */
822 if (!gh_procedure_p (pred))
824 THIS->parser_error (_ ("First argument must be a procedure taking one argument"));
827 Music*m = MY_MAKE_MUSIC("OutputPropertySetMusic");
828 m->set_mus_property ("predicate", pred);
829 m->set_mus_property ("grob-property", $3);
830 m->set_mus_property ("grob-value", $5);
835 $$ = unsmob_music ($1);
843 CONTEXT STRING Music {
844 Music*csm =MY_MAKE_MUSIC("ContextSpeccedMusic");
846 csm->set_mus_property ("element", $3->self_scm ());
847 scm_gc_unprotect_object ($3->self_scm ());
849 csm->set_mus_property ("context-type",$2);
850 csm->set_mus_property ("context-id", scm_makfrom0str (""));
854 | AUTOCHANGE STRING Music {
855 Music*chm = MY_MAKE_MUSIC("AutoChangeMusic");
856 chm->set_mus_property ("element", $3->self_scm ());
857 chm->set_mus_property ("iterator-ctor", Auto_change_iterator::constructor_proc);
859 scm_gc_unprotect_object ($3->self_scm ());
860 chm->set_mus_property ("what", $2);
863 chm->set_spot (*$3->origin ());
868 The other version is for easier debugging of
869 Sequential_music_iterator in combination with grace notes.
872 SCM start = THIS->lexer_->lookup_identifier ("startGraceMusic");
873 SCM stop = THIS->lexer_->lookup_identifier ("stopGraceMusic");
874 Music *startm = unsmob_music (start);
875 Music *stopm = unsmob_music (stop);
879 stopm = stopm->clone ();
880 ms = scm_cons (stopm->self_scm (), ms);
881 scm_gc_unprotect_object (stopm->self_scm ());
883 ms = scm_cons ($2->self_scm (), ms);
884 scm_gc_unprotect_object ($2->self_scm());
886 startm = startm->clone ();
887 ms = scm_cons (startm->self_scm () , ms);
888 scm_gc_unprotect_object (startm->self_scm ());
892 Music* seq = MY_MAKE_MUSIC("SequentialMusic");
893 seq->set_mus_property ("elements", ms);
896 $$ = MY_MAKE_MUSIC("GraceMusic");
897 $$->set_mus_property ("element", seq->self_scm ());
898 scm_gc_unprotect_object (seq->self_scm ());
900 $$ = MY_MAKE_MUSIC("GraceMusic");
901 $$->set_mus_property ("element", $2->self_scm ());
902 scm_gc_unprotect_object ($2->self_scm ());
905 | CONTEXT string '=' string Music {
906 Music * csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
908 csm->set_mus_property ("element", $5->self_scm ());
909 scm_gc_unprotect_object ($5->self_scm ());
911 csm->set_mus_property ("context-type", $2);
912 csm->set_mus_property ("context-id", $4);
923 int n = gh_scm2int (ly_car ($3)); int d = gh_scm2int (ly_cdr ($3));
925 $$= MY_MAKE_MUSIC("TimeScaledMusic");
926 $$->set_spot (THIS->pop_spot ());
929 $$->set_mus_property ("element", mp->self_scm ());
930 scm_gc_unprotect_object (mp->self_scm ());
931 $$->set_mus_property ("numerator", gh_int2scm (n));
932 $$->set_mus_property ("denominator", gh_int2scm (d));
933 $$->compress (Moment (Rational (n,d)));
936 | Repeated_music { $$ = $1; }
937 | Simultaneous_music { $$ = $1; }
938 | Sequential_music { $$ = $1; }
939 | TRANSPOSE pitch_also_in_chords pitch_also_in_chords Music {
940 $$ = MY_MAKE_MUSIC("TransposedMusic");
942 Pitch from = *unsmob_pitch ($2);
943 Pitch to = *unsmob_pitch ($3);
945 p->transpose (interval (from, to));
946 $$->set_mus_property ("element", p->self_scm ());
947 scm_gc_unprotect_object (p->self_scm ());
949 | APPLY embedded_scm Music {
950 SCM ret = gh_call1 ($2, $3->self_scm ());
951 Music *m = unsmob_music (ret);
953 THIS->parser_error ("\\apply must return a Music");
954 m = MY_MAKE_MUSIC("Music");
959 { THIS->lexer_->push_note_state (); }
962 THIS->lexer_->pop_state ();
965 { THIS->lexer_->push_figuredbass_state (); }
968 Music * chm = MY_MAKE_MUSIC("UntransposableMusic");
969 chm->set_mus_property ("element", $3->self_scm ());
971 scm_gc_unprotect_object ($3->self_scm());
973 THIS->lexer_->pop_state ();
976 { THIS->lexer_->push_chord_state (); }
979 Music * chm = MY_MAKE_MUSIC("UnrelativableMusic");
980 chm->set_mus_property ("element", $3->self_scm ());
981 scm_gc_unprotect_object ($3->self_scm());
984 THIS->lexer_->pop_state ();
987 { THIS->lexer_->push_lyric_state (); }
991 THIS->lexer_->pop_state ();
993 | relative_music { $$ = $1; }
994 | re_rhythmed_music { $$ = $1; }
995 | part_combined_music { $$ = $1; }
999 RELATIVE absolute_pitch Music {
1001 Pitch pit = *unsmob_pitch ($2);
1002 $$ = MY_MAKE_MUSIC("RelativeOctaveMusic");
1004 $$->set_mus_property ("element", p->self_scm ());
1005 scm_gc_unprotect_object (p->self_scm ());
1007 $$->set_mus_property ("last-pitch", p->to_relative_octave (pit).smobbed_copy ());
1013 ADDLYRICS Music Music {
1014 Music*l =MY_MAKE_MUSIC("LyricCombineMusic");
1015 l->set_mus_property ("elements", gh_list ($2->self_scm (), $3->self_scm (), SCM_UNDEFINED));
1016 scm_gc_unprotect_object ($3->self_scm ());
1017 scm_gc_unprotect_object ($2->self_scm ());
1022 part_combined_music:
1023 PARTCOMBINE STRING Music Music {
1024 Music * p= MY_MAKE_MUSIC("PartCombineMusic");
1025 p->set_mus_property ("what", $2);
1026 p->set_mus_property ("elements", gh_list ($3->self_scm (),$4->self_scm (), SCM_UNDEFINED));
1028 scm_gc_unprotect_object ($3->self_scm ());
1029 scm_gc_unprotect_object ($4->self_scm ());
1036 TRANSLATOR STRING '=' STRING {
1037 Music*t= MY_MAKE_MUSIC("TranslatorChange");
1038 t-> set_mus_property ("change-to-type", $2);
1039 t-> set_mus_property ("change-to-id", $4);
1042 $$->set_spot (THIS->here_input ());
1048 | ONCE simple_property_def {
1050 SCM e = $2->get_mus_property ("element");
1051 unsmob_music (e)->set_mus_property ("once", SCM_BOOL_T);
1055 simple_property_def:
1056 PROPERTY STRING '.' STRING '=' scalar {
1057 Music *t = set_property_music (scm_string_to_symbol ($4), $6);
1058 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1060 csm->set_mus_property ("element", t->self_scm ());
1061 scm_gc_unprotect_object (t->self_scm ());
1064 $$->set_spot (THIS->here_input ());
1066 csm-> set_mus_property ("context-type", $2);
1068 | PROPERTY STRING '.' STRING UNSET {
1070 Music *t = MY_MAKE_MUSIC("PropertyUnset");
1071 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1073 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1074 csm->set_mus_property ("element", t->self_scm ());
1075 scm_gc_unprotect_object (t->self_scm ());
1078 $$->set_spot (THIS->here_input ());
1080 csm-> set_mus_property ("context-type", $2);
1082 | PROPERTY STRING '.' STRING SET embedded_scm '=' embedded_scm {
1084 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1085 bool itc = internal_type_checking_global_b;
1086 Music *t = MY_MAKE_MUSIC("OverrideProperty");
1087 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1088 t->set_mus_property ("pop-first", SCM_BOOL_T);
1090 internal_type_checking_global_b = false;
1091 t->set_mus_property ("grob-property", $6);
1093 internal_type_checking_global_b = itc;
1094 t->set_mus_property ("grob-value", $8);
1096 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1097 csm->set_mus_property ("element", t->self_scm ());
1098 scm_gc_unprotect_object (t->self_scm ());
1100 $$->set_spot (THIS->here_input ());
1102 csm-> set_mus_property ("context-type", $2);
1104 | PROPERTY STRING '.' STRING OVERRIDE
1105 embedded_scm '=' embedded_scm
1111 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1112 bool itc = internal_type_checking_global_b;
1114 Music *t = MY_MAKE_MUSIC("OverrideProperty");
1115 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1117 internal_type_checking_global_b = false;
1118 t->set_mus_property ("grob-property", $6);
1119 t->set_mus_property ("grob-value", $8);
1121 internal_type_checking_global_b = itc;
1123 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1124 csm->set_mus_property ("element", t->self_scm ());
1125 scm_gc_unprotect_object (t->self_scm ());
1128 $$->set_spot (THIS->here_input ());
1130 csm-> set_mus_property ("context-type", $2);
1133 | PROPERTY STRING '.' STRING REVERT embedded_scm {
1134 Music *t = MY_MAKE_MUSIC("RevertProperty");
1136 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1137 bool itc = internal_type_checking_global_b;
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 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
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; }
1162 | full_markup { $$ = $1; }
1169 } /*cont */ simple_element post_events {
1170 SCM elts = $3-> get_mus_property ("elements");
1172 elts = gh_append3 (elts, scm_reverse_x ($1, SCM_EOL),
1173 scm_reverse_x ($4, SCM_EOL));
1175 $3-> set_mus_property ("elements", elts);
1179 | note_chord_element
1184 chord_body optional_notemode_duration post_events
1186 SCM dur = unsmob_duration ($2)->smobbed_copy();
1187 SCM es = $1->get_mus_property ("elements");
1188 SCM postevs = scm_reverse_x ($3, SCM_EOL);
1190 for (SCM s = es; gh_pair_p (s); s = gh_cdr (s))
1191 unsmob_music (gh_car(s))->set_mus_property ("duration", dur);
1192 es = gh_append2 (es, postevs);
1194 $1-> set_mus_property ("elements", es);
1200 CHORD_OPEN chord_body_elements CHORD_CLOSE
1202 $$ = MY_MAKE_MUSIC("EventChord");
1203 $$->set_mus_property ("elements",
1204 scm_reverse_x ($2, SCM_EOL));
1208 chord_body_elements:
1209 /* empty */ { $$ = SCM_EOL; }
1210 | chord_body_elements chord_body_element {
1211 $$ = gh_cons ($2->self_scm(), $1);
1212 scm_gc_unprotect_object ($2->self_scm());
1217 pitch exclamations questions post_events
1219 Music * n = MY_MAKE_MUSIC("NoteEvent");
1220 n->set_mus_property ("pitch", $1);
1222 n->set_mus_property ("cautionary", SCM_BOOL_T);
1223 if ($2 % 2 || $3 % 2)
1224 n->set_mus_property ("force-accidental", SCM_BOOL_T);
1226 SCM arts = scm_reverse_x ($4, SCM_EOL);
1227 n->set_mus_property ("articulations", arts);
1235 $$ = MY_MAKE_MUSIC("EventChord");
1236 $$->set_mus_property ("elements", scm_cons ($1->self_scm (), SCM_EOL));
1237 scm_gc_unprotect_object ($1->self_scm());
1239 $$-> set_spot (THIS->here_input ());
1240 $1-> set_spot (THIS->here_input ());
1243 Music *l = MY_MAKE_MUSIC("LigatureEvent");
1244 l->set_mus_property ("span-direction", gh_int2scm (START));
1245 l->set_spot (THIS->here_input ());
1247 $$ = MY_MAKE_MUSIC("EventChord");
1248 $$->set_mus_property ("elements", scm_cons (l->self_scm (), SCM_EOL));
1249 scm_gc_unprotect_object (l->self_scm());
1250 $$->set_spot (THIS->here_input ());
1253 Music *l = MY_MAKE_MUSIC("LigatureEvent");
1254 l->set_mus_property ("span-direction", gh_int2scm (STOP));
1255 l->set_spot (THIS->here_input ());
1257 $$ = MY_MAKE_MUSIC("EventChord");
1258 $$->set_mus_property ("elements", scm_cons (l->self_scm (), SCM_EOL));
1259 $$->set_spot (THIS->here_input ());
1260 scm_gc_unprotect_object (l->self_scm());
1263 $$ = MY_MAKE_MUSIC("VoiceSeparator");
1264 $$->set_spot (THIS->here_input ());
1268 $$ = MY_MAKE_MUSIC("BarCheck");
1269 $$->set_spot (THIS->here_input ());
1272 Music *t = set_property_music (ly_symbol2scm ("whichBar"), $2);
1274 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1275 csm->set_mus_property ("element", t->self_scm ());
1276 scm_gc_unprotect_object (t->self_scm ());
1279 $$->set_spot (THIS->here_input ());
1281 csm->set_mus_property ("context-type", scm_makfrom0str ("Timing"));
1283 | PARTIAL duration_length {
1284 Moment m = - unsmob_duration ($2)->get_length ();
1285 Music * p = set_property_music (ly_symbol2scm ( "measurePosition"),m.smobbed_copy ());
1287 Music * sp = MY_MAKE_MUSIC("ContextSpeccedMusic");
1288 sp->set_mus_property ("element", p->self_scm ());
1289 scm_gc_unprotect_object (p->self_scm ());
1292 sp-> set_mus_property ("context-type", scm_makfrom0str ("Timing"));
1297 proc = scm_c_eval_string ("make-clef-set");
1299 SCM result = scm_call_1 (proc, $2);
1300 scm_gc_protect_object (result);
1301 $$ = unsmob_music (result);
1306 proc = scm_c_eval_string ("make-time-signature-set");
1308 SCM result = scm_apply_2 (proc, gh_car ($2), gh_cdr ($2), SCM_EOL);
1309 scm_gc_protect_object (result);
1310 $$ = unsmob_music (result);
1315 shorthand_command_req { $$ = $1; }
1316 | verbose_command_req { $$ = $1; }
1319 shorthand_command_req:
1327 $$ = MY_MAKE_MUSIC("TieEvent");
1330 Music *b= MY_MAKE_MUSIC("BeamEvent");
1331 b->set_mus_property ("span-direction", gh_int2scm (START));
1334 THIS->last_beam_start_ = b->self_scm ();
1337 Music *b= MY_MAKE_MUSIC("BeamEvent");
1338 b->set_mus_property ("span-direction", gh_int2scm (STOP));
1342 $$ = MY_MAKE_MUSIC("BreathingSignEvent");
1345 $$ = MY_MAKE_MUSIC("PorrectusEvent");
1349 verbose_command_req:
1351 Music * m = MY_MAKE_MUSIC("MarkEvent");
1355 Music *m = MY_MAKE_MUSIC("MarkEvent");
1356 m->set_mus_property ("label", $2);
1359 | SKIP duration_length {
1360 Music * skip = MY_MAKE_MUSIC("SkipEvent");
1361 skip->set_mus_property ("duration", $2);
1369 Music *key= MY_MAKE_MUSIC("KeyChangeEvent");
1372 | KEY NOTENAME_PITCH SCM_IDENTIFIER {
1373 Music *key= MY_MAKE_MUSIC("KeyChangeEvent");
1375 key->set_mus_property ("pitch-alist", $3);
1376 ((Music*)key)->transpose (* unsmob_pitch ($2));
1385 | post_events post_event {
1386 $2->set_spot (THIS->here_input ());
1387 $$ = gh_cons ($2->self_scm(), $$);
1388 scm_gc_unprotect_object ($2->self_scm());
1401 Music * s = MY_MAKE_MUSIC("StringNumberEvent");
1402 s->set_mus_property ("string-number", gh_int2scm($1));
1403 s->set_spot (THIS->here_input ());
1409 event_that_take_dir:
1415 Music * m = MY_MAKE_MUSIC ("NewBeamEvent");
1416 m->set_spot (THIS->here_input());
1417 m->set_mus_property ("span-direction" , gh_int2scm (START));
1421 Music * m = MY_MAKE_MUSIC ("NewBeamEvent");
1422 m->set_spot (THIS->here_input());
1423 m->set_mus_property ("span-direction" , gh_int2scm (STOP));
1427 Music * m = MY_MAKE_MUSIC ("NewTieEvent");
1428 m->set_spot (THIS->here_input());
1431 | script_abbreviation {
1432 SCM s = THIS->lexer_->lookup_identifier ("dash" + ly_scm2string ($1));
1433 Music *a = MY_MAKE_MUSIC("ArticulationEvent");
1434 if (gh_string_p (s))
1435 a->set_mus_property ("articulation-type", s);
1436 else THIS->parser_error (_ ("Expecting string as script definition"));
1442 script_dir event_that_take_dir {
1443 $2->set_mus_property ("direction", gh_int2scm ($1));
1450 $$ = unsmob_music ($1);
1453 Music * a = MY_MAKE_MUSIC("TremoloEvent");
1454 a->set_spot (THIS->here_input ());
1455 a->set_mus_property ("tremolo-type", gh_int2scm ($1));
1482 | NOTENAME_PITCH sup_quotes {
1483 Pitch p = *unsmob_pitch ($1);
1485 $$ = p.smobbed_copy ();
1487 | NOTENAME_PITCH sub_quotes {
1488 Pitch p =* unsmob_pitch ($1);
1491 $$ = p.smobbed_copy ();
1504 | TONICNAME_PITCH sup_quotes {
1505 Pitch p = *unsmob_pitch ($1);
1507 $$ = p.smobbed_copy ();
1509 | TONICNAME_PITCH sub_quotes {
1510 Pitch p =* unsmob_pitch ($1);
1513 $$ = p.smobbed_copy ();
1527 pitch_also_in_chords:
1533 PITCH embedded_scm {
1535 if (!unsmob_pitch ($2)) {
1536 THIS->parser_error (_f ("Expecting musical-pitch value", 3));
1537 $$ = Pitch ().smobbed_copy ();
1543 DURATION embedded_scm {
1545 if (!unsmob_duration ($2))
1547 THIS->parser_error (_ ("Must have duration object"));
1548 $$ = Duration ().smobbed_copy ();
1555 if (!THIS->lexer_->lyric_state_b ())
1556 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1557 $$ = MY_MAKE_MUSIC("ExtenderEvent");
1563 if (!THIS->lexer_->lyric_state_b ())
1564 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1565 $$ = MY_MAKE_MUSIC("HyphenEvent");
1570 close_event_parens {
1572 dynamic_cast<Music *> ($$)->set_mus_property ("span-direction", gh_int2scm (START))
1579 Music * s= MY_MAKE_MUSIC("SlurEvent");
1581 s->set_spot (THIS->here_input());
1584 Music * s= MY_MAKE_MUSIC("PhrasingSlurEvent");
1586 s->set_spot (THIS->here_input());
1589 Music *s =MY_MAKE_MUSIC("CrescendoEvent");
1591 s->set_spot (THIS->here_input());
1594 Music *s =MY_MAKE_MUSIC("DecrescendoEvent");
1596 s->set_spot (THIS->here_input());
1604 dynamic_cast<Music *> ($$)->set_mus_property ("span-direction", gh_int2scm (STOP))
1611 Music *s = MY_MAKE_MUSIC("CrescendoEvent");
1612 s->set_spot (THIS->here_input());
1617 Music * s= MY_MAKE_MUSIC("SlurEvent");
1619 s->set_spot (THIS->here_input());
1623 Music * s= MY_MAKE_MUSIC("PhrasingSlurEvent");
1625 s->set_mus_property ("span-type", scm_makfrom0str ( "phrasing-slur"));
1626 s->set_spot (THIS->here_input());
1632 Music *t = MY_MAKE_MUSIC("TextScriptEvent");
1633 t->set_mus_property ("text", $1);
1634 t->set_spot (THIS->here_input ());
1638 Music *t = MY_MAKE_MUSIC("TextScriptEvent");
1639 t->set_mus_property ("text", $1);
1640 t->set_spot (THIS->here_input ());
1644 Music *t = MY_MAKE_MUSIC("TextScriptEvent");
1645 t->set_mus_property ("text", make_simple_markup ($1));
1646 t->set_spot (THIS->here_input ());
1651 Music * t = MY_MAKE_MUSIC("FingerEvent");
1652 t->set_mus_property ("digit", gh_int2scm ($1));
1653 t->set_spot (THIS->here_input ());
1658 script_abbreviation:
1660 $$ = scm_makfrom0str ("Hat");
1663 $$ = scm_makfrom0str ("Plus");
1666 $$ = scm_makfrom0str ("Dash");
1669 $$ = scm_makfrom0str ("Bar");
1672 $$ = scm_makfrom0str ("Larger");
1675 $$ = scm_makfrom0str ("Dot");
1678 $$ = scm_makfrom0str ("Underscore");
1685 | '-' { $$ = CENTER; }
1692 | pre_events open_event {
1693 $$ = gh_cons ($2->self_scm(), $$);
1694 scm_gc_unprotect_object ($2->self_scm());
1705 multiplied_duration {
1708 | verbose_duration {
1713 optional_notemode_duration:
1715 Duration dd = THIS->default_duration_;
1716 $$ = dd.smobbed_copy ();
1718 THIS->beam_check ($$);
1720 | multiplied_duration {
1722 THIS->default_duration_ = *unsmob_duration ($$);
1724 THIS->beam_check ($$);
1726 | verbose_duration {
1728 THIS->default_duration_ = *unsmob_duration ($$);
1733 bare_unsigned dots {
1735 if (!is_duration_b ($1))
1736 THIS->parser_error (_f ("not a duration: %d", $1));
1740 $$ = Duration (l, $2).smobbed_copy ();
1742 | DURATION_IDENTIFIER dots {
1743 Duration *d =unsmob_duration ($1);
1744 Duration k (d->duration_log (),d->dot_count () + $2);
1754 multiplied_duration:
1758 | multiplied_duration '*' bare_unsigned {
1759 $$ = unsmob_duration ($$)->compressed ( $3) .smobbed_copy ();
1761 | multiplied_duration '*' FRACTION {
1762 Rational m (gh_scm2int (ly_car ($3)), gh_scm2int (ly_cdr ($3)));
1764 $$ = unsmob_duration ($$)->compressed (m).smobbed_copy ();
1769 FRACTION { $$ = $1; }
1770 | UNSIGNED '/' UNSIGNED {
1771 $$ = scm_cons (gh_int2scm ($1), gh_int2scm ($3));
1789 | ':' bare_unsigned {
1790 if (!is_duration_b ($2))
1791 THIS->parser_error (_f ("not a duration: %d", $2));
1798 /*****************************************************************
1800 *****************************************************************/
1814 Music *bfr = MY_MAKE_MUSIC("BassFigureEvent");
1815 $$ = bfr->self_scm();
1816 scm_gc_unprotect_object ($$);
1819 Music *bfr = MY_MAKE_MUSIC("BassFigureEvent");
1820 $$ = bfr->self_scm();
1822 bfr->set_mus_property ("figure", gh_int2scm ($1));
1824 scm_gc_unprotect_object ($$);
1826 | bass_figure bass_mod {
1827 Music *m = unsmob_music ($1);
1829 SCM salter =m->get_mus_property ("alteration");
1830 int alter = gh_number_p ( salter) ? gh_scm2int (salter) : 0;
1831 m->set_mus_property ("alteration",
1832 gh_int2scm (alter + $2));
1834 m->set_mus_property ("alteration", gh_int2scm (0));
1842 unsmob_music ($$)->set_mus_property ("bracket-start", SCM_BOOL_T);
1847 | br_bass_figure ']' {
1849 unsmob_music ($1)->set_mus_property ("bracket-stop", SCM_BOOL_T);
1857 | figure_list br_bass_figure {
1858 $$ = scm_cons ($2, $1);
1863 FIGURE_OPEN figure_list FIGURE_CLOSE {
1864 Music * m = MY_MAKE_MUSIC("EventChord");
1865 $2 = scm_reverse_x ($2, SCM_EOL);
1866 m->set_mus_property ("elements", $2);
1867 $$ = m->self_scm ();
1878 pitch exclamations questions optional_notemode_duration optional_rest {
1880 Input i = THIS->pop_spot ();
1881 if (!THIS->lexer_->note_state_b ())
1882 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1886 n = MY_MAKE_MUSIC("RestEvent");
1888 n = MY_MAKE_MUSIC("NoteEvent");
1890 n->set_mus_property ("pitch", $1);
1891 n->set_mus_property ("duration", $4);
1895 n->set_mus_property ("cautionary", SCM_BOOL_T);
1896 if ($2 % 2 || $3 % 2)
1897 n->set_mus_property ("force-accidental", SCM_BOOL_T);
1899 Music *v = MY_MAKE_MUSIC("EventChord");
1900 v->set_mus_property ("elements", scm_list_n (n->self_scm (), SCM_UNDEFINED));
1901 scm_gc_unprotect_object (n->self_scm());
1907 | figure_spec optional_notemode_duration {
1908 Music * m = unsmob_music ($1);
1909 Input i = THIS->pop_spot ();
1911 for (SCM s = m->get_mus_property ("elements"); gh_pair_p (s); s = ly_cdr (s))
1913 unsmob_music (ly_car (s))->set_mus_property ("duration", $2);
1917 | RESTNAME optional_notemode_duration {
1919 Input i = THIS->pop_spot ();
1921 if (ly_scm2string ($1) =="s") {
1923 ev = MY_MAKE_MUSIC("SkipEvent");
1926 ev = MY_MAKE_MUSIC("RestEvent");
1929 ev->set_mus_property ("duration" ,$2);
1931 Music * velt = MY_MAKE_MUSIC("EventChord");
1932 velt->set_mus_property ("elements", scm_list_n (ev->self_scm (),SCM_UNDEFINED));
1937 | MULTI_MEASURE_REST optional_notemode_duration {
1942 proc = scm_c_eval_string ("make-multi-measure-rest");
1944 SCM mus = scm_call_2 (proc, $2,
1945 make_input (THIS->here_input()));
1946 scm_gc_protect_object (mus);
1947 $$ = unsmob_music (mus);
1949 | STRING optional_notemode_duration {
1950 Input i = THIS->pop_spot ();
1952 Music * lreq = MY_MAKE_MUSIC("LyricEvent");
1953 lreq->set_mus_property ("text", $1);
1954 lreq->set_mus_property ("duration",$2);
1956 Music * velt = MY_MAKE_MUSIC("EventChord");
1957 velt->set_mus_property ("elements", scm_list_n (lreq->self_scm (), SCM_UNDEFINED));
1964 if (!THIS->lexer_->chord_state_b ())
1965 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1972 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
1973 $$ = Chord::get_chord ($1, $3, $4, $5, $6, $2);
1974 $$->set_spot (THIS->here_input ());
1981 | CHORD_COLON chord_notes {
1990 | chord_notes '.' chord_step {
1991 $$ = gh_append2 ($$, $3);
1999 | CHORD_CARET chord_notes {
2009 | CHORD_SLASH steno_tonic_pitch {
2018 | CHORD_BASS steno_tonic_pitch {
2025 $$ = scm_cons ($1, SCM_EOL);
2027 | CHORDMODIFIER_PITCH {
2028 $$ = scm_cons (unsmob_pitch ($1)->smobbed_copy (), SCM_EOL);
2030 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
2031 $$ = scm_list_n (unsmob_pitch ($1)->smobbed_copy (),
2039 m.notename_ = ($1 - 1) % 7;
2040 m.octave_ = $1 > 7 ? 1 : 0;
2043 $$ = m.smobbed_copy ();
2045 | bare_unsigned '+' {
2047 m.notename_ = ($1 - 1) % 7;
2048 m.octave_ = $1 > 7 ? 1 : 0;
2052 $$ = m.smobbed_copy ();
2054 | bare_unsigned CHORD_MINUS {
2056 m.notename_ = ($1 - 1) % 7;
2057 m.octave_ = $1 > 7 ? 1 : 0;
2060 $$ = m.smobbed_copy ();
2068 number_expression '+' number_term {
2069 $$ = scm_sum ($1, $3);
2071 | number_expression '-' number_term {
2072 $$ = scm_difference ($1, $3);
2081 | number_factor '*' number_factor {
2082 $$ = scm_product ($1, $3);
2084 | number_factor '/' number_factor {
2085 $$ = scm_divide ($1, $3);
2090 '-' number_factor { /* %prec UNARY_MINUS */
2091 $$ = scm_difference ($2, SCM_UNDEFINED);
2099 $$ = gh_int2scm ($1);
2104 | NUMBER_IDENTIFIER {
2107 | REAL NUMBER_IDENTIFIER {
2108 $$ = gh_double2scm (gh_scm2double ($1) * gh_scm2double ($2));
2110 | UNSIGNED NUMBER_IDENTIFIER {
2111 $$ = gh_double2scm ($1 * gh_scm2double ($2));
2127 if (scm_integer_p ($1) == SCM_BOOL_T)
2129 int k = gh_scm2int ($1);
2133 THIS->parser_error (_ ("need integer number arg"));
2147 | STRING_IDENTIFIER {
2150 | string '+' string {
2151 $$ = scm_string_append (scm_list_n ($1, $3, SCM_UNDEFINED));
2158 | exclamations '!' { $$ ++; }
2163 | questions '?' { $$ ++; }
2173 { THIS->lexer_->push_markup_state (); }
2176 THIS->lexer_->pop_state ();
2182 $$ = make_simple_markup ($1);
2184 | MARKUP_HEAD_MARKUP0 markup {
2185 $$ = scm_list_n ($1, $2, SCM_UNDEFINED);
2187 | MARKUP_HEAD_MARKUP0_MARKUP1 markup markup {
2188 $$ = scm_list_n ($1, $2, $3, SCM_UNDEFINED);
2190 | MARKUP_HEAD_SCM0_MARKUP1 SCM_T markup {
2191 $$ = scm_list_n ($1, $2, $3, SCM_UNDEFINED);
2196 | MARKUP_HEAD_LIST0 markup_list {
2197 $$ = scm_list_n ($1,$2, SCM_UNDEFINED);
2199 | MARKUP_HEAD_SCM0 embedded_scm {
2200 $$ = scm_list_n ($1, $2, SCM_UNDEFINED);
2202 | MARKUP_HEAD_SCM0_SCM1_MARKUP2 embedded_scm embedded_scm markup {
2203 $$ = scm_list_n ($1, $2, $3, $4, SCM_UNDEFINED);
2205 | MARKUP_IDENTIFIER {
2212 CHORD_OPEN markup_list_body CHORD_CLOSE { $$ = scm_reverse_x ($2, SCM_EOL); }
2216 '{' markup_list_body '}' {
2219 line = scm_c_eval_string ("line-markup");
2221 $$ = scm_list_n (line, scm_reverse_x ($2, SCM_EOL), SCM_UNDEFINED);
2226 /**/ { $$ = SCM_EOL; }
2227 | markup_list_body markup {
2228 $$ = gh_cons ($2, $1) ;
2236 My_lily_parser::set_yydebug (bool )
2243 extern My_lily_parser * current_parser;
2246 My_lily_parser::do_yyparse ()
2248 current_parser = this;;
2249 yyparse ((void*)this);
2254 Should make this optional? It will also complain when you do
2258 which is entirely legitimate.
2260 Or we can scrap it. Barchecks should detect wrong durations, and
2261 skipTypesetting speeds it up a lot.
2265 My_lily_parser::beam_check (SCM dur)
2267 Duration *d = unsmob_duration (dur);
2268 if (unsmob_music (last_beam_start_) && d->duration_log () <= 2)
2270 Music * m = unsmob_music (last_beam_start_);
2271 m->origin ()->warning (_("Suspect duration found following this beam"));
2273 last_beam_start_ = SCM_EOL;
2281 return gh_pair_p (x)
2282 && SCM_BOOL_F != scm_object_property (gh_car (x), ly_symbol2scm ("markup-signature"));
2285 It is a little strange, to have this function in this file, but
2286 otherwise, we have to import music classes into the lexer.
2290 My_lily_lexer::try_special_identifiers (SCM * destination, SCM sid)
2292 if (gh_string_p (sid)) {
2294 return STRING_IDENTIFIER;
2295 } else if (gh_number_p (sid)) {
2297 return NUMBER_IDENTIFIER;
2298 } else if (unsmob_translator_def (sid)) {
2299 *destination = unsmob_translator_def (sid)->clone_scm();
2300 return TRANSLATOR_IDENTIFIER;
2301 } else if (unsmob_score (sid)) {
2302 Score *sc = new Score (*unsmob_score (sid));
2303 *destination =sc->self_scm ();
2304 return SCORE_IDENTIFIER;
2305 } else if (Music * mus =unsmob_music (sid)) {
2306 *destination = unsmob_music (sid)->clone ()->self_scm();
2307 unsmob_music (*destination)->
2308 set_mus_property ("origin", make_input (last_input_));
2309 return dynamic_cast<Event*> (mus)
2310 ? EVENT_IDENTIFIER : MUSIC_IDENTIFIER;
2311 } else if (unsmob_duration (sid)) {
2312 *destination = unsmob_duration (sid)->smobbed_copy();
2313 return DURATION_IDENTIFIER;
2314 } else if (unsmob_music_output_def (sid)) {
2315 Music_output_def *p = unsmob_music_output_def (sid);
2318 *destination = p->self_scm();
2319 return MUSIC_OUTPUT_DEF_IDENTIFIER;
2320 } else if (new_markup_p (sid)) {
2322 return MARKUP_IDENTIFIER;