Skip to content

Commit 236a9a8

Browse files
committed
Fix support for 'get_node' syntax, fixes #312
1 parent fcd3067 commit 236a9a8

File tree

5 files changed

+8
-1
lines changed

5 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

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

89
## [4.3.1] 2024-08-24
910

gdtoolkit/parser/gdscript.lark

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ _simple_lambda_stmt: single_lambda_stmt (";" single_lambda_stmt)* [";"]
263263
HEX.2: /-?0x[a-fA-F0-9][a-fA-F0-9_]*/
264264
BIN.2: /-?0b[01][01_]*/
265265
get_node: "$" (path | string | unique_node_path)
266-
!path: NAME ("/" "%"? NAME)*
266+
!path: ["/"] NAME ("/" ["%"] NAME)*
267267
!unique_node_path: "%" (path | REGULAR_STRING)
268268
array: "[" [type_cast ("," type_cast)* [trailing_comma]] "]"
269269
trailing_comma: ","

tests/formatter/input-output-pairs/simple_atom_expressions.in.gd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ func foo():
2323
var xd=%UniqueNodeName/Xyz
2424
var xe=%"a/b/c"
2525
var xf=%UniqueNodeName/%AnotherUniqueNodeName
26+
var xg=$/root
27+
var xh=$/root/a/b/c

tests/formatter/input-output-pairs/simple_atom_expressions.out.gd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ func foo():
2424
var xd = %UniqueNodeName/Xyz
2525
var xe = %"a/b/c"
2626
var xf = %UniqueNodeName/%AnotherUniqueNodeName
27+
var xg = $/root
28+
var xh = $/root/a/b/c

tests/valid-gd-scripts/node_paths.gd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ func foo():
1010
# @'xx'
1111
# @"""xxxx"""
1212
$Child/Sub.text = "xx"
13+
$/root
14+
$/root/A/B/C

0 commit comments

Comments
 (0)