class FoodIngredientParser::Strict::Grammar::SyntaxNode

Treetop syntax node with our additions, use this as parent for all our own nodes.

Private Instance Methods

to_a_deep(n, cls) click to toggle source
# File lib/food_ingredient_parser/strict/nodes.rb, line 12
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