module FoodFishParser::Strict::Grammar::SyntaxNodeAdditions

Additions for Treetop nodes, include this in other nodes where needed.

Public Instance Methods

to_a_deep(n, cls) click to toggle source
# File lib/food_fish_parser/strict/nodes.rb, line 9
def to_a_deep(n, cls)
  if n.is_a?(cls)
    [n]
  elsif n.nonterminal?
    n.elements.map {|m| to_a_deep(m, cls) }.flatten(1).compact
  end
end