#pragma once #include #include #include #include #include #include #include #include #include namespace hex::prv { class Provider; } namespace hex::pl { class Preprocessor; class Lexer; class Parser; class Validator; class Evaluator; class PatternData; class ASTNode; class PatternLanguage { public: PatternLanguage(); ~PatternLanguage(); [[nodiscard]] std::optional> parseString(const std::string &code); [[nodiscard]] std::optional> executeString(prv::Provider *provider, const std::string &string, const std::map &envVars = { }, const std::map &inVariables = { }); [[nodiscard]] std::optional> executeFile(prv::Provider *provider, const fs::path &path, const std::map &envVars = { }, const std::map &inVariables = { }); [[nodiscard]] const std::vector& getCurrentAST() const; void abort(); [[nodiscard]] const std::vector>& getConsoleLog(); [[nodiscard]] const std::optional>& getError(); [[nodiscard]] std::map getOutVariables() const; [[nodiscard]] u32 getCreatedPatternCount(); [[nodiscard]] u32 getMaximumPatternCount(); [[nodiscard]] bool hasDangerousFunctionBeenCalled() const; void allowDangerousFunctions(bool allow); private: Preprocessor *m_preprocessor; Lexer *m_lexer; Parser *m_parser; Validator *m_validator; Evaluator *m_evaluator; std::vector m_currAST; std::optional> m_currError; }; }