%token ADDQUOTE "\\addquote"
%token ALIAS "\\alias"
%token ALTERNATIVE "\\alternative"
-%token BOOK "\book"
+%token BOOK "\\book"
%token CHANGE "\\change"
%token CHORDMODE "\\chordmode"
%token CHORDS "\\chords"
%token TEMPO "\\tempo"
%token TIMES "\\times"
%token TRANSPOSE "\\transpose"
-%token TRANSPOSITION "\\transposition"
%token TYPE "\\type"
%token UNSET "\\unset"
%token WITH "\\with"
%token CHORD_COLON ":"
%token CHORD_MINUS "-"
%token CHORD_SLASH "/"
-%token DOUBLE_ANGLE_CLOSE ">>"
+%token ANGLE_OPEN "<"
+%token ANGLE_CLOSE ">"
%token DOUBLE_ANGLE_OPEN "<<"
+%token DOUBLE_ANGLE_CLOSE ">>"
%token E_BACKSLASH "\\"
%token E_ANGLE_CLOSE "\\>"
%token E_CHAR "\\C[haracter]"
%type <scm> simple_music_property_def
%type <scm> string_number_event
%type <scm> tempo_event
-%type <scm> toplevel_music
%type <outputdef> output_def_body
%type <outputdef> output_def_head
%type <scm> music_function_event
%type <scm> music_function_chord_body
%type <scm> music_function_musicless_prefix
+%type <scm> music_function_musicless_function
%type <scm> bass_figure
%type <scm> figured_bass_modification
%type <scm> br_bass_figure
scm_call_2 (proc, PARSER->self_scm (), score->self_scm ());
score->unprotect ();
}
- | toplevel_music {
+ | composite_music {
Music *music = unsmob_music ($1);
SCM proc = PARSER->lexer_->lookup_identifier ("toplevel-music-handler");
scm_call_2 (proc, PARSER->self_scm (), music->self_scm ());
}
;
-toplevel_music:
- composite_music {
- }
- ;
-
embedded_scm:
SCM_T
| SCM_IDENTIFIER
$$ = $1;
}
| music {
- $$ = $1;
+ /* Hack: Create event-chord around standalone events.
+ Prevents the identifier from being interpreted as a post-event. */
+ Music *mus = unsmob_music ($1);
+ bool is_event = mus &&
+ (scm_memq (ly_symbol2scm ("event"), mus->get_property ("types"))
+ != SCM_BOOL_F);
+ if (!is_event)
+ $$ = $1;
+ else
+ $$ = MAKE_SYNTAX ("event-chord", @$, scm_list_1 ($1));
}
| post_event {
$$ = $1;
| output_def_body context_def_spec_block {
assign_context_def ($$, $2);
}
- | output_def_body tempo_event {
- /*
- junk this ? there already is tempo stuff in
- music.
- */
- int m = scm_to_int (unsmob_music($2)->get_property ("metronome-count"));
- Duration *d = unsmob_duration (unsmob_music($2)->get_property ("tempo-unit"));
- set_tempo ($$, d->get_length (), m);
- }
| output_def_body error {
}
tempo_event:
TEMPO steno_duration '=' bare_unsigned {
- Music *m = MY_MAKE_MUSIC ("MetronomeChangeEvent");
- m->set_property ("tempo-unit", $2);
- m->set_property ("metronome-count", scm_from_int ( $4));
- $$ = m->unprotect ();
- }
+ $$ = MAKE_SYNTAX ("tempo", @$, $2, scm_int2num ($4));
+ }
;
/*
SIMULTANEOUS '{' music_list '}'{
$$ = MAKE_SYNTAX ("simultaneous-music", @$, scm_car ($3));
}
- | simul_open music_list simul_close {
+ | DOUBLE_ANGLE_OPEN music_list DOUBLE_ANGLE_CLOSE {
$$ = MAKE_SYNTAX ("simultaneous-music", @$, scm_car ($2));
}
;
/*
TODO: use code generation for this
*/
-generic_prefix_music_scm:
+music_function_musicless_function:
MUSIC_FUNCTION {
$$ = scm_list_2 ($1, make_input (@$));
}
| MUSIC_FUNCTION_MARKUP full_markup {
$$ = scm_list_3 ($1, make_input (@$), $2);
}
- | music_function_musicless_prefix music {
- $$ = ly_append2 ($1, scm_list_1 ($2));
- }
| MUSIC_FUNCTION_SCM_SCM function_scm_argument function_scm_argument {
$$ = scm_list_4 ($1, make_input (@$), $2, $3);
}
| MUSIC_FUNCTION_SCM_SCM_SCM function_scm_argument function_scm_argument function_scm_argument {
$$ = scm_list_5 ($1, make_input (@$), $2, $3, $4);
}
- | MUSIC_FUNCTION_MARKUP_MUSIC full_markup music {
+ | MUSIC_FUNCTION_MARKUP_MARKUP full_markup full_markup {
$$ = scm_list_4 ($1, make_input (@$), $2, $3);
}
- | MUSIC_FUNCTION_MARKUP_MARKUP full_markup full_markup {
+ ;
+
+/*
+TODO: use code generation for this
+*/
+music_function_musicless_prefix:
+ MUSIC_FUNCTION_MUSIC {
+ $$ = scm_list_2 ($1, make_input (@$));
+ }
+ | MUSIC_FUNCTION_SCM_MUSIC function_scm_argument {
+ $$ = scm_list_3 ($1, make_input (@$), $2);
+ }
+ | MUSIC_FUNCTION_SCM_SCM_MUSIC function_scm_argument function_scm_argument {
$$ = scm_list_4 ($1, make_input (@$), $2, $3);
}
+ | MUSIC_FUNCTION_SCM_SCM_SCM_MUSIC function_scm_argument function_scm_argument function_scm_argument {
+ $$ = scm_list_5 ($1, make_input (@$), $2, $3, $4);
+ }
+ | MUSIC_FUNCTION_SCM_SCM_SCM_SCM_MUSIC function_scm_argument function_scm_argument function_scm_argument function_scm_argument {
+ $$ = scm_list_n ($1, make_input (@$), $2, $3, $4, $5, SCM_UNDEFINED);
+ }
+ | MUSIC_FUNCTION_MARKUP_MUSIC full_markup {
+ $$ = scm_list_3 ($1, make_input (@$), $2);
+ }
+ ;
+
+generic_prefix_music_scm:
+ music_function_musicless_function {
+ $$ = $1;
+ }
+ | music_function_musicless_prefix music {
+ $$ = ly_append2 ($1, scm_list_1 ($2));
+ }
| MUSIC_FUNCTION_MUSIC_MUSIC music music {
$$ = scm_list_4 ($1, make_input (@$), $2, $3);
}
}
;
+
optional_id:
/**/ { $$ = SCM_EOL; }
| '=' simple_string {
}
;
-chord_open: '<'
- ;
-
-chord_close: '>'
- ;
-
-simul_open: DOUBLE_ANGLE_OPEN
- ;
-
-simul_close: DOUBLE_ANGLE_CLOSE
- ;
-
chord_body:
- chord_open chord_body_elements chord_close
+ ANGLE_OPEN chord_body_elements ANGLE_CLOSE
{
$$ = MAKE_SYNTAX ("event-chord", @$, scm_reverse_x ($2, SCM_EOL));
}
;
music_function_chord_body:
- MUSIC_FUNCTION {
- $$ = scm_list_2 ($1, make_input (@$));
+ music_function_musicless_function {
+ $$ = $1;
}
| music_function_musicless_prefix chord_body_element {
$$ = ly_append2 ($1, scm_list_1 ($2));
music_function_musicless_prefix post_event {
$$ = ly_append2 ($1, scm_list_1 ($2));
}
- ;
-
-/*
-TODO: use code generation for this
-*/
-music_function_musicless_prefix:
- MUSIC_FUNCTION_MUSIC {
- $$ = scm_list_2 ($1, make_input (@$));
- }
- | MUSIC_FUNCTION_SCM_MUSIC function_scm_argument {
- $$ = scm_list_3 ($1, make_input (@$), $2);
- }
- | MUSIC_FUNCTION_SCM_SCM_MUSIC function_scm_argument function_scm_argument {
- $$ = scm_list_4 ($1, make_input (@$), $2, $3);
- }
- | MUSIC_FUNCTION_SCM_SCM_SCM_MUSIC function_scm_argument function_scm_argument function_scm_argument {
- $$ = scm_list_5 ($1, make_input (@$), $2, $3, $4);
- }
- | MUSIC_FUNCTION_SCM_SCM_SCM_SCM_MUSIC function_scm_argument function_scm_argument function_scm_argument function_scm_argument {
- $$ = scm_list_n ($1, make_input (@$), $2, $3, $4, $5, SCM_UNDEFINED);
+ | music_function_musicless_function {
+ $$ = $1;
}
;
-
+
command_element:
command_event {
$$ = MAKE_SYNTAX ("bar-check", @$, SCM_UNDEFINED);
}
- | TRANSPOSITION pitch {
- Pitch middle_c;
- Pitch sounds_as_c = pitch_interval (*unsmob_pitch ($2), middle_c);
- $$ = MAKE_SYNTAX ("property-operation", @$, SCM_BOOL_F, ly_symbol2scm ("Staff"), ly_symbol2scm ("PropertySet"), ly_symbol2scm ("instrumentTransposition"), sounds_as_c.smobbed_copy ());
- }
| PARTIAL duration_length {
Moment m = - unsmob_duration ($2)->get_length ();
$$ = MAKE_SYNTAX ("property-operation", @$, SCM_BOOL_F, ly_symbol2scm ("Timing"), ly_symbol2scm ("PropertySet"), ly_symbol2scm ("measurePosition"), m.smobbed_copy ());
$$ = t->unprotect ();
}
| DIGIT {
- Music *t = MY_MAKE_MUSIC ("FingerEvent");
+ Music *t = MY_MAKE_MUSIC ("FingeringEvent");
t->set_property ("digit", scm_from_int ($1));
t->set_spot (@$);
$$ = t->unprotect ();
| '|' {
$$ = scm_makfrom0str ("Bar");
}
- | '>' {
+ | ANGLE_CLOSE {
$$ = scm_makfrom0str ("Larger");
}
| '.' {