summaryrefslogtreecommitdiff
path: root/lib/irb/ruby-lex.rb
diff options
context:
space:
mode:
authoraycabta <[email protected]>2020-03-26 16:43:16 +0900
committeraycabta <[email protected]>2020-03-26 17:41:21 +0900
commit22477128cd77e0d0dce7e78bc12f9cc8cccc1cb4 (patch)
treeb0c88a22f80a3f4609cf00bc3dcd0a251a7698b9 /lib/irb/ruby-lex.rb
parentffbb162f1a052054ce2864d2971e83da10f8aa78 (diff)
[ruby/irb] Suppress crashing when EncodingError has occurred without lineno
https://github.com/ruby/irb/commit/13572d8cdc
Diffstat (limited to 'lib/irb/ruby-lex.rb')
-rw-r--r--lib/irb/ruby-lex.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb
index 251db9efaa..d5630c8b52 100644
--- a/lib/irb/ruby-lex.rb
+++ b/lib/irb/ruby-lex.rb
@@ -211,6 +211,8 @@ class RubyLex
else
RubyVM::InstructionSequence.compile(code)
end
+ rescue EncodingError
+ # This is for a hash with invalid encoding symbol, {"\xAE": 1}
rescue SyntaxError => e
case e.message
when /unterminated (?:string|regexp) meets end of file/