class SyntaxTree::Parser::PinVisitor

way to make this work.
If someone actually does something like that, we’ll have to find another
foo in ^((bar = 0; bar; baz))
than to address them. For example, this will not work properly:
because I honestly think it’s going to be faster to write a new parser
Note that there are edge cases here that we straight up do not address,
yourself.
events for ^ ops and var_ref nodes. You have to piece it together
enough information about where pins are located in the tree. It only gives
Ugh… I really do not like this class. Basically, ripper doesn’t provide

def self.visit(node, tokens)

def self.visit(node, tokens)
  start_char = node.start_char
  allocated = []
  tokens.reverse_each do |token|
    char = token.location.start_char
    break if char <= start_char
    if token.is_a?(Op) && token.value == "^"
      allocated.unshift(tokens.delete(token))
    end
  end
  new(allocated).visit(node) if allocated.any?
end

def initialize(pins)

def initialize(pins)
  @pins = pins
  @stack = []
end

def visit(node)

def visit(node)
  return if pins.empty?
  stack << node
  super
  stack.pop
end

def visit_var_ref(node)

def visit_var_ref(node)
  node.pin(stack[-2], pins.shift)
end