]> git.donarmstrong.com Git - lilypond.git/commitdiff
Remove all closed music expressions
authorDavid Kastrup <dak@gnu.org>
Wed, 11 Dec 2013 19:25:29 +0000 (20:25 +0100)
committerDavid Kastrup <dak@gnu.org>
Thu, 19 Dec 2013 11:18:32 +0000 (12:18 +0100)
lily/parser.yy

index 9e257060ae3451dd02ea78de9c80b396e5f430ab..97c781b4e58071ca94e1ea71bea2471bdfcaf0b9 100644 (file)
@@ -62,7 +62,7 @@ deleting them.  Let's hope that a stack overflow doesn't trigger a move
 of the parse stack onto the heap. */
 
 %left PREC_BOT
-%nonassoc REPEAT REPEAT_IDENTIFIER
+%nonassoc REPEAT
 %nonassoc ALTERNATIVE
 
 /* The above precedences tackle the shift/reduce problem
@@ -330,7 +330,6 @@ If we give names, Bison complains.
 %token EMBEDDED_LILY "#{"
 
 %token BOOK_IDENTIFIER
-%token CHORD_BODY_IDENTIFIER
 %token CHORD_MODIFIER
 %token CHORD_REPETITION
 %token CONTEXT_DEF_IDENTIFIER
@@ -353,7 +352,6 @@ If we give names, Bison complains.
 %token NUMBER_IDENTIFIER
 %token OUTPUT_DEF_IDENTIFIER
 %token REAL
-%token REPEAT_IDENTIFIER
 %token RESTNAME
 %token SCM_ARG
 %token SCM_FUNCTION
@@ -1207,20 +1205,10 @@ repeated_music:
        {
                $$ = MAKE_SYNTAX ("repeat", @$, $2, $3, $4, SCM_EOL);
        }
-       | REPEAT_IDENTIFIER music
-       {
-               $$ = MAKE_SYNTAX ("repeat", @$, scm_car ($1), scm_cdr ($1),
-                                 $2, SCM_EOL);
-       }
        | REPEAT simple_string unsigned_number music ALTERNATIVE braced_music_list
        {
                $$ = MAKE_SYNTAX ("repeat", @$, $2, $3, $4, $6);
        }
-       | REPEAT_IDENTIFIER music ALTERNATIVE braced_music_list
-       {
-               $$ = MAKE_SYNTAX ("repeat", @$, scm_car ($1), scm_cdr ($1),
-                                 $2, $4);
-       }
        ;
 
 sequential_music:
@@ -1281,7 +1269,7 @@ context_modification:
         ;
 
 context_modification_arg:
-       embedded_scm_closed
+       embedded_scm
        | MUSIC_IDENTIFIER
        ;
 
@@ -1319,16 +1307,6 @@ composite_music:
        | music_bare
        ;
 
-/* Music that can be parsed without lookahead */
-closed_music:
-       music_bare
-       | complex_music_prefix closed_music
-       {
-               $$ = FINISH_MAKE_SYNTAX ($1, @$, $2);
-       }
-       | music_function_call_closed
-       ;
-
 music_bare:
        mode_changed_music
        | MUSIC_IDENTIFIER
@@ -1368,13 +1346,6 @@ grouped_music_list:
  * will match and whether or not \default will be appearing in the
  * argument list, and where.
  *
- * Many of the basic nonterminals used for argument list scanning come
- * in a "normal" and a "closed" flavor.  A closed expression is one
- * that can be parsed without a lookahead token.  That makes it
- * feasible for an optional argument that may need to be skipped:
- * skipping can only be accomplished by pushing back the token into
- * the lexer, and that only works when there is no lookahead token.
- *
  * Sequences of 0 or more optional arguments are scanned using either
  * function_arglist_backup or function_arglist_nonbackup.  The first
  * is used when optional arguments are followed by at least one
@@ -1432,35 +1403,6 @@ function_arglist_nonbackup_common:
        }
        ;
 
-function_arglist_closed_nonbackup:
-       function_arglist_nonbackup_common
-       | function_arglist_closed_common
-       | EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup embedded_scm_arg_closed
-       {
-               $$ = check_scheme_arg (parser, @4, $4, $3, $2);
-       }
-       | EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup bare_number_closed
-       {
-               $$ = check_scheme_arg (parser, @4, $4, $3, $2);
-       }
-       | EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup SCM_IDENTIFIER
-       {
-               $$ = check_scheme_arg (parser, @4,
-                                      try_string_variants ($2, $4),
-                                      $3, $2, $4);
-       }
-       | EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup STRING
-       {
-               $$ = check_scheme_arg (parser, @4,
-                                      try_string_variants ($2, $4),
-                                      $3, $2, $4);
-       }
-       | EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup full_markup
-       {
-               $$ = check_scheme_arg (parser, @4, $4, $3, $2);
-       }
-       ;
-
 symbol_list_arg:
        SYMBOL_LIST
        | SYMBOL_LIST '.' symbol_list_rev
