summaryrefslogtreecommitdiff
path: root/lib/prism/lex_compat.rb
diff options
context:
space:
mode:
authorKevin Newton <[email protected]>2023-10-12 11:38:57 -0400
committerKevin Newton <[email protected]>2023-10-13 15:31:30 -0400
commit11e946da2fa1af217a78c631cfbd88db5d0b5148 ()
tree83e22b488c3a91e77ac8f23c1059be6432470036 /lib/prism/lex_compat.rb
parentd06523bc52a4486db4193d7a6771e76c31157777 (diff)
[ruby/prism] Fix up PR failings
https://.com/ruby/prism/commit/11255f636e
-rw-r--r--lib/prism/lex_compat.rb48
1 files changed, 41 insertions, 7 deletions
@@ -370,10 +370,9 @@ module Prism
@embexpr_balance -= 1
when :on_tstring_content
if embexpr_balance == 0
- token.value.split(/(?<=\n)/).each_with_index do |line, index|
- next if line.strip.empty? && line.end_with?("\n")
- next if !(dedent_next || index > 0)
leading = line[/\A(\s*)\n?/, 1]
next_dedent = 0
@@ -430,6 +429,45 @@ module Prism
return results
end
# Otherwise, we're going to run through each token in the list and
# insert on_ignored_sp tokens for the amount of dedent that we need to
# perform. We also need to remove the dedent from the beginning of
@@ -787,10 +825,6 @@ module Prism
# We sort by location to compare against Ripper's output
tokens.sort_by!(&:location)
- if result_value.size - 1 > tokens.size
- raise StandardError, "Lost tokens when performing lex_compat"
- end
-
ParseResult.new(tokens, result.comments, result.errors, result.warnings, [])
end
end