+ 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::add(const string &kwd, LoaderAction *act)
+{
+ StatementKey key(kwd, (act ? act->get_signature() : "*"));
+ ActionMap::iterator i = actions.find(key);
+ if(i!=actions.end())
+ {
+ delete i->second;
+ i->second = act;
+ }
+ else
+ actions[key] = act;
+}
+
+void Loader::add_auxiliary_loader(Loader &ldr)
+{
+ aux_loaders.push_back(&ldr);
+}
+
+bool Loader::has_action(const StatementKey &key) const
+{
+ ActionMap::const_iterator i = actions.lower_bound(StatementKey(key.keyword, string()));
+ for(; (i!=actions.end() && i->first.keyword==key.keyword); ++i)
+ if(signature_match(key.signature, i->first.signature))
+ return true;
+ return false;
+}
+
+LoaderAction *Loader::find_action(const StatementKey &key) const
+{
+ ActionMap::const_iterator begin = actions.lower_bound(StatementKey(key.keyword, string()));
+ ActionMap::const_iterator end = actions.upper_bound(StatementKey(key.keyword, "~"));
+
+ if(begin==end)
+ throw unknown_keyword(key.keyword);
+
+ for(ActionMap::const_iterator i=begin; i!=end; ++i)
+ if(signature_match(key.signature, i->first.signature))
+ return i->second;
+
+ throw invalid_signature(key.keyword, key.signature);
+}
+
+const string &Loader::get_source() const
+{
+ if(!cur_st)
+ throw logic_error("no current statement");
+ return cur_st->source;
+}
+
+const string &Loader::get_keyword() const
+{
+ if(!cur_st)
+ throw logic_error("no current statement");
+ return cur_st->keyword;