Scony / godot-gdscript-toolkit

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

Set after var fails to be formatted #228

Closed o01eg closed 1 year ago

o01eg commented 1 year ago

Minimal example:

extends Node

func reset_to_factory_settings(sections, section, key) -> void:
    var value = sections[section][key]
    set(key, value)

produces error:

    set(key, value)
        ^

Unexpected token Token('SET', 'set') at line 5, column 2.
Expected one of: 
    * BIN
    * CIRCUMFLEX
    * BREAK
    * PERCENT
    * LSQB
    * NUMBER
    * VAR
    * FUNC
    * PLUS
    * AWAIT
    * IF
    * MATCH
    * REGULAR_STRING
    * TILDE
    * HEX
    * DOLLAR
    * PASS
    * _DEDENT
    * CONST
    * LBRACE
    * LONG_STRING
    * FOR
    * NAME
    * NOT
    * MINUS
    * BANG
    * AMPERSAND
    * LPAR
    * CONTINUE
    * WHILE
    * RETURN

If comment out var line or change set to set2 error is gone.

Version: gdtoolkit-4.1.0

Scony commented 1 year ago

Looks like some corner case involving set keyword from the properties. Thanks for reporting, I'll check what's wrong precisely.