Skip to content

Commit def6845

Browse files
tompngmatzbot
authored andcommitted
[ruby/irb] Fix indentation of xstring literal
(ruby/irb#1038) Fixes indent calculation of this input ``` if false p `ls` end ``` ruby/irb@4217a46f5d
1 parent c192d68 commit def6845

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/irb/nesting_parser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def scan_opens(tokens)
159159
when :on_heredoc_end
160160
opens.pop
161161
when :on_backtick
162-
opens << [t, nil] if t.state.allbits?(Ripper::EXPR_BEG)
162+
opens << [t, nil] unless t.state == Ripper::EXPR_ARG
163163
when :on_tstring_beg, :on_words_beg, :on_qwords_beg, :on_symbols_beg, :on_qsymbols_beg, :on_regexp_beg
164164
opens << [t, nil]
165165
when :on_tstring_end, :on_regexp_end, :on_label_end

test/irb/test_nesting_parser.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def `; end
5959
def f() = 1
6060
%(); %w[]; %q(); %r{}; %i[]
6161
"#{1}"; ''; /#{1}/; `#{1}`
62+
p(``); p ``; p x: ``; p 1, ``;
6263
:sym; :"sym"; :+; :`; :if
6364
[1, 2, 3]
6465
{ x: 1, y: 2 }

0 commit comments

Comments
 (0)