Auto-update dlang core files [skip ci]
This commit is contained in:
1 parent
c8a040ed7c
commit
890f4290b6
5 files changed
+21
-10
No files matched your search
@@ -14,10 +14,10 @@ static void NativeRegexMatch(DlangVM* vm)
|
||||
try {
|
||||
std::regex rx(pattern);
|
||||
bool matched = std::regex_match(text, rx);
|
||||
dlang_pushnumber(vm, matched ? 1.0 : 0.0);
|
||||
dlang_pushboolean(vm, matched);
|
||||
}
|
||||
catch (...) {
|
||||
dlang_pushnumber(vm, 0.0);
|
||||
dlang_pushboolean(vm, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,10 +29,10 @@ static void NativeRegexSearch(DlangVM* vm)
|
||||
try {
|
||||
std::regex rx(pattern);
|
||||
bool found = std::regex_search(text, rx);
|
||||
dlang_pushnumber(vm, found ? 1.0 : 0.0);
|
||||
dlang_pushboolean(vm, found);
|
||||
}
|
||||
catch (...) {
|
||||
dlang_pushnumber(vm, 0.0);
|
||||
dlang_pushboolean(vm, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ static void NativeRegexReplace(DlangVM* vm)
|
||||
try {
|
||||
std::regex rx(pattern);
|
||||
std::string result = std::regex_replace(text, rx, fmt);
|
||||
|
||||
dlang_pushstring(vm, result);
|
||||
dlang_pushindex(vm);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user