Fix regression after #1927

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This commit is contained in:
László Langó 2017-07-19 11:01:16 +02:00 committed by yichoi
parent 44833cf7be
commit ce1d555288
2 changed files with 15 additions and 29 deletions

View File

@ -518,49 +518,31 @@ re_parse_char_class (re_parser_ctx_t *parser_ctx_p, /**< number of classes */
}
} /* ch == LIT_CHAR_BACKSLASH */
if (ch == LIT_CHAR_UNDEF)
if (start != LIT_CHAR_UNDEF)
{
if (start != LIT_CHAR_UNDEF)
if (is_range)
{
if (is_range)
if (start > ch)
{
return ecma_raise_syntax_error (ECMA_ERR_MSG ("invalid character class, invalid range"));
return ecma_raise_syntax_error (ECMA_ERR_MSG ("invalid character class, wrong order"));
}
else
{
append_char_class (re_ctx_p, start, start);
append_char_class (re_ctx_p, start, ch);
start = LIT_CHAR_UNDEF;
}
}
}
else
{
if (start != LIT_CHAR_UNDEF)
{
if (is_range)
{
if (start > ch)
{
return ecma_raise_syntax_error (ECMA_ERR_MSG ("invalid character class, wrong order"));
}
else
{
append_char_class (re_ctx_p, start, ch);
start = LIT_CHAR_UNDEF;
is_range = false;
}
}
else
{
append_char_class (re_ctx_p, start, start);
start = ch;
is_range = false;
}
}
else
{
append_char_class (re_ctx_p, start, start);
start = ch;
}
}
else
{
start = ch;
}
}
while (token_type == RE_TOK_START_CHAR_CLASS || token_type == RE_TOK_START_INV_CHAR_CLASS);

View File

@ -129,3 +129,7 @@ assert (r == "abcdefghjklmnopqrstuvwxyz");
r = new RegExp ("[\\x61-\\x7a]+$").exec("abcdefghjklmnopqrstuvwxyz");
assert (r == "abcdefghjklmnopqrstuvwxyz");
r = new RegExp("[\\u0800-\\uffff]", "g");
assert (r.test ("\uffff"));
assert (!r.test ("\uffff"));