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);
411 lilypond_header_body:
413 $$ = ly_make_anonymous_module ();
414 THIS->lexer_->add_scope ($$);
416 | lilypond_header_body assignment {
422 HEADER '{' lilypond_header_body '}' {
423 $$ = THIS->lexer_-> remove_scope();
435 /* cont */ '=' identifier_init {
438 Should find generic way of associating input with objects.
440 Input ip = THIS->pop_spot ();
442 if (! regular_identifier_b ($1))
444 ip.warning (_ ("Identifier should have alphabetic characters only"));
447 THIS->lexer_->set_identifier ($1, $4);
450 TODO: devise standard for protection in parser.
452 The parser stack lives on the C-stack, which means that
453 all objects can be unprotected as soon as they're here.
464 $$ = $1->self_scm ();
465 scm_gc_unprotect_object ($$);
471 $$ = $1->self_scm ();
472 scm_gc_unprotect_object ($$);
474 | translator_spec_block {
478 $$ = $1->self_scm ();
479 scm_gc_unprotect_object ($$);
482 $$ = $1->self_scm ();
483 scm_gc_unprotect_object ($$);
488 | number_expression {
499 translator_spec_block:
500 TRANSLATOR '{' translator_spec_body '}'
506 translator_spec_body:
507 TRANSLATOR_IDENTIFIER {
509 unsmob_translator_def ($$)-> set_spot (THIS->here_input ());
512 $$ = Translator_def::make_scm ();
513 Translator_def*td = unsmob_translator_def ($$);
514 td->translator_group_type_ = $2;
515 td->set_spot (THIS->here_input ());
517 | translator_spec_body STRING '=' embedded_scm {
518 unsmob_translator_def ($$)->add_property_assign ($2, $4);
520 | translator_spec_body STRING OVERRIDE embedded_scm '=' embedded_scm {
521 unsmob_translator_def ($$)
522 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
524 | translator_spec_body STRING SET embedded_scm '=' embedded_scm {
525 unsmob_translator_def ($$)
526 ->add_push_property (scm_string_to_symbol ($2), $4, $6);
528 | translator_spec_body STRING REVERT embedded_scm {
529 unsmob_translator_def ($$)->add_pop_property (
530 scm_string_to_symbol ($2), $4);
532 | translator_spec_body NAME STRING {
533 unsmob_translator_def ($$)->type_name_ = $3;
535 | translator_spec_body CONSISTS STRING {
536 unsmob_translator_def ($$)->add_element ($3);
538 | translator_spec_body ALIAS STRING {
539 Translator_def*td = unsmob_translator_def ($$);
540 td->type_aliases_ = scm_cons ($3, td->type_aliases_);
542 | translator_spec_body GROBDESCRIPTIONS embedded_scm {
543 Translator_def*td = unsmob_translator_def($$);
544 // td->add_property_assign (ly_symbol2scm ("allGrobDescriptions"), $3);
545 for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p))
546 td->add_property_assign (scm_symbol_to_string (ly_caar (p)), ly_cdar (p));
548 | translator_spec_body CONSISTSEND STRING {
549 unsmob_translator_def ($$)->add_last_element ( $3);
551 | translator_spec_body ACCEPTS STRING {
552 unsmob_translator_def ($$)->set_acceptor ($3,true);
554 | translator_spec_body DENIES STRING {
555 unsmob_translator_def ($$)->set_acceptor ($3,false);
557 | translator_spec_body REMOVE STRING {
558 unsmob_translator_def ($$)->remove_element ($3);
569 /*cont*/ '{' score_body '}' {
572 if (!$$->defs_.size ())
574 Music_output_def *id =
575 unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
576 $$->add_output (id ? id->clone () : new Paper_def );
585 $$->set_spot (THIS->here_input ());
586 SCM m = $1->self_scm ();
587 scm_gc_unprotect_object (m);
592 SCM check_funcs = scm_c_eval_string ("toplevel-music-functions");
593 for (; gh_pair_p (check_funcs); check_funcs = gh_cdr (check_funcs))
594 m = gh_call1 (gh_car (check_funcs), m);
599 $$ = unsmob_score ($1);
600 $$->set_spot (THIS->here_input ());
602 | score_body lilypond_header {
605 | score_body output_def {
618 music_output_def_body '}' {
620 THIS-> lexer_-> remove_scope ();
624 music_output_def_body:
626 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultmidi"));
631 p = dynamic_cast<Midi_def*> (id->clone ());
636 THIS->lexer_->add_scope (p->scope_);
639 Music_output_def *id = unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
642 p = dynamic_cast<Paper_def*> (id->clone ());
646 THIS->lexer_->add_scope (p->scope_);
649 | PAPER '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
650 Music_output_def * o = unsmob_music_output_def ($3);
653 THIS->lexer_->add_scope (o->scope_);
655 | MIDI '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
656 Music_output_def * o = unsmob_music_output_def ($3);
659 THIS->lexer_->add_scope (o->scope_);
661 | music_output_def_body assignment {
664 | music_output_def_body translator_spec_block {
665 $$->assign_translator ($2);
667 | music_output_def_body tempo_event {
669 junk this ? there already is tempo stuff in
672 int m = gh_scm2int ( $2->get_mus_property ("metronome-count"));
673 Duration *d = unsmob_duration ($2->get_mus_property ("tempo-unit"));
674 Midi_def * md = dynamic_cast<Midi_def*> ($$);
676 md->set_tempo (d->get_length (), m);
678 | music_output_def_body error {
684 TEMPO steno_duration '=' bare_unsigned {
685 $$ = MY_MAKE_MUSIC("TempoEvent");
686 $$->set_mus_property ("tempo-unit", $2);
687 $$->set_mus_property ("metronome-count", gh_int2scm ( $4));
692 The representation of a list is the
696 to have efficient append.
700 $$ = scm_cons (SCM_EOL, SCM_EOL);
704 SCM c = scm_cons ($2->self_scm (), SCM_EOL);
705 scm_gc_unprotect_object ($2->self_scm ()); /* UGH */
706 if (gh_pair_p (ly_cdr (s)))
707 gh_set_cdr_x (ly_cdr (s), c); /* append */
709 gh_set_car_x (s, c); /* set first cons */
710 gh_set_cdr_x (s, c) ; /* remember last cell */
726 | ALTERNATIVE '{' Music_list '}' {
732 REPEAT string bare_unsigned Music Alternative_music
736 SCM alts = gh_pair_p ($5) ? gh_car ($5) : SCM_EOL;
737 if (times < scm_ilength (alts)) {
738 unsmob_music (gh_car (alts))
739 ->origin ()->warning (
740 _("More alternatives than repeats. Junking excess alternatives."));
741 alts = ly_truncate_list (times, alts);
747 proc = scm_c_eval_string ("make-repeated-music");
749 SCM mus = scm_call_1 (proc, $2);
750 scm_gc_protect_object (mus); // UGH.
751 Music *r =unsmob_music (mus);
754 r-> set_mus_property ("element", beg->self_scm ());
755 scm_gc_unprotect_object (beg->self_scm ());
757 r->set_mus_property ("repeat-count", gh_int2scm (times >? 1));
759 r-> set_mus_property ("elements",alts);
760 if (gh_equal_p ($2, scm_makfrom0str ("tremolo")))
763 we can not get durations and other stuff correct down the line, so we have to
764 add to the duration log here.
766 SCM func = scm_primitive_eval (ly_symbol2scm ("shift-duration-log"));
768 gh_call3 (func, r->self_scm (), gh_int2scm(-intlog2 ($3*2/3)),gh_int2scm(1));
770 gh_call3 (func, r->self_scm (), gh_int2scm(-intlog2 ($3)), gh_int2scm(0));
772 r->set_spot (*$4->origin ());
779 SEQUENTIAL '{' Music_list '}' {
780 $$ = MY_MAKE_MUSIC("SequentialMusic");
781 $$->set_mus_property ("elements", ly_car ($3));
782 $$->set_spot(THIS->here_input());
784 | '{' Music_list '}' {
785 $$ = MY_MAKE_MUSIC("SequentialMusic");
786 $$->set_mus_property ("elements", ly_car ($2));
787 $$->set_spot(THIS->here_input());
792 SIMULTANEOUS '{' Music_list '}'{
793 $$ = MY_MAKE_MUSIC("SimultaneousMusic");
794 $$->set_mus_property ("elements", ly_car ($3));
795 $$->set_spot(THIS->here_input());
798 | '<' Music_list '>' {
799 $$ = MY_MAKE_MUSIC("SimultaneousMusic");
800 $$->set_mus_property ("elements", ly_car ($2));
801 $$->set_spot(THIS->here_input());
806 event_chord { $$ = $1; }
807 | APPLYCONTEXT embedded_scm {
808 if (!gh_procedure_p ($2))
809 THIS->parser_error (_ ("\applycontext takes function argument"));
810 $$ = MY_MAKE_MUSIC ("ApplyContext");
811 $$->set_mus_property ("procedure", $2);
812 $$->set_spot (THIS->here_input());
814 | OUTPUTPROPERTY embedded_scm embedded_scm '=' embedded_scm {
816 if (!gh_symbol_p ($3))
818 THIS->parser_error (_ ("Second argument must be a symbol"));
820 /* Should check # args */
821 if (!gh_procedure_p (pred))
823 THIS->parser_error (_ ("First argument must be a procedure taking one argument"));
826 Music*m = MY_MAKE_MUSIC("OutputPropertySetMusic");
827 m->set_mus_property ("predicate", pred);
828 m->set_mus_property ("grob-property", $3);
829 m->set_mus_property ("grob-value", $5);
834 $$ = unsmob_music ($1);
842 CONTEXT STRING Music {
843 Music*csm =MY_MAKE_MUSIC("ContextSpeccedMusic");
845 csm->set_mus_property ("element", $3->self_scm ());
846 scm_gc_unprotect_object ($3->self_scm ());
848 csm->set_mus_property ("context-type",$2);
849 csm->set_mus_property ("context-id", scm_makfrom0str (""));
853 | AUTOCHANGE STRING Music {
854 Music*chm = MY_MAKE_MUSIC("AutoChangeMusic");
855 chm->set_mus_property ("element", $3->self_scm ());
856 chm->set_mus_property ("iterator-ctor", Auto_change_iterator::constructor_proc);
858 scm_gc_unprotect_object ($3->self_scm ());
859 chm->set_mus_property ("what", $2);
862 chm->set_spot (*$3->origin ());
867 The other version is for easier debugging of
868 Sequential_music_iterator in combination with grace notes.
871 SCM start = THIS->lexer_->lookup_identifier ("startGraceMusic");
872 SCM stop = THIS->lexer_->lookup_identifier ("stopGraceMusic");
873 Music *startm = unsmob_music (start);
874 Music *stopm = unsmob_music (stop);
878 stopm = stopm->clone ();
879 ms = scm_cons (stopm->self_scm (), ms);
880 scm_gc_unprotect_object (stopm->self_scm ());
882 ms = scm_cons ($2->self_scm (), ms);
883 scm_gc_unprotect_object ($2->self_scm());
885 startm = startm->clone ();
886 ms = scm_cons (startm->self_scm () , ms);
887 scm_gc_unprotect_object (startm->self_scm ());
891 Music* seq = MY_MAKE_MUSIC("SequentialMusic");
892 seq->set_mus_property ("elements", ms);
895 $$ = MY_MAKE_MUSIC("GraceMusic");
896 $$->set_mus_property ("element", seq->self_scm ());
897 scm_gc_unprotect_object (seq->self_scm ());
899 $$ = MY_MAKE_MUSIC("GraceMusic");
900 $$->set_mus_property ("element", $2->self_scm ());
901 scm_gc_unprotect_object ($2->self_scm ());
904 | CONTEXT string '=' string Music {
905 Music * csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
907 csm->set_mus_property ("element", $5->self_scm ());
908 scm_gc_unprotect_object ($5->self_scm ());
910 csm->set_mus_property ("context-type", $2);
911 csm->set_mus_property ("context-id", $4);
922 int n = gh_scm2int (ly_car ($3)); int d = gh_scm2int (ly_cdr ($3));
924 $$= MY_MAKE_MUSIC("TimeScaledMusic");
925 $$->set_spot (THIS->pop_spot ());
928 $$->set_mus_property ("element", mp->self_scm ());
929 scm_gc_unprotect_object (mp->self_scm ());
930 $$->set_mus_property ("numerator", gh_int2scm (n));
931 $$->set_mus_property ("denominator", gh_int2scm (d));
932 $$->compress (Moment (Rational (n,d)));
935 | Repeated_music { $$ = $1; }
936 | Simultaneous_music { $$ = $1; }
937 | Sequential_music { $$ = $1; }
938 | TRANSPOSE pitch_also_in_chords pitch_also_in_chords Music {
939 $$ = MY_MAKE_MUSIC("TransposedMusic");
941 Pitch from = *unsmob_pitch ($2);
942 Pitch to = *unsmob_pitch ($3);
944 p->transpose (interval (from, to));
945 $$->set_mus_property ("element", p->self_scm ());
946 scm_gc_unprotect_object (p->self_scm ());
948 | APPLY embedded_scm Music {
949 SCM ret = gh_call1 ($2, $3->self_scm ());
950 Music *m = unsmob_music (ret);
952 THIS->parser_error ("\\apply must return a Music");
953 m = MY_MAKE_MUSIC("Music");
958 { THIS->lexer_->push_note_state (); }
961 THIS->lexer_->pop_state ();
964 { THIS->lexer_->push_figuredbass_state (); }
967 Music * chm = MY_MAKE_MUSIC("UntransposableMusic");
968 chm->set_mus_property ("element", $3->self_scm ());
970 scm_gc_unprotect_object ($3->self_scm());
972 THIS->lexer_->pop_state ();
975 { THIS->lexer_->push_chord_state (); }
978 Music * chm = MY_MAKE_MUSIC("UnrelativableMusic");
979 chm->set_mus_property ("element", $3->self_scm ());
980 scm_gc_unprotect_object ($3->self_scm());
983 THIS->lexer_->pop_state ();
986 { THIS->lexer_->push_lyric_state (); }
990 THIS->lexer_->pop_state ();
992 | relative_music { $$ = $1; }
993 | re_rhythmed_music { $$ = $1; }
994 | part_combined_music { $$ = $1; }
998 RELATIVE absolute_pitch Music {
1000 Pitch pit = *unsmob_pitch ($2);
1001 $$ = MY_MAKE_MUSIC("RelativeOctaveMusic");
1003 $$->set_mus_property ("element", p->self_scm ());
1004 scm_gc_unprotect_object (p->self_scm ());
1006 $$->set_mus_property ("last-pitch", p->to_relative_octave (pit).smobbed_copy ());
1012 ADDLYRICS Music Music {
1013 Music*l =MY_MAKE_MUSIC("LyricCombineMusic");
1014 l->set_mus_property ("elements", gh_list ($2->self_scm (), $3->self_scm (), SCM_UNDEFINED));
1015 scm_gc_unprotect_object ($3->self_scm ());
1016 scm_gc_unprotect_object ($2->self_scm ());
1021 part_combined_music:
1022 PARTCOMBINE STRING Music Music {
1023 Music * p= MY_MAKE_MUSIC("PartCombineMusic");
1024 p->set_mus_property ("what", $2);
1025 p->set_mus_property ("elements", gh_list ($3->self_scm (),$4->self_scm (), SCM_UNDEFINED));
1027 scm_gc_unprotect_object ($3->self_scm ());
1028 scm_gc_unprotect_object ($4->self_scm ());
1035 TRANSLATOR STRING '=' STRING {
1036 Music*t= MY_MAKE_MUSIC("TranslatorChange");
1037 t-> set_mus_property ("change-to-type", $2);
1038 t-> set_mus_property ("change-to-id", $4);
1041 $$->set_spot (THIS->here_input ());
1047 | ONCE simple_property_def {
1049 SCM e = $2->get_mus_property ("element");
1050 unsmob_music (e)->set_mus_property ("once", SCM_BOOL_T);
1054 simple_property_def:
1055 PROPERTY STRING '.' STRING '=' scalar {
1056 Music *t = set_property_music (scm_string_to_symbol ($4), $6);
1057 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
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 UNSET {
1069 Music *t = MY_MAKE_MUSIC("PropertyUnset");
1070 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1072 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1073 csm->set_mus_property ("element", t->self_scm ());
1074 scm_gc_unprotect_object (t->self_scm ());
1077 $$->set_spot (THIS->here_input ());
1079 csm-> set_mus_property ("context-type", $2);
1081 | PROPERTY STRING '.' STRING SET embedded_scm '=' embedded_scm {
1083 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1084 bool itc = internal_type_checking_global_b;
1085 Music *t = MY_MAKE_MUSIC("OverrideProperty");
1086 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1087 t->set_mus_property ("pop-first", SCM_BOOL_T);
1089 internal_type_checking_global_b = false;
1090 t->set_mus_property ("grob-property", $6);
1092 internal_type_checking_global_b = itc;
1093 t->set_mus_property ("grob-value", $8);
1095 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1096 csm->set_mus_property ("element", t->self_scm ());
1097 scm_gc_unprotect_object (t->self_scm ());
1099 $$->set_spot (THIS->here_input ());
1101 csm-> set_mus_property ("context-type", $2);
1103 | PROPERTY STRING '.' STRING OVERRIDE
1104 embedded_scm '=' embedded_scm
1110 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1111 bool itc = internal_type_checking_global_b;
1113 Music *t = MY_MAKE_MUSIC("OverrideProperty");
1114 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1116 internal_type_checking_global_b = false;
1117 t->set_mus_property ("grob-property", $6);
1118 t->set_mus_property ("grob-value", $8);
1120 internal_type_checking_global_b = itc;
1122 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1123 csm->set_mus_property ("element", t->self_scm ());
1124 scm_gc_unprotect_object (t->self_scm ());
1127 $$->set_spot (THIS->here_input ());
1129 csm-> set_mus_property ("context-type", $2);
1132 | PROPERTY STRING '.' STRING REVERT embedded_scm {
1133 Music *t = MY_MAKE_MUSIC("RevertProperty");
1135 = gh_equal_p ($4, scm_makfrom0str ("autoBeamSettings"));
1136 bool itc = internal_type_checking_global_b;
1138 t->set_mus_property ("symbol", scm_string_to_symbol ($4));
1140 internal_type_checking_global_b = false;
1141 t->set_mus_property ("grob-property", $6);
1143 internal_type_checking_global_b = itc;
1145 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1146 csm->set_mus_property ("element", t->self_scm ());
1147 scm_gc_unprotect_object (t->self_scm ());
1150 $$->set_spot (THIS->here_input ());
1152 csm-> set_mus_property ("context-type", $2);
1159 | bare_int { $$ = gh_int2scm ($1); }
1160 | embedded_scm { $$ = $1; }
1161 | full_markup { $$ = $1; }
1168 } /*cont */ simple_element post_events {
1169 SCM elts = $3-> get_mus_property ("elements");
1171 elts = gh_append3 (elts, scm_reverse_x ($1, SCM_EOL),
1172 scm_reverse_x ($4, SCM_EOL));
1174 $3-> set_mus_property ("elements", elts);
1178 | note_chord_element
1183 chord_body optional_notemode_duration post_events
1185 SCM dur = unsmob_duration ($2)->smobbed_copy();
1186 SCM es = $1->get_mus_property ("elements");
1187 SCM postevs = scm_reverse_x ($3, SCM_EOL);
1189 for (SCM s = es; gh_pair_p (s); s = gh_cdr (s))
1190 unsmob_music (gh_car(s))->set_mus_property ("duration", dur);
1191 es = gh_append2 (es, postevs);
1193 $1-> set_mus_property ("elements", es);
1199 CHORD_OPEN chord_body_elements CHORD_CLOSE
1201 $$ = MY_MAKE_MUSIC("EventChord");
1202 $$->set_mus_property ("elements",
1203 scm_reverse_x ($2, SCM_EOL));
1207 chord_body_elements:
1208 /* empty */ { $$ = SCM_EOL; }
1209 | chord_body_elements chord_body_element {
1210 $$ = gh_cons ($2->self_scm(), $1);
1211 scm_gc_unprotect_object ($2->self_scm());
1216 pitch exclamations questions post_events
1218 Music * n = MY_MAKE_MUSIC("NoteEvent");
1219 n->set_mus_property ("pitch", $1);
1221 n->set_mus_property ("cautionary", SCM_BOOL_T);
1222 if ($2 % 2 || $3 % 2)
1223 n->set_mus_property ("force-accidental", SCM_BOOL_T);
1225 SCM arts = scm_reverse_x ($4, SCM_EOL);
1226 n->set_mus_property ("articulations", arts);
1234 $$ = MY_MAKE_MUSIC("EventChord");
1235 $$->set_mus_property ("elements", scm_cons ($1->self_scm (), SCM_EOL));
1236 scm_gc_unprotect_object ($1->self_scm());
1238 $$-> set_spot (THIS->here_input ());
1239 $1-> set_spot (THIS->here_input ());
1242 Music *l = MY_MAKE_MUSIC("LigatureEvent");
1243 l->set_mus_property ("span-direction", gh_int2scm (START));
1244 l->set_spot (THIS->here_input ());
1246 $$ = MY_MAKE_MUSIC("EventChord");
1247 $$->set_mus_property ("elements", scm_cons (l->self_scm (), SCM_EOL));
1248 scm_gc_unprotect_object (l->self_scm());
1249 $$->set_spot (THIS->here_input ());
1252 Music *l = MY_MAKE_MUSIC("LigatureEvent");
1253 l->set_mus_property ("span-direction", gh_int2scm (STOP));
1254 l->set_spot (THIS->here_input ());
1256 $$ = MY_MAKE_MUSIC("EventChord");
1257 $$->set_mus_property ("elements", scm_cons (l->self_scm (), SCM_EOL));
1258 $$->set_spot (THIS->here_input ());
1259 scm_gc_unprotect_object (l->self_scm());
1262 $$ = MY_MAKE_MUSIC("VoiceSeparator");
1263 $$->set_spot (THIS->here_input ());
1267 $$ = MY_MAKE_MUSIC("BarCheck");
1268 $$->set_spot (THIS->here_input ());
1271 Music *t = set_property_music (ly_symbol2scm ("whichBar"), $2);
1273 Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
1274 csm->set_mus_property ("element", t->self_scm ());
1275 scm_gc_unprotect_object (t->self_scm ());
1278 $$->set_spot (THIS->here_input ());
1280 csm->set_mus_property ("context-type", scm_makfrom0str ("Timing"));
1282 | PARTIAL duration_length {
1283 Moment m = - unsmob_duration ($2)->get_length ();
1284 Music * p = set_property_music (ly_symbol2scm ( "measurePosition"),m.smobbed_copy ());
1286 Music * sp = MY_MAKE_MUSIC("ContextSpeccedMusic");
1287 sp->set_mus_property ("element", p->self_scm ());
1288 scm_gc_unprotect_object (p->self_scm ());
1291 sp-> set_mus_property ("context-type", scm_makfrom0str ("Timing"));
1296 proc = scm_c_eval_string ("make-clef-set");
1298 SCM result = scm_call_1 (proc, $2);
1299 scm_gc_protect_object (result);
1300 $$ = unsmob_music (result);
1305 proc = scm_c_eval_string ("make-time-signature-set");
1307 SCM result = scm_apply_2 (proc, gh_car ($2), gh_cdr ($2), SCM_EOL);
1308 scm_gc_protect_object (result);
1309 $$ = unsmob_music (result);
1314 shorthand_command_req { $$ = $1; }
1315 | verbose_command_req { $$ = $1; }
1318 shorthand_command_req:
1326 $$ = MY_MAKE_MUSIC("TieEvent");
1329 Music *b= MY_MAKE_MUSIC("BeamEvent");
1330 b->set_mus_property ("span-direction", gh_int2scm (START));
1333 THIS->last_beam_start_ = b->self_scm ();
1336 Music *b= MY_MAKE_MUSIC("BeamEvent");
1337 b->set_mus_property ("span-direction", gh_int2scm (STOP));
1341 $$ = MY_MAKE_MUSIC("BreathingSignEvent");
1344 $$ = MY_MAKE_MUSIC("PorrectusEvent");
1348 verbose_command_req:
1350 Music * m = MY_MAKE_MUSIC("MarkEvent");
1354 Music *m = MY_MAKE_MUSIC("MarkEvent");
1355 m->set_mus_property ("label", $2);
1358 | SKIP duration_length {
1359 Music * skip = MY_MAKE_MUSIC("SkipEvent");
1360 skip->set_mus_property ("duration", $2);
1368 Music *key= MY_MAKE_MUSIC("KeyChangeEvent");
1371 | KEY NOTENAME_PITCH SCM_IDENTIFIER {
1372 Music *key= MY_MAKE_MUSIC("KeyChangeEvent");
1374 key->set_mus_property ("pitch-alist", $3);
1375 ((Music*)key)->transpose (* unsmob_pitch ($2));
1384 | post_events post_event {
1385 $2->set_spot (THIS->here_input ());
1386 $$ = gh_cons ($2->self_scm(), $$);
1387 scm_gc_unprotect_object ($2->self_scm());
1400 Music * s = MY_MAKE_MUSIC("StringNumberEvent");
1401 s->set_mus_property ("string-number", gh_int2scm($1));
1402 s->set_spot (THIS->here_input ());
1408 event_that_take_dir:
1414 Music * m = MY_MAKE_MUSIC ("NewBeamEvent");
1415 m->set_spot (THIS->here_input());
1416 m->set_mus_property ("span-direction" , gh_int2scm (START));
1420 Music * m = MY_MAKE_MUSIC ("NewBeamEvent");
1421 m->set_spot (THIS->here_input());
1422 m->set_mus_property ("span-direction" , gh_int2scm (STOP));
1426 Music * m = MY_MAKE_MUSIC ("NewTieEvent");
1427 m->set_spot (THIS->here_input());
1430 | script_abbreviation {
1431 SCM s = THIS->lexer_->lookup_identifier ("dash" + ly_scm2string ($1));
1432 Music *a = MY_MAKE_MUSIC("ArticulationEvent");
1433 if (gh_string_p (s))
1434 a->set_mus_property ("articulation-type", s);
1435 else THIS->parser_error (_ ("Expecting string as script definition"));
1441 script_dir event_that_take_dir {
1442 $2->set_mus_property ("direction", gh_int2scm ($1));
1449 $$ = unsmob_music ($1);
1452 Music * a = MY_MAKE_MUSIC("TremoloEvent");
1453 a->set_spot (THIS->here_input ());
1454 a->set_mus_property ("tremolo-type", gh_int2scm ($1));
1481 | NOTENAME_PITCH sup_quotes {
1482 Pitch p = *unsmob_pitch ($1);
1484 $$ = p.smobbed_copy ();
1486 | NOTENAME_PITCH sub_quotes {
1487 Pitch p =* unsmob_pitch ($1);
1490 $$ = p.smobbed_copy ();
1503 | TONICNAME_PITCH sup_quotes {
1504 Pitch p = *unsmob_pitch ($1);
1506 $$ = p.smobbed_copy ();
1508 | TONICNAME_PITCH sub_quotes {
1509 Pitch p =* unsmob_pitch ($1);
1512 $$ = p.smobbed_copy ();
1526 pitch_also_in_chords:
1532 PITCH embedded_scm {
1534 if (!unsmob_pitch ($2)) {
1535 THIS->parser_error (_f ("Expecting musical-pitch value", 3));
1536 $$ = Pitch ().smobbed_copy ();
1542 DURATION embedded_scm {
1544 if (!unsmob_duration ($2))
1546 THIS->parser_error (_ ("Must have duration object"));
1547 $$ = Duration ().smobbed_copy ();
1554 if (!THIS->lexer_->lyric_state_b ())
1555 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1556 $$ = MY_MAKE_MUSIC("ExtenderEvent");
1562 if (!THIS->lexer_->lyric_state_b ())
1563 THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
1564 $$ = MY_MAKE_MUSIC("HyphenEvent");
1569 close_event_parens {
1571 dynamic_cast<Music *> ($$)->set_mus_property ("span-direction", gh_int2scm (START))
1578 Music * s= MY_MAKE_MUSIC("SlurEvent");
1580 s->set_spot (THIS->here_input());
1583 Music * s= MY_MAKE_MUSIC("PhrasingSlurEvent");
1585 s->set_spot (THIS->here_input());
1588 Music *s =MY_MAKE_MUSIC("CrescendoEvent");
1590 s->set_spot (THIS->here_input());
1593 Music *s =MY_MAKE_MUSIC("DecrescendoEvent");
1595 s->set_spot (THIS->here_input());
1603 dynamic_cast<Music *> ($$)->set_mus_property ("span-direction", gh_int2scm (STOP))
1610 Music *s = MY_MAKE_MUSIC("CrescendoEvent");
1611 s->set_spot (THIS->here_input());
1616 Music * s= MY_MAKE_MUSIC("SlurEvent");
1618 s->set_spot (THIS->here_input());
1622 Music * s= MY_MAKE_MUSIC("PhrasingSlurEvent");
1624 s->set_mus_property ("span-type", scm_makfrom0str ( "phrasing-slur"));
1625 s->set_spot (THIS->here_input());
1631 Music *t = MY_MAKE_MUSIC("TextScriptEvent");
1632 t->set_mus_property ("text", $1);
1633 t->set_spot (THIS->here_input ());
1637 Music *t = MY_MAKE_MUSIC("TextScriptEvent");
1638 t->set_mus_property ("text", $1);
1639 t->set_spot (THIS->here_input ());
1643 Music *t = MY_MAKE_MUSIC("TextScriptEvent");
1644 t->set_mus_property ("text", make_simple_markup ($1));
1645 t->set_spot (THIS->here_input ());
1650 Music * t = MY_MAKE_MUSIC("FingerEvent");
1651 t->set_mus_property ("digit", gh_int2scm ($1));
1652 t->set_spot (THIS->here_input ());
1657 script_abbreviation:
1659 $$ = scm_makfrom0str ("Hat");
1662 $$ = scm_makfrom0str ("Plus");
1665 $$ = scm_makfrom0str ("Dash");
1668 $$ = scm_makfrom0str ("Bar");
1671 $$ = scm_makfrom0str ("Larger");
1674 $$ = scm_makfrom0str ("Dot");
1677 $$ = scm_makfrom0str ("Underscore");
1684 | '-' { $$ = CENTER; }
1691 | pre_events open_event {
1692 $$ = gh_cons ($2->self_scm(), $$);
1693 scm_gc_unprotect_object ($2->self_scm());
1704 multiplied_duration {
1707 | verbose_duration {
1712 optional_notemode_duration:
1714 Duration dd = THIS->default_duration_;
1715 $$ = dd.smobbed_copy ();
1717 THIS->beam_check ($$);
1719 | multiplied_duration {
1721 THIS->default_duration_ = *unsmob_duration ($$);
1723 THIS->beam_check ($$);
1725 | verbose_duration {
1727 THIS->default_duration_ = *unsmob_duration ($$);
1732 bare_unsigned dots {
1734 if (!is_duration_b ($1))
1735 THIS->parser_error (_f ("not a duration: %d", $1));
1739 $$ = Duration (l, $2).smobbed_copy ();
1741 | DURATION_IDENTIFIER dots {
1742 Duration *d =unsmob_duration ($1);
1743 Duration k (d->duration_log (),d->dot_count () + $2);
1753 multiplied_duration:
1757 | multiplied_duration '*' bare_unsigned {
1758 $$ = unsmob_duration ($$)->compressed ( $3) .smobbed_copy ();
1760 | multiplied_duration '*' FRACTION {
1761 Rational m (gh_scm2int (ly_car ($3)), gh_scm2int (ly_cdr ($3)));
1763 $$ = unsmob_duration ($$)->compressed (m).smobbed_copy ();
1768 FRACTION { $$ = $1; }
1769 | UNSIGNED '/' UNSIGNED {
1770 $$ = scm_cons (gh_int2scm ($1), gh_int2scm ($3));
1788 | ':' bare_unsigned {
1789 if (!is_duration_b ($2))
1790 THIS->parser_error (_f ("not a duration: %d", $2));
1797 /*****************************************************************
1799 *****************************************************************/
1813 Music *bfr = MY_MAKE_MUSIC("BassFigureEvent");
1814 $$ = bfr->self_scm();
1815 scm_gc_unprotect_object ($$);
1818 Music *bfr = MY_MAKE_MUSIC("BassFigureEvent");
1819 $$ = bfr->self_scm();
1821 bfr->set_mus_property ("figure", gh_int2scm ($1));
1823 scm_gc_unprotect_object ($$);
1825 | bass_figure bass_mod {
1826 Music *m = unsmob_music ($1);
1828 SCM salter =m->get_mus_property ("alteration");
1829 int alter = gh_number_p ( salter) ? gh_scm2int (salter) : 0;
1830 m->set_mus_property ("alteration",
1831 gh_int2scm (alter + $2));
1833 m->set_mus_property ("alteration", gh_int2scm (0));
1841 unsmob_music ($$)->set_mus_property ("bracket-start", SCM_BOOL_T);
1846 | br_bass_figure ']' {
1848 unsmob_music ($1)->set_mus_property ("bracket-stop", SCM_BOOL_T);
1856 | figure_list br_bass_figure {
1857 $$ = scm_cons ($2, $1);
1862 FIGURE_OPEN figure_list FIGURE_CLOSE {
1863 Music * m = MY_MAKE_MUSIC("EventChord");
1864 $2 = scm_reverse_x ($2, SCM_EOL);
1865 m->set_mus_property ("elements", $2);
1866 $$ = m->self_scm ();
1877 pitch exclamations questions optional_notemode_duration optional_rest {
1879 Input i = THIS->pop_spot ();
1880 if (!THIS->lexer_->note_state_b ())
1881 THIS->parser_error (_ ("Have to be in Note mode for notes"));
1885 n = MY_MAKE_MUSIC("RestEvent");
1887 n = MY_MAKE_MUSIC("NoteEvent");
1889 n->set_mus_property ("pitch", $1);
1890 n->set_mus_property ("duration", $4);
1894 n->set_mus_property ("cautionary", SCM_BOOL_T);
1895 if ($2 % 2 || $3 % 2)
1896 n->set_mus_property ("force-accidental", SCM_BOOL_T);
1898 Music *v = MY_MAKE_MUSIC("EventChord");
1899 v->set_mus_property ("elements", scm_list_n (n->self_scm (), SCM_UNDEFINED));
1900 scm_gc_unprotect_object (n->self_scm());
1906 | figure_spec optional_notemode_duration {
1907 Music * m = unsmob_music ($1);
1908 Input i = THIS->pop_spot ();
1910 for (SCM s = m->get_mus_property ("elements"); gh_pair_p (s); s = ly_cdr (s))
1912 unsmob_music (ly_car (s))->set_mus_property ("duration", $2);
1916 | RESTNAME optional_notemode_duration {
1918 Input i = THIS->pop_spot ();
1920 if (ly_scm2string ($1) =="s") {
1922 ev = MY_MAKE_MUSIC("SkipEvent");
1925 ev = MY_MAKE_MUSIC("RestEvent");
1928 ev->set_mus_property ("duration" ,$2);
1930 Music * velt = MY_MAKE_MUSIC("EventChord");
1931 velt->set_mus_property ("elements", scm_list_n (ev->self_scm (),SCM_UNDEFINED));
1936 | MULTI_MEASURE_REST optional_notemode_duration {
1941 proc = scm_c_eval_string ("make-multi-measure-rest");
1943 SCM mus = scm_call_2 (proc, $2,
1944 make_input (THIS->here_input()));
1945 scm_gc_protect_object (mus);
1946 $$ = unsmob_music (mus);
1948 | STRING optional_notemode_duration {
1949 Input i = THIS->pop_spot ();
1951 Music * lreq = MY_MAKE_MUSIC("LyricEvent");
1952 lreq->set_mus_property ("text", $1);
1953 lreq->set_mus_property ("duration",$2);
1955 Music * velt = MY_MAKE_MUSIC("EventChord");
1956 velt->set_mus_property ("elements", scm_list_n (lreq->self_scm (), SCM_UNDEFINED));
1963 if (!THIS->lexer_->chord_state_b ())
1964 THIS->parser_error (_ ("Have to be in Chord mode for chords"));
1971 steno_tonic_pitch optional_notemode_duration chord_additions chord_subtractions chord_inversion chord_bass {
1972 $$ = Chord::get_chord ($1, $3, $4, $5, $6, $2);
1973 $$->set_spot (THIS->here_input ());
1980 | CHORD_COLON chord_notes {
1989 | chord_notes '.' chord_step {
1990 $$ = gh_append2 ($$, $3);
1998 | CHORD_CARET chord_notes {
2008 | CHORD_SLASH steno_tonic_pitch {
2017 | CHORD_BASS steno_tonic_pitch {
2024 $$ = scm_cons ($1, SCM_EOL);
2026 | CHORDMODIFIER_PITCH {
2027 $$ = scm_cons (unsmob_pitch ($1)->smobbed_copy (), SCM_EOL);
2029 | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
2030 $$ = scm_list_n (unsmob_pitch ($1)->smobbed_copy (),
2038 m.notename_ = ($1 - 1) % 7;
2039 m.octave_ = $1 > 7 ? 1 : 0;
2042 $$ = m.smobbed_copy ();
2044 | bare_unsigned '+' {
2046 m.notename_ = ($1 - 1) % 7;
2047 m.octave_ = $1 > 7 ? 1 : 0;
2051 $$ = m.smobbed_copy ();
2053 | bare_unsigned CHORD_MINUS {
2055 m.notename_ = ($1 - 1) % 7;
2056 m.octave_ = $1 > 7 ? 1 : 0;
2059 $$ = m.smobbed_copy ();
2067 number_expression '+' number_term {
2068 $$ = scm_sum ($1, $3);
2070 | number_expression '-' number_term {
2071 $$ = scm_difference ($1, $3);
2080 | number_factor '*' number_factor {
2081 $$ = scm_product ($1, $3);
2083 | number_factor '/' number_factor {
2084 $$ = scm_divide ($1, $3);
2089 '-' number_factor { /* %prec UNARY_MINUS */
2090 $$ = scm_difference ($2, SCM_UNDEFINED);
2098 $$ = gh_int2scm ($1);
2103 | NUMBER_IDENTIFIER {
2106 | REAL NUMBER_IDENTIFIER {
2107 $$ = gh_double2scm (gh_scm2double ($1) * gh_scm2double ($2));
2109 | UNSIGNED NUMBER_IDENTIFIER {
2110 $$ = gh_double2scm ($1 * gh_scm2double ($2));
2126 if (scm_integer_p ($1) == SCM_BOOL_T)
2128 int k = gh_scm2int ($1);
2132 THIS->parser_error (_ ("need integer number arg"));
2146 | STRING_IDENTIFIER {
2149 | string '+' string {
2150 $$ = scm_string_append (scm_list_n ($1, $3, SCM_UNDEFINED));
2157 | exclamations '!' { $$ ++; }
2162 | questions '?' { $$ ++; }
2172 { THIS->lexer_->push_markup_state (); }
2175 THIS->lexer_->pop_state ();
2181 $$ = make_simple_markup ($1);
2183 | MARKUP_HEAD_MARKUP0 markup {
2184 $$ = scm_list_n ($1, $2, SCM_UNDEFINED);
2186 | MARKUP_HEAD_MARKUP0_MARKUP1 markup markup {
2187 $$ = scm_list_n ($1, $2, $3, SCM_UNDEFINED);
2189 | MARKUP_HEAD_SCM0_MARKUP1 SCM_T markup {
2190 $$ = scm_list_n ($1, $2, $3, SCM_UNDEFINED);
2195 | MARKUP_HEAD_LIST0 markup_list {
2196 $$ = scm_list_n ($1,$2, SCM_UNDEFINED);
2198 | MARKUP_HEAD_SCM0 embedded_scm {
2199 $$ = scm_list_n ($1, $2, SCM_UNDEFINED);
2201 | MARKUP_HEAD_SCM0_SCM1_MARKUP2 embedded_scm embedded_scm markup {
2202 $$ = scm_list_n ($1, $2, $3, $4, SCM_UNDEFINED);
2204 | MARKUP_IDENTIFIER {
2211 CHORD_OPEN markup_list_body CHORD_CLOSE { $$ = scm_reverse_x ($2, SCM_EOL); }
2215 '{' markup_list_body '}' {
2218 line = scm_c_eval_string ("line-markup");
2220 $$ = scm_list_n (line, scm_reverse_x ($2, SCM_EOL), SCM_UNDEFINED);
2225 /**/ { $$ = SCM_EOL; }
2226 | markup_list_body markup {
2227 $$ = gh_cons ($2, $1) ;
2235 My_lily_parser::set_yydebug (bool )
2242 extern My_lily_parser * current_parser;
2245 My_lily_parser::do_yyparse ()
2247 current_parser = this;;
2248 yyparse ((void*)this);
2253 Should make this optional? It will also complain when you do
2257 which is entirely legitimate.
2259 Or we can scrap it. Barchecks should detect wrong durations, and
2260 skipTypesetting speeds it up a lot.
2264 My_lily_parser::beam_check (SCM dur)
2266 Duration *d = unsmob_duration (dur);
2267 if (unsmob_music (last_beam_start_) && d->duration_log () <= 2)
2269 Music * m = unsmob_music (last_beam_start_);
2270 m->origin ()->warning (_("Suspect duration found following this beam"));
2272 last_beam_start_ = SCM_EOL;
2280 return gh_pair_p (x)
2281 && SCM_BOOL_F != scm_object_property (gh_car (x), ly_symbol2scm ("markup-signature"));
2284 It is a little strange, to have this function in this file, but
2285 otherwise, we have to import music classes into the lexer.
2289 My_lily_lexer::try_special_identifiers (SCM * destination, SCM sid)
2291 if (gh_string_p (sid)) {
2293 return STRING_IDENTIFIER;
2294 } else if (gh_number_p (sid)) {
2296 return NUMBER_IDENTIFIER;
2297 } else if (unsmob_translator_def (sid)) {
2298 *destination = unsmob_translator_def (sid)->clone_scm();
2299 return TRANSLATOR_IDENTIFIER;
2300 } else if (unsmob_score (sid)) {
2301 Score *sc = new Score (*unsmob_score (sid));
2302 *destination =sc->self_scm ();
2303 return SCORE_IDENTIFIER;
2304 } else if (Music * mus =unsmob_music (sid)) {
2305 *destination = unsmob_music (sid)->clone ()->self_scm();
2306 unsmob_music (*destination)->
2307 set_mus_property ("origin", make_input (last_input_));
2308 return dynamic_cast<Event*> (mus)
2309 ? EVENT_IDENTIFIER : MUSIC_IDENTIFIER;
2310 } else if (unsmob_duration (sid)) {
2311 *destination = unsmob_duration (sid)->smobbed_copy();
2312 return DURATION_IDENTIFIER;
2313 } else if (unsmob_music_output_def (sid)) {
2314 Music_output_def *p = unsmob_music_output_def (sid);
2317 *destination = p->self_scm();
2318 return MUSIC_OUTPUT_DEF_IDENTIFIER;
2319 } else if (new_markup_p (sid)) {
2321 return MARKUP_IDENTIFIER;