]> git.donarmstrong.com Git - lilypond.git/commitdiff
(My_lily_lexer): copy scopes so temporary
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 22 Jun 2004 18:30:45 +0000 (18:30 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 22 Jun 2004 18:30:45 +0000 (18:30 +0000)
assignments don't reach the original file.

ChangeLog
lily/include/my-lily-parser.hh
lily/my-lily-lexer.cc

index 3db38215ffeff938c9d6797a50a711b97fa56584..f87d8c9a6a27f2844e54090ccd4672d80a57e044 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2004-06-22  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * lily/my-lily-lexer.cc (My_lily_lexer): copy scopes so temporary
+       assignments don't reach the original file.
+
        * lily/my-lily-parser.cc (My_lily_parser): only copy lexer if it
        exists
 
index 7c7c92aafc55881fdd25eb068be0f2d8fb61f882..83fbb1386261d61a92b5c40cc7d2a04c0de24c75 100644 (file)
@@ -43,9 +43,10 @@ public:
   Sources *sources_;
   Duration default_duration_;
   String output_basename_;
-  //  Protected_scm header_;
+
   int score_count_;
   int book_count_;
+
   int fatal_error_;
   int error_level_;
   bool ignore_version_b_;
index bf251d11cec8e0ac700f021227799c05e2e912a3..374a078390db5bc698d06101c26f08db1299c4df 100644 (file)
@@ -106,9 +106,21 @@ My_lily_lexer::My_lily_lexer (My_lily_lexer const &src)
   chordmodifier_tab_ = src.chordmodifier_tab_;
   pitchname_tab_stack_ = src.pitchname_tab_stack_;
   sources_ = src.sources_;
-  scopes_ = src.scopes_;
+  
   error_level_ = src.error_level_; 
   main_input_b_ = src.main_input_b_;
+
+  SCM scopes = SCM_EOL;
+  SCM* tail = &scopes;
+  for (SCM s = src.scopes_; ly_c_pair_p (s); s = ly_cdr (s))
+    {
+      SCM newmod = ly_make_anonymous_module (false);
+      ly_import_module (newmod, ly_car (s));
+      *tail = scm_cons (newmod, SCM_EOL);
+      tail = SCM_CDRLOC (*tail);
+    }
+  
+  scopes_ =  scopes;
 }
 
 My_lily_lexer::~My_lily_lexer ()
@@ -176,6 +188,7 @@ My_lily_lexer::start_main_input ()
 {
   // yy_flex_debug = 1;
   new_input (main_input_name_, sources_);
+  
   /* Do not allow \include in --safe-mode */
   allow_includes_b_ = allow_includes_b_ && !safe_global_b;
 
@@ -202,15 +215,12 @@ My_lily_lexer::set_identifier (SCM name, SCM s)
 
       scm_module_define (mod, sym, s);
     }
-  
   else
     {
       programming_error ("Identifier is not a symbol.");
     }
 }
 
-
-
 void
 My_lily_lexer::LexerError (char const *s)
 {
@@ -233,7 +243,6 @@ My_lily_lexer::escaped_char (char c) const
       return '\n';
     case 't':
       return '\t';
-
     case '\'':
     case '\"':
     case '\\':