Last Modified
2014-09-11 14:51:21 +0000
Requires

Description

Matches trees against expressions. Trees are formed by arrays and hashes for expressing membership and sequence. The leafs of the tree are other classes.

A tree issued by the parslet library might look like this:

{ 
  :function_call => {
    :name => 'foobar', 
    :args => [1, 2, 3]
  }
}

A pattern that would match against this tree would be:

{ :function_call => { :name => simple(:name), :args => sequence(:args) }}

Note that Parslet::Pattern only matches at a given subtree; it wont try to match recursively. To do that, please use Parslet::Transform.