aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-12-01 22:58:20 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-12-02 02:41:39 +0900
commite5e1f9813e23c427cf45a25181b2e6d3cf97411a (patch)
tree43f0ead958e92e9aba68dc896e947b00bb00fd6a /parse.y
parentadd0ab07e8b5e8f271e7bffa21c650c38a46c7db (diff)
downloadruby-e5e1f9813e23c427cf45a25181b2e6d3cf97411a.tar.gz
[Bug #19838] Flush delayed token nonconsecutive with the next token
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y8
1 files changed, 8 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index 063e28b918..6931df9c1d 100644
--- a/parse.y
+++ b/parse.y
@@ -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);