#include "argumentstore.h"
#include "binaryparser.h"
#include "binfloat.h"
+#include "except.h"
#include "input.h"
#include "loaderaction.h"
namespace Msp {
namespace DataFile {
-class bad_definition: public runtime_error
-{
-public:
- bad_definition(const std::string &w):
- runtime_error(w)
- { }
-
- virtual ~bad_definition() throw() { }
-};
-
-class nesting_error: public logic_error
-{
-public:
- nesting_error(const std::string &w):
- logic_error(w)
- { }
-
- virtual ~nesting_error() throw() { }
-};
-
-
BinaryParser::BinaryParser(Input &i, const string &s):
ParserMode(i, s),
float_precision(32),
+++ /dev/null
-#include <typeinfo>
-#include <msp/debug/demangle.h>
-#include <msp/strings/format.h>
-#include "dataerror.h"
-
-using namespace std;
-
-namespace Msp {
-namespace DataFile {
-
-data_error::data_error(const string &s, unsigned l, const string &w):
- runtime_error(make_what(s, l, w)),
- source(s),
- line(l)
-{ }
-
-data_error::data_error(const string &s, unsigned l, const exception &e):
- runtime_error(make_what(s, l, format("%s (%s)", Debug::demangle(typeid(e).name()), e.what()))),
- source(s),
- line(l)
-{ }
-
-string data_error::make_what(const string &s, unsigned l, const string &w)
-{
- if(l)
- return format("%s:%d: %s", s, l, w);
- else
- return format("%s: %s", s, w);
-}
-
-} // namespace DataFile
-} // namespace Msp
+++ /dev/null
-#ifndef MSP_DATAFILE_DATAERROR_H_
-#define MSP_DATAFILE_DATAERROR_H_
-
-#include <stdexcept>
-
-namespace Msp {
-namespace DataFile {
-
-class data_error: public std::runtime_error
-{
-private:
- std::string source;
- unsigned line;
-
-public:
- data_error(const std::string &, unsigned, const std::string &);
- data_error(const std::string &, unsigned, const std::exception &);
- virtual ~data_error() throw() { }
-
- const std::string &get_source() const { return source; }
- unsigned get_line() const { return line; }
-
-private:
- std::string make_what(const std::string &, unsigned, const std::string &);
-};
-
-} // namespace DataFile
-} // namespace Msp
-
-#endif
--- /dev/null
+#include <typeinfo>
+#include <msp/debug/demangle.h>
+#include <msp/strings/format.h>
+#include "except.h"
+
+using namespace std;
+
+namespace Msp {
+namespace DataFile {
+
+data_error::data_error(const string &s, unsigned l, const string &w):
+ runtime_error(make_what(s, l, w)),
+ source(s),
+ line(l)
+{ }
+
+data_error::data_error(const string &s, unsigned l, const exception &e):
+ runtime_error(make_what(s, l, format("%s (%s)", Debug::demangle(typeid(e).name()), e.what()))),
+ source(s),
+ line(l)
+{ }
+
+string data_error::make_what(const string &s, unsigned l, const string &w)
+{
+ if(l)
+ return format("%s:%d: %s", s, l, w);
+ else
+ return format("%s: %s", s, w);
+}
+
+
+parse_error::parse_error(const string &t):
+ runtime_error(t.empty() ? "at end of input" : format("after '%s'", t))
+{ }
+
+
+syntax_error::syntax_error(const string &t):
+ runtime_error(t.empty() ? "at end of input" : format("at '%s'", t))
+{ }
+
+
+bad_definition::bad_definition(const string &w):
+ runtime_error(w)
+{ }
+
+
+nesting_error::nesting_error(const string &w):
+ logic_error(w)
+{ }
+
+} // namespace DataFile
+} // namespace Msp
--- /dev/null
+#ifndef MSP_DATAFILE_EXCEPT_H_
+#define MSP_DATAFILE_EXCEPT_H_
+
+#include <stdexcept>
+
+namespace Msp {
+namespace DataFile {
+
+class data_error: public std::runtime_error
+{
+private:
+ std::string source;
+ unsigned line;
+
+public:
+ data_error(const std::string &, unsigned, const std::string &);
+ data_error(const std::string &, unsigned, const std::exception &);
+ virtual ~data_error() throw() { }
+
+ const std::string &get_source() const { return source; }
+ unsigned get_line() const { return line; }
+
+private:
+ std::string make_what(const std::string &, unsigned, const std::string &);
+};
+
+
+class parse_error: public std::runtime_error
+{
+public:
+ parse_error(const std::string &);
+ virtual ~parse_error() throw() { }
+};
+
+
+class syntax_error: public std::runtime_error
+{
+public:
+ syntax_error(const std::string &t);
+ virtual ~syntax_error() throw() { }
+};
+
+
+class bad_definition: public std::runtime_error
+{
+public:
+ bad_definition(const std::string &w);
+ virtual ~bad_definition() throw() { }
+};
+
+
+class nesting_error: public std::logic_error
+{
+public:
+ nesting_error(const std::string &);
+ virtual ~nesting_error() throw() { }
+};
+
+} // namespace DataFile
+} // namespace Msp
+
+#endif
#include <msp/core/raii.h>
#include <msp/strings/format.h>
-#include "dataerror.h"
+#include "except.h"
#include "loader.h"
#include "type.h"
#include <msp/strings/format.h>
#include "binaryparser.h"
-#include "dataerror.h"
+#include "except.h"
#include "parser.h"
#include "statement.h"
#include "textparser.h"
#include <msp/strings/format.h>
#include <msp/strings/utils.h>
+#include "except.h"
#include "input.h"
#include "textparser.h"
#include "token.h"
namespace Msp {
namespace DataFile {
-class parse_error: public runtime_error
-{
-public:
- parse_error(const std::string &t):
- runtime_error(t.empty() ? "at end of input" : format("after '%s'", t))
- { }
-
- virtual ~parse_error() throw() { }
-};
-
-
-class syntax_error: public runtime_error
-{
-public:
- syntax_error(const std::string &t):
- runtime_error(t.empty() ? "at end of input" : format("at '%s'", t))
- { }
-
- virtual ~syntax_error() throw() { }
-};
-
-
TextParser::TextParser(Input &i, const string &s):
ParserMode(i, s)
{ }