From: David Kastrup Date: Wed, 7 Sep 2011 17:04:16 +0000 (+0200) Subject: parser.yy: allow the last music argument of an SCM_FUNCTION to omit delimiters in... X-Git-Tag: release/2.15.11-1~12^2~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=e23ca4ba967bf2794b529891d5e7267df34c2d7f;p=lilypond.git parser.yy: allow the last music argument of an SCM_FUNCTION to omit delimiters in most cases --- diff --git a/lily/parser.yy b/lily/parser.yy index 032d24a070..9a686fe216 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -390,6 +390,7 @@ If we give names, Bison complains. %type context_prop_spec %type direction_less_char %type duration_length +%type closed_embedded_scm %type embedded_scm %type figure_list %type figure_spec @@ -413,6 +414,7 @@ If we give names, Bison complains. %type markup_composed_list %type markup_command_list %type markup_command_list_arguments +%type closed_markup_command_list_arguments %type markup_command_basic_arguments %type markup_head_1_item %type markup_head_1_list @@ -440,7 +442,9 @@ If we give names, Bison complains. %type property_operation %type property_path property_path_revved %type scalar -%type scm_function_call +%type closed_scalar +%type open_scm_function_call +%type closed_scm_function_call %type script_abbreviation %type simple_chord_elements %type simple_markup @@ -543,13 +547,18 @@ toplevel_expression: } ; -embedded_scm: +closed_embedded_scm: SCM_TOKEN | SCM_IDENTIFIER - | scm_function_call + | closed_scm_function_call + ; + +embedded_scm: + closed_embedded_scm + | open_scm_function_call ; -scm_function_call: +closed_scm_function_call: SCM_FUNCTION closed_function_arglist { $$ = run_music_function (PARSER, @$, @@ -557,6 +566,14 @@ scm_function_call: } ; +open_scm_function_call: + SCM_FUNCTION open_function_arglist + { + $$ = run_music_function (PARSER, @$, + $1, $2); + } + ; + embedded_lilypond: { $$ = MAKE_SYNTAX ("void-music", @$, SCM_UNDEFINED); } | identifier_init @@ -962,10 +979,10 @@ tempo_event: TEMPO steno_duration '=' tempo_range { $$ = MAKE_SYNTAX ("tempo", @$, SCM_EOL, $2, $4); } - | TEMPO scalar steno_duration '=' tempo_range { + | TEMPO closed_scalar steno_duration '=' tempo_range { $$ = MAKE_SYNTAX ("tempo", @$, $2, $3, $5); } - | TEMPO scalar { + | TEMPO closed_scalar { $$ = MAKE_SYNTAX ("tempo", @$, $2); } ; @@ -1102,7 +1119,7 @@ grouped_music_list: ; function_scm_argument: - embedded_scm + closed_embedded_scm | simple_string ; @@ -1120,6 +1137,9 @@ open_function_arglist: EXPECT_MUSIC function_arglist open_music { $$ = scm_cons ($3, $2); } + | EXPECT_SCM function_arglist open_scm_function_call { + $$ = scm_cons ($3, $2); + } ; /* a closed argument list is one that does not end in a music @@ -1334,10 +1354,10 @@ context_change: property_path_revved: - embedded_scm { + closed_embedded_scm { $$ = scm_cons ($1, SCM_EOL); } - | property_path_revved embedded_scm { + | property_path_revved closed_embedded_scm { $$ = scm_cons ($2, $1); } ; @@ -1475,7 +1495,7 @@ simple_string: STRING { } ; -scalar: string { +closed_scalar: string { $$ = $1; } | lyric_element { @@ -1484,7 +1504,7 @@ scalar: string { | bare_number { $$ = $1; } - | embedded_scm { + | closed_embedded_scm { $$ = $1; } | full_markup { @@ -1495,6 +1515,10 @@ scalar: string { } ; +scalar: closed_scalar + | open_scm_function_call + ; + event_chord: /* TODO: Create a special case that avoids the creation of EventChords around simple_elements that have no post_events? @@ -2510,7 +2534,7 @@ markup_braced_list_body: ; markup_command_list: - MARKUP_LIST_FUNCTION markup_command_list_arguments { + MARKUP_LIST_FUNCTION closed_markup_command_list_arguments { $$ = scm_cons ($1, scm_reverse_x($2, SCM_EOL)); } ; @@ -2519,7 +2543,7 @@ markup_command_basic_arguments: EXPECT_MARKUP_LIST markup_command_list_arguments markup_list { $$ = scm_cons ($3, $2); } - | EXPECT_SCM markup_command_list_arguments embedded_scm { + | EXPECT_SCM markup_command_list_arguments closed_embedded_scm { $$ = scm_cons ($3, $2); } | EXPECT_NO_MORE_ARGS { @@ -2527,13 +2551,21 @@ markup_command_basic_arguments: } ; -markup_command_list_arguments: +closed_markup_command_list_arguments: markup_command_basic_arguments { $$ = $1; } | EXPECT_MARKUP markup_command_list_arguments markup { $$ = scm_cons ($3, $2); } ; +markup_command_list_arguments: + closed_markup_command_list_arguments + | EXPECT_SCM markup_command_list_arguments open_scm_function_call + { + $$ = scm_cons ($3, $2); + } + ; + markup_head_1_item: MARKUP_FUNCTION EXPECT_MARKUP markup_command_list_arguments { $$ = scm_cons ($1, scm_reverse_x ($3, SCM_EOL));