]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 2728: count pairs of brackets
authorDavid Kastrup <dak@gnu.org>
Fri, 10 Aug 2012 10:20:36 +0000 (12:20 +0200)
committerDavid Kastrup <dak@gnu.org>
Thu, 18 Oct 2012 16:57:40 +0000 (18:57 +0200)
What this actually does is exit the parser after the main file, then
continue parsing the rest of the init file in a separate call of the
parser.

This delivers useful error messages in case that the main input is
incomplete.

lily/lexer.ll
lily/lily-parser.cc
lily/parser.yy

index 57b9a599678027aa95bde7c06854beeeb65893f8..9fb4cb6d558429e8d76811d6cb2922ab1da9f6d0 100644 (file)
@@ -694,7 +694,7 @@ BOM_UTF8    \357\273\277
                   reflect after.
                */ 
                is_main_input_ = include_stack_.size () > 2;
-               if (!close_input ())
+               if (!close_input () || !is_main_input_)
                /* Returns YY_NULL */
                        yyterminate ();
        }
index c21180c31b7ea7872232d0472254c65fed2b3efc..833fe6e1588fc7feea90375adfe1a16f18f06579 100644 (file)
@@ -120,7 +120,9 @@ Lily_parser::parse_file (string init, string name, string out_name)
      OUT_FILE (unless IN_FILE redefines output file name).  */
 
   SCM mod = lexer_->set_current_scope ();
-  do_yyparse ();
+  do {
+    do_yyparse ();
+  } while (!lexer_->is_clean ());
 
   /*
     Don't mix cyclic pointers with weak tables.
index fc9aea63be73c95966a31ebe207b12228fdff2bf..35252bcb6e84f9fba33a6e6f2dbe43ef265286a0 100644 (file)
@@ -240,6 +240,7 @@ void set_music_properties (Music *p, SCM a);
 */
 
 /* Keyword tokens with plain escaped name.  */
+%token END_OF_FILE 0 "end of input"
 %token ACCEPTS "\\accepts"
 %token ADDLYRICS "\\addlyrics"
 %token ALIAS "\\alias"