From cd0774cd89f44ae3880ae5d3840787012d9df603 Mon Sep 17 00:00:00 2001 From: dave caruso Date: Sun, 6 Aug 2023 06:13:39 -0700 Subject: Implement --test-name-pattern (#3998) * Fix end not being emitted all the time * stuff * Implement -t * Undo js_printer changes * Undo http changes * Update InternalModuleRegistryConstants.h * Delete unrelated test --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> --- src/bun.js/bindings/RegularExpression.cpp | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/bun.js/bindings/RegularExpression.cpp (limited to 'src/bun.js/bindings/RegularExpression.cpp') diff --git a/src/bun.js/bindings/RegularExpression.cpp b/src/bun.js/bindings/RegularExpression.cpp new file mode 100644 index 000000000..1c8df1bc0 --- /dev/null +++ b/src/bun.js/bindings/RegularExpression.cpp @@ -0,0 +1,35 @@ +#include "root.h" +#include "headers-handwritten.h" +#include "JavaScriptCore/RegularExpression.h" + +using namespace JSC; +using namespace JSC::Yarr; + +extern "C" RegularExpression* Yarr__RegularExpression__init(BunString pattern, uint16_t flags) +{ + return new RegularExpression(Bun::toWTFString(pattern), OptionSet(static_cast(flags))); +} +extern "C" void Yarr__RegularExpression__deinit(RegularExpression* re) +{ + delete re; +} +extern "C" bool Yarr__RegularExpression__isValid(RegularExpression* re) +{ + return re->isValid(); +} +extern "C" int Yarr__RegularExpression__matchedLength(RegularExpression* re) +{ + return re->matchedLength(); +} +extern "C" int Yarr__RegularExpression__searchRev(RegularExpression* re, BunString string) +{ + return re->searchRev(Bun::toWTFString(string)); +} +// extern "C" int Yarr__RegularExpression__match(RegularExpression* re, BunString string, int32_t start, int32_t* matchLength) +// { +// return re->match(Bun::toWTFString(string), start, matchLength); +// } +extern "C" int Yarr__RegularExpression__matches(RegularExpression* re, BunString string) +{ + return re->match(Bun::toWTFString(string), 0, 0); +} \ No newline at end of file -- cgit v1.2.3