Project

General

Profile

Bug #15467

Creating a class with a Cyrillic first symbol in the name leads to a SyntaxError in IRB

Added by an_vlad (Vladislav Andreev) 4 months ago. Updated 4 months ago.

Status:
Open
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
[ruby-core:90732]

Description

What happens: a syntax error occurs when a user writes class Класс and hits 'Enter' in IRB.

What is expected to happen: the same thing that happens when you create a class in IRB with class SomeClass line and hit 'Enter'.

How to reproduce:

  1. Run IRB.
  2. Write: class Класс and hit 'Enter'.

This leads to a syntax error: unexpected end-of-input, expecting end.

Some details:

  • class Класс; end will successfully create a class.
  • It seems like having a Cyrillic symbol as the first letter in a class name causes this error: class ZКласс works fine.

History

Updated by Hanmac (Hans Mackowiak) 4 months ago

from #13770 it should work? can you try it in pure ruby if your class name works?

i think the problem might be more in irb than ruby itself?

Updated by shevegen (Robert A. Heiler) 4 months ago

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?

Updated by an_vlad (Vladislav Andreev) 4 months ago

shevegen (Robert A. Heiler) wrote:

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.

Updated by duerst (Martin Dürst) 4 months ago

  • Assignee set to keiju (Keiju Ishitsuka)

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.

Also available in: Atom PDF