SCM lookup_identifier (string s);
SCM lookup_identifier_symbol (SCM s);
void push_extra_token (int token_type, SCM scm = SCM_UNDEFINED);
- void push_chord_state (SCM tab);
+ void push_chord_state (SCM alist);
void push_figuredbass_state ();
void push_lyric_state ();
void push_initial_state ();
void push_markup_state ();
- void push_note_state (SCM tab);
+ void push_note_state (SCM alist);
void pop_state ();
void LexerError (char const *);
void LexerWarning (char const *);
}
void
-Lily_lexer::push_chord_state (SCM tab)
+Lily_lexer::push_chord_state (SCM alist)
{
- pitchname_tab_stack_ = scm_cons (tab, pitchname_tab_stack_);
+ SCM p = scm_assq (alist, pitchname_tab_stack_);
+
+ if (scm_is_false (p))
+ p = scm_cons (alist, alist_to_hashq (alist));
+ pitchname_tab_stack_ = scm_cons (p, pitchname_tab_stack_);
yy_push_state (chords);
}
}
void
-Lily_lexer::push_note_state (SCM tab)
+Lily_lexer::push_note_state (SCM alist)
{
- pitchname_tab_stack_ = scm_cons (tab, pitchname_tab_stack_);
+ SCM p = scm_assq (alist, pitchname_tab_stack_);
+
+ if (scm_is_false (p))
+ p = scm_cons (alist, alist_to_hashq (alist));
+ pitchname_tab_stack_ = scm_cons (p, pitchname_tab_stack_);
yy_push_state (notes);
}
if ((YYSTATE == notes) || (YYSTATE == chords)) {
SCM handle = SCM_BOOL_F;
if (scm_is_pair (pitchname_tab_stack_))
- handle = scm_hashq_get_handle (scm_car (pitchname_tab_stack_), sym);
+ handle = scm_hashq_get_handle (scm_cdar (pitchname_tab_stack_), sym);
if (scm_is_pair (handle)) {
yylval.scm = scm_cdr (handle);
smobify_self ();
add_scope (ly_make_module (false));
- push_note_state (scm_c_make_hash_table (0));
+ push_note_state (SCM_EOL);
chordmodifier_tab_ = scm_make_vector (scm_from_int (1), SCM_EOL);
}
}
scopes_ = scopes;
- push_note_state (scm_c_make_hash_table (0));
+ push_note_state (SCM_EOL);
}
Lily_lexer::~Lily_lexer ()
if (p->lexer_->is_note_state ())
{
p->lexer_->pop_state ();
- p->lexer_->push_note_state (alist_to_hashq (names));
+ p->lexer_->push_note_state (names);
}
return SCM_UNSPECIFIED;
lilypond
| EMBEDDED_LILY {
SCM nn = parser->lexer_->lookup_identifier ("pitchnames");
- parser->lexer_->push_note_state (alist_to_hashq (nn));
+ parser->lexer_->push_note_state (nn);
} embedded_lilypond {
parser->lexer_->pop_state ();
parser->lexer_->set_identifier (ly_symbol2scm ("parseStringResult"), $3);
mode_changing_head:
NOTEMODE {
SCM nn = parser->lexer_->lookup_identifier ("pitchnames");
- parser->lexer_->push_note_state (alist_to_hashq (nn));
+ parser->lexer_->push_note_state (nn);
$$ = ly_symbol2scm ("notes");
}
| DRUMMODE
{
SCM nn = parser->lexer_->lookup_identifier ("drumPitchNames");
- parser->lexer_->push_note_state (alist_to_hashq (nn));
+ parser->lexer_->push_note_state (nn);
$$ = ly_symbol2scm ("drums");
}
SCM nn = parser->lexer_->lookup_identifier ("chordmodifiers");
parser->lexer_->chordmodifier_tab_ = alist_to_hashq (nn);
nn = parser->lexer_->lookup_identifier ("pitchnames");
- parser->lexer_->push_chord_state (alist_to_hashq (nn));
+ parser->lexer_->push_chord_state (nn);
$$ = ly_symbol2scm ("chords");
}
mode_changing_head_with_context:
DRUMS {
SCM nn = parser->lexer_->lookup_identifier ("drumPitchNames");
- parser->lexer_->push_note_state (alist_to_hashq (nn));
+ parser->lexer_->push_note_state (nn);
$$ = ly_symbol2scm ("DrumStaff");
}
SCM nn = parser->lexer_->lookup_identifier ("chordmodifiers");
parser->lexer_->chordmodifier_tab_ = alist_to_hashq (nn);
nn = parser->lexer_->lookup_identifier ("pitchnames");
- parser->lexer_->push_chord_state (alist_to_hashq (nn));
+ parser->lexer_->push_chord_state (nn);
$$ = ly_symbol2scm ("ChordNames");
}
| LYRICS
}
| SCORE {
SCM nn = parser->lexer_->lookup_identifier ("pitchnames");
- parser->lexer_->push_note_state (alist_to_hashq (nn));
+ parser->lexer_->push_note_state (nn);
} '{' score_body '}' {
Score * sc = $4;
$$ = scm_list_2 (ly_lily_module_constant ("score-markup"), sc->self_scm ());