# File lib/puppet-lint/plugin.rb, line 74
  def filter_tokens
    @title_tokens = []
    @resource_indexes = []
    @class_indexes = []
    @defined_type_indexes = []

    @tokens.each_index do |token_idx|
      if @tokens[token_idx].first == :COLON
        # gather a list of tokens that are resource titles
        if @tokens[token_idx-1].first == :RBRACK
          title_array_tokens = @tokens[@tokens.rindex { |r| r.first == :LBRACK }+1..token_idx-2]
          @title_tokens += title_array_tokens.select { |token| [:STRING, :NAME].include? token.first }
        else
          if @tokens[token_idx + 1].first != :LBRACE
            @title_tokens << @tokens[token_idx-1]
          end
        end

        # gather a list of start and end indexes for resource attribute blocks
        if @tokens[token_idx+1].first != :LBRACE
          @resource_indexes << {:start => token_idx+1, :end => @tokens[token_idx+1..-1].index { |r| [:SEMIC, :RBRACE].include? r.first }+token_idx}
        end
      elsif [:CLASS, :DEFINE].include? @tokens[token_idx].first
        lbrace_count = 0
        @tokens[token_idx+1..-1].each_index do |class_token_idx|
          idx = class_token_idx + token_idx
          if @tokens[idx].first == :LBRACE
            lbrace_count += 1
          elsif @tokens[idx].first == :RBRACE
            lbrace_count -= 1
            if lbrace_count == 0
              if @tokens[token_idx].first == :CLASS and @tokens[token_idx + 1].first != :LBRACE
                @class_indexes << {:start => token_idx, :end => idx}
              end
              @defined_type_indexes << {:start => token_idx, :end => idx} if @tokens[token_idx].first == :DEFINE
              break
            end
          end
        end
      end
    end
  end