def start_binding
      binding    = ''
      open_count = 1

      # scan until we reach a {{ or }}
      loop do
        binding << @html.scan_until(/(\{\{|\}\}|\n|\Z)/)

        match = @html[1]
        if match == '}}'
          # close
          open_count -= 1
          break if open_count == 0
        elsif match == '{{'
          # open more
          open_count += 1
        elsif match == "\n" || @html.eos?
          # Starting new tag, should be closed before this
          # or end of doc before closed binding
          raise_parse_error("unclosed binding: {#{binding.strip}")
        else
          #:nocov:
          fail 'should not reach here'
          #:nocov:
        end
      end

      binding = binding[0..-3]
      @handler.binding(binding) if @handler.respond_to?(:binding)
    end
def start_binding
      binding    = ''
      open_count = 1

      # scan until we reach a {{ or }}
      loop do
        binding << @html.scan_until(/(\{\{|\}\}|\n|\Z)/)

        match = @html[1]
        if match == '}}'
          # close
          open_count -= 1
          break if open_count == 0
        elsif match == '{{'
          # open more
          open_count += 1
        elsif match == "\n" || @html.eos?
          # Starting new tag, should be closed before this
          # or end of doc before closed binding
          raise_parse_error("unclosed binding: {#{binding.strip}")
        else
          #:nocov:
          fail 'should not reach here'
          #:nocov:
        end
      end

      binding = binding[0..-3]
      @handler.binding(binding) if @handler.respond_to?(:binding)
    end
Findings the end of a binding