class SyntaxTree::Parser
def on_block_var(params, locals)
:call-seq:
def on_block_var(params, locals) index = tokens.rindex { |node| node.is_a?(Op) && %w[| ||].include?(node.value) } ending = tokens.delete_at(index) beginning = ending.value == "||" ? ending : consume_operator(:|) # If there are no parameters, then we didn't have anything to base the # location information of off. Now that we have an opening of the # block, we can correct this. if params.empty? start_line = params.location.start_line start_char = ( if beginning.value == "||" beginning.location.start_char else find_next_statement_start(beginning.location.end_char) end ) location = Location.fixed( line: start_line, char: start_char, column: start_char - line_counts[start_line - 1].start ) params = params.copy(location: location) end BlockVar.new( params: params, locals: locals || [], location: beginning.location.to(ending.location) ) end