]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.63
authorfred <fred>
Sun, 24 Mar 2002 19:43:19 +0000 (19:43 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:43:19 +0000 (19:43 +0000)
lib/includable-lexer.cc
lib/include/includable-lexer.hh
lily/my-lily-parser.cc

index 2f8d33f4610ebbbdad5d720b6ade4b56d10a194b..61f1c1b613d3aa779857a10da93a3be256cb530a 100644 (file)
@@ -21,9 +21,11 @@ Includable_lexer::new_input(String s, Sources  * global_sources)
 {
     Source_file * sl = global_sources->get_file_l(s);
     if (!sl) {
-       LexerError("can't find file");
+       LexerError("Can't find file `" + s+ "'");
        return; 
-    }
+    } else
+
+    
     char_count_stack_.push(0);
     if (yy_current_buffer) 
        state_stack_.push(yy_current_buffer);
@@ -79,5 +81,8 @@ Includable_lexer::add_lexed_char(int count)
 Source_file*
 Includable_lexer::source_file_l()const
 {
-    return include_stack_.top();
+    if (include_stack_.empty())
+       return 0;
+    else
+       return include_stack_.top();
 }
index a5416ef45a04fbcd9d48218d38004df2b906490e..a84f736c4858ee7e11ec634da51c243c639475d8 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  includable-lexer.hh -- declare 
+  includable-lexer.hh -- declare Includable_lexer
 
   source file of the LilyPond music typesetter
 
@@ -9,8 +9,10 @@
 
 #ifndef INCLUDABLE_LEXER_HH
 #define INCLUDABLE_LEXER_HH
-#include "string.hh"
+
 #include <FlexLexer.h>
+
+#include "string.hh"
 #include "varray.hh"
 #include "fproto.hh"
 #include "proto.hh"
@@ -28,6 +30,7 @@ protected:
     Array<Source_file*> include_stack_;
     Array<int> char_count_stack_;
 public:
+
     Source_file* source_file_l()const;
     void new_input(String s,Sources*);
     Includable_lexer();
index 5d46c7d5b31d1e862dc3b69b2ae79e0ceefd79d3..5389803e63dff272b66fdfa09607361334fb9656 100644 (file)
@@ -36,6 +36,7 @@ My_lily_parser::set_debug()
     lexer_p_->set_debug( !monitor->silence(s+"Lexer") && check_debug);
 #endif
 }
+
 void
 My_lily_parser::print_declarations()
 {
@@ -60,11 +61,17 @@ My_lily_parser::do_init_file()
 void
 My_lily_parser::parse_file(String init, String s)
 {
-    *mlog << "Parsing ... ";
     lexer_p_ = new My_lily_lexer;
     init_str_ = init;
     
+    
+
+    *mlog << "Parsing ... ";
     lexer_p_->new_input(s, source_l_);
+    if (!lexer_p_->source_file_l()) {
+       warning("Can not find toplevel file. Ignoring " + s);
+       return; 
+    }
     do_yyparse();
     print_declarations();