#include "lyric-combine-music.hh"
#include "transposed-music.hh"
#include "time-scaled-music.hh"
-#include "new-repeated-music.hh"
+#include "repeated-music.hh"
#include "mudela-version.hh"
#include "grace-music.hh"
+#include "auto-change-music.hh"
// mmm
Mudela_version oldest_version ("1.1.52");
void
print_mudela_versions (ostream &os)
{
- os << "Oldest supported input version: " << oldest_version.str () << endl;
+ os << _f ("Oldest supported input version: %s", oldest_version.str ())
+ << endl;
}
// needed for bison.simple's malloc() and free()
#include <malloc.h>
#define THIS ((My_lily_parser *) my_lily_parser_l)
#define yyerror THIS->parser_error
-#define ARRAY_SIZE(a,s) if (a.size () != s) THIS->parser_error (_f("expecting %d arguments", s))
+#define ARRAY_SIZE(a,s) if (a.size () != s) THIS->parser_error (_f ("Expecting %d arguments", s))
%}
%pure_parser
/* tokens which are not keywords */
-
+%token AUTOCHANGE
%token TEXTSCRIPT
%token ACCEPTS
%token ALTERNATIVE
%token CLEF
%token CM_T
%token CONSISTS
+%token SEQUENTIAL
+%token SIMULTANEOUS
%token CONSISTSEND
%token DURATION
%token EXTENDER
%token VERSION
/* escaped */
-%token E_EXCLAMATION E_SMALLER E_BIGGER E_CHAR
+%token E_EXCLAMATION E_SMALLER E_BIGGER E_CHAR CHORD_MINUS CHORD_CARET
%type <i> exclamations questions
%token <i> DIGIT
mudela: /* empty */
| mudela toplevel_expression {}
- | mudela assignment { }
+ | mudela assignment { }
| mudela error
| mudela INVALID {
THIS->error_level_i_ =1;
}
| SCM_T STRING semicolon {
if (THIS->lexer_p_->main_input_b_ && safe_global_b)
- error (_("Cannot evaluate Scheme in safe mode"));
+ error (_("Can't evaluate Scheme in safe mode"));
gh_eval_str ($2->ch_l ());
delete $2;
};
translator_spec_body:
TRANS_IDENTIFIER {
$$ = $1->access_content_Translator (true);
+ Translator_group * tg = dynamic_cast<Translator_group*> ($$);
+ if (!tg)
+ THIS->parser_error (_("Need a translator group for a context"));
$$-> set_spot (THIS->here_input ());
}
| TYPE STRING semicolon {
delete $4;
/* ugh*/
- Translator_group * tr = dynamic_cast<Translator_group*>($$);
- tr->set_property (*$2, str);
+ Translator_group* tg = dynamic_cast<Translator_group*> ($$);
+ if (!tg)
+ THIS->parser_error (_("Need a translator group for a context"));
+ tg->set_property (*$2, str);
}
| translator_spec_body NAME STRING semicolon {
$$->type_str_ = *$3;
URG URG.
*/
if ($3->size () % 2)
- warning ("Need even number of args for shape array");
+ warning (_ ("Need even number of args for shape array"));
for (int i=0; i < $3->size (); i+=2)
{
*/
midi_block:
MIDI
-
- '{' midi_body '}' { $$ = $3; }
+ '{' midi_body '}' {
+ $$ = $3;
+ THIS-> lexer_p_-> scope_l_arr_.pop();
+ }
;
midi_body: /* empty */ {
- $$ = THIS->default_midi_p ();
+ Midi_def * p =THIS->default_midi_p ();
+ $$ = p;
+ THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
}
| MIDI_IDENTIFIER {
- $$ = $1-> access_content_Midi_def (true);
+ Midi_def * p =$1-> access_content_Midi_def (true);
+ $$ = p;
+ THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
}
| midi_body assignment semicolon {
{
Music_sequence* m = dynamic_cast <Music_sequence*> ($5);
if (m && $3 < m->length_i ())
- $5->warning ("More alternatives than repeats. Junking excess alternatives.");
+ $5->warning (_ ("More alternatives than repeats. Junking excess alternatives."));
Repeated_music * r = new Repeated_music ($4, $3 >? 1, m);
$$ = r;
r->fold_b_ = (*$2 == "fold");
- r->semi_fold_b_ = (*$2 == "semi");
+ r->volta_fold_b_ = (*$2 == "volta");
delete $2;
r->set_spot ($4->spot ());
}
}
;
-Sequential_music: '{' Music_list '}' {
+Sequential_music:
+ SEQUENTIAL '{' Music_list '}' {
+ $$ = new Sequential_music ($3);
+ $$->set_spot ($3->spot ());
+ }
+ | '{' Music_list '}' {
$$ = new Sequential_music ($2);
$$->set_spot ($2->spot ());
}
;
-Simultaneous_music: '<' Music_list '>' {
+Simultaneous_music:
+ SIMULTANEOUS '{' Music_list '}'{
+ $$ = new Simultaneous_music ($3);
+ $$->set_spot ($3->spot ());
+ }
+ | '<' Music_list '>' {
$$ = new Simultaneous_music ($2);
$$->set_spot ($2->spot ());
}
| property_def
| translator_change
| Simple_music '*' unsigned '/' unsigned {
- /* urg */
- $$ = new Time_scaled_music ($3, $5, $1);
+ $$ = $1;
+ $$->compress (Moment($3, $5 ));
}
| Simple_music '*' unsigned {
- $$ = new Time_scaled_music ($3, 1, $1);
+ $$ = $1;
+ $$->compress (Moment ($3, 1));
}
;
$$ = csm;
}
+ | AUTOCHANGE STRING Music {
+ Auto_change_music * chm = new Auto_change_music (*$2, $3);
+ delete $2;
+ $$ = chm;
+ chm->set_spot ($3->spot ());
+ }
| GRACE Music {
$$ = new Grace_music ($2);
}
b->span_type_str_ = "beam";
$$ =b;
}
+ | '[' ':' unsigned {
+ if (!Duration::duration_type_b ($3))
+ THIS->parser_error (_f ("not a duration: %d", $3));
+ else if ($3 < 8)
+ THIS->parser_error (_ ("Can't abbreviate"));
+ else
+ THIS->set_abbrev_beam ($3);
+
+ Chord_tremolo_req* a = new Chord_tremolo_req;
+ a->span_dir_ = START;
+ a->type_i_ = THIS->abbrev_beam_type_i_;
+ $$=a;
+ }
| ']' {
- Span_req*b= new Span_req;
- b->span_dir_ = STOP;
- b->span_type_str_ = "beam";
- $$ = b;
+ if (!THIS->abbrev_beam_type_i_)
+ {
+ Span_req*b= new Span_req;
+ b->span_dir_ = STOP;
+ b->span_type_str_ = "beam";
+ $$ = b;
+ }
+ else
+ {
+ Chord_tremolo_req* a = new Chord_tremolo_req;
+ a->span_dir_ = STOP;
+ a->type_i_ = THIS->abbrev_beam_type_i_;
+ THIS->set_abbrev_beam (0);
+ $$ = a;
+ }
}
| BREATHE {
$$ = new Breathing_sign_req;
m->one_beat_i_=$4;
$$ = m;
}
- | PENALTY int {
+ | PENALTY int {
Break_req * b = new Break_req;
- b->penalty_i_ = $2;
- b-> set_spot (THIS->here_input ());
+ b->penalty_f_ = $2 / 100.0;
+ b->set_spot (THIS->here_input ());
$$ = b;
}
| SKIP duration_length {
if (Script_req * gs = dynamic_cast<Script_req*> ($2))
gs->dir_ = Direction ($1);
else if ($1)
- $2->warning ("Can't specify direction for this request");
+ $2->warning (_ ("Can't specify direction for this request"));
$$ = $2;
}
;
extender_req:
EXTENDER {
if (!THIS->lexer_p_->lyric_state_b ())
- THIS->parser_error (_ ("have to be in Lyric mode for lyrics"));
+ THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
$$ = new Extender_req;
}
;
hyphen_req:
HYPHEN {
if (!THIS->lexer_p_->lyric_state_b ())
- THIS->parser_error (_ ("have to be in Lyric mode for lyrics"));
+ THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
$$ = new Hyphen_req;
}
;
if (!Duration::duration_type_b ($2))
THIS->parser_error (_f ("not a duration: %d", $2));
else if ($2 < 8)
- THIS->parser_error (_ ("can't abbreviate"));
+ THIS->parser_error (_ ("Can't abbreviate"));
$$ = $2;
}
;
simple_element:
musical_pitch exclamations questions optional_notemode_duration {
if (!THIS->lexer_p_->note_state_b ())
- THIS->parser_error (_ ("have to be in Note mode for notes"));
+ THIS->parser_error (_ ("Have to be in Note mode for notes"));
Note_req *n = new Note_req;
delete $1;
n->duration_ = *$4;
delete $4;
+ if (THIS->abbrev_beam_type_i_)
+ {
+ if (n->duration_.plet_b ())
+ THIS->parser_error (_ ("Can't abbreviate tuplet"));
+ else
+ n->duration_.set_plet (1, 2);
+ }
n->cautionary_b_ = $3 % 2;
n->forceacc_b_ = $2 % 2 || n->cautionary_b_;
}
| STRING optional_notemode_duration {
if (!THIS->lexer_p_->lyric_state_b ())
- THIS->parser_error (_ ("have to be in Lyric mode for lyrics"));
+ THIS->parser_error (_ ("Have to be in Lyric mode for lyrics"));
$$ = THIS->get_word_element (*$1, $2);
delete $1;
}
| chord {
if (!THIS->lexer_p_->chord_state_b ())
- THIS->parser_error (_ ("have to be in Chord mode for chords"));
+ THIS->parser_error (_ ("Have to be in Chord mode for chords"));
$$ = $1;
}
;
{
$$ = new Array<Musical_pitch>;
}
- | '-' chord_notes {
+ | CHORD_MINUS chord_notes {
$$ = $2;
}
;
{
$$ = new Array<Musical_pitch>;
}
- | '^' chord_notes {
+ | CHORD_CARET chord_notes {
$$ = $2;
}
;
-/*
- forevery : X : optional_X sucks. Devise a solution.
-*/
-
chord_inversion:
{
$$ = 0;
$$ = new Array<Musical_pitch>;
$$->push (*$1);
}
- | CHORDMODIFIER_PITCH chord_note {
+ | CHORDMODIFIER_PITCH chord_note { /* Ugh. */
$$ = new Array<Musical_pitch>;
$$->push (*$1);
$$->push (*$2);
$$->octave_i_ = $1 > 7 ? 1 : 0;
$$->accidental_i_ = 1;
}
- | unsigned '-' {
+ | unsigned CHORD_MINUS {
$$ = new Musical_pitch;
$$->notename_i_ = ($1 - 1) % 7;
$$->octave_i_ = $1 > 7 ? 1 : 0;