From 5d6757c5943505c6ff22262e217b1e71c1e71147 Mon Sep 17 00:00:00 2001 From: nanobowers Date: Tue, 10 Dec 2024 16:19:29 -0500 Subject: [PATCH] Allow constants to start with non-ascii uppercase and titlecase (#15148) --- spec/compiler/lexer/lexer_spec.cr | 2 ++ src/compiler/crystal/syntax/lexer.cr | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/compiler/lexer/lexer_spec.cr b/spec/compiler/lexer/lexer_spec.cr index 6813c1fe8df3..cae4959ed636 100644 --- a/spec/compiler/lexer/lexer_spec.cr +++ b/spec/compiler/lexer/lexer_spec.cr @@ -276,6 +276,8 @@ describe "Lexer" do it_lexes "&+@foo", :OP_AMP_PLUS it_lexes "&-@foo", :OP_AMP_MINUS it_lexes_const "Foo" + it_lexes_const "ÁrvíztűrőTükörfúrógép" + it_lexes_const "DžLjNjDzᾈᾉᾊ" it_lexes_instance_var "@foo" it_lexes_class_var "@@foo" it_lexes_globals ["$foo", "$FOO", "$_foo", "$foo123"] diff --git a/src/compiler/crystal/syntax/lexer.cr b/src/compiler/crystal/syntax/lexer.cr index dbca2448585d..660bcf2f6848 100644 --- a/src/compiler/crystal/syntax/lexer.cr +++ b/src/compiler/crystal/syntax/lexer.cr @@ -1048,7 +1048,7 @@ module Crystal scan_ident(start) else - if current_char.ascii_uppercase? + if current_char.uppercase? || current_char.titlecase? while ident_part?(next_char) # Nothing to do end