feat: ready to start main work
This commit is contained in:
@ -3,9 +3,7 @@
|
||||
#define PYTHON_INTERPRETER_EVALVISITOR_H
|
||||
|
||||
#include <any>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "Python3ParserBaseVisitor.h"
|
||||
#include "int2048/int2048.h"
|
||||
@ -53,26 +51,4 @@ class EvalVisitor : public Python3ParserBaseVisitor {
|
||||
std::any visitArglist(Python3Parser::ArglistContext *ctx) override;
|
||||
std::any visitArgument(Python3Parser::ArgumentContext *ctx) override;
|
||||
};
|
||||
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;
|
||||
};
|
||||
#endif // PYTHON_INTERPRETER_EVALVISITOR_H
|
||||
|
@ -6,7 +6,17 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
class NameScopeClass {
|
||||
;
|
||||
};
|
||||
struct FunctionItem
|
||||
{
|
||||
;
|
||||
};
|
||||
struct FucntionContainer
|
||||
{
|
||||
;
|
||||
};
|
||||
#endif
|
@ -0,0 +1,39 @@
|
||||
#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) {}
|
||||
};
|
||||
#endif
|
Reference in New Issue
Block a user