From 17e6ecc417c0d138c264cf938b9f0c39a0d713fb Mon Sep 17 00:00:00 2001
From: hanwen <hanwen>
Date: Sun, 30 May 2004 17:44:36 +0000
Subject: [PATCH] * lily/my-lily-parser.cc (parse_string): delete lexer after
 use.

* lily/my-lily-lexer.cc (My_lily_lexer): copy keytable.
---
 ChangeLog              | 2 ++
 lily/my-lily-lexer.cc  | 3 ---
 lily/my-lily-parser.cc | 7 +++++++
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 96adb64a41..bdc094a535 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2004-05-30  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+	* lily/my-lily-parser.cc (parse_string): delete lexer after use.
+
 	* lily/my-lily-lexer.cc (My_lily_lexer): copy keytable.
 
 	* lily/include/paper-book.hh (class Paper_book): remove height_
diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc
index 2738602bbc..a2ad7efaf0 100644
--- a/lily/my-lily-lexer.cc
+++ b/lily/my-lily-lexer.cc
@@ -85,7 +85,6 @@ static Keyword_ent the_key_tab[] = {
 
 
 My_lily_lexer::My_lily_lexer (Sources *sources)
-  
 {
   keytable_ = new Keyword_table (the_key_tab);
   encoding_ = SCM_EOL;
@@ -117,8 +116,6 @@ My_lily_lexer::~My_lily_lexer ()
   delete keytable_;
 }
 
-
-
 SCM
 My_lily_lexer::encoding () const
 {
diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc
index f5a54cc885..d1a24e8e79 100644
--- a/lily/my-lily-parser.cc
+++ b/lily/my-lily-parser.cc
@@ -143,6 +143,9 @@ My_lily_parser::parse_string (String ly_code)
       parent->error_level_ = lexer_->error_level_; 
       parent->main_input_b_ = lexer_->main_input_b_;
     }
+
+  delete lexer_;
+  lexer_ = 0;
 }
 
 void
@@ -317,6 +320,10 @@ LY_DEFINE (ly_clone_parser, "ly:clone-parser",
 {
   My_lily_parser *parser = unsmob_my_lily_parser (parser_smob);
   My_lily_parser *clone = new My_lily_parser (*parser);
+
+  /*
+    FIXME: should copy scopes too.
+   */
   return scm_gc_unprotect_object (clone->self_scm ());
 }
 
-- 
2.39.5