From: David Kastrup Date: Thu, 28 Mar 2013 17:07:22 +0000 (+0100) Subject: Issue 3274: Restructure parsing of reverts to avoid ambiguities in relation to BACKUP X-Git-Tag: release/2.17.16-1~26 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=eedec40e61ffd9df87060afeba71a49314877174;p=lilypond.git Issue 3274: Restructure parsing of reverts to avoid ambiguities in relation to BACKUP A music expression could start with BACKUP (an artificially inserted token never present in the source code itself) due to the previous rules. If the BACKUP mechanism is needed in different unrelated rules applicable in similar contexts, this can lead to shift/reduce conflicts. While the actual (separate) code prompting this issue was rewritten in a manner reining its BACKUP tokens in on its own and thus avoiding the conflict triggering this issue, it still makes sense to confine the range where BACKUP tokens are recognized to the actual limited contexts where they are being produced, in order to keep such conflicts down, and to stop the parser from creative reinterpretation of situations that can only arise by programmer error. --- diff --git a/lily/parser.yy b/lily/parser.yy index 62c97b7fdf..ddaf90d10e 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -2066,6 +2066,13 @@ property_operation: // \revert Accidental.color revert_arg: + revert_arg_backup BACKUP symbol_list_arg + { + $$ = $3; + } + ; + +revert_arg_backup: revert_arg_part { if (scm_is_null ($1) @@ -2074,20 +2081,16 @@ revert_arg: else MYBACKUP (SYMBOL_LIST, scm_reverse_x ($1, SCM_EOL), @1); } - | revert_arg BACKUP symbol_list_arg - { - $$ = $3; - } ; // revert_arg_part delivers results in reverse revert_arg_part: symbol_list_part - | revert_arg BACKUP SCM_ARG '.' symbol_list_part + | revert_arg_backup BACKUP SCM_ARG '.' symbol_list_part { $$ = scm_append_x (scm_list_2 ($5, $3)); } - | revert_arg BACKUP SCM_ARG symbol_list_part + | revert_arg_backup BACKUP SCM_ARG symbol_list_part { $$ = scm_append_x (scm_list_2 ($4, $3)); }