]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/loader.cpp
Provide access to the keyword of the current statement
[libs/datafile.git] / source / loader.cpp
index 81370687ffd7e32f35a413359ac47d90d01c6c5a..997e7c9eec27f7f480c711291f6a47f997c7039e 100644 (file)
@@ -1,6 +1,6 @@
 #include <msp/core/raii.h>
 #include <msp/strings/format.h>
-#include "dataerror.h"
+#include "except.h"
 #include "loader.h"
 #include "type.h"
 
@@ -47,28 +47,6 @@ bool signature_match(const string &st_sig, const string &act_sig)
 namespace Msp {
 namespace DataFile {
 
-class unknown_keyword: public runtime_error
-{
-public:
-       unknown_keyword(const std::string &k):
-               runtime_error(k)
-       { }
-
-       virtual ~unknown_keyword() throw() { }
-};
-
-
-class invalid_signature: public runtime_error
-{
-public:
-       invalid_signature(const std::string &k, const std::string &s):
-               runtime_error(format("%s %s", k, s))
-       { }
-
-       virtual ~invalid_signature() throw() { }
-};
-
-
 Loader::Loader():
        cur_st(0),
        direct(false),
@@ -227,5 +205,12 @@ const string &Loader::get_source() const
        return cur_st->source;
 }
 
+const string &Loader::get_keyword() const
+{
+       if(!cur_st)
+               throw logic_error("no current statement");
+       return cur_st->keyword;
+}
+
 } // namespace DataFile
 } // namespace Msp