Open nickcoutsos opened 2 years ago
While looking into fixing an issue with my handling of unit_address
nodes I noticed that there's a similar issue with the node's address
field returning @
. If this fix is alright I'd be happy to make a followup PR to update fields that have optional matches.
It seems the underlying issue here is that the value
field was being applied to the =
(non-named child) as well, and node.childForFieldName()
only returns the first. For my use case I need to use a cursor to access each instance of the field so I can just restrict that to named children anyway, but I think the above fix is otherwise valid.
I've noticed that the value field in a property node gives
=
instead of the property's value node. This change just restructures that part of the rule so that the entire value field is optional, and the portion used in the field starts after the=
token.I was a little unsure about this approach since it makes it sound like the presence of the field is optional but this is consistent with the tests.