diff options
author | manga_osyo <[email protected]> | 2021-12-06 10:04:12 +0900 |
---|---|---|
committer | aycabta <[email protected]> | 2021-12-24 20:44:02 +0900 |
commit | f279d41847e07949ca7ad3f2d3d5cbe9fa3aabf5 (patch) | |
tree | 3d6be903195141ab14ff30f56fcf558a787f2709 /lib/irb/ruby-lex.rb | |
parent | babc200ee89e9f7329d167b2f725a51486a7f6aa (diff) |
Fix warning in `Lexer::Elem#[]`
Changed to use `#pos` `#event` `#tok` `#state` since using Lexer::Elem#[0~4] now gives a warning.
see: https://github.com/ruby/ruby/commit/8944009be7418614ce7d4077807ac2b60d4d5d85
https://github.com/ruby/reline/commit/9adbb9af32
Diffstat (limited to 'lib/irb/ruby-lex.rb')
-rw-r--r-- | lib/irb/ruby-lex.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb index f2069a2b5f..29862f5507 100644 --- a/lib/irb/ruby-lex.rb +++ b/lib/irb/ruby-lex.rb @@ -752,16 +752,16 @@ class RubyLex end i += 1 end - start_token.last.nil? ? '' : start_token.last + start_token.last.nil? ? nil : start_token.last end def process_literal_type(tokens = @tokens) start_token = check_string_literal(tokens) return nil if start_token == "" - case start_token.event + case start_token&.event when :on_tstring_beg - case start_token.tok + case start_token&.tok when ?" then ?" when /^%.$/ then ?" when /^%Q.$/ then ?" @@ -776,7 +776,7 @@ class RubyLex when :on_qsymbols_beg then ?] when :on_symbols_beg then ?] when :on_heredoc_beg - start_token.tok =~ /<<[-~]?(['"`])[_a-zA-Z0-9]+\1/ + start_token&.tok =~ /<<[-~]?(['"`])[_a-zA-Z0-9]+\1/ case $1 when ?" then ?" when ?' then ?' |