Skip to content

Commit fc50238

Browse files
committed
Fix RegExp matching on right brackets and braces.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
1 parent ba37e6b commit fc50238

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,15 +853,15 @@ re_parse_next_token (re_parser_ctx_t *parser_ctx_p, /**< RegExp parser context *
853853
{
854854
advance = 1;
855855
out_token_p->type = RE_TOK_START_CHAR_CLASS;
856+
856857
if (re_lookup (parser_ctx_p->iter, 1) == LIT_CHAR_CIRCUMFLEX)
857858
{
858859
advance = 2;
859860
out_token_p->type = RE_TOK_START_INV_CHAR_CLASS;
860861
}
862+
861863
break;
862864
}
863-
case LIT_CHAR_RIGHT_SQUARE:
864-
case LIT_CHAR_RIGHT_BRACE:
865865
case LIT_CHAR_QUESTION:
866866
case LIT_CHAR_ASTERISK:
867867
case LIT_CHAR_PLUS:
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2015 Samsung Electronics Co., Ltd.
2+
// Copyright 2015 University of Szeged.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
16+
var r;
17+
r = new RegExp("]");
18+
assert (r.exec("]") == "]");
19+
20+
r = new RegExp("}");
21+
assert (r.exec("}") == "}");

0 commit comments

Comments
 (0)