Added RegExp dotAll flag (#4000)

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
This commit is contained in:
kisbg
2020-07-24 13:42:57 +02:00
committed by GitHub
parent cf097ca16b
commit d39a076b2e
11 changed files with 87 additions and 11 deletions
+6
View File
@@ -2816,6 +2816,12 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
{
flag = RE_FLAG_STICKY;
}
#if ENABLED (JERRY_ESNEXT)
else if (source_p[0] == LIT_CHAR_LOWERCASE_S)
{
flag = RE_FLAG_DOTALL;
}
#endif /* ENABLED (JERRY_ESNEXT) */
if (flag == 0)
{
-5
View File
@@ -36,11 +36,6 @@
*/
#define RE_CACHE_SIZE 8u
/**
* RegExp flags mask (first 10 bits are for reference count and the rest for the actual RegExp flags)
*/
#define RE_FLAGS_MASK 0x3F
/**
* Maximum value that can be encoded in the RegExp bytecode as a single byte.
*/
+1 -1
View File
@@ -61,7 +61,7 @@ re_cache_lookup (ecma_string_t *pattern_str_p, /**< pattern string */
ecma_string_t *cached_pattern_str_p = ecma_get_string_from_value (cached_bytecode_p->source);
if ((cached_bytecode_p->header.status_flags & RE_FLAGS_MASK) == flags
if (cached_bytecode_p->header.status_flags == flags
&& ecma_compare_ecma_strings (cached_pattern_str_p, pattern_str_p))
{
return cached_bytecode_p;