smobify_self ();
- lexer_ = new Lily_lexer (sources_);
+ lexer_ = new Lily_lexer (sources_, this);
lexer_->unprotect ();
}
smobify_self ();
if (src.lexer_)
- lexer_ = new Lily_lexer (*src.lexer_);
-
+ {
+ lexer_ = new Lily_lexer (*src.lexer_, this);
+ }
+
lexer_->unprotect ();
}
lexer_->main_input_name_ = name;
message (_ ("Parsing..."));
- // progress_indication ("\n");
set_yydebug (0);
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
self_scm ());
lexer_->main_input_name_ = "<string>";
- lexer_->is_main_input_ = true;
-
- set_yydebug (0);
+ lexer_->is_main_input_ = true;
lexer_->new_input (lexer_->main_input_name_, ly_code, sources_);
SCM mod = lexer_->set_current_scope ();
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
{
{
SCM id = parser->lexer_->lookup_identifier ("$defaultheader");
if (!ly_is_module (id))
- id = ly_make_anonymous_module (be_safe_global);
+ id = parser->make_scope ();
else
{
- SCM nid = ly_make_anonymous_module (false);
- ly_module_copy(nid,id);
+ SCM nid = parser->make_scope ();
+ ly_module_copy (nid, id);
id = nid;
}
return id;
}
+
+SCM
+Lily_parser::make_scope () const
+{
+ return ly_make_anonymous_module (be_safe_global);
+}