Skip to content

Commit cccf5c3

Browse files
committed
Extract list of ltype tokens to constants
1 parent 09d9dcc commit cccf5c3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/irb/ruby-lex.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,13 +388,16 @@ def check_corresponding_token_depth(tokens, lines, line_index)
388388
indent if indent_level < prev_indent_level
389389
end
390390

391+
LTYPE_TOKENS = %i[
392+
on_heredoc_beg on_tstring_beg
393+
on_regexp_beg on_symbeg on_backtick
394+
on_symbols_beg on_qsymbols_beg
395+
on_words_beg on_qwords_beg
396+
]
397+
391398
def ltype_from_open_tokens(opens)
392399
start_token = opens.reverse_each.find do |tok|
393-
%i[
394-
on_heredoc_beg on_tstring_beg on_symbeg on_regexp_beg
395-
on_symbols_beg on_qsymbols_beg
396-
on_words_beg on_qwords_beg
397-
].include?(tok.event)
400+
LTYPE_TOKENS.include?(tok.event)
398401
end
399402
return nil unless start_token
400403

0 commit comments

Comments
 (0)