{
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);
Source_file*
Includable_lexer::source_file_l()const
{
- return include_stack_.top();
+ if (include_stack_.empty())
+ return 0;
+ else
+ return include_stack_.top();
}
/*
- includable-lexer.hh -- declare
+ includable-lexer.hh -- declare Includable_lexer
source file of the LilyPond music typesetter
#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"
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();
lexer_p_->set_debug( !monitor->silence(s+"Lexer") && check_debug);
#endif
}
+
void
My_lily_parser::print_declarations()
{
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();