#include "paper-book.hh"
#include "output-def.hh"
#include "scm-hash.hh"
-#include "scm-option.hh"
+#include "program-option.hh"
#include "score.hh"
-#include "text-item.hh"
+#include "text-interface.hh"
#include "warn.hh"
#define MY_MAKE_MUSIC(x) make_music_by_name (ly_symbol2scm (x))
Music*
make_lyric_combine_music (SCM name, Music *music)
{
- Music *combine = MY_MAKE_MUSIC ("NewLyricCombineMusic");
+ Music *combine = MY_MAKE_MUSIC ("LyricCombineMusic");
combine->set_property ("element", music->self_scm ());
combine->set_property ("associated-context", name);
return combine;
%{
int
-yylex (YYSTYPE *s, YYLTYPE *l, void *v)
+yylex (YYSTYPE *s, YYLTYPE *loc, void *v)
{
Lily_parser *pars = (Lily_parser*) v;
Lily_lexer *lex = pars->lexer_;
lex->lexval = (void*) s;
- lex->lexloc = l;
+ lex->lexloc = loc;
lex->prepare_for_next_token ();
return lex->yylex ();
}
%pure_parser
%locations
-/* FIXME: The third option is an alias that will be used to display
- the syntax error. There's a bug (reported with patch) in bison CVS
- that prints double backslashes
+/* The third option is an alias that will be used to display the
+ syntax error. Bison CVS now correctly handles backslash escapes.
+
+ FIXME: Bison needs to translate some of these, eg, STRING.
- bison.ly:1:5: error: syntax error, unexpected \\book", expecting '{'
- \book
- \book %expect \book error here
*/
/* Keyword tokens with plain escaped name. */
%token CONSISTS "\\consists"
%token CONTEXT "\\context"
%token DEFAULT "\\default"
+%token DEFAULTCHILD "\\defaultchild"
%token DENIES "\\denies"
%token DESCRIPTION "\\description"
%token DRUMMODE "\\drummode"
%type <book> book_block
%type <book> book_body
-%type <i> bare_int
%type <i> bare_unsigned
%type <i> bass_mod
%type <i> dots
;
score_body:
- /**/ {
- $$ = new Score;
+ Music {
+ SCM m = $1->self_scm ();
+ scm_gc_unprotect_object (m);
+ SCM scorify = ly_lily_module_constant ("scorify-music");
+ SCM score = scm_call_2 (scorify, m, THIS->self_scm ());
+
+ // pass ownernship to C++ again.
+ scm_gc_protect_object (score);
+ $$ = unsmob_score (score);
$$->set_spot (@$);
}
| SCORE_IDENTIFIER {
- $$ = new Score ( *unsmob_score ($1));
+ $$ = unsmob_score ($1);
$$->set_spot (@$);
}
| score_body object_id_setting {
$$->user_key_ = ly_scm2string ($2);
}
- | score_body Music {
- SCM m = $2->self_scm ();
- scm_gc_unprotect_object (m);
- $$->set_music (m, THIS->self_scm ());
- }
| score_body lilypond_header {
$$->header_ = $2;
}
r-> set_property ("element", beg->self_scm ());
scm_gc_unprotect_object (beg->self_scm ());
}
- r->set_property ("repeat-count", scm_int2num (times >? 1));
+ r->set_property ("repeat-count", scm_int2num (max (times, 1)));
r-> set_property ("elements",alts);
if (ly_c_equal_p ($2, scm_makfrom0str ("tremolo"))) {
| REMOVE { $$ = ly_symbol2scm ("remove"); }
| ACCEPTS { $$ = ly_symbol2scm ("accepts"); }
+ | DEFAULTCHILD { $$ = ly_symbol2scm ("default-child"); }
| DENIES { $$ = ly_symbol2scm ("denies"); }
| ALIAS { $$ = ly_symbol2scm ("alias"); }
| LYRICS_STRING {
$$ = $1;
}
- | bare_int {
- $$ = scm_int2num ($1);
+ | bare_number {
+ $$ = $1;
+/* if (scm_integer_p ($1) == SCM_BOOL_T)
+ {
+ int k = scm_to_int (scm_inexact_to_exact ($1));
+ $$ = k;
+ } else
+ {
+ THIS->parser_error (@1, _ ("need integer number arg"));
+ $$ = 0;
+ }*/
}
| embedded_scm {
$$ = $1;
{
Duration dd = THIS->default_duration_;
$$ = dd.smobbed_copy ();
-
- THIS->beam_check ($$);
}
| multiplied_duration {
$$ = $1;
THIS->default_duration_ = *unsmob_duration ($$);
-
- THIS->beam_check ($$);
}
;
}
;
-bare_int:
- bare_number {
- if (scm_integer_p ($1) == SCM_BOOL_T)
- {
- int k = scm_to_int ($1);
- $$ = k;
- } else
- {
- THIS->parser_error (@1, _ ("need integer number arg"));
- $$ = 0;
- }
- }
- | '-' bare_int {
- $$ = -$2;
- }
- ;
-
exclamations:
{ $$ = 0; }
| exclamations '!' { $$ ++; }
;
markup_braced_list_body:
- /* empty */ { $$ = scm_list (SCM_EOL); }
+ /* empty */ { $$ = SCM_EOL; }
| markup_braced_list_body markup {
$$ = scm_cons ($2, $1);
}
markup:
markup_head_1_list simple_markup {
- $$ = scm_car (scm_call_2 (ly_lily_module_constant ("map-markup-command-list"), $1, scm_list_1 ($2)));
+ SCM mapper = ly_lily_module_constant ("map-markup-command-list");
+ $$ = scm_car (scm_call_2 (mapper, $1, scm_list_1 ($2)));
}
| simple_markup {
$$ = $1;
}
-/*
-Should make this optional? It will also complain when you do
-
- [s4]
-
-which is entirely legitimate.
-
-Or we can scrap it. Barchecks should detect wrong durations, and
-skipTypesetting speeds it up a lot.
-*/
-
-void
-Lily_parser::beam_check (SCM dur)
-{
- Duration *d = unsmob_duration (dur);
- if (unsmob_music (last_beam_start_) && d->duration_log () <= 2)
- {
- Music *m = unsmob_music (last_beam_start_);
- m->origin ()->warning (_f ("suspect duration in beam: %s",
- d->to_string ()));
- }
- last_beam_start_ = SCM_EOL;
-}
-