3
V'íc ã @ s. d Z ddlZG dd deZG dd dZdS )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-2022 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
é Nc @ s e Zd ZdZdS )Ú EndOfTextzZ
Raise if end of text is reached and the user
tried to call a match function.
N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r r ú4/tmp/pip-build-gk9425m9/Pygments/pygments/scanner.pyr s r c @ sV e Zd ZdZdddZdd ZeeejZdd Zd d
Zdd Z d
d Z
dd ZdS )ÚScannerzp
Simple scanner
All method patterns are regular expression strings (not
compiled expressions!)
r c C s8 || _ t|| _d| _d| _|| _d| _d| _i | _dS )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 r r r Ú__init__# s
zScanner.__init__c C s | j | jkS )z.`True` if the scanner reached the end of text.)r r )r r r r Úeos1 s zScanner.eosc C s@ | j rt || jkr*tj|| j| j|<