Module: Ibex::NormalizeExpression

Defined in:
lib/ibex/normalize/expression.rb

Overview

Deterministically renders frontend EBNF items for production origin metadata.

Class Method Summary collapse

Class Method Details

.render(item) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ibex/normalize/expression.rb', line 8

def render(item)
  pending = [item] #: Array[untyped]
  output = [] #: Array[String]
  until pending.empty?
    current = pending.pop
    if current.is_a?(String)
      output << current
      next
    end

    push_render_item(pending, current)
  end
  output.join
end