]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 2935: is_main_input_ should only be set by \maininput command
authorDavid Kastrup <dak@gnu.org>
Tue, 30 Oct 2012 10:17:22 +0000 (11:17 +0100)
committerDavid Kastrup <dak@gnu.org>
Tue, 30 Oct 2012 10:18:01 +0000 (11:18 +0100)
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
lily/lily-parser.cc

index 60a41943a61ce2b2148e2717fa5d972370d7ea87..9f99b463bf71aff27531bb356490cdeb11c6749d 100644 (file)
@@ -315,7 +315,7 @@ BOM_UTF8    \357\273\277
 
 
 <INITIAL,chords,lyrics,notes,figures>\\maininput           {
-       if (!is_main_input_)
+       if (!is_main_input_ && include_stack_.size () == 1)
        {
                start_main_input ();
                is_main_input_ = true;
index 7b35f0e8e478c5b9a3cf3b7c26a18ab4fc418145..550f6fb84743f298cbfd1da60ab1e23bcaa67b06 100644 (file)
@@ -143,7 +143,6 @@ void
 Lily_parser::parse_string (string ly_code)
 {
   lexer_->main_input_name_ = "<string>";
-  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)
     {