+ SetForScope<const Statement *> set_cst(cur_st, &st);
+
+ try
+ {
+ StatementKey key(st.keyword, st.get_signature());
+
+ if(!aux_loaders.empty() && !has_action(key))
+ {
+ for(vector<Loader *>::const_iterator i=aux_loaders.begin(); i!=aux_loaders.end(); ++i)
+ if((*i)->has_action(key))
+ return (*i)->load_statement(st);
+ }
+
+ LoaderAction *act = find_action(key);
+ if(act)
+ {
+ sub_loaded = false;
+ act->execute(*this, st);
+ if(check_sub_loads && !st.sub.empty() && !sub_loaded)
+ throw logic_error("substatements ignored");
+ }
+ }
+ catch(const data_error &)
+ {
+ throw;
+ }
+ catch(const exception &e)
+ {
+ throw data_error(st.source, st.line, e);
+ }
+}
+
+void Loader::load_sub_with(Loader &ldr)
+{
+ if(direct)
+ {
+ ldr.load_direct(*cur_parser, cur_level+1);
+ ldr.finish();
+ }
+ else if(cur_st)
+ {
+ ldr.load(*cur_st);
+ sub_loaded = true;
+ }
+ else
+ throw logic_error("no current statement");
+}
+
+void Loader::set_actions(ActionMap &a)
+{
+ if(actions)
+ throw logic_error("actions already set");
+
+ actions = &a;
+ if(a.empty())
+ init_actions();
+}
+
+void Loader::add(const string &kwd, LoaderAction *act)
+{
+ if(!actions)
+ actions = &local_actions;
+
+ StatementKey key(kwd, (act ? act->get_signature() : "*"));
+ ActionMap::iterator i = actions->find(key);
+ if(i!=actions->end())
+ {