Hi.

> I am still trying to understand the Parslet transformations.
>
> My rules are:
>
> Rule Factor2:
> @t.rule(:factor => simple(:str)) { str
>       #Some code
>       str
>     }
> {:result=>{:term=>{:factor=>"a"@2, :plus=>"+ "@4, :term=>"b"@6}}}
>
>
> My question: "why does not :term=>{factor=>"a" being transformed in
> :term => "a" after firing the Factor2 rule?"
>

Because you asked to match a simple() thing, but in your parse tree, :factor
points to a subtree, not a simple scalar.

Something else that always trips me up is that sequence() only matches
arrays of simple things, not arrays that contain other sequences, or
subtrees.

HTH

ant

Reply via email to