File: pattern.rb [parslet-1.5.0 Documentation]

Last Modified
  2015-05-02 00:52:41 +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.