30 lines
731 B
C++
30 lines
731 B
C++
#ifndef YERBACON_SEMANTICANALYSIS_HPP
|
|
#define YERBACON_SEMANTICANALYSIS_HPP
|
|
|
|
#include "parsing/ParseComponents.hpp"
|
|
#include "Tasking.hpp"
|
|
|
|
#define make_task(T, C, F) make_task_base_R(T, C, F)
|
|
|
|
struct SemanticAnalyser final: public Tasking {
|
|
const auto& analyseTree(const ParseTree& tree) {
|
|
const auto& task_map = getTaskMapInstance();
|
|
for (unsigned int i = 0; i < tree.size(); ++i) {
|
|
try {
|
|
task_map.at(tree[i]->getId())(tree, i);
|
|
} catch (const out_of_range&) {}
|
|
}
|
|
return tree;
|
|
}
|
|
private:
|
|
unordered_task_map getTaskMapInstance() final {
|
|
return {
|
|
|
|
};
|
|
};
|
|
};
|
|
|
|
#undef make_task
|
|
|
|
#endif //YERBACON_SEMANTICANALYSIS_HPP
|