class ActionDispatch::Journey::Visitors::String

:nodoc:

def binary(node, seed)

def binary(node, seed)
  visit(node.right, visit(node.left, seed))
end

def nary(node, seed)

def nary(node, seed)
  last_child = node.children.last
  node.children.inject(seed) { |s, c|
    string = visit(c, s)
    string << "|" unless last_child == c
    string
  }
end

def terminal(node, seed)

def terminal(node, seed)
  seed + node.left
end

def visit_GROUP(node, seed)

def visit_GROUP(node, seed)
  visit(node.left, seed.dup << "(") << ")"
end