�
|�e � �: � d Z ddlZ G d� de� Z G d� d� Zy)a
pygments.scanner
~~~~~~~~~~~~~~~~
This library implements a regex based scanner. Some languages
like Pascal are easy to parse but have some keywords that
depend on the context. Because of this it's impossible to lex
that just by using a regular expression lexer like the
`RegexLexer`.
Have a look at the `DelphiLexer` to get an idea of how to use
this scanner.
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
� Nc � � e Zd ZdZy)� EndOfTextzZ
Raise if end of text is reached and the user
tried to call a match function.
N)�__name__�
__module__�__qualname__�__doc__� � �2/usr/lib/python3/dist-packages/pygments/scanner.pyr r s � �r
r c �b � e Zd ZdZd
d�Zd� Z eeej � Zd� Zd� Zd� Z d� Z
d� Zy )�Scannerzp
Simple scanner
All method patterns are regular expression strings (not
compiled expressions!)
c � � || _ t |� | _ d| _ d| _ || _ d| _ d| _ i | _ y)z{
:param text: The text which should be scanned
:param flags: default regular expression flags
r N) �data�len�data_length� start_pos�pos�flags�last�match� _re_cache)�self�textr s r �__init__zScanner.__init__# sA � �
�� ��t�9�����������
��� ���
���r
c �4 � | j | j k\ S )z.`True` if the scanner reached the end of text.)r r �r s r �eoszScanner.eos1 s � ��x�x�4�+�+�+�+r
c �
� | j r
t � �|| j vr-t j || j
� | j |< |