[ruby/yarp] Check for eof in yp_regexp_char_is_eof
https://github.com/ruby/yarp/commit/f3fbc5bf9e
This commit is contained in:
parent
6ee106ff79
commit
261e3663fd
@ -57,6 +57,9 @@ yp_regexp_char_expect(yp_regexp_parser_t *parser, char value) {
|
||||
// This advances the current token to the next instance of the given character.
|
||||
static bool
|
||||
yp_regexp_char_find(yp_regexp_parser_t *parser, char value) {
|
||||
if (yp_regexp_char_is_eof(parser)) {
|
||||
return false;
|
||||
}
|
||||
const char *end = (const char *) memchr(parser->cursor, value, (size_t) (parser->end - parser->cursor));
|
||||
if (end == NULL) {
|
||||
return false;
|
||||
@ -383,7 +386,7 @@ yp_regexp_parse_group(yp_regexp_parser_t *parser) {
|
||||
break;
|
||||
case '\'': { // named capture group
|
||||
const char *start = ++parser->cursor;
|
||||
if (yp_regexp_char_is_eof(parser) || !yp_regexp_char_find(parser, '\'')) {
|
||||
if (!yp_regexp_char_find(parser, '\'')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user