aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/RegularExpression.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/bindings/RegularExpression.cpp')
-rw-r--r--src/bun.js/bindings/RegularExpression.cpp35
1 files changed, 35 insertions, 0 deletions
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<Flags>(static_cast<Flags>(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