summaryrefslogtreecommitdiff
path: root/src/span.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/span.cpp')
-rw-r--r--src/span.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/span.cpp b/src/span.cpp
new file mode 100644
index 00000000..e3458c8b
--- /dev/null
+++ b/src/span.cpp
@@ -0,0 +1,37 @@
+/*
+ * MRustC - Rust Compiler
+ * - By John Hodge (Mutabah/thePowersGang)
+ *
+ * span.cpp
+ * - Spans and error handling
+ */
+#include <functional>
+#include <iostream>
+#include <span.hpp>
+
+void Span::bug(::std::function<void(::std::ostream&)> msg) const
+{
+ ::std::cerr << this->filename << ":" << this->start_line << ": BUG:";
+ msg(::std::cerr);
+ ::std::cerr << ::std::endl;
+ abort();
+}
+
+void Span::error(ErrorType tag, ::std::function<void(::std::ostream&)> msg) const {
+ ::std::cerr << this->filename << ":" << this->start_line << ": error:";
+ msg(::std::cerr);
+ ::std::cerr << ::std::endl;
+ abort();
+}
+void Span::warning(WarningType tag, ::std::function<void(::std::ostream&)> msg) const {
+ ::std::cerr << this->filename << ":" << this->start_line << ": warning:";
+ msg(::std::cerr);
+ ::std::cerr << ::std::endl;
+ //abort();
+}
+void Span::note(::std::function<void(::std::ostream&)> msg) const {
+ ::std::cerr << this->filename << ":" << this->start_line << ": note:";
+ msg(::std::cerr);
+ ::std::cerr << ::std::endl;
+ //abort();
+}