GDScript: Be more lenient with identifiers

- Allow identifiers similar to keywords if they are in ASCII range.
- Allow constants to be treated as regular identifiers.
- Allow keywords that can be used as identifiers in expressions.
This commit is contained in:
George Marques
2023-02-09 11:17:37 -03:00
parent d02a7bc00d
commit 03ea77407c
8 changed files with 67 additions and 6 deletions

View File

@@ -0,0 +1,3 @@
func test():
var P1 = "ok" # Technically it is visually similar to keyword "PI" but allowed since it's in ASCII range.
print(P1)

View File

@@ -0,0 +1,16 @@
func test():
# The following keywords are allowed as identifiers:
var match = "match"
print(match)
var PI = "PI"
print(PI)
var INF = "INF"
print(INF)
var NAN = "NAN"
print(NAN)
var TAU = "TAU"
print(TAU)

View File

@@ -0,0 +1,6 @@
GDTEST_OK
match
PI
INF
NAN
TAU