2021-01-22 18:01:39 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <hex.hpp>
|
|
|
|
|
|
|
|
#include <bit>
|
|
|
|
#include <optional>
|
|
|
|
#include <string>
|
|
|
|
#include <string_view>
|
|
|
|
#include <vector>
|
|
|
|
|
2021-09-08 15:18:24 +02:00
|
|
|
#include <hex/pattern_language/log_console.hpp>
|
2021-01-22 18:01:39 +01:00
|
|
|
|
|
|
|
namespace hex::prv { class Provider; }
|
|
|
|
|
2021-09-08 15:18:24 +02:00
|
|
|
namespace hex::pl {
|
2021-01-22 18:01:39 +01:00
|
|
|
|
|
|
|
class Preprocessor;
|
|
|
|
class Lexer;
|
|
|
|
class Parser;
|
|
|
|
class Validator;
|
|
|
|
class Evaluator;
|
2021-08-29 22:15:18 +02:00
|
|
|
class PatternData;
|
2021-01-22 18:01:39 +01:00
|
|
|
|
|
|
|
class PatternLanguage {
|
|
|
|
public:
|
2021-01-23 14:00:09 +01:00
|
|
|
PatternLanguage();
|
2021-01-22 18:01:39 +01:00
|
|
|
~PatternLanguage();
|
|
|
|
|
2021-09-08 15:18:24 +02:00
|
|
|
std::optional<std::vector<PatternData*>> executeString(prv::Provider *provider, const std::string &string);
|
|
|
|
std::optional<std::vector<PatternData*>> executeFile(prv::Provider *provider, const std::string &path);
|
2021-01-22 18:01:39 +01:00
|
|
|
|
2021-01-23 14:00:09 +01:00
|
|
|
const std::vector<std::pair<LogConsole::Level, std::string>>& getConsoleLog();
|
|
|
|
const std::optional<std::pair<u32, std::string>>& getError();
|
2021-01-22 18:01:39 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
Preprocessor *m_preprocessor;
|
|
|
|
Lexer *m_lexer;
|
|
|
|
Parser *m_parser;
|
|
|
|
Validator *m_validator;
|
|
|
|
Evaluator *m_evaluator;
|
|
|
|
|
2021-03-15 08:11:19 +01:00
|
|
|
prv::Provider *m_provider = nullptr;
|
|
|
|
std::endian m_defaultEndian = std::endian::native;
|
|
|
|
u32 m_recursionLimit = 32;
|
2021-01-22 18:01:39 +01:00
|
|
|
|
|
|
|
std::optional<std::pair<u32, std::string>> m_currError;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|