From: David Kastrup Date: Fri, 12 Jun 2015 11:41:11 +0000 (+0200) Subject: Issue 4442/7: Stop maintaining "parser" variable X-Git-Tag: release/2.19.22-1~44^2~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=4b43f28b9af77d8204dfefe73452fe433b15ea7b;p=lilypond.git Issue 4442/7: Stop maintaining "parser" variable 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. --- diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index 8645d58cf1..93d9a055c7 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -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_; diff --git a/lily/parse-scm.cc b/lily/parse-scm.cc index 7e8c26b06f..c83866849f 100644 --- a/lily/parse-scm.cc +++ b/lily/parse-scm.cc @@ -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_);