1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix warning in Lexer::Elem#[]

Changed to use `#pos` `#event` `#tok` `#state` since using Lexer::Elem#[0~4] now gives a warning.
see: 8944009be7

9adbb9af32
This commit is contained in:
manga_osyo 2021-12-06 10:04:12 +09:00 committed by aycabta
parent babc200ee8
commit f279d41847

View file

@ -752,16 +752,16 @@ class RubyLex
end end
i += 1 i += 1
end end
start_token.last.nil? ? '' : start_token.last start_token.last.nil? ? nil : start_token.last
end end
def process_literal_type(tokens = @tokens) def process_literal_type(tokens = @tokens)
start_token = check_string_literal(tokens) start_token = check_string_literal(tokens)
return nil if start_token == "" return nil if start_token == ""
case start_token.event case start_token&.event
when :on_tstring_beg when :on_tstring_beg
case start_token.tok case start_token&.tok
when ?" then ?" when ?" then ?"
when /^%.$/ then ?" when /^%.$/ then ?"
when /^%Q.$/ then ?" when /^%Q.$/ then ?"
@ -776,7 +776,7 @@ class RubyLex
when :on_qsymbols_beg then ?] when :on_qsymbols_beg then ?]
when :on_symbols_beg then ?] when :on_symbols_beg then ?]
when :on_heredoc_beg when :on_heredoc_beg
start_token.tok =~ /<<[-~]?(['"`])[_a-zA-Z0-9]+\1/ start_token&.tok =~ /<<[-~]?(['"`])[_a-zA-Z0-9]+\1/
case $1 case $1
when ?" then ?" when ?" then ?"
when ?' then ?' when ?' then ?'