1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

Add support for Unicode identifiers in GDScript

This is using an adapted version of UAX#31 to not rely on the ICU
database (which isn't available in builds without TextServerAdvanced).
It allows most characters used in diverse scripts but not everything.
This commit is contained in:
George Marques
2023-01-18 22:56:00 -03:00
parent 2ec0da1a75
commit 7548e043fc
14 changed files with 145 additions and 33 deletions

View File

@@ -0,0 +1,3 @@
func test():
var аs # Using Cyrillic "а".
print(аs)

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Identifier "аs" is visually similar to the GDScript keyword "as" and thus not allowed.

View File

@@ -0,0 +1,35 @@
const π = PI
var = π
func test():
var փորձարկում = "test"
prints("փորձարկում", փորձարկում)
var امتحان = "test"
prints("امتحان", امتحان)
var = "test"
prints("পরীক্ষা", )
var тест = "test"
prints("тест", тест)
var = "test"
prints("जाँच", )
var = "test"
prints("기준", )
var = "test"
prints("测试", )
var = "test"
prints("テスト", )
var = "test"
prints("試験", )
var = "test"
prints("പരീക്ഷ", )
var = "test"
prints("ทดสอบ", )
var δοκιμή = "test"
prints("δοκιμή", δοκιμή)
const d = 1.1
_process(d)
print(is_equal_approx(, PI + (d * PI)))
func _process(Δ: float) -> void:
+= Δ * π

View File

@@ -0,0 +1,14 @@
GDTEST_OK
փորձարկում test
امتحان test
পরীক্ষা test
тест test
जाँच test
기준 test
测试 test
テスト test
試験 test
പരീക്ഷ test
ทดสอบ test
δοκιμή test
true

View File

@@ -0,0 +1,5 @@
func test():
var port = 0 # Only latin characters.
var pοrt = 1 # The "ο" is Greek omicron.
prints(port, pοrt)

View File

@@ -0,0 +1,6 @@
GDTEST_OK
>> WARNING
>> Line: 3
>> CONFUSABLE_IDENTIFIER
>> The identifier "pοrt" has misleading characters and might be confused with something else.
0 1