File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -380,18 +380,21 @@ yp_regexp_parse_group(yp_regexp_parser_t *parser) {
380
380
switch (* parser -> cursor ) {
381
381
case '#' : { // inline comments
382
382
if (parser -> encoding_changed && parser -> encoding -> multibyte ) {
383
+ bool escaped = false;
384
+
383
385
// Here we're going to take a slow path and iterate through
384
386
// each multibyte character to find the close paren. We do
385
387
// this because \ can be a trailing byte in some encodings.
386
388
while (parser -> cursor < parser -> end ) {
387
- if (* parser -> cursor == ')' ) {
389
+ if (! escaped && * parser -> cursor == ')' ) {
388
390
parser -> cursor ++ ;
389
391
return true;
390
392
}
391
393
392
394
size_t width = parser -> encoding -> char_width (parser -> cursor , (ptrdiff_t ) (parser -> end - parser -> cursor ));
393
395
if (width == 0 ) return false;
394
396
397
+ escaped = (width == 1 ) && (* parser -> cursor == '\\' );
395
398
parser -> cursor += width ;
396
399
}
397
400
You can’t perform that action at this time.
0 commit comments