class_docstr: Lexer which can be used for highlighting of fragments according to variables in the grammar.
  
  (It does not actual lexing of the string, but it exposes an API, compatible
  with the Pygments lexer class.)
  
  :param compiled_grammar: Grammar as returned by the `compile()` function.
  :param lexers: Dictionary mapping variable names of the regular grammar to
                 the lexers that should be used for this part. (This can
                 call other lexers recursively.) If you wish a part of the
                 grammar to just get one fragment, use a
                 `prompt_toolkit.lexers.SimpleLexer`.
code: def lex_document(
      self, document: Document
  ) -> Callable[[int], StyleAndTextTuples]:
      lines = list(split_lines(self._get_text_fragments(document.text)))
  
      def get_line(lineno: int) -> StyleAndTextTuples:
          try:
              return lines[lineno]
          except IndexError:
              return []
  
      return get_line
  
file_path: catboost/contrib/python/prompt-toolkit/py3/prompt_toolkit/contrib/regular_languages/lexer.py
imports: from __future__ import annotations
  from typing import Callable
  from prompt_toolkit.document import Document
  from prompt_toolkit.formatted_text.base import StyleAndTextTuples
  from prompt_toolkit.formatted_text.utils import split_lines
  from prompt_toolkit.lexers import Lexer
  from .compiler import _CompiledGrammar
label_desc: Use image node_id 3 for calling the GrammarLexer obj's underlying member method code with example usage: obj.lex_document(document) and returns: get_line, lines, list