]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/loader.cpp
Move all exception classes to except.h, for real this time
[libs/datafile.git] / source / loader.cpp
index e1a0d4abd7bcd80adfa4040c2a9bdf43ffb43ee7..81fd27eecebf87c16e3418ae6d11e3ead9ba8d80 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"
 
@@ -24,7 +24,7 @@ bool signature_match(const string &st_sig, const string &act_sig)
        else if(act_sig.size()==2 && act_sig[1]=='*')
        {
                for(string::const_iterator i=st_sig.begin(); i!=st_sig.end(); ++i)
-                       if(*i!=act_sig[0])
+                       if(!signature_match(*i, act_sig[0]))
                                return false;
 
                return true;
@@ -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),
@@ -87,7 +65,7 @@ void Loader::load(Parser &p)
        {
                if(p.peek(0))
                        load_direct(p, 0);
-               else
+               else if(p)  // Peek may have processed an __end, so recheck goodness
                {
                        // Parse in raw mode so we can peek immediately after a mode change
                        Statement st = p.parse(true);