JavascriptRegularExpressionResult.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #pragma once
  6. namespace Js
  7. {
  8. class JavascriptRegularExpressionResult
  9. {
  10. private:
  11. static const PropertyIndex InputIndex = 0;
  12. static const PropertyIndex IndexIndex = 1;
  13. public:
  14. // Constructor for storing matches for a global regex (not captures)
  15. static JavascriptArray* Create(void *const stackAllocationPointer, JavascriptString* input, ScriptContext* const scriptContext);
  16. // Constructor for storing captures
  17. static JavascriptArray* Create(void *const stackAllocationPointer, const int numGroups, JavascriptString* input, ScriptContext* const scriptContext);
  18. static void SetMatch(JavascriptArray* arr, const UnifiedRegex::GroupInfo match);
  19. // Must be >= 2, but ensure that it will be equal to the total slot count so that the slot array is not created
  20. static const PropertyIndex InlineSlotCount = HeapConstants::ObjectGranularity / sizeof(Var);
  21. #if DEBUG
  22. static bool Is(JavascriptArray* arr);
  23. #endif
  24. private:
  25. static void InstantiateForceInlinedMembers();
  26. };
  27. } // namespace Js