Files
imhex/include/views/view_pattern_editor.hpp
WerWolv c051f5d3e7 patterns: Rewrite evaluation engine (#306)
* patterns: Rewrite most of the evaluator to mainly use polymorphism instead of just RTTI

* patterns: Fixed a couple of AST memory leaks

* patterns: Parse string operations correctly

* patterns: Various fixes and cleanup

* patterns: Implement primitive function definitions

Function parameters now need to provide their type in the definition

* patterns: Added function variable definition and assignment

* patterns: Added remaining function statements

* patterns: Added unsized and while-sized arrays

* patterns: Added multi variable declarations to functions

* patterns: Added std::format built-in function

* patterns: Allow passing custom types to functions

* patterns: Added attributes and new "format" attribute

* patterns: Use libfmt for std::print instead of custom version

* patterns: Remove unnecessary string compare function

* pattern: Fix preprocessor directives

* patterns: Fix unit tests

* patterns: Added cast expression

* patterns: Handle endianess in function parameters

* patterns: Added casting to different endian

* patterns: Added 'str' type for functions
2021-09-21 21:29:18 +02:00

42 lines
1.0 KiB
C++

#pragma once
#include <hex/views/view.hpp>
#include <hex/pattern_language/pattern_language.hpp>
#include <hex/pattern_language/log_console.hpp>
#include <hex/providers/provider.hpp>
#include <cstring>
#include <filesystem>
#include <string_view>
#include <thread>
#include <vector>
#include <TextEditor.h>
namespace hex {
class ViewPatternEditor : public View {
public:
ViewPatternEditor();
~ViewPatternEditor() override;
void drawMenu() override;
void drawAlwaysVisible() override;
void drawContent() override;
private:
pl::PatternLanguage *m_patternLanguageRuntime;
std::vector<std::string> m_possiblePatternFiles;
int m_selectedPatternFile = 0;
bool m_runAutomatically = false;
bool m_evaluatorRunning = false;
TextEditor m_textEditor;
std::vector<std::pair<pl::LogConsole::Level, std::string>> m_console;
void loadPatternFile(const std::string &path);
void clearPatternData();
void parsePattern(char *buffer);
};
}