Class: Treetop::Runtime::SyntaxNode

Inherits:
Object
  • Object
show all
Defined in:
lib/treetop/syntax_node_ext.rb

Direct Known Subclasses

Liquidice::TreetopNodes::Base

Instance Method Summary collapse

Instance Method Details

#has_ascendant?(type:, stop_node_type: Liquidice::TreetopNodes::LiquidTemplate) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
# File 'lib/treetop/syntax_node_ext.rb', line 4

def has_ascendant?(type:, stop_node_type: Liquidice::TreetopNodes::LiquidTemplate)
  return false if parent.nil?
  return false if self.is_a?(stop_node_type)

  parent.is_a?(type) || parent.has_ascendant?(type: type, stop_node_type: stop_node_type)
end