[Bug #21202] Fix wrong token concat while tokenizing nested unterminated heredoc (#13000)

This commit is contained in:
tomoya ishida 2025-03-29 20:46:43 +09:00 committed by GitHub
parent 549c7fe29d
commit a4a6019550
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
Notes: git 2025-03-29 11:47:11 +00:00
Merged-By: tompng <tomoyapenguin@gmail.com>
2 changed files with 46 additions and 1 deletions

View file

@ -9036,7 +9036,7 @@ here_document(struct parser_params *p, rb_strterm_heredoc_t *here)
if (!has_delayed_token(p)) {
dispatch_scan_event(p, tSTRING_CONTENT);
}
else {
else if (p->delayed.end_line + 1 == p->ruby_sourceline) {
if ((len = p->lex.pcur - p->lex.ptok) > 0) {
if (!(func & STR_FUNC_REGEXP)) {
int cr = ENC_CODERANGE_UNKNOWN;
@ -9051,6 +9051,10 @@ here_document(struct parser_params *p, rb_strterm_heredoc_t *here)
}
dispatch_delayed_token(p, tSTRING_CONTENT);
}
else {
dispatch_delayed_token(p, tSTRING_CONTENT);
dispatch_scan_event(p, tSTRING_CONTENT);
}
lex_goto_eol(p);
#endif
heredoc_restore(p, &p->lex.strterm->u.heredoc);