pattern.rb

Path: lib/parslet/pattern.rb
Last Update: Fri Jul 15 14:35:39 -0400 2016

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.

[Validate]