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
%nonassoc COMPOSITE
%left ADDLYRICS
-%right ':' UNSIGNED REAL
+%right ':' UNSIGNED REAL E_UNSIGNED EVENT_IDENTIFIER EVENT_FUNCTION '^' '_'
+ HYPHEN EXTENDER DURATION_IDENTIFIER
- /* The above are needed for collecting tremoli greedily, and together
- with the next rule for putting together numbers and units
+ /* The above are needed for collecting tremoli and other items (that
+ could otherwise be interpreted as belonging to the next function
+ argument) greedily, and together with the next rule will serve to
+ join numbers and units greedily instead of allowing them into
+ separate function arguments
*/
%nonassoc NUMBER_IDENTIFIER
%token REST "\\rest"
%token REVERT "\\revert"
%token SCORE "\\score"
+%token SCORELINES "\\score-lines"
%token SEQUENTIAL "\\sequential"
%token SET "\\set"
%token SIMULTANEOUS "\\simultaneous"
%token EMBEDDED_LILY "#{"
%token BOOK_IDENTIFIER
+%token CHORD_BODY_IDENTIFIER
%token CHORD_MODIFIER
%token CHORD_REPETITION
%token CONTEXT_DEF_IDENTIFIER
%token CONTEXT_MOD_IDENTIFIER
%token DRUM_PITCH
%token PITCH_IDENTIFIER
+%token PITCH_ARG
%token DURATION_IDENTIFIER
%token EVENT_IDENTIFIER
%token EVENT_FUNCTION
%token NUMBER_IDENTIFIER
%token OUTPUT_DEF_IDENTIFIER
%token REAL
+%token REPEAT_IDENTIFIER
%token RESTNAME
%token SCM_ARG
%token SCM_FUNCTION
{
$$ = parser->lexer_->eval_scm_token ($1);
}
+ | FRACTION
| full_markup_list
| context_modification
| score_block
}
;
+embedded_lilypond_number:
+ '-' embedded_lilypond_number
+ {
+ $$ = scm_difference ($2, SCM_UNDEFINED);
+ }
+ | bare_number_common
+ | UNSIGNED NUMBER_IDENTIFIER
+ {
+ $$ = scm_product ($1, $2);
+ }
+ ;
+
embedded_lilypond:
/* empty */
{
// contains no source location.
$$ = MAKE_SYNTAX ("void-music", @$);
}
- | identifier_init
+ | identifier_init_nonumber
+ | embedded_lilypond_number
+ | post_event post_events
+ {
+ $$ = scm_reverse_x ($2, SCM_EOL);
+ if (Music *m = unsmob_music ($1))
+ {
+ if (m->is_mus_type ("post-event-wrapper"))
+ $$ = scm_append
+ (scm_list_2 (m->get_property ("elements"),
+ $$));
+ else
+ $$ = scm_cons ($1, $$);
+ }
+ if (scm_is_pair ($$)
+ && scm_is_null (scm_cdr ($$)))
+ $$ = scm_car ($$);
+ else
+ {
+ Music * m = MY_MAKE_MUSIC ("PostEvents", @$);
+ m->set_property ("elements", $$);
+ $$ = m->unprotect ();
+ }
+ }
+ | multiplied_duration
| music_embedded music_embedded music_list {
$3 = scm_reverse_x ($3, SCM_EOL);
if (unsmob_music ($2))
identifier_init:
- score_block
- | book_block
- | bookpart_block
- | output_def
- | context_def_spec_block
- | music_assign
+ identifier_init_nonumber
+ | number_expression
| post_event_nofinger post_events
{
$$ = scm_reverse_x ($2, SCM_EOL);
$$ = m->unprotect ();
}
}
- | number_expression
+ ;
+
+identifier_init_nonumber:
+ score_block
+ | book_block
+ | bookpart_block
+ | output_def
+ | context_def_spec_block
+ | music_assign
| FRACTION
| string
| embedded_scm
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 ':'
;
/*
{
$$ = $3;
}
+ | multiplied_duration post_events
+ {
+ Music *n = MY_MAKE_MUSIC ("NoteEvent", @$);
+
+ parser->default_duration_ = *unsmob_duration ($1);
+ n->set_property ("duration", $1);
+
+ if (scm_is_pair ($2))
+ n->set_property ("articulations",
+ scm_reverse_x ($2, SCM_EOL));
+ $$ = n->unprotect ();
+ }
;
music_embedded_backup:
{
$$ = 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:
*/
function_arglist_nonbackup_common:
- EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup FRACTION
+ EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup post_event_nofinger
{
$$ = check_scheme_arg (parser, @4, $4, $3, $2);
}
- | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed_nonbackup post_event_nofinger
- {
- $$ = check_scheme_arg (parser, @4, $4, $3, $2);
- }
- | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed_nonbackup '-' UNSIGNED
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup '-' UNSIGNED
{
SCM n = scm_difference ($5, SCM_UNDEFINED);
if (scm_is_true (scm_call_1 ($2, n)))
}
}
- | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed_nonbackup '-' REAL
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup '-' REAL
{
$$ = check_scheme_arg (parser, @4,
scm_difference ($5, SCM_UNDEFINED),
$3, $2);
}
- | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed_nonbackup '-' NUMBER_IDENTIFIER
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup '-' NUMBER_IDENTIFIER
{
$$ = check_scheme_arg (parser, @4,
scm_difference ($5, SCM_UNDEFINED),
{
$$ = 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_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.
function_arglist_backup:
- function_arglist_backup_common
- | 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
+ function_arglist_common
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup embedded_scm_arg_closed
{
if (scm_is_true (scm_call_1 ($2, $4)))
{
MYBACKUP (SCM_ARG, $4, @4);
}
}
- | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed_backup post_event_nofinger
+ | 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 (NUMBER_IDENTIFIER, $4, @4);
}
}
- | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup FRACTION
- {
- if (scm_is_true (scm_call_1 ($2, $4)))
- {
- $$ = scm_cons ($4, $3);
- } else {
- $$ = scm_cons (loc_on_music (@3, $1), $3);
- MYBACKUP (FRACTION, $4, @4);
- }
- }
- | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed_backup '-' UNSIGNED
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup '-' UNSIGNED
{
SCM n = scm_difference ($5, SCM_UNDEFINED);
if (scm_is_true (scm_call_1 ($2, n))) {
}
}
- | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed_backup '-' REAL
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup '-' REAL
{
SCM n = scm_difference ($5, SCM_UNDEFINED);
if (scm_is_true (scm_call_1 ($2, n))) {
MYBACKUP (REAL, n, @5);
}
}
- | EXPECT_OPTIONAL EXPECT_SCM function_arglist_closed_backup '-' NUMBER_IDENTIFIER
+ | EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup '-' NUMBER_IDENTIFIER
{
SCM n = scm_difference ($5, SCM_UNDEFINED);
if (scm_is_true (scm_call_1 ($2, n))) {
}
| EXPECT_OPTIONAL EXPECT_SCM function_arglist_backup PITCH_IDENTIFIER
{
- if (scm_is_true (scm_call_1 ($2, $4)))
+ SCM m = make_music_from_simple (parser, @4, $4);
+ if (unsmob_music (m) && scm_is_true (scm_call_1 ($2, m)))
{
- $$ = scm_cons ($4, $3);
+ 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
{
- if (scm_is_true (scm_call_1 ($2, $4)))
+ 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
{
- if (scm_is_true (scm_call_1 ($2, $4)))
+ 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_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 pitch_arg
+ {
+ $$ = check_scheme_arg (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
- {
- $$ = check_scheme_arg (parser, @3,
- $3, $2, $1);
- }
- | EXPECT_SCM function_arglist_optional FRACTION
+ | EXPECT_SCM function_arglist_optional bare_number_common
{
$$ = check_scheme_arg (parser, @3,
$3, $2, $1);
}
- | EXPECT_SCM function_arglist_closed_optional post_event_nofinger
+ | EXPECT_SCM function_arglist_optional post_event_nofinger
{
$$ = check_scheme_arg (parser, @3,
$3, $2, $1);
}
- | EXPECT_SCM function_arglist_closed_optional '-' NUMBER_IDENTIFIER
+ | EXPECT_SCM function_arglist_optional '-' NUMBER_IDENTIFIER
{
SCM n = scm_difference ($4, SCM_UNDEFINED);
$$ = check_scheme_arg (parser, @4, n, $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);
}
- | EXPECT_SCM function_arglist_closed_optional '-' UNSIGNED
+ | EXPECT_SCM function_arglist_optional '-' UNSIGNED
{
$$ = $2;
SCM n = scm_difference ($4, SCM_UNDEFINED);
}
}
- | EXPECT_SCM function_arglist_closed_optional '-' REAL
+ | EXPECT_SCM function_arglist_optional '-' REAL
{
$$ = $2;
SCM n = scm_difference ($4, SCM_UNDEFINED);
$$ = 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);
}
- | EXPECT_SCM function_arglist_closed_optional '-' NUMBER_IDENTIFIER
+ | EXPECT_SCM function_arglist_optional '-' NUMBER_IDENTIFIER
{
$$ = check_scheme_arg (parser, @3,
scm_difference ($4, SCM_UNDEFINED),
$2, $1);
}
- | EXPECT_SCM function_arglist_closed_optional post_event_nofinger
- {
- $$ = check_scheme_arg (parser, @3,
- $3, $2, $1);
- }
- | EXPECT_SCM function_arglist_optional FRACTION
+ | EXPECT_SCM function_arglist_optional post_event_nofinger
{
$$ = 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
;
context_change:
- CHANGE STRING '=' STRING {
- $$ = MAKE_SYNTAX ("context-change", @$, scm_string_to_symbol ($2), $4);
+ CHANGE symbol '=' simple_string {
+ $$ = MAKE_SYNTAX ("context-change", @$, $2, $4);
}
;
{
$$ = scm_difference ($2, SCM_UNDEFINED);
}
- | FRACTION
| STRING
| 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 ("void-music", @1);
}
}
- }
+ } %prec ':'
| simple_chord_elements post_events {
- SCM elts = ly_append2 ($1, scm_reverse_x ($2, SCM_EOL));
-
- Input i;
- /* why is this giving wrong start location? -ns
- * i = @$; */
- i.set_location (@1, @2);
- $$ = MAKE_SYNTAX ("event-chord", i, elts);
- }
+ if (scm_is_pair ($2)) {
+ if (unsmob_pitch ($1))
+ $1 = make_chord_elements (@1,
+ $1,
+ parser->default_duration_.smobbed_copy (),
+ SCM_EOL);
+
+ SCM elts = ly_append2 ($1, scm_reverse_x ($2, SCM_EOL));
+
+ $$ = MAKE_SYNTAX ("event-chord", @1, elts);
+ } else if (!unsmob_pitch ($1))
+ $$ = MAKE_SYNTAX ("event-chord", @1, $1);
+ // A mere pitch drops through.
+ } %prec ':'
| CHORD_REPETITION optional_notemode_duration post_events {
Input i;
i.set_location (@1, @3);
$$ = MAKE_SYNTAX ("repetition-chord", i,
$2, scm_reverse_x ($3, SCM_EOL));
- }
+ } %prec ':'
| MULTI_MEASURE_REST optional_notemode_duration post_events {
Input i;
i.set_location (@1, @3);
$$ = MAKE_SYNTAX ("multi-measure-rest", i, $2,
scm_reverse_x ($3, SCM_EOL));
- }
+ } %prec ':'
| command_element
| note_chord_element
;
m-> set_property ("elements", es);
m->set_spot (@$);
$$ = m->self_scm ();
- }
+ } %prec ':'
;
chord_body:
{
$$ = MAKE_SYNTAX ("event-chord", @$, scm_reverse_x ($2, SCM_EOL));
}
+ | CHORD_BODY_IDENTIFIER
;
chord_body_elements:
}
| script_abbreviation {
SCM s = parser->lexer_->lookup_identifier ("dash" + ly_scm2string ($1));
- Music *a = MY_MAKE_MUSIC ("ArticulationEvent", @$);
- if (scm_is_string (s))
+ if (scm_is_string (s)) {
+ Music *a = MY_MAKE_MUSIC ("ArticulationEvent", @$);
a->set_property ("articulation-type", s);
- else parser->parser_error (@1, _ ("expecting string as script definition"));
- $$ = a->unprotect ();
+ $$ = a->unprotect ();
+ } else if (ly_prob_type_p (s, ly_symbol2scm ("ArticulationEvent"))) {
+ $$ = s;
+ if (Music *original = unsmob_music (s)) {
+ Music *a = original->clone ();
+ a->set_spot (parser->lexer_->override_input (@$));
+ $$ = a->unprotect ();
+ }
+ } else parser->parser_error (@1, _ ("expecting string or ArticulationEvent as script definition"));
}
;
pitch:
steno_pitch
- | PITCH_IDENTIFIER
+ | PITCH_IDENTIFIER quotes {
+ if (!scm_is_eq (SCM_INUM0, $2))
+ {
+ Pitch p = *unsmob_pitch ($1);
+ p = p.transposed (Pitch (scm_to_int ($2),0,0));
+ $$ = p.smobbed_copy ();
+ }
+ }
;
-pitch_also_in_chords:
- pitch
- | steno_tonic_pitch
+pitch_arg:
+ PITCH_ARG quotes {
+ if (!scm_is_eq (SCM_INUM0, $2))
+ {
+ Pitch p = *unsmob_pitch ($1);
+ p = p.transposed (Pitch (scm_to_int ($2),0,0));
+ $$ = p.smobbed_copy ();
+ }
+ }
;
gen_text_def:
maybe_notemode_duration:
{
$$ = SCM_UNDEFINED;
- }
+ } %prec ':'
| multiplied_duration {
$$ = $1;
parser->default_duration_ = *unsmob_duration ($$);
}
;
+// Can return a single pitch rather than a list.
simple_chord_elements:
new_chord {
if (!parser->lexer_->is_chord_state ())
if (scm_is_pair ($3))
unsmob_music ($$)->set_property
("articulations", scm_reverse_x ($3, SCM_EOL));
- }
+ } %prec ':'
;
+// Can return a single pitch rather than a list.
new_chord:
- steno_tonic_pitch optional_notemode_duration {
- $$ = make_chord_elements (@$, $1, $2, SCM_EOL);
+ steno_tonic_pitch maybe_notemode_duration {
+ if (SCM_UNBNDP ($2))
+ $$ = $1;
+ else
+ $$ = make_chord_elements (@$, $1, $2, SCM_EOL);
}
| 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:
;
tempo_range:
- UNSIGNED {
+ unsigned_number {
$$ = $1;
- }
- | UNSIGNED '-' UNSIGNED {
+ } %prec ':'
+ | unsigned_number '-' unsigned_number {
$$ = scm_cons ($1, $3);
}
;
unsigned_number:
UNSIGNED
| NUMBER_IDENTIFIER
+ {
+ if (!scm_is_integer ($1)
+ || scm_is_true (scm_negative_p ($1)))
+ {
+ parser->parser_error (@1, _("not an unsigned integer"));
+ $$ = SCM_INUM0;
+ }
+ }
+ | embedded_scm
+ {
+ if (!scm_is_integer ($1)
+ || scm_is_true (scm_negative_p ($1)))
+ {
+ parser->parser_error (@1, _("not an unsigned integer"));
+ $$ = SCM_INUM0;
+ }
+ }
;
exclamations:
;
markup_top:
- simple_markup_list {
+ markup_list {
$$ = scm_list_2 (ly_lily_module_constant ("line-markup"), $1);
}
| markup_head_1_list simple_markup
;
-simple_markup_list:
+markup_list:
markup_composed_list {
$$ = $1;
}
{
$$ = $2;
}
- ;
-
-markup_list:
- simple_markup_list
- | markup_score
- {
- $$ = scm_list_1 (scm_list_2 (ly_lily_module_constant ("score-lines-markup-list"), $1));
- }
- ;
-
-markup_score:
- SCORE {
+ | SCORELINES {
SCM nn = parser->lexer_->lookup_identifier ("pitchnames");
parser->lexer_->push_note_state (nn);
} '{' score_body '}' {
- $$ = $4;
+ $$ = scm_list_1 (scm_list_2 (ly_lily_module_constant ("score-lines-markup-list"), $4));
parser->lexer_->pop_state ();
}
;
| markup_braced_list_body markup {
$$ = scm_cons ($2, $1);
}
- | markup_braced_list_body simple_markup_list {
+ | markup_braced_list_body markup_list {
$$ = scm_reverse_x ($2, $1);
}
;
STRING {
$$ = make_simple_markup ($1);
}
+ | SCORE {
+ SCM nn = parser->lexer_->lookup_identifier ("pitchnames");
+ parser->lexer_->push_note_state (nn);
+ } '{' score_body '}' {
+ $$ = scm_list_2 (ly_lily_module_constant ("score-markup"), $4);
+ parser->lexer_->pop_state ();
+ }
| MARKUP_FUNCTION markup_command_basic_arguments {
$$ = scm_cons ($1, scm_reverse_x ($2, SCM_EOL));
}
{
$$ = $2;
}
- | markup_score
- {
- $$ = scm_list_2 (ly_lily_module_constant ("score-markup"), $1);
- }
;
markup:
parser->default_duration_.smobbed_copy ());
} else if (parser->lexer_->is_chord_state ()) {
if (unsmob_pitch (simple))
- return make_chord_elements (loc, simple,
- parser->default_duration_.smobbed_copy (),
- SCM_EOL);
+ return MAKE_SYNTAX
+ ("event-chord",
+ loc,
+ make_chord_elements (loc, simple,
+ parser->default_duration_.smobbed_copy (),
+ SCM_EOL));
}
return simple;
}