source file of the GNU LilyPond music typesetter
- (c) 1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
Jan Nieuwenhuizen <janneke@gnu.org>
*/
%token PAPER
%token PARTCOMBINE
%token PARTIAL
-%token PROPERTY
%token RELATIVE
%token REMOVE
%token REPEAT
%type <scm> embedded_scm scalar
%type <music> Music Sequential_music Simultaneous_music
%type <music> relative_music re_rhythmed_music
-%type <music> music_property_def context_change
-%type <scm> Music_list
+%type <music> music_property_def context_change
+%type <scm> context_prop_spec
+%type <scm> Music_list
%type <scm> property_operation context_mod translator_mod optional_context_mod
%type <outputdef> music_output_def_body music_output_def_head
-%type <music> shorthand_command_req
%type <music> post_event tagged_post_event
-%type <music> command_req verbose_command_req
+%type <music> command_req
%type <music> string_number_event
%type <scm> string bare_number number_expression number_term number_factor
%type <score> score_block score_body
for (int i=0; i < sc->defs_.size (); i++)
default_rendering (sc->music_, sc->defs_[i]->self_scm(),head, outname);
- if (sc->defs_.empty ())
+ if (sc->defs_.is_empty ())
{
Music_output_def *id =
unsmob_music_output_def (THIS->lexer_->lookup_identifier
for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p)) {
SCM tag = gh_caar (p);
+
+ /* TODO: should make new tag "grob-definition" ? */
td->add_context_mod (scm_list_n (ly_symbol2scm ("assign"),
- tag, ly_cdar (p), SCM_UNDEFINED));
+ tag, gh_cons (ly_cdar (p), SCM_EOL), SCM_UNDEFINED));
}
}
| translator_spec_body context_mod {
}
| music_output_def_head '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
+ scm_gc_unprotect_object ($1->self_scm ());
Music_output_def * o = unsmob_music_output_def ($3);
$$ = o;
THIS->lexer_->remove_scope ();
scm_gc_unprotect_object ($2->self_scm ());
$$ = unsmob_music (res);
scm_gc_protect_object (res);
- $$->set_spot (THIS->here_input())
+ $$->set_spot (THIS->here_input());
}
| PARTCOMBINE Music Music {
static SCM proc;
scm_gc_unprotect_object (startm->self_scm ());
}
-
Music* seq = MY_MAKE_MUSIC("SequentialMusic");
seq->set_mus_property ("elements", ms);
THIS->lexer_->pop_state ();
}
- | CHORDS
- {
+ | CHORDS {
SCM nn = THIS->lexer_->lookup_identifier ("chordmodifiers");
THIS->lexer_->chordmodifier_tab_ = alist_to_hashq (nn);
- THIS->lexer_->push_chord_state (); }
- Music
- {
+ nn = THIS->lexer_->lookup_identifier ("pitchnames");
+ THIS->lexer_->push_chord_state (alist_to_hashq (nn));
+
+ } Music {
Music * chm = MY_MAKE_MUSIC("UnrelativableMusic");
chm->set_mus_property ("element", $3->self_scm ());
scm_gc_unprotect_object ($3->self_scm());
}
;
-music_property_def:
- PROPERTY STRING '.' property_operation {
- Music * t = property_op_to_music ($4);
- Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
-
- csm->set_mus_property ("element", t->self_scm ());
- scm_gc_unprotect_object (t->self_scm ());
-
- $$ = csm;
- $$->set_spot (THIS->here_input ());
+context_prop_spec:
+ STRING {
+ $$ = scm_list_n (ly_symbol2scm ("Bottom"), scm_string_to_symbol ($1), SCM_UNDEFINED);
+ }
+ | STRING '.' STRING {
+ $$ = scm_list_n (scm_string_to_symbol ($1), scm_string_to_symbol ($3), SCM_UNDEFINED);
+ }
+ ;
- csm-> set_mus_property ("context-type", scm_string_to_symbol ($2));
+music_property_def:
+ OVERRIDE context_prop_spec embedded_scm '=' scalar {
+ $$ = property_op_to_music (scm_list_n (
+ ly_symbol2scm ("poppush"),
+ gh_cadr ($2),
+ $3, $5, SCM_UNDEFINED));
+ $$= context_spec_music (gh_car ($2), SCM_UNDEFINED, $$, SCM_EOL);
+ }
+ | SET context_prop_spec '=' scalar {
+ $$ = property_op_to_music (scm_list_n (
+ ly_symbol2scm ("assign"),
+ gh_cadr ($2),
+ $4, SCM_UNDEFINED));
+ $$= context_spec_music (gh_car ($2), SCM_UNDEFINED, $$, SCM_EOL);
+ }
+ | REVERT context_prop_spec embedded_scm {
+ $$ = property_op_to_music (scm_list_n (
+ ly_symbol2scm ("pop"),
+ gh_cadr ($2),
+ $3, SCM_UNDEFINED));
+
+ $$= context_spec_music (gh_car ($2), SCM_UNDEFINED, $$, SCM_EOL);
+ }
+ | UNSET context_prop_spec {
+ $$ = property_op_to_music (scm_list_n (
+ ly_symbol2scm ("unset"),
+ gh_cadr ($2)));
+ $$= context_spec_music (gh_car ($2), SCM_UNDEFINED, $$, SCM_EOL);
}
| ONCE music_property_def {
$$ = $2;
- SCM e = $2->get_mus_property ("element");
- unsmob_music (e)->set_mus_property ("once", SCM_BOOL_T);
+ $$->set_mus_property ("once", SCM_BOOL_T);
}
;
+
scalar:
string { $$ = $1; }
| bare_int { $$ = gh_int2scm ($1); }
if ($2 % 2 || $3 % 2)
n->set_mus_property ("force-accidental", SCM_BOOL_T);
- SCM arts = scm_reverse_x ($4, SCM_EOL);
- n->set_mus_property ("articulations", arts);
+ if (gh_pair_p ($4)) {
+ SCM arts = scm_reverse_x ($4, SCM_EOL);
+ n->set_mus_property ("articulations", arts);
+ }
+ $$ = n;
+ }
+ | DRUM_PITCH post_events {
+ Music *n = MY_MAKE_MUSIC("NoteEvent");
+ n->set_mus_property ("duration" ,$2);
+ n->set_mus_property ("drum-type" , $1);
+ n->set_spot (THIS->here_input());
+ if (gh_pair_p ($2)) {
+ SCM arts = scm_reverse_x ($2, SCM_EOL);
+ n->set_mus_property ("articulations", arts);
+ }
$$ = n;
}
;
$$-> set_spot (THIS->here_input ());
$1-> set_spot (THIS->here_input ());
}
+ | SKIP duration_length {
+ Music * skip = MY_MAKE_MUSIC("SkipMusic");
+ skip->set_mus_property ("duration", $2);
+
+ $$ = skip;
+ }
| OCTAVE { THIS->push_spot (); }
pitch {
Music *l = MY_MAKE_MUSIC("RelativeOctaveCheck");
;
command_req:
- shorthand_command_req { $$ = $1; }
- | verbose_command_req { $$ = $1; }
- ;
-
-shorthand_command_req:
BREATHE {
$$ = MY_MAKE_MUSIC("BreathingSignEvent");
}
| E_TILDE {
$$ = MY_MAKE_MUSIC("PesOrFlexaEvent");
}
- ;
-
-verbose_command_req:
- MARK DEFAULT {
+ | MARK DEFAULT {
Music * m = MY_MAKE_MUSIC("MarkEvent");
$$ = m;
}
-
- | SKIP duration_length {
- Music * skip = MY_MAKE_MUSIC("SkipEvent");
- skip->set_mus_property ("duration", $2);
-
- $$ = skip;
- }
| tempo_event {
$$ = $1;
}
csm->set_mus_property ("element", m->self_scm ());
scm_gc_unprotect_object (m->self_scm ());
- csm->set_mus_property ("context-type", scm_string_to_symbol (type));
+ csm->set_mus_property ("context-type",
+ gh_symbol_p (type) ? type : scm_string_to_symbol (type));
csm->set_mus_property ("property-operations", ops);
if (gh_string_p (id))