summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Parser.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2019-02-26 00:13:38 +0100
committerJose <jose@zeroc.com>2019-02-26 00:14:51 +0100
commit668a3838e26b4e21a8635bd4ea39c3f7da96e2c8 (patch)
tree3a598d5e05995ef82787dfd262ace44511ca8db3 /cpp/src/Slice/Parser.cpp
parentFloat/double fixes and some linting (diff)
downloadice-668a3838e26b4e21a8635bd4ea39c3f7da96e2c8.tar.bz2
ice-668a3838e26b4e21a8635bd4ea39c3f7da96e2c8.tar.xz
ice-668a3838e26b4e21a8635bd4ea39c3f7da96e2c8.zip
Generate imports for types defined in separate Swift modules
Diffstat (limited to 'cpp/src/Slice/Parser.cpp')
-rw-r--r--cpp/src/Slice/Parser.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index e49c20f1c50..52004688edf 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -19,6 +19,52 @@
using namespace std;
using namespace Slice;
+
+Slice::CompilerException::CompilerException(const char* file, int line, const string& r) :
+ IceUtil::Exception(file, line),
+ _reason(r)
+{
+}
+
+#ifndef ICE_CPP11_COMPILER
+Slice::CompilerException::~CompilerException() throw()
+{
+}
+#endif
+
+string
+Slice::CompilerException::ice_id() const
+{
+ return "::Slice::CompilerException";
+}
+
+void
+Slice::CompilerException::ice_print(ostream& out) const
+{
+ IceUtil::Exception::ice_print(out);
+ out << ": " << _reason;
+}
+
+#ifndef ICE_CPP11_MAPPING
+Slice::CompilerException*
+Slice::CompilerException::ice_clone() const
+{
+ return new CompilerException(*this);
+}
+#endif
+
+void
+Slice::CompilerException::ice_throw() const
+{
+ throw *this;
+}
+
+string
+Slice::CompilerException::reason() const
+{
+ return _reason;
+}
+
extern FILE* slice_in;
extern int slice_debug;
@@ -227,6 +273,20 @@ Slice::DefinitionContext::warning(WarningCategory category, const string& file,
}
}
+void
+Slice::DefinitionContext::error(const string& file, int line, const string& msg) const
+{
+ emitError(file, line, msg);
+ throw CompilerException(__FILE__, __LINE__, msg);
+}
+
+void
+Slice::DefinitionContext::error(const string& file, const string& line, const string& msg) const
+{
+ emitError(file, line, msg);
+ throw CompilerException(__FILE__, __LINE__, msg);
+}
+
bool
Slice::DefinitionContext::suppressWarning(WarningCategory category) const
{