stevearc / godot_parser

Python library for parsing Godot scene files
MIT License
54 stars 11 forks source link

Supports trailing commas in list definitions. #2

Closed jjmontesl closed 3 years ago

jjmontesl commented 3 years ago

Apparently, lists can include a trailing comma (at least lists in the section header).

This is an example, in the section header:

[node name="Pit Water Trigger" type="Area2D" parent="Scene/Trial1/Acid Pit" groups=[
"WaterBody",
]]
visible = false
position = Vector2( -8.50171, -130.333 )
collision_layer = 256
collision_mask = 2147483649
script = ExtResource( 20 )
__meta__ = {
"_edit_group_": true
}

Note how the groups attribute is a list which contains newlines and a trailing separator (a comma). Newlines are not a problem for the parser but the comma was not supported.

This pull request modifies the parser definition to add support for trailing commas in list values.

stevearc commented 3 years ago

Looks good to me! Thanks!