start_symbol:
lilypond
| EMBEDDED_LILY {
- SCM nn = parser->lexer_->lookup_identifier ("pitchnames");
- parser->lexer_->push_note_state (nn);
+ parser->lexer_->push_note_state (Lily::pitchnames);
} embedded_lilypond {
parser->lexer_->pop_state ();
*retval = $3;
toplevel_expression:
- {
- parser->lexer_->add_scope (get_header (parser));
- } lilypond_header {
- parser->lexer_->set_identifier (ly_symbol2scm ("$defaultheader"), $2);
+ header_block {
+ parser->lexer_->set_identifier (ly_symbol2scm ("$defaultheader"), $1);
}
| book_block {
SCM proc = parser->lexer_->lookup_identifier ("toplevel-book-handler");
| partial_markup
| full_markup_list
| context_modification
+ | header_block
| score_block
| context_def_spec_block
| book_block
}
;
+header_block:
+ {
+ parser->lexer_->add_scope (get_header (parser));
+ } lilypond_header {
+ $$ = $2;
+ }
+ ;
+
/*
DECLARATIONS
*/
identifier_init:
identifier_init_nonumber
| number_expression
+ | symbol_list_part_bare '.' property_path
+ {
+ $$ = scm_reverse_x ($1, $3);
+ }
+ | symbol_list_part_bare ',' property_path
+ {
+ $$ = scm_reverse_x ($1, $3);
+ }
| post_event_nofinger post_events
{
$$ = scm_reverse_x ($2, SCM_EOL);
;
identifier_init_nonumber:
- score_block
+ header_block
+ | score_block
| book_block
| bookpart_block
| output_def
embedded_scm
|
{
- SCM nn = parser->lexer_->lookup_identifier ("pitchnames");
- parser->lexer_->push_note_state (nn);
+ parser->lexer_->push_note_state (Lily::pitchnames);
}
composite_music
{
{
if (scm_is_pair ($1))
$1 = scm_car ($1);
- SCM nn = parser->lexer_->lookup_identifier ("pitchnames");
- parser->lexer_->push_note_state (nn);
+ parser->lexer_->push_note_state (Lily::pitchnames);
} music_or_context_def
{
parser->lexer_->pop_state ();
context_modification:
WITH
{
- SCM nn = parser->lexer_->lookup_identifier ("pitchnames");
- parser->lexer_->push_note_state (nn);
+ parser->lexer_->push_note_state (Lily::pitchnames);
} '{' context_mod_list '}'
{
parser->lexer_->pop_state ();
| MUSIC_IDENTIFIER
;
-optional_context_mod:
- /**/ {
- $$ = SCM_EOL;
- }
- | context_modification
+/* A list of single mods collected from a (possibly empty) sequence of
+ * context modifications, usually written as \with ... \with ...
+ */
+
+optional_context_mods:
+ context_modification_mods_list
{
- $$ = $1;
+ if (scm_is_pair ($1))
+ $$ = scm_append_x (scm_reverse_x ($1, SCM_EOL));
}
;
+/* The worker for optional_context_mods conses a (reversed) list where
+ * each element contains the list of single context mods from one
+ * context modification block. Context_mod::get_mods creates fresh
+ * copies, so it's okay to use append! on them.
+ */
+
+context_modification_mods_list:
+ /**/ {
+ $$ = SCM_EOL;
+ }
+ | context_modification_mods_list context_modification
+ {
+ if (Context_mod *m = unsmob<Context_mod> ($2))
+ $$ = scm_cons (m->get_mods (), $1);
+ }
+ ;
+
+/* A Context_mod is a container for a list of context mods like
+ * \consists ... \override ... . context_mod_list produces a
+ * Context_mod from the inside of a \with { ... } statement.
+ */
+
context_mod_list:
/**/ {
$$ = Context_mod ().smobbed_copy ();
;
context_prefix:
- CONTEXT symbol optional_id optional_context_mod {
- Context_mod *ctxmod = unsmob<Context_mod> ($4);
- SCM mods = SCM_EOL;
- if (ctxmod)
- mods = ctxmod->get_mods ();
- $$ = START_MAKE_SYNTAX (context_specification, $2, $3, mods, SCM_BOOL_F);
+ CONTEXT symbol optional_id optional_context_mods {
+ $$ = START_MAKE_SYNTAX (context_specification, $2, $3, $4, SCM_BOOL_F);
}
- | NEWCONTEXT symbol optional_id optional_context_mod {
- Context_mod *ctxmod = unsmob<Context_mod> ($4);
- SCM mods = SCM_EOL;
- if (ctxmod)
- mods = ctxmod->get_mods ();
- $$ = START_MAKE_SYNTAX (context_specification, $2, $3, mods, SCM_BOOL_T);
+ | NEWCONTEXT symbol optional_id optional_context_mods {
+ $$ = START_MAKE_SYNTAX (context_specification, $2, $3, $4, SCM_BOOL_T);
}
;
new_lyrics:
- ADDLYRICS optional_context_mod lyric_mode_music {
- Context_mod *ctxmod = unsmob<Context_mod> ($2);
- SCM mods = SCM_EOL;
- if (ctxmod)
- mods = ctxmod->get_mods ();
- $$ = scm_acons ($3, mods, SCM_EOL);
+ ADDLYRICS optional_context_mods lyric_mode_music {
+ $$ = scm_acons ($3, $2, SCM_EOL);
}
- | new_lyrics ADDLYRICS optional_context_mod lyric_mode_music {
- Context_mod *ctxmod = unsmob<Context_mod> ($3);
- SCM mods = SCM_EOL;
- if (ctxmod)
- mods = ctxmod->get_mods ();
- $$ = scm_acons ($4, mods, $1);
+ | new_lyrics ADDLYRICS optional_context_mods lyric_mode_music {
+ $$ = scm_acons ($4, $3, $1);
}
;
| UNSIGNED
;
+symbol_list_part_bare:
+ STRING
+ {
+ $$ = try_string_variants (Lily::key_list_p, $1);
+ if (SCM_UNBNDP ($$)) {
+ parser->parser_error (@1, _("not a key"));
+ $$ = SCM_EOL;
+ } else
+ $$ = scm_reverse ($$);
+ }
+ | UNSIGNED
+ {
+ $$ = scm_list_1 ($1);
+ }
+ ;
function_arglist_nonbackup:
function_arglist_common
}
parser->lexer_->pop_state ();
}
- | mode_changing_head_with_context optional_context_mod grouped_music_list {
- Context_mod *ctxmod = unsmob<Context_mod> ($2);
- SCM mods = SCM_EOL;
- if (ctxmod)
- mods = ctxmod->get_mods ();
- $$ = MAKE_SYNTAX (context_specification, @$, $1, SCM_EOL, mods, SCM_BOOL_T, $3);
+ | mode_changing_head_with_context optional_context_mods grouped_music_list {
+ $$ = MAKE_SYNTAX (context_specification, @$, $1, SCM_EOL, $2, SCM_BOOL_T, $3);
if (scm_is_eq ($1, ly_symbol2scm ("ChordNames")))
{
$$ = MAKE_SYNTAX (unrelativable_music, @$, $$);
mode_changing_head:
NOTEMODE {
- SCM nn = parser->lexer_->lookup_identifier ("pitchnames");
- parser->lexer_->push_note_state (nn);
+ parser->lexer_->push_note_state (Lily::pitchnames);
$$ = ly_symbol2scm ("notes");
}
| DRUMMODE
{
- SCM nn = parser->lexer_->lookup_identifier ("drumPitchNames");
- parser->lexer_->push_note_state (nn);
+ parser->lexer_->push_note_state (Lily::drum_pitch_names);
$$ = ly_symbol2scm ("drums");
}
$$ = ly_symbol2scm ("figures");
}
| CHORDMODE {
- SCM nn = parser->lexer_->lookup_identifier ("chordmodifiers");
- parser->lexer_->chordmodifier_tab_ = alist_to_hashq (nn);
- nn = parser->lexer_->lookup_identifier ("pitchnames");
- parser->lexer_->push_chord_state (nn);
+ parser->lexer_->chordmodifier_tab_ =
+ alist_to_hashq (Lily::chordmodifiers);
+ parser->lexer_->push_chord_state (Lily::pitchnames);
$$ = ly_symbol2scm ("chords");
}
mode_changing_head_with_context:
DRUMS {
- SCM nn = parser->lexer_->lookup_identifier ("drumPitchNames");
- parser->lexer_->push_note_state (nn);
+ parser->lexer_->push_note_state (Lily::drum_pitch_names);
$$ = ly_symbol2scm ("DrumStaff");
}
$$ = ly_symbol2scm ("FiguredBass");
}
| CHORDS {
- SCM nn = parser->lexer_->lookup_identifier ("chordmodifiers");
- parser->lexer_->chordmodifier_tab_ = alist_to_hashq (nn);
- nn = parser->lexer_->lookup_identifier ("pitchnames");
- parser->lexer_->push_chord_state (nn);
+ parser->lexer_->chordmodifier_tab_ =
+ alist_to_hashq (Lily::chordmodifiers);
+ parser->lexer_->push_chord_state (Lily::pitchnames);
$$ = ly_symbol2scm ("ChordNames");
}
| LYRICS
$$ = scm_difference ($2, SCM_UNDEFINED);
}
| string
+ | symbol_list_part_bare '.' property_path
+ {
+ $$ = scm_reverse_x ($1, $3);
+ }
+ | symbol_list_part_bare ',' property_path
+ {
+ $$ = scm_reverse_x ($1, $3);
+ }
;
event_chord:
$$ = $2;
}
| SCORELINES {
- SCM nn = parser->lexer_->lookup_identifier ("pitchnames");
- parser->lexer_->push_note_state (nn);
+ parser->lexer_->push_note_state (Lily::pitchnames);
} '{' score_body '}' {
Score *sc = unsmob<Score> ($4);
sc->origin ()->set_spot (@$);
$$ = make_simple_markup ($1);
}
| SCORE {
- SCM nn = parser->lexer_->lookup_identifier ("pitchnames");
- parser->lexer_->push_note_state (nn);
+ parser->lexer_->push_note_state (Lily::pitchnames);
} '{' score_body '}' {
Score *sc = unsmob<Score> ($4);
sc->origin ()->set_spot (@$);