1
0
mirror of synced 2024-12-12 07:51:05 +01:00
ImHex/plugins/libimhex/include/hex/pattern_language/lexer.hpp
WerWolv e74c0f5cf5 sys: Tons of long overdue cleanup
- std::string -> const std::string& where needed
- Added a FileIO abstraction class
- Fixed recent files not updating
- Removed localization file from global include
- Renamed lang to pattern_language/pl
- Renamed EventFileDropped to RequestFileOpen
2021-09-08 15:18:24 +02:00

30 lines
620 B
C++

#pragma once
#include <hex.hpp>
#include <hex/pattern_language/token.hpp>
#include <optional>
#include <string>
#include <vector>
namespace hex::pl {
class Lexer {
public:
using LexerError = std::pair<u32, std::string>;
Lexer() = default;
std::optional<std::vector<Token>> lex(const std::string& code);
const LexerError& getError() { return this->m_error; }
private:
LexerError m_error;
[[noreturn]] void throwLexerError(const std::string &error, u32 lineNumber) const {
throw LexerError(lineNumber, "Lexer: " + error);
}
};
}