Scony / godot-gdscript-toolkit

Independent set of GDScript tools - parser, linter, formatter, and more
MIT License
944 stars 65 forks source link

`gdlint`: bug with unique names based on `String` #284

Closed el-falso closed 5 months ago

el-falso commented 6 months ago

Currently there is a problem with gdlint not recognizing unique names correctly which are based on a String:

For example: @onready var test := %"Test", which is valid in GDScript, will raise the following error:

["Line ", "", "@onready var test := %\"Test\"", "                      ^", "", "Unexpected token Token(\'REGULAR_STRING\', \'\"Test\"\') at line 20, column 23.", "Expected one of: ", "\t* NAME", "Previous tokens: [Token(\'PERCENT\', \'%\')]", "", "Failure: 1 problem found", ""]
Scony commented 6 months ago

Could you please post the full gdscript code? Or at least the failing part?

el-falso commented 6 months ago

I did! but here a more valid script test.gd

extends Node2D
@onready var test := %"Test"

It fails with:

test.gd:

@onready var test := %"Test"
                      ^

Unexpected token Token('REGULAR_STRING', '"Test"') at line 2, column 23.
Expected one of: 
        * NAME
Previous tokens: [Token('PERCENT', '%')]

Failure: 1 problem found