Module: FoodFishParser::Strict::Grammar::SyntaxNodeAdditions

Included in:
AquacAreaNode, CatchAreaNode, FishNameNode, FishNode, RootNode
Defined in:
lib/food_fish_parser/strict/nodes.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#to_a_deep(n, cls) ⇒ Object



9
10
11
12
13
14
15
# 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