def hash_indexes
@hash_indexes ||= Proc.new do
hashes = []
tokens.each_with_index do |token, token_idx|
next unless token.prev_code_token
next unless [:EQUALS, :ISEQUAL, :FARROW, :LPAREN].include? token.prev_code_token.type
if token.type == :LBRACE
level = 0
real_idx = 0
tokens[token_idx+1..-1].each_with_index do |cur_token, cur_token_idx|
real_idx = token_idx + 1 + cur_token_idx
level += 1 if cur_token.type == :LBRACE
level -= 1 if cur_token.type == :RBRACE
break if level < 0
end
hashes << {
:start => token_idx,
:end => real_idx,
:tokens => tokens[token_idx..real_idx],
}
end
end
hashes
end.call
end