From 7cee59f148669079a68177090fb36e29b2e51f66 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Tue, 30 Oct 2012 11:17:22 +0100 Subject: [PATCH] Issue 2935: is_main_input_ should only be set by \maininput command is_main_input reflects the state of being in the reign of the main input file as opposed to the init file, which corresponds to a drop of privileges. This drop of privileges is explicitly signified with \maininput and should not otherwise be tampered with in order not to restrict the init file's capabilities. There should be no way to arrive at a lexer from within LilyPond or Scheme without is_main_input_ set unless one already has one such lexer to start with. --- lily/lexer.ll | 2 +- lily/lily-parser.cc | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lily/lexer.ll b/lily/lexer.ll index 60a41943a6..9f99b463bf 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -315,7 +315,7 @@ BOM_UTF8 \357\273\277 \\maininput { - if (!is_main_input_) + if (!is_main_input_ && include_stack_.size () == 1) { start_main_input (); is_main_input_ = true; diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index 7b35f0e8e4..550f6fb847 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -143,7 +143,6 @@ void Lily_parser::parse_string (string ly_code) { lexer_->main_input_name_ = ""; - lexer_->is_main_input_ = true; lexer_->new_input (lexer_->main_input_name_, ly_code, sources_); SCM mod = lexer_->set_current_scope (); @@ -161,7 +160,6 @@ Lily_parser::parse_string_expression (string ly_code, string filename, int line) { lexer_->main_input_name_ = filename; - lexer_->is_main_input_ = true; lexer_->new_input (lexer_->main_input_name_, ly_code, sources_); if (line) { -- 2.39.5