mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
patterns: Merged in new pattern language refactor (#1533)
This commit is contained in:
@@ -162,22 +162,19 @@ namespace hex::ui {
|
||||
char c = filter[i];
|
||||
|
||||
if (i < filter.size() - 1 && c == '=' && filter[i + 1] == '=') {
|
||||
try {
|
||||
pl::core::Lexer lexer;
|
||||
pl::core::Lexer lexer;
|
||||
|
||||
auto source = filter.substr(i + 2);
|
||||
auto tokens = lexer.lex(filter.substr(i + 2), filter.substr(i + 2));
|
||||
pl::api::Source source(filter.substr(i + 2));
|
||||
auto tokens = lexer.lex(&source);
|
||||
|
||||
if (!tokens.has_value() || tokens->size() != 2)
|
||||
return std::nullopt;
|
||||
|
||||
auto literal = std::get_if<pl::core::Token::Literal>(&tokens->front().value);
|
||||
if (literal == nullptr)
|
||||
return std::nullopt;
|
||||
result.value = *literal;
|
||||
} catch (pl::core::err::LexerError &) {
|
||||
if (!tokens.isOk() || tokens.unwrap().size() != 2)
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
auto literal = std::get_if<pl::core::Token::Literal>(&tokens.unwrap().front().value);
|
||||
if (literal == nullptr)
|
||||
return std::nullopt;
|
||||
result.value = *literal;
|
||||
|
||||
break;
|
||||
} else if (c == '.') {
|
||||
result.path.emplace_back();
|
||||
|
||||
Reference in New Issue
Block a user