X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Flily-parser.cc;h=ae3943dbdb3e89061ba30ee53600b43215ad9123;hb=cc18fd6f82df460cc31695c4c31f47f45b7e434e;hp=1f073fb07a3b7cff5a0bf60efe519fd16b3b46bf;hpb=35fafba86276f47f3742fd10f0107eea1cc926ea;p=lilypond.git diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index 1f073fb07a..ae3943dbdb 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -36,7 +36,7 @@ Lily_parser::Lily_parser (Sources *sources) smobify_self (); - lexer_ = new Lily_lexer (sources_); + lexer_ = new Lily_lexer (sources_, this); lexer_->unprotect (); } @@ -50,8 +50,10 @@ Lily_parser::Lily_parser (Lily_parser const &src) smobify_self (); if (src.lexer_) - lexer_ = new Lily_lexer (*src.lexer_); - + { + lexer_ = new Lily_lexer (*src.lexer_, this); + } + lexer_->unprotect (); } @@ -95,7 +97,6 @@ Lily_parser::parse_file (string init, string name, string out_name) lexer_->main_input_name_ = name; message (_ ("Parsing...")); - // progress_indication ("\n"); set_yydebug (0); @@ -123,12 +124,12 @@ Lily_parser::parse_file (string init, string name, string out_name) if (!define_spots_.empty ()) { - define_spots_.back ().warning (_ ("braces don't match")); + define_spots_.back ().warning (_ ("braces do not match")); error_level_ = 1; } error_level_ = error_level_ | lexer_->error_level_; - lexer_ = 0; + clear (); } void @@ -157,6 +158,18 @@ Lily_parser::parse_string (string ly_code) error_level_ = error_level_ | lexer_->error_level_; } +void +Lily_parser::clear () +{ + if (lexer_) + { + while (lexer_->has_scope ()) + lexer_->remove_scope (); + } + + lexer_ = 0; +} + char const * Lily_parser::here_str0 () const {