/*
This file is part of LilyPond, the GNU music typesetter.
- Copyright (C) 1997--2010 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ Copyright (C) 1997--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
Jan Nieuwenhuizen <janneke@gnu.org>
LilyPond is free software: you can redistribute it and/or modify
/* Artificial tokens, for more generic function syntax */
%token <i> EXPECT_MARKUP;
%token <i> EXPECT_MUSIC;
+%token <i> EXPECT_PITCH;
+%token <i> EXPECT_DURATION;
%token <i> EXPECT_SCM;
%token <i> EXPECT_MARKUP_LIST
/* After the last argument. */
%token <scm> MARKUP_FUNCTION
%token <scm> MARKUP_LIST_FUNCTION
%token <scm> MARKUP_IDENTIFIER
+%token <scm> MARKUPLINES_IDENTIFIER
%token <scm> MUSIC_FUNCTION
%token <scm> MUSIC_IDENTIFIER
%token <scm> NOTENAME_PITCH
/* Music */
%type <scm> composite_music
%type <scm> grouped_music_list
+%type <scm> closed_music
%type <scm> music
%type <scm> prefix_composite_music
%type <scm> repeated_music
%type <scm> step_number
%type <scm> step_numbers
%type <scm> string
+%type <scm> tempo_range
%type <score> score_block
%type <score> score_body
| full_markup {
$$ = $1;
}
+ | full_markup_list {
+ $$ = $1;
+ }
| DIGIT {
$$ = scm_from_int ($1);
}
;
tempo_event:
- TEMPO steno_duration '=' bare_unsigned {
- $$ = MAKE_SYNTAX ("tempo", @$, SCM_BOOL_F, $2, scm_from_int ($4));
- }
- | TEMPO string steno_duration '=' bare_unsigned {
- $$ = MAKE_SYNTAX ("tempo", @$, make_simple_markup($2), $3, scm_from_int ($5));
- }
- | TEMPO full_markup steno_duration '=' bare_unsigned {
- $$ = MAKE_SYNTAX ("tempo", @$, $2, $3, scm_from_int ($5));
+ TEMPO steno_duration '=' tempo_range {
+ $$ = MAKE_SYNTAX ("tempo", @$, SCM_EOL, $2, $4);
}
- | TEMPO string {
- $$ = MAKE_SYNTAX ("tempoText", @$, make_simple_markup($2) );
+ | TEMPO scalar steno_duration '=' tempo_range {
+ $$ = MAKE_SYNTAX ("tempo", @$, $2, $3, $5);
}
- | TEMPO full_markup {
- $$ = MAKE_SYNTAX ("tempoText", @$, $2 );
+ | TEMPO scalar {
+ $$ = MAKE_SYNTAX ("tempo", @$, $2);
}
;
| grouped_music_list { $$ = $1; }
;
+/* Music that can't be followed by additional events or durations */
+closed_music:
+ MUSIC_IDENTIFIER
+ | grouped_music_list
+ ;
+
grouped_music_list:
simultaneous_music { $$ = $1; }
| sequential_music { $$ = $1; }
;
function_arglist_nonmusic_last:
- EXPECT_MARKUP function_arglist full_markup {
+ EXPECT_NO_MORE_ARGS {
+ /* This is for 0-ary functions, so they don't need to
+ read a lookahead token */
+ $$ = SCM_EOL;
+ }
+ | EXPECT_MARKUP function_arglist full_markup {
$$ = scm_cons ($3, $2);
}
| EXPECT_MARKUP function_arglist simple_string {
$$ = scm_cons ($3, $2);
}
+ | EXPECT_PITCH function_arglist pitch {
+ $$ = scm_cons ($3, $2);
+ }
+ | EXPECT_DURATION function_arglist_nonmusic_last duration_length {
+ $$ = scm_cons ($3, $2);
+ }
| EXPECT_SCM function_arglist function_scm_argument {
$$ = scm_cons ($3, $2);
}
| EXPECT_MARKUP function_arglist_nonmusic simple_string {
$$ = scm_cons ($3, $2);
}
+ | EXPECT_PITCH function_arglist_nonmusic pitch {
+ $$ = scm_cons ($3, $2);
+ }
+ | EXPECT_DURATION function_arglist_nonmusic duration_length {
+ $$ = scm_cons ($3, $2);
+ }
| EXPECT_SCM function_arglist_nonmusic function_scm_argument {
$$ = scm_cons ($3, $2);
}
;
-function_arglist: EXPECT_NO_MORE_ARGS {
- /* This is for 0-ary functions, so they don't need to
- read a lookahead token */
- $$ = SCM_EOL;
- }
- | function_arglist_music_last
+function_arglist:
+ function_arglist_music_last
| function_arglist_nonmusic_last
;
generic_prefix_music_scm:
MUSIC_FUNCTION function_arglist {
- $$ = ly_append2 (scm_list_2 ($1, make_input (@$)), scm_reverse_x ($2, SCM_EOL));
+ $$ = scm_cons ($1, scm_cons (make_input (@$), scm_reverse_x ($2, SCM_EOL)));
}
;
new_lyrics:
ADDLYRICS { PARSER->lexer_->push_lyric_state (); }
/*cont */
- grouped_music_list {
+ closed_music {
/* Can also use music at the expensive of two S/Rs similar to
\repeat \alternative */
PARSER->lexer_->pop_state ();
}
| new_lyrics ADDLYRICS {
PARSER->lexer_->push_lyric_state ();
- } grouped_music_list {
+ } closed_music {
PARSER->lexer_->pop_state ();
$$ = scm_cons ($4, $1);
}
;
re_rhythmed_music:
- grouped_music_list new_lyrics {
+ closed_music new_lyrics {
$$ = MAKE_SYNTAX ("add-lyrics", @$, $1, scm_reverse_x ($2, SCM_EOL));
}
| LYRICSTO simple_string {
scalar: string {
$$ = $1;
}
- | LYRICS_STRING {
+ | lyric_element {
$$ = $1;
}
| bare_number {
}
| DRUM_PITCH post_events {
Music *n = MY_MAKE_MUSIC ("NoteEvent", @$);
- n->set_property ("duration", $2);
n->set_property ("drum-type", $1);
if (scm_is_pair ($2)) {
but it's more consistent with music_function_event if we
prohibit it here too */
music_function_identifier_musicless_prefix EXPECT_MUSIC function_arglist_nonmusic chord_body_element {
- $$ = ly_append2 (scm_list_2 ($1, make_input (@$)), scm_reverse_x ($3, scm_list_1 ($4)));
+ $$ = scm_cons ($1, scm_cons (make_input (@$), scm_reverse_x ($3, scm_list_1 ($4))));
}
| music_function_identifier_musicless_prefix function_arglist_nonmusic {
- $$ = ly_append2 (scm_list_2 ($1, make_input (@$)), scm_reverse_x ($2, SCM_EOL));
+ $$ = scm_cons ($1, scm_cons (make_input (@$), scm_reverse_x ($2, SCM_EOL)));
}
;
restriction we get a shift/reduce conflict from e.g.
c8-\partcombine c8 -. */
music_function_identifier_musicless_prefix EXPECT_MUSIC function_arglist_nonmusic post_event {
- $$ = ly_append2 (scm_list_2 ($1, make_input (@$)), scm_reverse_x ($3, scm_list_1 ($4)));
+ $$ = scm_cons ($1, scm_cons (make_input (@$), scm_reverse_x ($3, scm_list_1 ($4))));
}
| music_function_identifier_musicless_prefix function_arglist_nonmusic {
- $$ = ly_append2 (scm_list_2 ($1, make_input (@$)), scm_reverse_x ($2, SCM_EOL));
+ $$ = scm_cons ($1, scm_cons (make_input (@$), scm_reverse_x ($2, SCM_EOL)));
}
;
direction_less_event {
$$ = $1;
}
- | '-' music_function_event {
+ | script_dir music_function_event {
$$ = run_music_function (PARSER, $2);
+ if ($1)
+ {
+ unsmob_music ($$)->set_property ("direction", scm_from_int ($1));
+ }
}
| HYPHEN {
if (!PARSER->lexer_->is_lyric_state ())
}
;
+tempo_range:
+ bare_unsigned {
+ $$ = scm_from_int ($1);
+ }
+ | bare_unsigned '~' bare_unsigned {
+ $$ = scm_cons (scm_from_int ($1), scm_from_int ($3));
+ }
+ ;
+
/*
UTILITIES
}
;
-
exclamations:
{ $$ = 0; }
| exclamations '!' { $$ ++; }
;
full_markup_list:
- MARKUPLINES
+ MARKUPLINES_IDENTIFIER {
+ $$ = $1;
+ }
+ | MARKUPLINES
{ PARSER->lexer_->push_markup_state (); }
markup_list {
$$ = $3;
;
markup_list:
- markup_composed_list {
+ MARKUPLINES_IDENTIFIER {
+ $$ = $1;
+ }
+ | markup_composed_list {
$$ = $1;
}
| markup_braced_list {
if (is_lyric_state ())
return LYRIC_MARKUP_IDENTIFIER;
return MARKUP_IDENTIFIER;
+ } else if (Text_interface::is_markup_list (sid)) {
+ *destination = sid;
+ return MARKUPLINES_IDENTIFIER;
}
return -1;