@@ -1607,45 +1549,22 @@ function_arglist_nonbackup_reparse:
 
 
 // function_arglist_backup can't occur at the end of an argument
-// list.  It needs to be careful about avoiding lookahead only until
-// it has made a decision whether or not to accept the parsed entity.
-// At that point of time, music requiring lookahead to parse becomes
-// fine.
+// list.
 function_arglist_backup:
        function_arglist_common
-       | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup embedded_scm_arg_closed
+       | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup embedded_scm_arg
        {
                if (scm_is_true (scm_call_1 ($2, $4)))
-               {
                        $$ = scm_cons ($4, $3);
-               } else {
-                       $$ = scm_cons (loc_on_music (@3, $1), $3);
-                       MYBACKUP (SCM_ARG, $4, @4);
-               }
-       }
-       | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup REPEAT simple_string unsigned_number
-       {
-               $4 = MAKE_SYNTAX ("repeat", @4, $5, $6,
-                                 MY_MAKE_MUSIC ("Music", @4)->unprotect (),
-                                 SCM_EOL);
-               if (scm_is_true (scm_call_1 ($2, $4)))
-               {
-                       $$ = $3;
-                       MYREPARSE (@4, $2, REPEAT_IDENTIFIER, scm_cons ($5, $6));
-               } else {
-                       $$ = scm_cons (loc_on_music (@3, $1), $3);
-                       MYBACKUP (REPEAT_IDENTIFIER, scm_cons ($5, $6), @4);
-               }
-       }
-       | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup chord_body
-       {
-               if (scm_is_true (scm_call_1 ($2, $4)))
-               {
-                       $$ = $3;
-                       MYREPARSE (@4, $2, CHORD_BODY_IDENTIFIER, $4);
-               } else {
-                       $$ = scm_cons (loc_on_music (@3, $1), $3);
-                       MYBACKUP (CHORD_BODY_IDENTIFIER, $4, @4);
+               else {
+                       $$ = make_music_from_simple (parser, @4, $4);
+                       if (scm_is_true (scm_call_1 ($2, $$)))
+                               $$ = scm_cons ($$, $3);
+                       else
+                       {
+                               $$ = scm_cons (loc_on_music (@3, $1), $3);
+                               MYBACKUP (SCM_ARG, $4, @4);
+                       }
                }
        }
        | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup post_event_nofinger
@@ -1747,54 +1666,6 @@ function_arglist_backup:
                        MYBACKUP (NUMBER_IDENTIFIER, n, @5);
                }
        }
-       | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup PITCH_IDENTIFIER
-       {
-               SCM m = make_music_from_simple (parser, @4, $4);
-               if (unsmob_music (m) && scm_is_true (scm_call_1 ($2, m)))
-               {
-                       MYREPARSE (@4, $2, PITCH_IDENTIFIER, $4);
-                       $$ = $3;
-               } else if (scm_is_true (scm_call_1 ($2, $4)))
-               {
-                       MYREPARSE (@4, $2, PITCH_ARG, $4);
-                       $$ = $3;
-               } else {
-                       $$ = scm_cons (loc_on_music (@3, $1), $3);
-                       MYBACKUP (PITCH_IDENTIFIER, $4, @4);
-               }
-       }
-       | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup NOTENAME_PITCH
-       {
-               SCM m = make_music_from_simple (parser, @4, $4);
-               if (unsmob_music (m) && scm_is_true (scm_call_1 ($2, m)))
-               {
-                       MYREPARSE (@4, $2, NOTENAME_PITCH, $4);
-                       $$ = $3;
-               } else if (scm_is_true (scm_call_1 ($2, $4)))
-               {
-                       MYREPARSE (@4, $2, PITCH_ARG, $4);
-                       $$ = $3;
-               } else {
-                       $$ = scm_cons (loc_on_music (@3, $1), $3);
-                       MYBACKUP (NOTENAME_PITCH, $4, @4);
-               }
-       }
-       | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup TONICNAME_PITCH
-       {
-               SCM m = make_music_from_simple (parser, @4, $4);
-               if (unsmob_music (m) && scm_is_true (scm_call_1 ($2, m)))
-               {
-                       MYREPARSE (@4, $2, TONICNAME_PITCH, $4);
-                       $$ = $3;
-               } else if (scm_is_true (scm_call_1 ($2, $4)))
-               {
-                       MYREPARSE (@4, $2, PITCH_ARG, $4);
-                       $$ = $3;
-               } else {
-                       $$ = scm_cons (loc_on_music (@3, $1), $3);
-                       MYBACKUP (TONICNAME_PITCH, $4, @4);
-               }
-       }
        | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup DURATION_IDENTIFIER
        {
                if (scm_is_true (scm_call_1 ($2, $4)))
@@ -2032,55 +1903,6 @@ function_arglist_common_reparse:
        }
        ;
 
