diff options
author | 2023-08-06 06:13:39 -0700 | |
---|---|---|
committer | 2023-08-06 06:13:39 -0700 | |
commit | cd0774cd89f44ae3880ae5d3840787012d9df603 (patch) | |
tree | b1285dd26a5134b227f56afcc58c8e2b519fd3a1 /src/bun.js/bindings/RegularExpression.cpp | |
parent | cf8650937aa03b7410c24675868eec36b7e2f390 (diff) | |
download | bun-cd0774cd89f44ae3880ae5d3840787012d9df603.tar.gz bun-cd0774cd89f44ae3880ae5d3840787012d9df603.tar.zst bun-cd0774cd89f44ae3880ae5d3840787012d9df603.zip |
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>
Diffstat (limited to 'src/bun.js/bindings/RegularExpression.cpp')
-rw-r--r-- | src/bun.js/bindings/RegularExpression.cpp | 35 |
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 |