Closed ravinggenius closed 7 years ago
Comments? Thoughts? I'm happy to tackle this if that helps.
Would have to be opt-in. Have you got an idea on how to implement this?
I would change transform_elt
to check raise_on_unmatch
and either return the node or raise an exception. Sample usage below:
class MyTransform < Parslet::Transform
def self.apply(raw_tree)
new(raise_on_unmatch: true).apply(raw_tree)
end
end
For my application if a subtree doesn't get matched by a transform rule, I have an error. It would be nice if Parslet could optionally raise an exception to alert when no transform rule matches. The exception should include the unmatched keys and ideally the classes and/or contents of the corresponding values.
I'm sure not everyone would want this behavior, so it should be opt-in somehow. This would be extremely useful to me.