1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:37:35 +00:00

LibJS: Implement RegExp.prototype [ @@match ] with UTF-16 code units

This commit is contained in:
Timothy Flynn 2021-07-22 10:19:27 -04:00 committed by Linus Groh
parent b1ea9c20b0
commit 2c023157e9
6 changed files with 103 additions and 16 deletions

View file

@ -6,6 +6,7 @@
#pragma once
#include <AK/Utf16View.h>
#include <LibJS/Runtime/Object.h>
namespace JS {
@ -14,13 +15,13 @@ class RegExpStringIterator final : public Object {
JS_OBJECT(RegExpStringIterator, Object);
public:
static RegExpStringIterator* create(GlobalObject&, Object& regexp_object, String string, bool global, bool unicode);
static RegExpStringIterator* create(GlobalObject&, Object& regexp_object, Vector<u16> string, bool global, bool unicode);
explicit RegExpStringIterator(Object& prototype, Object& regexp_object, String string, bool global, bool unicode);
explicit RegExpStringIterator(Object& prototype, Object& regexp_object, Vector<u16> string, bool global, bool unicode);
virtual ~RegExpStringIterator() override = default;
Object& regexp_object() { return m_regexp_object; }
String const& string() const { return m_string; }
Utf16View string() const { return Utf16View { m_string }; }
bool global() const { return m_global; }
bool unicode() const { return m_unicode; }
@ -31,7 +32,7 @@ private:
virtual void visit_edges(Cell::Visitor&) override;
Object& m_regexp_object;
String m_string;
Vector<u16> m_string;
bool m_global { false };
bool m_unicode { false };
bool m_done { false };