Yerbacon/src/headers/Tasking.hpp
Username404-59 d4df3aa4ea
Add boilerplate for semantic analysis
Signed-off-by: Username404-59 <w.iron.zombie@gmail.com>
2024-08-07 03:05:55 +02:00

21 lines
764 B
C++

#ifndef YERBACON_TASKING_HPP
#define YERBACON_TASKING_HPP
#include <typeindex>
#include <unordered_map>
#include "parsing/ParseComponents.hpp"
#define make_task_base(start, type, captures, function_body) make_pair(type_index(typeid(type)), [captures](const ParseTree& parsedTree, unsigned int& index) { start; function_body })
#define make_task_base_R(T, C, F) make_task_base(const T& parseComponent = reinterpret_cast<T&>(*parsedTree[index]), T, C, F)
class Tasking {
protected:
typedef function<void (const ParseTree& parsedTree, unsigned int& index)> task;
typedef unordered_map<type_index, task> unordered_task_map;
public:
virtual unordered_task_map getTaskMapInstance() = 0;
virtual ~Tasking() = default;
};
#endif //YERBACON_TASKING_HPP