> Is it possible to somehow access information put on the transformer from the
> rules?
> I need to supply information to the transformer on creation and then pass it
> on to every node that gets created in the rules.
> Any ideas :)?
Hey,
I am not sure if I get this. But: Here's what your question makes me
think of: Say I have a context object that I want to pass around, like a
document I want to add all nodes into. Say also that I want to do this
in nice OOP-style, not using globals. Here's what you do:
doc = Document.new
transform.apply(tree, :doc => doc)
and a rule in transform would look like:
class MyTransform < Parslet::Transform
rule(SOMETHING) { doc.append Node.new }
rule(OROTHER) { |d| d[:doc].append Node.new }
end
Does this help?
k