X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fparser.yy;h=1d54ba97601290bdb5da524b8be090286f9080f0;hb=cc676c5aadd45985251b5d60fa23eed1ed98f6e6;hp=08c0e1e742083472bb87a62f75a81c37ce59aa74;hpb=4c6280c2ba6b0485aae7da731def216c2524bd0b;p=lilypond.git diff --git a/lily/parser.yy b/lily/parser.yy index 08c0e1e742..1d54ba9760 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -160,7 +160,7 @@ void set_music_properties (Music *p, SCM a); %token ADDQUOTE "\\addquote" %token ALIAS "\\alias" %token ALTERNATIVE "\\alternative" -%token BOOK "\book" +%token BOOK "\\book" %token CHANGE "\\change" %token CHORDMODE "\\chordmode" %token CHORDS "\\chords" @@ -206,7 +206,6 @@ void set_music_properties (Music *p, SCM a); %token TEMPO "\\tempo" %token TIMES "\\times" %token TRANSPOSE "\\transpose" -%token TRANSPOSITION "\\transposition" %token TYPE "\\type" %token UNSET "\\unset" %token WITH "\\with" @@ -223,8 +222,10 @@ void set_music_properties (Music *p, SCM a); %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]" @@ -348,7 +349,6 @@ If we give names, Bison complains. %type simple_music_property_def %type string_number_event %type tempo_event -%type toplevel_music %type output_def_body %type output_def_head @@ -365,6 +365,7 @@ If we give names, Bison complains. %type music_function_event %type music_function_chord_body %type music_function_musicless_prefix +%type music_function_musicless_function %type bass_figure %type figured_bass_modification %type br_bass_figure @@ -477,7 +478,7 @@ toplevel_expression: 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 ()); @@ -502,11 +503,6 @@ toplevel_expression: } ; -toplevel_music: - composite_music { - } - ; - embedded_scm: SCM_T | SCM_IDENTIFIER @@ -902,7 +898,7 @@ simultaneous_music: 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)); } ; @@ -949,7 +945,7 @@ function_scm_argument: /* TODO: use code generation for this */ -generic_prefix_music_scm: +music_function_musicless_function: MUSIC_FUNCTION { $$ = scm_list_2 ($1, make_input (@$)); } @@ -959,21 +955,48 @@ generic_prefix_music_scm: | 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); } @@ -988,6 +1011,7 @@ generic_prefix_music_scm: } ; + optional_id: /**/ { $$ = SCM_EOL; } | '=' simple_string { @@ -1331,20 +1355,8 @@ note_chord_element: } ; -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)); } @@ -1403,8 +1415,8 @@ chord_body_element: ; 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)); @@ -1415,29 +1427,11 @@ music_function_event: 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 { @@ -1475,11 +1469,6 @@ command_element: $$ = 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 ()); @@ -1746,7 +1735,7 @@ gen_text_def: $$ = 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 (); @@ -1766,7 +1755,7 @@ script_abbreviation: | '|' { $$ = scm_makfrom0str ("Bar"); } - | '>' { + | ANGLE_CLOSE { $$ = scm_makfrom0str ("Larger"); } | '.' {