diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-12-01 22:58:20 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-12-02 02:41:39 +0900 |
commit | e5e1f9813e23c427cf45a25181b2e6d3cf97411a (patch) | |
tree | 43f0ead958e92e9aba68dc896e947b00bb00fd6a /parse.y | |
parent | add0ab07e8b5e8f271e7bffa21c650c38a46c7db (diff) | |
download | ruby-e5e1f9813e23c427cf45a25181b2e6d3cf97411a.tar.gz |
[Bug #19838] Flush delayed token nonconsecutive with the next token
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -7631,6 +7631,14 @@ add_delayed_token(struct parser_params *p, const char *tok, const char *end, int #endif if (tok < end) { + if (has_delayed_token(p)) { + bool next_line = end_with_newline_p(p, p->delayed.token); + int end_line = (next_line ? 1 : 0) + p->delayed.end_line; + int end_col = (next_line ? 0 : p->delayed.end_col); + if (end_line != p->ruby_sourceline || end_col != tok - p->lex.pbeg) { + dispatch_delayed_token(p, tSTRING_CONTENT); + } + } if (!has_delayed_token(p)) { p->delayed.token = rb_str_buf_new(end - tok); rb_enc_associate(p->delayed.token, p->enc); |