Skip to content

Commit 926fb76

Browse files
committed
Rework the ENABLE_REGEXP_STRICT_MODE macro
The new name is JERRY_REGEXP_STRICT_MODE set to 0 by default. The CMake feature option is not updated (yet). JerryScript-DCO-1.0-Signed-off-by: Peter Gal [email protected]
1 parent 03ca514 commit 926fb76

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

jerry-core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ endif()
229229

230230
# RegExp strict mode
231231
if(FEATURE_REGEXP_STRICT_MODE)
232-
set(DEFINES_JERRY ${DEFINES_JERRY} ENABLE_REGEXP_STRICT_MODE)
232+
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_REGEXP_STRICT_MODE=1)
233233
endif()
234234

235235
# RegExp recursion depth limit

jerry-core/config.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,15 @@
118118
# define JERRY_ES2015_TEMPLATE_STRINGS JERRY_ES2015
119119
#endif /* !defined(JERRY_ES2015_TEMPLATE_STRINGS) */
120120

121+
/**
122+
* Enables/disables the RegExp strict mode
123+
*
124+
* Default value: 0
125+
*/
126+
#ifndef JERRY_REGEXP_STRICT_MODE
127+
# define JERRY_REGEXP_STRICT_MODE 0
128+
#endif
129+
121130
/**
122131
* Enables/disables the unicode case conversion in the engine.
123132
* By default Unicode case conversion is enabled.

jerry-core/parser/regexp/re-parser.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -890,9 +890,9 @@ re_parse_next_token (re_parser_ctx_t *parser_ctx_p, /**< RegExp parser context *
890890
}
891891
case LIT_CHAR_LEFT_BRACE:
892892
{
893-
#ifdef ENABLE_REGEXP_STRICT_MODE
893+
#if defined (JERRY_REGEXP_STRICT_MODE) && (JERRY_REGEXP_STRICT_MODE == 1)
894894
return ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid RegExp token."));
895-
#else /* !ENABLE_REGEXP_STRICT_MODE */
895+
#else /* !defined (JERRY_REGEXP_STRICT_MODE) || (JERRY_REGEXP_STRICT_MODE == 0) */
896896
const lit_utf8_byte_t *input_curr_p = parser_ctx_p->input_curr_p;
897897

898898
lit_utf8_decr (&parser_ctx_p->input_curr_p);
@@ -917,7 +917,7 @@ re_parse_next_token (re_parser_ctx_t *parser_ctx_p, /**< RegExp parser context *
917917
parser_ctx_p->input_curr_p = input_curr_p;
918918
ret_value = ECMA_VALUE_EMPTY;
919919
}
920-
#endif /* ENABLE_REGEXP_STRICT_MODE */
920+
#endif /* defined (JERRY_REGEXP_STRICT_MODE) && (JERRY_REGEXP_STRICT_MODE == 1) */
921921
break;
922922
}
923923
case LIT_CHAR_NULL:

0 commit comments

Comments
 (0)