2020-11-10 15:26:38 +01:00
|
|
|
#pragma once
|
|
|
|
|
2021-01-13 17:28:27 +01:00
|
|
|
#include <hex/views/view.hpp>
|
2021-09-08 15:18:24 +02:00
|
|
|
#include <hex/pattern_language/pattern_language.hpp>
|
2021-09-21 21:29:18 +02:00
|
|
|
#include <hex/pattern_language/log_console.hpp>
|
2021-01-13 17:28:27 +01:00
|
|
|
#include <hex/providers/provider.hpp>
|
2020-11-10 15:26:38 +01:00
|
|
|
|
|
|
|
#include <cstring>
|
2020-11-21 14:39:16 +01:00
|
|
|
#include <filesystem>
|
2021-02-07 13:40:47 +01:00
|
|
|
#include <string_view>
|
Pattern Language rewrite (#111)
* Initial parser rewrite effort
Lexer and Token cleanup, Parser started over
* Greatly improved parser syntax
* Reimplemented using declarations and variable placement parsing
* Added back unions and structs
* Added enums as well as mathematical expressions (+, -, *, /, <<, >>, &, |, ^)
* Code style improvement
* Implemented arrays and fixed memory issues
* Fixed more memory issues in parser, reimplemented validator, evaluator and patterns
* Fixed builtin types, arrays and reimplemented strings
* Improved error messages
* Made character a distinct type, used for chars and strings
* Implemented padding, fixed arrays
* Added bitfields
* Added rvalue parsing, no evaluating yet
* Added .idea folder to gitignore
* Fixed build on MacOS
* Added custom implementation of integral concept if not available
* Rebased onto master
* Fixed array variable decl crash
* Added rvalues and dot syntax
* Lower case all pattern language error messages
* Fixed typo in variable name
* Fixed bug where preprocessor would not ignore commented out directives
* Reimplemented pointers
* Fixed rebase issues
2021-01-02 20:27:11 +01:00
|
|
|
#include <thread>
|
2021-01-23 14:01:23 +01:00
|
|
|
#include <vector>
|
2020-11-10 15:26:38 +01:00
|
|
|
|
2021-01-13 17:28:27 +01:00
|
|
|
#include <TextEditor.h>
|
2020-11-12 21:20:51 +01:00
|
|
|
|
2020-11-10 15:26:38 +01:00
|
|
|
namespace hex {
|
|
|
|
|
2021-08-28 21:51:33 +02:00
|
|
|
class ViewPatternEditor : public View {
|
2020-11-10 15:26:38 +01:00
|
|
|
public:
|
2021-08-28 21:51:33 +02:00
|
|
|
ViewPatternEditor();
|
|
|
|
~ViewPatternEditor() override;
|
2020-11-10 15:26:38 +01:00
|
|
|
|
2020-12-22 18:10:01 +01:00
|
|
|
void drawMenu() override;
|
2021-02-07 14:29:13 +01:00
|
|
|
void drawAlwaysVisible() override;
|
2020-12-22 18:10:01 +01:00
|
|
|
void drawContent() override;
|
2020-11-10 15:26:38 +01:00
|
|
|
|
|
|
|
private:
|
2021-09-08 15:18:24 +02:00
|
|
|
pl::PatternLanguage *m_patternLanguageRuntime;
|
2021-09-26 21:18:25 +02:00
|
|
|
std::vector<std::filesystem::path> m_possiblePatternFiles;
|
|
|
|
u32 m_selectedPatternFile = 0;
|
2021-02-20 22:38:31 +01:00
|
|
|
bool m_runAutomatically = false;
|
2021-02-22 11:56:33 +01:00
|
|
|
bool m_evaluatorRunning = false;
|
2021-09-21 23:17:50 +02:00
|
|
|
bool m_hasUnevaluatedChanges = false;
|
2020-11-10 15:26:38 +01:00
|
|
|
|
2021-09-26 21:18:25 +02:00
|
|
|
bool m_acceptPatternWindowOpen = false;
|
|
|
|
|
2020-11-20 18:24:59 +01:00
|
|
|
TextEditor m_textEditor;
|
2021-09-08 15:18:24 +02:00
|
|
|
std::vector<std::pair<pl::LogConsole::Level, std::string>> m_console;
|
2020-11-12 21:20:51 +01:00
|
|
|
|
2021-09-08 15:18:24 +02:00
|
|
|
void loadPatternFile(const std::string &path);
|
2020-11-14 14:42:21 +01:00
|
|
|
void clearPatternData();
|
2020-11-10 21:31:04 +01:00
|
|
|
void parsePattern(char *buffer);
|
2020-11-10 15:26:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|