From 5ef2f17ae2971f84ee4518cdb6a8c804c268dcd0 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sun, 1 Aug 2004 23:55:21 +0000 Subject: [PATCH] (parse_string): don't overwrite keytable_. --- ChangeLog | 2 ++ lily/include/lily-lexer.hh | 2 +- lily/lily-lexer.cc | 5 ++--- lily/lily-parser.cc | 15 +++++++++++---- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index a2217214db..d65f974c2a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2004-08-02 Han-Wen Nienhuys + * lily/lily-parser.cc (parse_string): don't overwrite keytable_. + * lily/slur-quanting.cc (enumerate_attachments): apply center on stem-X in more cases. diff --git a/lily/include/lily-lexer.hh b/lily/include/lily-lexer.hh index b697068bcd..71a0d58fdf 100644 --- a/lily/include/lily-lexer.hh +++ b/lily/include/lily-lexer.hh @@ -42,6 +42,7 @@ private: int identifier_type (SCM); char escaped_char (char) const; + Keyword_table *keytable_; public: String main_input_name_; void *lexval; @@ -53,7 +54,6 @@ public: SCM chordmodifier_tab_; SCM pitchname_tab_stack_; - Keyword_table *keytable_; int error_level_; Input last_input_; diff --git a/lily/lily-lexer.cc b/lily/lily-lexer.cc index fa0ae8d544..49e680a122 100644 --- a/lily/lily-lexer.cc +++ b/lily/lily-lexer.cc @@ -104,7 +104,7 @@ Lily_lexer::Lily_lexer (Sources *sources) Lily_lexer::Lily_lexer (Lily_lexer const &src) : Includable_lexer () { - keytable_ = (src.keytable_) ? new Keyword_table (*src.keytable_) : 0; + keytable_ = (src.keytable_) ? new Keyword_table (*src.keytable_) : 0; encoding_ = src.encoding_; chordmodifier_tab_ = src.chordmodifier_tab_; pitchname_tab_stack_ = src.pitchname_tab_stack_; @@ -118,7 +118,7 @@ Lily_lexer::Lily_lexer (Lily_lexer const &src) smobify_self (); SCM scopes = SCM_EOL; - SCM* tail = &scopes; + SCM *tail = &scopes; for (SCM s = src.scopes_; ly_c_pair_p (s); s = ly_cdr (s)) { SCM newmod = ly_make_anonymous_module (false); @@ -281,7 +281,6 @@ Lily_lexer::set_encoding (String s) encoding_ = SCM_EOL; } - #include "ly-smobs.icc" IMPLEMENT_SMOBS (Lily_lexer); diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index 5827f75a95..3b106602b1 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -118,7 +118,8 @@ Lily_parser::parse_file (String init, String name, String out_name) void Lily_parser::parse_string (String ly_code) { - Lily_lexer *parent = lexer_; + SCM parent_prot = lexer_ ? lexer_->self_scm () : SCM_EOL; + Lily_lexer * parent = lexer_; lexer_ = (parent == 0 ? new Lily_lexer (sources_) : new Lily_lexer (*parent)); scm_gc_unprotect_object (lexer_->self_scm ()); @@ -146,9 +147,12 @@ Lily_parser::parse_string (String ly_code) error_level_ = error_level_ | lexer_->error_level_; - if (parent != 0) +#if 0 + if (Lily_lexer::unsmob (parent_prot)) { - parent->keytable_ = lexer_->keytable_; + /* + what the fuck is this good for? + */ parent->encoding_ = lexer_->encoding_; parent->chordmodifier_tab_ = lexer_->chordmodifier_tab_; parent->pitchname_tab_stack_ = lexer_->pitchname_tab_stack_; @@ -157,7 +161,10 @@ Lily_parser::parse_string (String ly_code) parent->error_level_ = lexer_->error_level_; parent->main_input_b_ = lexer_->main_input_b_; } - + + scm_remember_upto_here_1 (parent_prot); +#endif + scm_set_current_module (oldmod); lexer_ = 0; } -- 2.39.5