From: David Kastrup Date: Tue, 30 Oct 2012 10:17:22 +0000 (+0100) Subject: Issue 2935: is_main_input_ should only be set by \maininput command X-Git-Tag: release/2.17.6-1~13 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7cee59f148669079a68177090fb36e29b2e51f66;hp=8e6cd3b698c695a868445b15e2010c7f212a8ee7;p=lilypond.git 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. --- 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) {