patterns: Added demangle function
This commit is contained in:
parent
663fb88367
commit
84530e0817
@ -7,6 +7,7 @@
|
||||
#include <pl/core/evaluator.hpp>
|
||||
#include <pl/patterns/pattern.hpp>
|
||||
|
||||
#include <llvm/Demangle/Demangle.h>
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
void registerPatternLanguageFunctions() {
|
||||
@ -16,7 +17,7 @@ namespace hex::plugin::builtin {
|
||||
pl::api::Namespace nsHexCore = { "builtin", "hex", "core" };
|
||||
{
|
||||
/* get_selection() */
|
||||
ContentRegistry::PatternLanguage::addDangerousFunction(nsHexCore, "get_selection", FunctionParameterCount::none(), [](Evaluator *, auto) -> std::optional<Token::Literal> {
|
||||
ContentRegistry::PatternLanguage::addFunction(nsHexCore, "get_selection", FunctionParameterCount::none(), [](Evaluator *, auto) -> std::optional<Token::Literal> {
|
||||
if (!ImHexApi::HexEditor::isSelectionValid())
|
||||
return std::numeric_limits<u128>::max();
|
||||
|
||||
@ -26,6 +27,16 @@ namespace hex::plugin::builtin {
|
||||
});
|
||||
}
|
||||
|
||||
pl::api::Namespace nsHexDec = { "builtin", "hex", "dec" };
|
||||
{
|
||||
/* demangle(mangled_string) */
|
||||
ContentRegistry::PatternLanguage::addFunction(nsHexDec, "demangle", FunctionParameterCount::exactly(1), [](Evaluator *, auto params) -> std::optional<Token::Literal> {
|
||||
const auto mangledString = Token::literalToString(params[0], false);
|
||||
|
||||
return llvm::demangle(mangledString);
|
||||
});
|
||||
}
|
||||
|
||||
pl::api::Namespace nsHexHttp = { "builtin", "hex", "http" };
|
||||
{
|
||||
/* get(url) */
|
||||
|
Loading…
Reference in New Issue
Block a user