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: Coroutine (state machine) for the input parser.
docstr_tok: ["Coroutine","(","state","machine",")","for","the","input","parser","."]
code: def _input_parser_generator(
      self,
  ) -> Generator[None, str | _Flush, None]:
      """
      Coroutine (state machine) for the input parser.
      """
      prefix = ""
      retry = False
      flush = False
  
      while True:
          flush = False
  
          if retry:
              retry = False
          else:
              # Get next character.
              c = yield
  
              if isinstance(c, _Flush):
                  flush = True
              else:
                  prefix += c
  
          # If we have some data, check for matches.
          if prefix:
              is_prefix_of_longer_match = (
                  _IS_PREFIX_OF_LONGER_MATCH_CACHE[prefix]
              )
              match = self._get_match(prefix)
  
              # Exact matches found, call handlers..
              if (flush or not is_prefix_of_longer_match) and match:
                  self._call_handler(match, prefix)
                  prefix = ""
  
              # No exact match found.
              elif (
                  flush or not is_prefix_of_longer_match
              ) and not match:
                  found = False
                  retry = True
  
                  # Loop over the input, try the longest match first and
                  # shift.
                  for i in range(len(prefix), 0, -1):
                      match = self._get_match(prefix[:i])
                      if match:
                          self._call_handler(match, prefix[:i])
                          prefix = prefix[i:]
                          found = True
  
                  if not found:
                      self._call_handler(prefix[0], prefix[0])
                      prefix = prefix[1:]
  
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 5 for calling the Vt100Parser obj's underlying member method code with example usage: obj._input_parser_generator() without return types