Fix RegExp character class compilation on unicode ranges.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
@@ -419,8 +419,13 @@ re_parse_char_class (re_parser_ctx_t *parser_ctx_p, /**< number of classes */
|
||||
}
|
||||
|
||||
parser_ctx_p->input_curr_p += 2;
|
||||
append_char_class (re_ctx_p, code_unit, code_unit);
|
||||
ch = LIT_CHAR_UNDEF;
|
||||
if (is_range == false && lit_utf8_peek_next (parser_ctx_p->input_curr_p) == LIT_CHAR_MINUS)
|
||||
{
|
||||
start = code_unit;
|
||||
continue;
|
||||
}
|
||||
|
||||
ch = code_unit;
|
||||
}
|
||||
else if (ch == LIT_CHAR_LOWERCASE_U)
|
||||
{
|
||||
@@ -432,8 +437,13 @@ re_parse_char_class (re_parser_ctx_t *parser_ctx_p, /**< number of classes */
|
||||
}
|
||||
|
||||
parser_ctx_p->input_curr_p += 4;
|
||||
append_char_class (re_ctx_p, code_unit, code_unit);
|
||||
ch = LIT_CHAR_UNDEF;
|
||||
if (is_range == false && lit_utf8_peek_next (parser_ctx_p->input_curr_p) == LIT_CHAR_MINUS)
|
||||
{
|
||||
start = code_unit;
|
||||
continue;
|
||||
}
|
||||
|
||||
ch = code_unit;
|
||||
}
|
||||
else if (ch == LIT_CHAR_LOWERCASE_D)
|
||||
{
|
||||
|
||||
@@ -111,3 +111,21 @@ catch (e)
|
||||
{
|
||||
assert (e instanceof SyntaxError);
|
||||
}
|
||||
|
||||
r = new RegExp ("^[\\u0061-\\u007a]+$").exec("abcdefghjklmnopqrstuvwxyz");
|
||||
assert (r == "abcdefghjklmnopqrstuvwxyz");
|
||||
|
||||
r = new RegExp ("^[\\u0061-\\u007a]+").exec("abcdefghjklmnopqrstuvwxyz");
|
||||
assert (r == "abcdefghjklmnopqrstuvwxyz");
|
||||
|
||||
r = new RegExp ("[\\u0061-\\u007a]+$").exec("abcdefghjklmnopqrstuvwxyz");
|
||||
assert (r == "abcdefghjklmnopqrstuvwxyz");
|
||||
|
||||
r = new RegExp ("^[\\x61-\\x7a]+$").exec("abcdefghjklmnopqrstuvwxyz");
|
||||
assert (r == "abcdefghjklmnopqrstuvwxyz");
|
||||
|
||||
r = new RegExp ("^[\\x61-\\x7a]+").exec("abcdefghjklmnopqrstuvwxyz");
|
||||
assert (r == "abcdefghjklmnopqrstuvwxyz");
|
||||
|
||||
r = new RegExp ("[\\x61-\\x7a]+$").exec("abcdefghjklmnopqrstuvwxyz");
|
||||
assert (r == "abcdefghjklmnopqrstuvwxyz");
|
||||
|
||||
Reference in New Issue
Block a user