RegExpPrototype.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibJS/Runtime/PrototypeObject.h>
  8. #include <LibJS/Runtime/RegExpObject.h>
  9. #include <LibJS/Runtime/Utf16String.h>
  10. namespace JS {
  11. ThrowCompletionOr<Value> regexp_exec(VM&, Object& regexp_object, Utf16String string);
  12. size_t advance_string_index(Utf16View const& string, size_t index, bool unicode);
  13. class RegExpPrototype final : public PrototypeObject<RegExpPrototype, RegExpObject> {
  14. JS_PROTOTYPE_OBJECT(RegExpPrototype, RegExpObject, RegExp);
  15. GC_DECLARE_ALLOCATOR(RegExpPrototype);
  16. public:
  17. virtual void initialize(Realm&) override;
  18. virtual ~RegExpPrototype() override = default;
  19. private:
  20. explicit RegExpPrototype(Realm&);
  21. JS_DECLARE_NATIVE_FUNCTION(exec);
  22. JS_DECLARE_NATIVE_FUNCTION(flags);
  23. JS_DECLARE_NATIVE_FUNCTION(symbol_match);
  24. JS_DECLARE_NATIVE_FUNCTION(symbol_match_all);
  25. JS_DECLARE_NATIVE_FUNCTION(symbol_replace);
  26. JS_DECLARE_NATIVE_FUNCTION(symbol_search);
  27. JS_DECLARE_NATIVE_FUNCTION(source);
  28. JS_DECLARE_NATIVE_FUNCTION(symbol_split);
  29. JS_DECLARE_NATIVE_FUNCTION(test);
  30. JS_DECLARE_NATIVE_FUNCTION(to_string);
  31. JS_DECLARE_NATIVE_FUNCTION(compile);
  32. #define __JS_ENUMERATE(FlagName, flagName, flag_name, ...) \
  33. JS_DECLARE_NATIVE_FUNCTION(flag_name);
  34. JS_ENUMERATE_REGEXP_FLAGS
  35. #undef __JS_ENUMERATE
  36. };
  37. }