Method: Parslet.sequence

Defined in:
lib/parslet.rb

.sequence(symbol) ⇒ Object

Returns a placeholder for a tree transformation that will only match a sequence of elements. The symbol you specify will be the key for the matched sequence in the returned dictionary.

# This would match a body element that contains several declarations.
{ :body => sequence(:declarations) }

The above example would match :body => ['a', 'b'], but not :body => 'a'.

see Transform


270
271
272
# File 'lib/parslet.rb', line 270

def sequence(symbol)
  Pattern::SequenceBind.new(symbol)
end