Interesting that the first variant with "; end" works.
Does the code work for you in every way when you put it into a standalone .rb file and run this?
Yes, it does work when I run similar code in a file.
UPD I've just tried to run the same piece of code with a Greek name (class Κατηγορίας and then 'Enter') and it also didn't work inside the IRB session. So this issue is caused by any Unicode symbol taking the first place in the name of a class.
It is indeed the first letter that's relevant. Examples such as class Sigmα
(last letter of class name is Greek alpha) and class Sιγμα
(only first letter is Latin, rest is Greek) work without problems.
The problem for me is that the traceback doesn't give any specific information.
I have assigned this issue to Keiju Ishitsuka, the creator of IRB. Hopefully we can get some help or hints from him.
$ irb27
irb(main):001:0> class Класс
irb(main):001:0> end
=> nil
irb(main):002:0> class ласс
irb(main):002:0> end
Traceback (most recent call last):
3: from /usr/local/bin/irb27:23:in `<main>'
2: from /usr/local/bin/irb27:23:in `load'
1: from /usr/local/lib/ruby/gems/2.7/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
SyntaxError ((irb):2: class/module name must be CONSTANT)
class ласс
^~~~~~~~
$ irb26
irb(main):001:0> class Класс
Traceback (most recent call last):
3: from /usr/local/bin/irb26:23:in `<main>'
2: from /usr/local/bin/irb26:23:in `load'
1: from /usr/local/lib/ruby/gems/2.6/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
SyntaxError ((irb):1: syntax error, unexpected end-of-input, expecting end)