def resource_indexes
@resource_indexes ||= Proc.new do
result = []
tokens.each_index do |token_idx|
if tokens[token_idx].type == :COLON
next_token = tokens[token_idx].next_code_token
depth = 1
if next_token.type != :LBRACE
tokens[(token_idx + 1)..-1].each_index do |idx|
real_idx = token_idx + idx + 1
if tokens[real_idx].type == :LBRACE
depth += 1
elsif {:SEMIC => true, :RBRACE => true}.include? tokens[real_idx].type
unless tokens[real_idx].type == :SEMIC && depth > 1
depth -= 1
if depth == 0
result << {:start => token_idx + 1, :end => real_idx}
break
end
end
end
end
end
end
end
result
end.call
end