41 lines
1.0 KiB
C++
41 lines
1.0 KiB
C++
#ifndef UTILS_H
|
|
#define UTILS_H
|
|
#include <any>
|
|
#include <exception>
|
|
#include <stdexcept>
|
|
#include <vector>
|
|
class InterpretException : public std::exception {
|
|
public:
|
|
InterpretException() {}
|
|
InterpretException(const char *message) : m_message(message) {}
|
|
|
|
const char *what() const noexcept override { return m_message; }
|
|
|
|
~InterpretException() noexcept override {}
|
|
|
|
private:
|
|
const char *m_message;
|
|
};
|
|
|
|
class FatalError : public std::exception {
|
|
public:
|
|
FatalError(const char *message) : m_message(message) {}
|
|
|
|
const char *what() const noexcept override { return m_message; }
|
|
|
|
private:
|
|
const char *m_message;
|
|
};
|
|
enum FlowControlStatusType { BREAK, CONTINUE, RETURN };
|
|
struct FlowType {
|
|
FlowControlStatusType Status;
|
|
// TODO: return lists
|
|
std::vector<std::any> ReturnValueLists;
|
|
FlowType() {}
|
|
FlowType(FlowControlStatusType Status) : Status(Status) {}
|
|
FlowType(FlowControlStatusType Status, std::vector<std::any> ReturnValueLists)
|
|
: Status(Status), ReturnValueLists(ReturnValueLists) {}
|
|
};
|
|
|
|
struct NoneType {};
|
|
#endif |