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:
parent
babc200ee8
commit
f279d41847
1 changed files with 4 additions and 4 deletions
|
@ -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 ?'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue