def title_tokens
@title_tokens ||= Proc.new do
result = []
tokens.each_index do |token_idx|
if tokens[token_idx].type == :COLON
if tokens[token_idx-1].type == :RBRACK
array_start_idx = tokens.rindex { |r|
r.type == :LBRACK
}
title_array_tokens = tokens[(array_start_idx + 1)..(token_idx - 2)]
result += title_array_tokens.select { |token|
{:STRING => true, :NAME => true}.include? token.type
}
else
next_token = tokens[token_idx].next_code_token
if next_token.type != :LBRACE
result << tokens[token_idx - 1]
end
end
end
end
result
end.call
end