class Parslet::Pattern::SubtreeBind

Used internally for representing a bind placeholder in a Parslet::Transform pattern. This is the superclass for all bindings.

It defines the most permissive kind of bind, the one that matches any subtree whatever it looks like.

Public Instance Methods

can_bind?(subtree) click to toggle source
# File lib/parslet/pattern/binding.rb, line 17
def can_bind?(subtree)
  true
end
inspect() click to toggle source
# File lib/parslet/pattern/binding.rb, line 13
def inspect
  "#{bind_type_name}(#{symbol.inspect})"
end
variable_name() click to toggle source
# File lib/parslet/pattern/binding.rb, line 9
def variable_name
  symbol
end

Private Instance Methods

bind_type_name() click to toggle source
# File lib/parslet/pattern/binding.rb, line 22
def bind_type_name 
  if md=self.class.name.match(/(\w+)Bind/)
    md.captures.first.downcase
  else
    # This path should never be used, but since this is for inspection only,
    # let's not raise.
    'unknown_bind'
  end
end