summaryrefslogtreecommitdiff
path: root/src/error.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/error.h')
-rw-r--r--src/error.h41
1 files changed, 6 insertions, 35 deletions
diff --git a/src/error.h b/src/error.h
index 0f128b4e..d61490aa 100644
--- a/src/error.h
+++ b/src/error.h
@@ -65,43 +65,14 @@ extern std::ostringstream _ctxt_buffer;
((long(_ctxt_buffer.tellp()) == 0) ? \
(_ctxt_buffer << msg) : (_ctxt_buffer << std::endl << msg))
-inline string error_context() {
- string context = _ctxt_buffer.str();
- _ctxt_buffer.str("");
- return context;
-}
-
-inline string file_context(const path& file, std::size_t line) {
- std::ostringstream buf;
- buf << "\"" << file << "\", line " << line << ": ";
- return buf.str();
-}
+string error_context();
-inline string line_context(const string& line,
- istream_pos_type pos = istream_pos_type(0),
- istream_pos_type end_pos = istream_pos_type(0))
-{
- std::ostringstream buf;
- buf << " " << line << "\n";
+string file_context(const path& file, std::size_t line);
+string line_context(const string& line,
+ istream_pos_type pos = istream_pos_type(0),
+ istream_pos_type end_pos = istream_pos_type(0));
- if (pos != istream_pos_type(0)) {
- buf << " ";
- if (end_pos == istream_pos_type(0)) {
- for (istream_pos_type i = 0; i < pos; i += 1)
- buf << " ";
- buf << "^\n";
- } else {
- for (istream_pos_type i = 0; i < end_pos; i += 1) {
- if (i >= pos)
- buf << "^";
- else
- buf << " ";
- }
- buf << '\n';
- }
- }
- return buf.str();
-}
+void report_error(const std::exception& err);
#define DECLARE_EXCEPTION(name, kind) \
class name : public kind { \