← Back
Editing: pygments.cpython-311.pyc
� �Ïc�. � �t � d Z ddlZddlmZmZ ddlmZmZmZm Z m Z mZmZm Z ddlmZ ddlmZmZ ddlmZ ddlmZ dd lmZ d dlmZmZ erddlmZ g d �Z G d� de�� � Z G d� de� � Z G d� de� � Z! G d� deee"df e"f � � Z# e#� � Z$ G d� de� � Z%dS )z� Adaptor classes for using Pygments lexers within prompt_toolkit. This includes syntax synchronization code, so that we don't have to start lexing at the beginning of a document, when displaying a very large text. � N)�ABCMeta�abstractmethod)� TYPE_CHECKING�Callable�Dict� Generator�Iterable�Optional�Tuple�Type)�Document)�FilterOrBool� to_filter)�StyleAndTextTuples)�split_lines��pygments_token_to_classname� )�Lexer�SimpleLexer)r )� PygmentsLexer� SyntaxSync� SyncFromStart� RegexSyncc �F � e Zd ZdZedededeeef fd�� � ZdS )r a Syntax synchroniser. This is a tool that finds a start position for the lexer. This is especially important when editing big documents; we don't want to start the highlighting by running the lexer from the beginning of the file. That is very slow when editing. �document�lineno�returnc � � dS )a/ Return the position from where we can start lexing as a (row, column) tuple. :param document: `Document` instance that contains all the lines. :param lineno: The line that we want to highlight. (We need to return this line, or an earlier position.) N� ��selfr r s �@/usr/lib/python3/dist-packages/prompt_toolkit/lexers/pygments.py�get_sync_start_positionz"SyntaxSync.get_sync_start_position/ s � � � � N) �__name__� __module__�__qualname__�__doc__r r �intr r$ r r% r# r r '