#include "file-path.hh"
#include "debug.hh"
#include "dimensions.hh"
-#include "identifier.hh"
#include "command-request.hh"
#include "musical-request.hh"
#include "my-lily-parser.hh"
#include "grace-music.hh"
#include "auto-change-music.hh"
#include "part-combine-music.hh"
+#include "scm-hash.hh"
#include "chord.hh"
%union {
Link_array<Request> *reqvec;
- Identifier *id;
String * string;
Music *music;
Score *score;
Scope *scope;
-
+ Scheme_hash_table *scmhash;
Musical_req* musreq;
Music_output_def * outputdef;
%token MEASURES
%token MIDI
%token MM_T
-%token MUSICAL_PITCH
+%token PITCH
%token NAME
%token PITCHNAMES
%token NOTES
%token <id> IDENTIFIER
-%token <id> SCORE_IDENTIFIER
-%token <id> MUSIC_OUTPUT_DEF_IDENTIFIER
+%token <scm> SCORE_IDENTIFIER
+%token <scm> MUSIC_OUTPUT_DEF_IDENTIFIER
%token <scm> NUMBER_IDENTIFIER
%token <scm> REQUEST_IDENTIFIER
%token <real> REAL
%type <outputdef> output_def
-%type <scope> lilypond_header lilypond_header_body
+%type <scmhash> lilypond_header lilypond_header_body
%type <request> open_request_parens close_request_parens open_request close_request
%type <request> request_with_dir request_that_take_dir verbose_request
%type <i> sub_quotes sup_quotes
%type <reqvec> pre_requests post_requests
%type <request> gen_text_def
-%type <scm> steno_musical_pitch musical_pitch absolute_musical_pitch
-%type <scm> steno_tonic_pitch
+%type <scm> steno_pitch pitch absolute_pitch
+%type <scm> explicit_pitch steno_tonic_pitch
%type <scm> chord_additions chord_subtractions chord_notes chord_step
%type <music> chord
THIS->lexer_p_->chordmodifier_tab_ = $1;
}
| lilypond_header {
- delete header_global_p;
- header_global_p = $1;
+ if (global_header_p)
+ scm_unprotect_object (global_header_p->self_scm ());
+ global_header_p = $1;
}
| score_block {
score_global_array.push ($1);
+
}
| output_def {
- Identifier * id = new
- Music_output_def_identifier ($1, MUSIC_OUTPUT_DEF_IDENTIFIER);
if (dynamic_cast<Paper_def*> ($1))
- THIS->lexer_p_->set_identifier ("$defaultpaper", id->self_scm ());
+ THIS->lexer_p_->set_identifier ("$defaultpaper", $1->self_scm ());
else if (dynamic_cast<Midi_def*> ($1))
- THIS->lexer_p_->set_identifier ("$defaultmidi", id->self_scm ());
+ THIS->lexer_p_->set_identifier ("$defaultmidi", $1->self_scm ());
}
| embedded_scm {
// junk value
lilypond_header_body:
{
- $$ = new Scope;
- THIS->lexer_p_-> scope_l_arr_.push ($$);
+ $$ = new Scheme_hash_table;
+
+ Scope *sc = new Scope ($$);
+ THIS->lexer_p_-> scope_l_arr_.push (sc);
}
| lilypond_header_body assignment semicolon {
lilypond_header:
HEADER '{' lilypond_header_body '}' {
$$ = $3;
- THIS->lexer_p_-> scope_l_arr_.pop ();
+ delete THIS->lexer_p_-> scope_l_arr_.pop ();
}
;
all objects can be unprotected as soon as they're here.
*/
- Identifier * id =unsmob_identifier ($4);
- Input spot = THIS->pop_spot ();
- if (id) id->set_spot (spot);
+ /*
+ Should find generic way of associating input with objects.
+ */
+ THIS->pop_spot ();
}
;
identifier_init:
score_block {
- $$ = (new Score_identifier ($1, SCORE_IDENTIFIER))->self_scm();
+ $$ = $1->self_scm ();
+ scm_unprotect_object ($$);
}
| output_def {
- $$ = (new Music_output_def_identifier ($1, MUSIC_OUTPUT_DEF_IDENTIFIER))->self_scm();
+ $$ = $1->self_scm ();
+ scm_unprotect_object ($$);
}
| translator_spec_block {
$$ = $1;
$$ = $4;
if (!$$->def_p_arr_.size ())
{
- Identifier *id =
- unsmob_identifier (THIS->lexer_p_->lookup_identifier ("$defaultpaper"));
- $$->add_output (id ? id->access_content_Music_output_def (true) : new Paper_def );
+ Music_output_def *id =
+ unsmob_music_output_def (THIS->lexer_p_->lookup_identifier ("$defaultpaper"));
+ $$->add_output (id ? id->clone () : new Paper_def );
}
}
-/*
- | SCORE '{' score_body error {
- $$ = $3
- $$->set_spot (THIS->here_input ());
- // THIS->here_input ().error ("SCORE INVALID");
- $$->error ("SCORE INVALID");
- THIS->parser_error (_f ("SCORE ERROR"));
- }
-*/
;
score_body:
Music {
$$ = new Score;
-
+
$$->set_spot (THIS->here_input ());
SCM m = $1->self_scm ();
scm_unprotect_object (m);
$$->music_ = m;
}
| SCORE_IDENTIFIER {
- $$ = $1->access_content_Score (true);
+ $$ = new Score (*unsmob_score ($1));
+ $$->set_spot (THIS->here_input ());
}
| score_body lilypond_header {
+ scm_unprotect_object ($2->self_scm ());
$$->header_p_ = $2;
}
| score_body output_def {
music_output_def_body:
MIDI '{' {
- Identifier *id = unsmob_identifier (THIS->lexer_p_->lookup_identifier ("$defaultmidi"));
+ Music_output_def *id = unsmob_music_output_def (THIS->lexer_p_->lookup_identifier ("$defaultmidi"));
Midi_def* p =0;
if (id)
- p = dynamic_cast<Midi_def*> (id->access_content_Music_output_def (true));
+ p = dynamic_cast<Midi_def*> (id->clone ());
else
p = new Midi_def;
THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
}
| PAPER '{' {
- Identifier *id = unsmob_identifier (THIS->lexer_p_->lookup_identifier ("$defaultpaper"));
+ Music_output_def *id = unsmob_music_output_def (THIS->lexer_p_->lookup_identifier ("$defaultpaper"));
Paper_def *p = 0;
if (id)
- p = dynamic_cast<Paper_def*> (id->access_content_Music_output_def (true));
+ p = dynamic_cast<Paper_def*> (id->clone ());
else
p = new Paper_def;
THIS-> lexer_p_-> scope_l_arr_.push (p->scope_p_);
$$ = p;
}
| PAPER '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
- Music_output_def *p = $3->access_content_Music_output_def (true);
+ Music_output_def *p = unsmob_music_output_def ($3);
+ p = p->clone();
THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
$$ = p;
}
| MIDI '{' MUSIC_OUTPUT_DEF_IDENTIFIER {
- Music_output_def *p = $3->access_content_Music_output_def (true);
+ Music_output_def *p = unsmob_music_output_def ($3);
+ p = p->clone();
+
THIS->lexer_p_->scope_l_arr_.push (p->scope_p_);
$$ = p;
}
SCM s = $$;
SCM c = gh_cons ($2->self_scm (), SCM_EOL);
scm_unprotect_object ($2->self_scm ()); /* UGH */
-
-
if (gh_pair_p (gh_cdr (s)))
gh_set_cdr_x (gh_cdr (s), c); /* append */
else
| Repeated_music { $$ = $1; }
| Simultaneous_music { $$ = $1; }
| Sequential_music { $$ = $1; }
- | TRANSPOSE musical_pitch Music {
+ | TRANSPOSE pitch Music {
$$ = new Transposed_music (SCM_EOL);
Music *p = $3;
Pitch pit = *unsmob_pitch ($2);
;
relative_music:
- RELATIVE absolute_musical_pitch Music {
+ RELATIVE absolute_pitch Music {
Music * p = $3;
Pitch pit = *unsmob_pitch ($2);
$$ = new Relative_octave_music (SCM_EOL);
}
;
-steno_musical_pitch:
+steno_pitch:
NOTENAME_PITCH {
$$ = $1;
}
}
;
-musical_pitch:
- steno_musical_pitch {
+pitch:
+ steno_pitch {
+ $$ = $1;
+ }
+ | explicit_pitch {
$$ = $1;
}
- | MUSICAL_PITCH embedded_scm {
- if (!unsmob_pitch ($2))
+ ;
+
+explicit_pitch:
+ PITCH embedded_scm {
+ $$ = $2;
+ if (!unsmob_pitch ($2)) {
THIS->parser_error (_f ("Expecting musical-pitch value", 3));
- Pitch m;
- $$ = m.smobbed_copy ();
+ $$ = Pitch ().smobbed_copy ();
+ }
}
;
}
;
-absolute_musical_pitch:
- steno_musical_pitch {
+absolute_pitch:
+ steno_pitch {
$$ = $1;
}
;
steno_duration {
$$ = $1;
}
+ | explicit_duration {
+ $$ = $1;
+ }
| duration_length '*' bare_unsigned {
$$ = unsmob_duration ($$)->compressed ( $3) .smobbed_copy ();
}
| entered_notemode_duration {
$$ = $1;
}
+ | explicit_duration {
+ $$ = $1;
+ }
;
steno_duration:
simple_element:
- musical_pitch exclamations questions optional_notemode_duration {
+ pitch exclamations questions optional_notemode_duration {
if (!THIS->lexer_p_->note_state_b ())
THIS->parser_error (_ ("Have to be in Note mode for notes"));
Request_chord * rqc2 = new Request_chord (SCM_EOL);
rqc2->set_mus_property ("elements", gh_list (sk->self_scm (), SCM_UNDEFINED));;
Request_chord * rqc3 = new Request_chord(SCM_EOL);
- rqc2->set_mus_property ("elements", gh_list (sp2->self_scm (), SCM_UNDEFINED));;
+ rqc3->set_mus_property ("elements", gh_list (sp2->self_scm (), SCM_UNDEFINED));;
SCM ms = gh_list (rqc1->self_scm (), rqc2->self_scm (), rqc3->self_scm (), SCM_UNDEFINED);