Skip to content

Commit

Permalink
Fix support for 'get_node' syntax, fixes #312
Browse files Browse the repository at this point in the history
  • Loading branch information
Scony committed Sep 1, 2024
1 parent fcd3067 commit 236a9a8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Changed
- Removed `private-method-call` linter check due to false positives when calling `super._foo()`
- Fixed support for `get_node` syntax to accommodate for `$/(...)`

## [4.3.1] 2024-08-24

Expand Down
2 changes: 1 addition & 1 deletion gdtoolkit/parser/gdscript.lark
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ _simple_lambda_stmt: single_lambda_stmt (";" single_lambda_stmt)* [";"]
HEX.2: /-?0x[a-fA-F0-9][a-fA-F0-9_]*/
BIN.2: /-?0b[01][01_]*/
get_node: "$" (path | string | unique_node_path)
!path: NAME ("/" "%"? NAME)*
!path: ["/"] NAME ("/" ["%"] NAME)*
!unique_node_path: "%" (path | REGULAR_STRING)
array: "[" [type_cast ("," type_cast)* [trailing_comma]] "]"
trailing_comma: ","
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ func foo():
var xd=%UniqueNodeName/Xyz
var xe=%"a/b/c"
var xf=%UniqueNodeName/%AnotherUniqueNodeName
var xg=$/root
var xh=$/root/a/b/c
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ func foo():
var xd = %UniqueNodeName/Xyz
var xe = %"a/b/c"
var xf = %UniqueNodeName/%AnotherUniqueNodeName
var xg = $/root
var xh = $/root/a/b/c
2 changes: 2 additions & 0 deletions tests/valid-gd-scripts/node_paths.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ func foo():
# @'xx'
# @"""xxxx"""
$Child/Sub.text = "xx"
$/root
$/root/A/B/C

0 comments on commit 236a9a8

Please sign in to comment.