You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: html_entity.rb
    path of file: ./repos/kramdown/lib/kramdown/parser/kramdown
    
    the code of the file until where you have to start completion: # -*- coding: utf-8; frozen_
    
      def parse_html_entity
        start_line_number = @src.current_line_number
        @src.pos += @src.matched_size
        begin
          value = ::Kramdown::Utils::Entities.entity(@src[1] || (@src[2]&.to_i) || @src[3].hex)
          @tree.children << Element.new(:entity, value,
                                        nil, original: @src.matched, location: start_line_number)
        rescue ::Kramdown::Error
          @tree.children << Element.new(:entity, ::Kramdown::Utils::Entities.entity('amp'),
                                        nil, location: start_line_number)
          add_text(@src.matched[1..-1])
        end