-function_arglist_closed:
-       function_arglist_closed_nonbackup
-       | EXPECT_OPTIONAL EXPECT_SCM function_arglist_skip_nonbackup DEFAULT
-       {
-               $$ = scm_cons (loc_on_music (@4, $1), $3);
-       }
-       ;
-
-function_arglist_closed_common:
-       EXPECT_NO_MORE_ARGS {
-               $$ = SCM_EOL;
-       }
-       | EXPECT_SCM function_arglist_optional embedded_scm_arg_closed
-       {
-               $$ = check_scheme_arg (parser, @3,
-                                      $3, $2, $1);
-       }
-       | EXPECT_SCM function_arglist_optional bare_number_common_closed
-       {
-               $$ = check_scheme_arg (parser, @3,
-                                      $3, $2, $1);
-       }
-       | EXPECT_SCM function_arglist_optional '-' NUMBER_IDENTIFIER
-       {
-               $$ = check_scheme_arg (parser, @3,
-                                      scm_difference ($4, SCM_UNDEFINED),
-                                      $2, $1);
-       }
-       | EXPECT_SCM function_arglist_optional post_event_nofinger
-       {
-               $$ = check_scheme_arg (parser, @3,
-                                      $3, $2, $1);
-       }
-       | function_arglist_common_reparse REPARSE SCM_ARG
-       {
-               $$ = check_scheme_arg (parser, @3,
-                                      $3, $1, $2);
-       }
-       | function_arglist_common_reparse REPARSE bare_number_common_closed
-       {
-               $$ = check_scheme_arg (parser, @3,
-                                      $3, $1, $2);
-       }
-       | function_arglist_common_reparse REPARSE symbol_list_arg
-       {
-               $$ = check_scheme_arg (parser, @3, $3, $1, $2);
-       }
-       ;
-
 function_arglist_optional:
        function_arglist_backup
        | EXPECT_OPTIONAL EXPECT_SCM function_arglist_skip_backup DEFAULT
@@ -2098,24 +1920,6 @@ function_arglist_skip_backup:
        }
        ;
 
-embedded_scm_closed:
-       embedded_scm_bare
-       | scm_function_call_closed
-       ;
-
-embedded_scm_arg_closed:
-       embedded_scm_bare_arg
-       | scm_function_call_closed
-       | closed_music
-       ;
-
-scm_function_call_closed:
-       SCM_FUNCTION function_arglist_closed {
-               $$ = MAKE_SYNTAX ("music-function", @$,
-                                        $1, $2);
-       }
-       ;
-
 music_function_call:
        MUSIC_FUNCTION function_arglist {
                $$ = MAKE_SYNTAX ("music-function", @$,
@@ -2668,7 +2472,6 @@ chord_body:
        {
                $$ = MAKE_SYNTAX ("event-chord", @$, scm_reverse_x ($2, SCM_EOL));
        }
-       | CHORD_BODY_IDENTIFIER
        ;
 
 chord_body_elements:
@@ -2737,18 +2540,6 @@ music_function_chord_body:
        | MUSIC_IDENTIFIER
        ;
 
-// Event functions may only take closed arglists, otherwise it would
-// not be clear whether a following postevent should be associated
-// with the last argument of the event function or with the expression
-// for which the function call acts itself as event.
-
-music_function_call_closed:
-       MUSIC_FUNCTION function_arglist_closed {
-               $$ = MAKE_SYNTAX ("music-function", @$,
-                                        $1, $2);
-       }
-       ;
-
 event_function_event:
        EVENT_FUNCTION function_arglist {
                $$ = MAKE_SYNTAX ("music-function", @$,
@@ -2990,7 +2781,7 @@ gen_text_def:
                        make_simple_markup ($1));
                $$ = t->unprotect ();
        }
-       | embedded_scm_closed
+       | embedded_scm
        {
                Music *m = unsmob_music ($1);
                if (m && m->is_mus_type ("post-event"))
@@ -3460,11 +3251,6 @@ bare_number:
        }
        ;
 
-bare_number_closed:
-       UNSIGNED
-       | bare_number_common_closed
-       ;
-
 unsigned_number:
        UNSIGNED
        | NUMBER_IDENTIFIER
@@ -3623,7 +3409,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_closed {
+       | EXPECT_SCM markup_command_list_arguments embedded_scm {
          $$ = check_scheme_arg (parser, @3, $3, $2, $1);
        }
        | EXPECT_NO_MORE_ARGS {