source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ Jan Nieuwenhuizen <janneke@gnu.org>
*/
#include "my-lily-parser.hh"
#include "midi-def.hh"
#include "paper-def.hh"
#include "identifier.hh"
+#include "chord.hh"
My_lily_parser::My_lily_parser (Sources * source_l)
{
first_b_ = true;
source_l_ = source_l;
lexer_p_ = 0;
- abbrev_beam_type_i_ = 0;
default_duration_.durlog_i_ = 2;
- default_abbrev_i_ = 0;
error_level_i_ = 0;
extender_req = 0;
fatal_error_i_ = 0;
exit_status_i_ = 1;
}
-void
-My_lily_parser::set_abbrev_beam (int type_i)
-{
- abbrev_beam_type_i_ = type_i;
-}
void
My_lily_parser::set_last_duration (Duration const *d)
{
default_duration_ = *d;
-
- /*
- forget plet part,
- but keep sticky plet factor within plet brackets
- */
- default_duration_.plet_ = plet_;
}
}
Simultaneous_music *
-My_lily_parser::get_note_element (Note_req *rq, Duration * duration_p)
+My_lily_parser::get_chord (Musical_pitch tonic, Array<Musical_pitch>* add_arr_p, Array<Musical_pitch>* sub_arr_p, Musical_pitch* inversion_p, Duration d)
{
Simultaneous_music*v = new Request_chord;
v->set_spot (here_input ());
- v->add_music (rq);
+ Chord chord (tonic, add_arr_p, sub_arr_p, inversion_p);
- // too bad parser reads (default) duration via member access,
- // this hack will do for now..
- if (abbrev_beam_type_i_)
+ Tonic_req* t = new Tonic_req;
+ t->pitch_ = tonic;
+ v->add_music (t);
+
+ for (int i = 0; i < chord.pitch_arr_.size (); i++)
{
- assert (!duration_p->plet_b ());
- duration_p->set_plet (1, 2);
+ Musical_pitch p = chord.pitch_arr_[i];
+ Note_req* n = new Note_req;
+ n->pitch_ = p;
+ n->duration_ = d;
+ v->add_music (n);
}
+
+ return v;
+}
+
+Simultaneous_music *
+My_lily_parser::get_note_element (Note_req *rq, Duration * duration_p)
+{
+ Simultaneous_music*v = new Request_chord;
+ v->set_spot (here_input ());
+
+ v->add_music (rq);
+
rq->duration_ = *duration_p;
rq->set_spot (here_input ());
delete duration_p ;
/*
UGH.
*/
-Array<Request*>*
+Link_array<Request>*
My_lily_parser::get_parens_request (int t)
{
- Array<Request*>& reqs = *new Array<Request*>;
+ Link_array<Request>& reqs = *new Link_array<Request>;
switch (t)
{
case '~':
reqs.push (new Tie_req);
break;
- case BEAMPLET:
- case MAEBTELP:
- {
- Plet_req* p = new Plet_req;
- p->plet_i_ = plet_.type_i_;
- reqs.push (p);
- }
- /* fall through */
+
case '[':
case ']':
{
- if (!abbrev_beam_type_i_)
- {
- reqs.push (new Beam_req);
- }
- else
- {
- Abbreviation_beam_req* a = new Abbreviation_beam_req;
- a->type_i_ = abbrev_beam_type_i_;
- if (t==']')
- abbrev_beam_type_i_ = 0;
- reqs.push (a);
- }
+ reqs.push (new Beam_req);
}
break;
reqs.push (new Span_dynamic_req);
break;
- case PLET:
- case TELP:
- {
- Plet_req* p = new Plet_req;
- p->plet_i_ = plet_.type_i_;
- reqs.push (p);
- }
- break;
case ')':
case '(':
{
switch (t)
{
- case BEAMPLET:
- dynamic_cast<Span_req*> (reqs.top ())->spantype = Span_req::START;
- /* fall through */
case '<':
case '>':
case '(':
case '[':
- case PLET:
- dynamic_cast<Span_req*> (reqs.top ())->spantype = Span_req::START;
+ dynamic_cast<Span_req*> (reqs[0])->spantype_ = START;
break;
- case MAEBTELP:
- dynamic_cast<Span_req*> (reqs.top ())->spantype = Span_req::STOP;
- /* fall through */
+
case '!':
case ')':
case ']':
- dynamic_cast<Span_req*> (reqs[0])->spantype = Span_req::STOP;
+ dynamic_cast<Span_req*> (reqs[0])->spantype_ = STOP;
break;
default:
return Input (f_l, here_ch_C());
}
-void
-My_lily_parser::add_notename (String s, Musical_pitch p)
-{
- lexer_p_->add_notename (s, p);
-
-}
-
Paper_def*
My_lily_parser::default_paper_p ()
{