# File lib/html5/tokenizer.rb, line 444
    def attribute_name_state
      data = @stream.char
      leavingThisState = true
      emitToken = false
      if data == "="
        @state = :before_attribute_value_state
      elsif data == :EOF
        @token_queue << {:type => :ParseError, :data => "eof-in-attribute-name"}
        @state = :data_state
        emitToken = true
      elsif ASCII_LETTERS.include? data
        @current_token[:data][-1][0] += data + @stream.chars_until(ASCII_LETTERS, true)
        leavingThisState = false
      elsif data == ">"
        # XXX If we emit here the attributes are converted to a dict
        # without being checked and when the code below runs we error
        # because data is a dict not a list
        emitToken = true
      elsif SPACE_CHARACTERS.include? data
        @state = :after_attribute_name_state
      elsif data == "/"
        process_solidus_in_tag
        @state = :before_attribute_name_state
      else
        @current_token[:data][-1][0] += data
        leavingThisState = false
      end

      if leavingThisState
        # Attributes are not dropped at this stage. That happens when the
        # start tag token is emitted so values can still be safely appended
        # to attributes, but we do want to report the parse error in time.
        if @lowercase_attr_name
            @current_token[:data][-1][0] = @current_token[:data].last.first.downcase
        end
        @current_token[:data][0...-1].each {|name,value|
          if @current_token[:data].last.first == name
            @token_queue << {:type => :ParseError, :data => "duplicate-attribute"}
            break # don't report an error more than once
          end
        }
        # XXX Fix for above XXX
        emit_current_token if emitToken
      end
      return true
    end