class_docstr: Parser for VT100 input stream.
  Data can be fed through the `feed` method and the given callback will be
  called with KeyPress objects.
  
  ::
  
      def callback(key):
          pass
      i = Vt100Parser(callback)
      i.feed('data...')
  
  :attr feed_key_callback: Function that will be called when a key is parsed.
class_docstr_tok: ["Parser","for","VT100","input","stream",".","Data","can","be","fed","through","the","`","feed","`","method","and","the","given","callback","will","be","called","with","KeyPress","objects",".",":",":","def","callback","(","key",")",":","pass","i","=","Vt100Parser","(","callback",")","i.feed","(","'data\u0001","...","'",")",":","attr","feed_key_callback",":","Function","that","will","be","called","when","a","key","is","parsed","."]
docstr: Feed the input stream.
  
  :param data: Input string (unicode).
docstr_tok: ["Feed","the","input","stream",".",":","param","data",":","Input","string","(","unicode",")","."]
code: def feed(self, data: str) -> None:
      """
      Feed the input stream.
  
      :param data: Input string (unicode).
      """
      # Handle bracketed paste. (We bypass the parser that matches all other
      # key presses and keep reading input until we see the end mark.)
      # This is much faster then parsing character by character.
      if self._in_bracketed_paste:
          self._paste_buffer += data
          end_mark = "\x1b[201~"
  
          if end_mark in self._paste_buffer:
              end_index = self._paste_buffer.index(end_mark)
  
              # Feed content to key bindings.
              paste_content = self._paste_buffer[:end_index]
              self.feed_key_callback(
                  KeyPress(Keys.BracketedPaste, paste_content)
              )
  
              # Quit bracketed paste mode and handle remaining input.
              self._in_bracketed_paste = False
              remaining = self._paste_buffer[
                  end_index + len(end_mark) :
              ]
              self._paste_buffer = ""
  
              self.feed(remaining)
  
      # Handle normal input character by character.
      else:
          for i, c in enumerate(data):
              if self._in_bracketed_paste:
                  # Quit loop and process from this position when the parser
                  # entered bracketed paste.
                  self.feed(data[i:])
                  break
              else:
                  self._input_parser.send(c)
  
imports: from __future__ import annotations
  import re
  from typing import Callable, Dict, Generator
  from ..key_binding.key_processor import KeyPress
  from ..keys import Keys
  from .ansi_escape_sequences import ANSI_SEQUENCES
label_desc: Use image node_id 7 for calling the Vt100Parser obj's underlying member method code with example usage: obj.feed(data) without return types