lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Restructure parsing of reverts to avoid ambiguities in relation to B


From: dak
Subject: Re: Restructure parsing of reverts to avoid ambiguities in relation to BACKUP (issue 8103043)
Date: Tue, 02 Apr 2013 21:40:04 +0000

Reviewers: janek,

Message:
On 2013/04/02 21:23:16, janek wrote:
I'm not sure what the previous ambiguities were

A music expression could start with BACKUP (an artificially inserted
token never present in the source code itself) due to these rules.  I
needed BACKUP in a different context and got shift/reduce conflicts
because of these rules.  I finally managed writing the _other_ code in a
way reining its BACKUP tokens in, so the respective patch could go on
independent review/countdown.

It still makes sense, however, to recognize BACKUP only in the limited
contexts where it is actually 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.

Description:
Restructure parsing of reverts to avoid ambiguities in relation to
BACKUP

Please review this at https://codereview.appspot.com/8103043/

Affected files:
  M lily/parser.yy


Index: lily/parser.yy
diff --git a/lily/parser.yy b/lily/parser.yy
index ee413b301feb33f4d16d4a372c4a4c4c0ccfd8bc..795dcd27c953e062f6bffb4c317ada2f3bd84b18 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));
        }               





reply via email to

[Prev in Thread] Current Thread [Next in Thread]