Fix for #32: Allow single-element actions#49
Conversation
|
There are some problems I have with this code that indicate why it doesn't make sense to run action functions for references, optional rules, or anything else that doesn't create new nodes itself. You've put in You're also passing the single node obtained from the reference rule as the I don't think that wrapping the node in a list here helps either, because this conceptually doesn't align with what action functions are for: constructing new nodes in place of Canopy's built-in tree node constructor. Running actions at points where new nodes are not created is more likely to cause confusing behaviour. It causes nodes to be parsed in a context-sensitive rather than context-free way, as it would be if you attached the action to the referenced rule, rather than the rule referencing it. |
I didn't explore removing ca4041d but in theory it should be possible to revert now.
Now works with all single-element actions, with added tests