From a1e4212ea78b8074ceb58b4785ecdcaa7115b00c Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 22 Jun 2004 18:30:45 +0000 Subject: [PATCH] (My_lily_lexer): copy scopes so temporary assignments don't reach the original file. --- ChangeLog | 3 +++ lily/include/my-lily-parser.hh | 3 ++- lily/my-lily-lexer.cc | 19 ++++++++++++++----- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3db38215ff..f87d8c9a6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2004-06-22 Han-Wen Nienhuys + * 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 diff --git a/lily/include/my-lily-parser.hh b/lily/include/my-lily-parser.hh index 7c7c92aafc..83fbb13862 100644 --- a/lily/include/my-lily-parser.hh +++ b/lily/include/my-lily-parser.hh @@ -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_; diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index bf251d11ce..374a078390 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -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 '\\': -- 2.39.5