]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4442/7: Stop maintaining "parser" variable
authorDavid Kastrup <dak@gnu.org>
Fri, 12 Jun 2015 11:41:11 +0000 (13:41 +0200)
committerDavid Kastrup <dak@gnu.org>
Tue, 16 Jun 2015 19:17:29 +0000 (21:17 +0200)
When invoking a parser, the global "parser" variable was temporarily
pointing to the parser.  This mechanism was somewhat awkward and with
problems of its own.  Since an active parser maintains the %parser fluid
now, we can forego maintaining the "parser" variable altogether.

lily/lily-parser.cc
lily/parse-scm.cc

index 8645d58cf1e1d04fbc274a701f0cffffc98d3aad..93d9a055c7fec9dd563190425a2fcad03c73e962 100644 (file)
@@ -99,7 +99,6 @@ Lily_parser::print_smob (SCM port, scm_print_state *)
 void
 Lily_parser::parse_file (const string &init, const string &name, const string &out_name)
 {
-  lexer_->set_identifier (ly_symbol2scm ("parser"), self_scm ());
   output_basename_ = out_name;
 
   lexer_->main_input_name_ = name;
@@ -125,11 +124,6 @@ Lily_parser::parse_file (const string &init, const string &name, const string &o
     }
   while (!lexer_->is_clean ());
 
-  /*
-    Don't mix cyclic pointers with weak tables.
-  */
-  lexer_->set_identifier (ly_symbol2scm ("parser"),
-                          SCM_EOL);
   ly_reexport_module (scm_current_module ());
 
   scm_set_current_module (mod);
@@ -145,10 +139,9 @@ Lily_parser::parse_string (const string &ly_code)
   lexer_->new_input (lexer_->main_input_name_, ly_code, sources_);
 
   SCM mod = lexer_->set_current_scope ();
-  SCM parser = lexer_->lookup_identifier_symbol (ly_symbol2scm ("parser"));
-  lexer_->set_identifier (ly_symbol2scm ("parser"), self_scm ());
+
   do_yyparse ();
-  lexer_->set_identifier (ly_symbol2scm ("parser"), parser);
+
   scm_set_current_module (mod);
 
   error_level_ = error_level_ | lexer_->error_level_;
@@ -165,12 +158,10 @@ Lily_parser::parse_string_expression (const string &ly_code, const string &filen
       lexer_->get_source_file ()->set_line (0, line);
     }
   SCM mod = lexer_->set_current_scope ();
-  SCM parser = lexer_->lookup_identifier_symbol (ly_symbol2scm ("parser"));
-  lexer_->set_identifier (ly_symbol2scm ("parser"), self_scm ());
+
   lexer_->push_extra_token (Input (), EMBEDDED_LILY);
   SCM result = do_yyparse ();
 
-  lexer_->set_identifier (ly_symbol2scm ("parser"), parser);
   scm_set_current_module (mod);
 
   error_level_ = error_level_ | lexer_->error_level_;
index 7e8c26b06fe829358deccd272dddc2c905184a83..c83866849fd164c9597b6b29d80347ff69b1bcae 100644 (file)
@@ -98,11 +98,6 @@ internal_ly_eval_scm (Parse_start *ps)
           module = scm_gc_protect_object (scm_call_0 (function));
         }
 
-      // We define the parser so trusted Scheme functions can
-      // access the real namespace underlying the parser.
-      if (ps->parser_)
-        scm_module_define (module, ly_symbol2scm ("parser"),
-                           ps->parser_->self_scm ());
       return scm_eval (ps->form_, module);
     }
   return scm_primitive_eval (ps->form_);