]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3274: Restructure parsing of reverts to avoid ambiguities in relation to BACKUP
authorDavid Kastrup <dak@gnu.org>
Thu, 28 Mar 2013 17:07:22 +0000 (18:07 +0100)
committerDavid Kastrup <dak@gnu.org>
Sat, 6 Apr 2013 07:11:25 +0000 (09:11 +0200)
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.

lily/parser.yy

index 62c97b7fdf284280f6e4d3cd43f02cca38cbd115..ddaf90d10edc668f30566ca3f8e570bc161f4303 100644 (file)
@@ -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));
        }