of the parse stack onto the heap. */
%left PREC_BOT
-%nonassoc REPEAT
+%nonassoc REPEAT REPEAT_IDENTIFIER
%nonassoc ALTERNATIVE
/* The above precedences tackle the shift/reduce problem
%left ADDLYRICS
%right ':' UNSIGNED REAL E_UNSIGNED EVENT_IDENTIFIER EVENT_FUNCTION '^' '_'
- HYPHEN EXTENDER
+ HYPHEN EXTENDER DURATION_IDENTIFIER
/* The above are needed for collecting tremoli and other items (that
could otherwise be interpreted as belonging to the next function
%token EMBEDDED_LILY "#{"
%token BOOK_IDENTIFIER
+%token CHORD_BODY_IDENTIFIER
%token CHORD_MODIFIER
%token CHORD_REPETITION
%token CONTEXT_DEF_IDENTIFIER
%token NUMBER_IDENTIFIER
%token OUTPUT_DEF_IDENTIFIER
%token REAL
+%token REPEAT_IDENTIFIER
%token RESTNAME
%token SCM_ARG
%token SCM_FUNCTION
TEMPO steno_duration '=' tempo_range {
$$ = MAKE_SYNTAX ("tempo", @$, SCM_EOL, $2, $4);
}
- | TEMPO scalar_closed steno_duration '=' tempo_range {
+ | TEMPO scalar steno_duration '=' tempo_range {
$$ = MAKE_SYNTAX ("tempo", @$, $2, $3, $5);
}
| TEMPO scalar {
$$ = MAKE_SYNTAX ("tempo", @$, $2);
- }
+ } %prec ':'
;
/*
{
$$ = 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:
{
$$ = check_scheme_arg (parser, @4, $4, $3, $2);
}
- | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed_nonbackup bare_number_closed
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup bare_number_closed
{
$$ = check_scheme_arg (parser, @4, $4, $3, $2);
}
(parser, @4, $4),
$3, $2);
}
- | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed_nonbackup bare_number_common
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup bare_number_common
{
$$ = check_scheme_arg (parser, @4, $4, $3, $2);
}
else
MYREPARSE (@4, $2, SCM_ARG, $4);
}
- | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed_nonbackup UNSIGNED
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup UNSIGNED
{
$$ = $3;
if (scm_is_true (scm_call_1 ($2, $4)))
MYREPARSE (@4, $2, DURATION_IDENTIFIER, d);
}
}
- | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed_nonbackup DURATION_IDENTIFIER {
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup DURATION_IDENTIFIER {
$$ = $3;
MYREPARSE (@4, $2, DURATION_IDENTIFIER, $4);
}
| function_arglist_common
;
-function_arglist_closed_backup:
- function_arglist_backup_common
- | function_arglist_closed_common
- ;
-
function_arglist_backup_common:
EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup embedded_scm_arg_closed
{
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);
+ }
+ }
| EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup post_event_nofinger
{
if (scm_is_true (scm_call_1 ($2, $4)))
MYBACKUP (LYRIC_ELEMENT, $4, @4);
}
}
- | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed_backup UNSIGNED
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup UNSIGNED
{
if (scm_is_true (scm_call_1 ($2, $4)))
{
}
}
}
- | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed_backup REAL
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup REAL
{
if (scm_is_true (scm_call_1 ($2, $4)))
{
MYBACKUP (REAL, $4, @4);
}
}
- | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed_backup NUMBER_IDENTIFIER
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup NUMBER_IDENTIFIER
{
if (scm_is_true (scm_call_1 ($2, $4)))
{
MYBACKUP (TONICNAME_PITCH, $4, @4);
}
}
- | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed_backup DURATION_IDENTIFIER
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup DURATION_IDENTIFIER
{
if (scm_is_true (scm_call_1 ($2, $4)))
{
MYBACKUP (STRING, $4, @4);
}
}
+ | function_arglist_backup REPARSE music_assign
+ {
+ if (scm_is_true (scm_call_1 ($2, $3)))
+ $$ = scm_cons ($3, $1);
+ else
+ $$ = check_scheme_arg (parser, @3,
+ make_music_from_simple
+ (parser, @3, $3),
+ $1, $2);
+ }
| function_arglist_backup REPARSE bare_number_common
{
$$ = check_scheme_arg (parser, @3,
{
$$ = check_scheme_arg (parser, @3, $3, $1, $2);
}
- | function_arglist_backup REPARSE pitch_also_in_chords
- {
- $$ = check_scheme_arg (parser, @3, $3, $1, $2);
- }
;
function_arglist:
(parser, @3, $3),
$2, $1);
}
- | EXPECT_SCM function_arglist_closed_optional bare_number_common
+ | EXPECT_SCM function_arglist_optional bare_number_common
{
$$ = check_scheme_arg (parser, @3,
$3, $2, $1);
// know the predicate to be false.
MYREPARSE (@3, $1, SCM_ARG, $3);
}
- | EXPECT_SCM function_arglist_closed_optional UNSIGNED
+ | EXPECT_SCM function_arglist_optional UNSIGNED
{
$$ = $2;
if (scm_is_true (scm_call_1 ($1, $3)))
MYREPARSE (@3, $1, DURATION_IDENTIFIER, d);
}
}
- | EXPECT_SCM function_arglist_closed_optional DURATION_IDENTIFIER
+ | EXPECT_SCM function_arglist_optional DURATION_IDENTIFIER
{
$$ = $2;
MYREPARSE (@3, $1, DURATION_IDENTIFIER, $3);
$$ = check_scheme_arg (parser, @3,
$3, $2, $1);
}
- | EXPECT_SCM function_arglist_closed_optional bare_number_common_closed
+ | EXPECT_SCM function_arglist_optional bare_number_common_closed
{
$$ = check_scheme_arg (parser, @3,
$3, $2, $1);
}
;
-function_arglist_closed_optional:
- function_arglist_closed_backup
- | EXPECT_OPTIONAL EXPECT_SCM function_arglist_skip_backup DEFAULT
- {
- $$ = scm_cons (loc_on_music (@4, $1), $3);
- }
- | function_arglist_skip_backup BACKUP
- ;
-
embedded_scm_closed:
embedded_scm_bare
| scm_function_call_closed
| full_markup
;
-scalar_closed:
- embedded_scm_arg_closed
- | SCM_IDENTIFIER
- // for scalar_closed to be an actually closed (no lookahead)
- // expression, we'd need to use bare_number_closed here. It
- // turns out that the only use of scalar_closed in TEMPO is
- // not of the kind requiring the full closedness criterion.
- | bare_number
- | '-' bare_number
- {
- $$ = scm_difference ($2, SCM_UNDEFINED);
- }
- | FRACTION
- | STRING
- | full_markup
- ;
-
-
event_chord:
simple_element post_events {
// Let the rhythmic music iterator sort this mess out.
{
$$ = MAKE_SYNTAX ("event-chord", @$, scm_reverse_x ($2, SCM_EOL));
}
+ | CHORD_BODY_IDENTIFIER
;
chord_body_elements:
| PITCH_IDENTIFIER
;
-pitch_also_in_chords:
- pitch
- | steno_tonic_pitch
- ;
-
gen_text_def:
full_markup {
Music *t = MY_MAKE_MUSIC ("TextScriptEvent", @$);
maybe_notemode_duration:
{
$$ = SCM_UNDEFINED;
- }
+ } %prec ':'
| multiplied_duration {
$$ = $1;
parser->default_duration_ = *unsmob_duration ($$);
| steno_tonic_pitch optional_notemode_duration chord_separator chord_items {
SCM its = scm_reverse_x ($4, SCM_EOL);
$$ = make_chord_elements (@$, $1, $2, scm_cons ($3, its));
- }
+ } %prec ':'
;
chord_items: