Use lex_eol macros

This commit is contained in:
Nobuyoshi Nakada 2023-10-13 02:32:45 +09:00
parent 17b0643392
commit 81399a5c46
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465

View File

@ -7912,7 +7912,7 @@ tokadd_utf8(struct parser_params *p, rb_encoding **encp,
* does its own validation and will catch any issues.
*/
tokadd(p, open_brace);
while (++p->lex.pcur < p->lex.pend) {
while (!lex_eol_ptr_p(p, ++p->lex.pcur)) {
int c = peekc(p);
if (c == close_brace) {
tokadd(p, c);
@ -7922,7 +7922,7 @@ tokadd_utf8(struct parser_params *p, rb_encoding **encp,
else if (c == term) {
break;
}
if (c == '\\' && p->lex.pcur + 1 < p->lex.pend) {
if (c == '\\' && !lex_eol_n_p(p, 1)) {
tokadd(p, c);
c = *++p->lex.pcur;
}