403Webshell
Server IP : 172.67.201.108  /  Your IP : 216.73.217.99
Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5
System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3.9/site-packages/elementpath/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.9/site-packages/elementpath/__pycache__/tdop.cpython-39.opt-1.pyc
a

���c�|�@sdZddlZddlZddlmZddlmZmZddl	m
Z
ddlmZddl
mZddlmZmZmZmZmZmZmZmZmZmZmZmZed	�Ze�d
�ZGdd�de �Z!e"e#d
�dd�Z$e"e"d�dd�Z%Gdd�d�Z&Gdd�de�Z'Gdd�de(�Z)Gdd�de)d�Z*dS)zT
This module contains base classes and helper functions for defining Pratt parsers.
�N)�name)�Decimal�DecimalException)�	takewhile)�ABCMeta)�MutableSequence)�Any�cast�ClassVar�Callable�Dict�List�Optional�Union�Tuple�Type�Pattern�Match)	�(start)�(end)�(string)�(float)�	(decimal)�	(integer)�(name)�	(invalid)�	(unknown)z\sc@seZdZdZdS)�
ParseErrorz.An error when parsing source with TDOP parser.N)�__name__�
__module__�__qualname__�__doc__�r"r"�4/usr/lib/python3.9/site-packages/elementpath/tdop.pyr4sr)�s�returncCstdd�ttj|�D��S)Ncss|]
}dVqdS)�Nr")�.0�_r"r"r#�	<genexpr>9�z'count_leading_spaces.<locals>.<genexpr>)�sumr�str�isspace�r$r"r"r#�count_leading_spaces8sr/)�symbolr%cs�dd��|��r|��S|tvr0|dd���Stdd�|D��rvd�dd�|D��}|���dd	��d
d	��dd	�S|�d
d�}|��r�|���dd	�Sd	��fdd�|D��}|�dd	��d
d	��dd	�S)
zP
    Converts a symbol string to an identifier (only alphanumeric and '_').
    cSs,|��s|dkr|Sdtt|����SdS)Nr(z%s_)�isalnum�unicode_namer,�title)�cr"r"r#�get_id_name@sz(symbol_to_classname.<locals>.get_id_namer&���css|]}|dvVqdS)z-_Nr"�r'r4r"r"r#r)Jr*z&symbol_to_classname.<locals>.<genexpr>� css|]}t|�VqdS�N)r2r7r"r"r#r)Kr*��-r(c3s|]}�|�VqdSr9r"r7�r5r"r#r)Rr*)r1r3�SPECIAL_SYMBOLS�all�join�replace�isidentifier)r0�valuer"r<r#�symbol_to_classname<s rCc@speZdZdZed�dd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
ed�dd�Zed�dd�Zed�dd�Z
dS)�
MultiLabelaV
    Helper class for defining multi-value label for tokens. Useful when a symbol has more roles.
    A label of this type has equivalence with each of its values.

    Example:
        label = MultiLabel('function', 'operator')
        label == 'symbol'    # False
        label == 'function'  # True
        label == 'operator'  # True
    ��valuescGs
||_dSr9rE)�selfrFr"r"r#�__init__aszMultiLabel.__init__cst�fdd�|jD��S)Nc3s|]}�|kVqdSr9r"�r'�v��otherr"r#r)er*z$MultiLabel.__eq__.<locals>.<genexpr>��anyrF�rGrLr"rKr#�__eq__dszMultiLabel.__eq__cst�fdd�|jD��S)Nc3s|]}�|kVqdSr9r"rIrKr"r#r)hr*z$MultiLabel.__ne__.<locals>.<genexpr>)r>rFrOr"rKr#�__ne__gszMultiLabel.__ne__cCsd|jj|jfS)Nz%s%s)�	__class__rrF�rGr"r"r#�__repr__jszMultiLabel.__repr__cCsd�|j��dd�S)N�__r8r()r?rFr@rSr"r"r#�__str__mszMultiLabel.__str__cCs
t|j�Sr9)�hashrFrSr"r"r#�__hash__pszMultiLabel.__hash__��itemcst�fdd�|jD��S)Nc3s|]}�|vVqdSr9r"rIrYr"r#r)tr*z*MultiLabel.__contains__.<locals>.<genexpr>rM)rGrZr"rYr#�__contains__sszMultiLabel.__contains__r.cst�fdd�|jD��S)Nc3s|]}|���VqdSr9)�
startswithrIr.r"r#r)wr*z(MultiLabel.startswith.<locals>.<genexpr>rM�rGr$r"r.r#r\vszMultiLabel.startswithcst�fdd�|jD��S)Nc3s|]}|���VqdSr9)�endswithrIr.r"r#r)zr*z&MultiLabel.endswith.<locals>.<genexpr>rMr]r"r.r#r^yszMultiLabel.endswithN)rrr r!r,rHrPrQrTrVrXr[r\r^r"r"r"r#rDVs
rDc@s�eZdZUdZdZeed<dZeed<dZe	ed<dZ
e	ed<dZee	ed	<d
Z
eeed<ded
<eed<e	ed<eeefed<dBdeedd�dd�Zdd�Zdd�Zdd�Zdd�Zdd�Ze	d�dd �Zd!d"�Zd#d$�Zeed�d%d&��Zee	d�d'd(��Zee	d�d)d*��Zeeeefd�d+d,��Zd-d.�Zd/d0�Z d1d2�Z!d3d4�Z"dd5�d6d7�Z#dd5�d8d9�Z$dCd:d;�Z%dDd=d>�Z&dEd@dA�Z'dS)F�Tokena
    Token base class for defining a parser based on Pratt's method.

    Each token instance is a list-like object. The number of token's items is
    the arity of the represented operator, where token's items are the operands.
    Nullary operators are used for symbols, names and literals. Tokens with items
    represent the other operators (unary, binary and so on).

    Each token class has a *symbol*, a lbp (left binding power) value and a rbp
    (right binding power) value, that are used in the sense described by the
    Pratt's method. This implementation of Pratt tokens includes two extra
    attributes, *pattern* and *label*, that can be used to simplify the parsing
    of symbols in a concrete parser.

    :param parser: The parser instance that creates the token instance.
    :param value: The token value. If not provided defaults to token symbol.

    :cvar symbol: the symbol of the token class.
    :cvar lbp: Pratt's left binding power, defaults to 0.
    :cvar rbp: Pratt's right binding power, defaults to 0.
    :cvar pattern: the regex pattern used for the token class. Defaults to the     escaped symbol. Can be customized to match more detailed conditions (eg. a     function with its left round bracket), in order to simplify the related code.
    :cvar label: defines the typology of the token class. Its value is used in     representations of the token instance and can be used to restrict code choices     without more complicated analysis. The label value can be set as needed by the     parser implementation (eg. 'function', 'axis', 'constructor function' are used by     the XPath parsers). In the base parser class defaults to 'symbol' with 'literal'     and 'operator' as possible alternatives. If set by a tuple of values the token     class label is transformed to a multi-value label, that means the token class can     covers multiple roles (eg. as XPath function or axis). In those cases the definitive     role is defined at parse time (nud and/or led methods) after the token instance creation.
    r�lbp�rbpr:r0�labelN�pattern)�_items�parserrB�_source�spanrd�ParserrerBrfrg)rerBr%cCsFg|_||_|dur|n|j|_|j|_|jdur6dn|j��|_dS)N)rr)rdrer0rB�sourcerf�
next_matchrg)rGrerBr"r"r#rH�s
zToken.__init__cCs
|j|Sr9�rd�rG�ir"r"r#�__getitem__�szToken.__getitem__cCs||j|<dSr9rk�rGrmrZr"r"r#�__setitem__�szToken.__setitem__cCs|j|=dSr9rkrlr"r"r#�__delitem__�szToken.__delitem__cCs
t|j�Sr9)�lenrdrSr"r"r#�__len__�sz
Token.__len__cCs|j�||�dSr9)rd�insertror"r"r#rt�szToken.insert�r%cCs6|jtvr"d|j|jdd�fSd|j|jfSdS)Nz%r %sr&r6)r0r=rBrbrSr"r"r#rV�s
z
Token.__str__cCs6|j|j}}||kr&d|jj|fSd|jjSdS)Nz%s(value=%r)z%s())r0rBrRr)rGr0rBr"r"r#rT�szToken.__repr__cCs4z|j|jko|j|jkWSty.YdS0dS)NF)r0rB�AttributeErrorrOr"r"r#rP�szToken.__eq__cCst|�Sr9�rrrSr"r"r#�arity�szToken.aritycCs�|jdkrd|jS|jtvr(d|jS|jdkrh|s:dSt|�dkrP|djSdd�d	d
�|D��S|svd|jSd|jd�dd
�|D��fSd
S)z%Returns a tree representation string.rz(%s)z(%r)�(z()r&rr8css|]}|jVqdSr9��tree�r'rZr"r"r#r)�r*zToken.tree.<locals>.<genexpr>z(%s %s)css|]}|jVqdSr9rzr|r"r"r#r)�r*N)r0rBr=rrr{r?rSr"r"r#r{�s






z
Token.treecCs�|j}|dkr|jS|dkr&t|j�S|tvr8t|j�St|�}|sH|S|dkr~d|jvrld|dj|fSd||djfS|dkr�d|dj||djfSd|d	�d
d�|D��fSdS)
z)Returns the source representation string.rrr&�postfixz%s %sr�z%s %s %sr8css|]}|jVqdSr9)rir|r"r"r#r)r*zToken.source.<locals>.<genexpr>N)	r0rBr,r=�reprrrrbrir?)rGr0Zlengthr"r"r#ri�s"


zToken.sourcecCsR|jd}|jd|��d�d}|dkr6d|dfS|||jd|��d�fS)zCA tuple with the position of the token in terms of line and column.rN�
r&)rgrf�count�rindex)rG�token_index�liner"r"r#�positions

zToken.positioncCs|���dS)zPratt's null denotation methodN��wrong_syntaxrSr"r"r#�nudsz	Token.nudcCs|���dS)zPratt's left denotation methodNr��rG�leftr"r"r#�ledsz	Token.ledcCs|jS)zEvaluation method�rBrSr"r"r#�evaluateszToken.evaluatecgs�|s|r|j|vr�|Vn�t|�dkrP|r4|j|vr:|V|dj|�EdHnL|dj|�EdH|rr|j|vrx|V|jdd�D]}|j|�EdHq�dS)z3Returns a generator for iterating the token's tree.r&rN)r0rr�iterrd)rG�symbols�tr"r"r#r�sz
Token.iter��messagecGs|r|j|vr|�|��dSr9�r0r��rGr�r�r"r"r#�expected(szToken.expectedcGs|r|j|vr|�|��dSr9r�r�r"r"r#�
unexpected,szToken.unexpectedcCs�|rt|�S|jtvr"td|�S|jdkr:td|j�S|jdkrRtd|j�S|jdkrjtd|j�S|jdkr�td	|j�S|jjjd
kr�td�Std�SdS)
Nz
unexpected %srzinvalid literal %rrzunknown symbol %rrzunexpected name %rrzunexpected literal %rrzsource is emptyzunexpected end of source)rr0r=rBre�token�rGr�r"r"r#r�0s




zToken.wrong_syntax�invalid typecCst|�Sr9)�	TypeErrorr�r"r"r#�
wrong_typeBszToken.wrong_type�
invalid valuecCst|�Sr9)�
ValueErrorr�r"r"r#�wrong_valueEszToken.wrong_value)N)N)r�)r�)(rrr r!r`�int�__annotations__rar0r,rbrcr�	__slots__r
rrrHrnrprqrsrtrVrTrP�propertyrxr{rir�r�r�r�r�r�r�r�r�r�r"r"r"r#r_}sL
!

r_cseZdZ�fdd�Z�ZS)�
ParserMetacstt|��||||�}tj|jj��D]&\}}t|t�r(|j|jkr(t	d��q(t
|d�s`t|_t
|d�svt
�d�|_t
|d�s�t
�d�|_d|vr�d|_d|vr�t�|_|D] }t
|d�r�|j�|j�q�q�d	|v�ri|_|D]"}t
|d	�r�|j�|j��qq�|S)
Nz<Multiple parser class definitions per module are not allowed�token_base_class�literals_patternz8'[^']*'|"[^"]*"|(?:\d+|\.\d+)(?:\.\d*)?(?:[Ee][+-]?\d+)?�name_patternz
[A-Za-z0-9_]+�	tokenizer�SYMBOLS�symbol_table)�superr��__new__�sys�modulesr�__dict__�items�
isinstance�RuntimeError�hasattrr_r��re�compiler�r�r��setr��updater�)Zmcsr�bases�	namespace�cls�krJZ
base_class�rRr"r#r�Ks6


�



zParserMeta.__new__)rrr r��
__classcell__r"r"r�r#r�Isr�c@seZdZUdZeZeZdZe	e
ed<iZe
eeeefed<eed<eed<eed<e	eed<e
ed	<e
ed
<dZdd
�Zdd�Zeed�dd�Zeed�dd�Zeed�dd�ZdFeed�dd�Zedd��Zdd �Zd!d"�ZdGd$d%�Zed&d'��Z e!eed(�d)d*��Z"e!ed+�d,d-��Z#e!eeeed.�d/d0��Z$e!dHeed1�d2d3��Z%e!dIeed1�d4d5��Z&e!dJeed1�d6d7��Z'e!dKeed1�d8d9��Z(e!dLeed1�d:d;��Z)e!dMeed1�d<d=��Z*e!dNe+eeefee,d>�d?d@��Z-e!dAdB��Z.e.Z/e!eeeefe
dC�dDdE��Z0dS)Orha�
    Parser class for implementing a Top Down Operator Precedence parser.

    :cvar SYMBOLS: the symbols of the definable tokens for the parser. In the base class it's an     immutable set that contains the symbols for special tokens (literals, names and end-token).    Has to be extended in a concrete parser adding all the symbols of the language.
    :cvar symbol_table: a dictionary that stores the token classes defined for the language.
    :type symbol_table: dict
    :cvar token_base_class: the base class for creating language's token classes.
    :type token_base_class: Token
    :cvar tokenizer: the language tokenizer compiled regexp.
    Nr�r��_start_tokenr��
next_tokenrjr�r�)ri�tokensrjr�r�r�cCsJ|jdur|��d|_td�|_d|_|jd|�|_|j|_|_	dS)Nr:r"r)
r��buildrir�r�rjr�r�r�r�rSr"r"r#rH�s

zParser.__init__cCs$|j|juo"|j|jko"|j|jkSr9)r�r�r�rOr"r"r#rP�s

�
�z
Parser.__eq__)rir%c
Cs�z�zt|j�|��|_WnHty`}z0|jd|t|��}|�d�|���WYd}~n
d}~00||_	|�
�|��}|j�
d�|Wtd�|_d|_|j|_|_Std�|_d|_|j|_|_0dS)z�
        Parses a source code of the formal language. This is the main method that has to be
        called for a parser's instance.

        :param source: The source string.
        :return: The root of the token's tree that parse the source.
        rzinvalid source type, {}Nrr")r�r��finditerr�r�r��typer��formatri�advance�
expressionr�r�rjr�r�)rGri�errr�Z
root_tokenr"r"r#�parse�s*&
��
zParser.parse)r�r%c	
Gs�|jjdks|r&|jj|vr&|j���|j|_zttt|j��|_Wn(t	yl|j
d|�|_Y�q�Yq.0|j��\}}}}|dur�z|j
||�|_WnPty�|j
�|�dur�|j
d||�|_|j���|j
d||�|_Yn0�q�q.|du�r>|ddv�r,|�|�}|j
d||�|_�q�d|v�s@d	|v�r�zt|�}WnJt�y�}z0|j
d
||�|_|jjt|�d��WYd}~nd}~00|j
d||�|_n�d
|v�r"zt|�}WnJt�y}z0|j
d
||�|_|jjt|�d��WYd}~nd}~00|j
d||�|_n|j
d|t|��|_�q�q.|du�r`|j
d||�|_�q�q.|du�r�|j
d||�|_|j���q.t|j�����r.d}t||j����q.|jS)a*
        The Pratt's function for advancing to next token.

        :param symbols: Optional arguments tuple. If not empty one of the provided         symbols is expected. If the next token's symbol differs the parser raises a         parse error.
        :return: The next token instance.
        rNrrrz'"r�e�Err�r�.rrz.unexpected matching %r: incompatible tokenizer)r�r0r�r�r	r�nextr�rj�
StopIterationr��groups�KeyErrorr��match�unescape�floatr�r,rrr��group�stripr�)	rGr��literalr0r�unknownrBr��msgr"r"r#r��sh	�
�



(
(

zParser.advance)�stop_symbolsr%cGs|s|j�d��n|jjdkr(|j���|j|_g}zttt|j��|_	Wn&t
yp|jd|�|_Yq�Yq40|j	�d�}|dur�|�
�}||vr�|�|�q�z|j||�|_Wq�Wq�ty�|jd|�|_|j���Yq�0q4|�|j	���q4d�|�S)a�
        Advances until one of the symbols is found or the end of source is reached,
        returning the raw source string placed before. Useful for raw parsing of
        comments and references enclosed between specific symbols.

        :param stop_symbols: The symbols that have to be found for stopping advance.
        :return: The source string chunk enclosed between the initial position         and the first stop symbol.
        z at least a stop symbol required!rr~Nrr:)r�r�r0r�r�r	rr�r�rjr�r�r�r��appendr�r?)rGr�Zsource_chunkr0r"r"r#�
advance_until�s0


zParser.advance_untilr)rar%cCs@|j}|��|��}||jjkr<|j}|��|�|�}q|S)aP
        Pratt's function for parsing an expression. It calls token.nud() and then advances
        until the right binding power is less the left binding power of the next
        token, invoking the led() method on the following token.

        :param rbp: right binding power for the expression.
        :return: left token.
        )r�r�r�r`r�)rGrar�r�r"r"r#r�s	zParser.expressioncCs|jjS)z:Property that returns the current line and column indexes.)r�r�rSr"r"r#r�*szParser.positioncCs t|jd|jjd����S)zu
        Returns `True` if the parser is positioned at the start
        of the source, ignoring the spaces.
        r)�boolrir�rgr�rSr"r"r#�is_source_start/szParser.is_source_startcCsp|jjd}z|jd|��d�d}Wn*tyRt|jd|����YS0t|j||����SdS)zx
        Returns `True` if the parser is positioned at the start
        of a source line, ignoring the spaces.
        rNr�r&)r�rgrir�r�r�r�)rGr�Z
line_startr"r"r#�
is_line_start6szParser.is_line_startTcCs^|jj\}}z8|r2|dkr2|j|ddvr2WdS|oB|j|dvWStyXYdS0dS)ay
        Returns `True` if the source has an extra space (whitespace, tab or newline)
        immediately before or after the current position of the parser.

        :param before: if `True` considers also the extra spaces before         the current token symbol.
        :param after: if `True` considers also the extra spaces after         the current token symbol.
        rr&z 	
TFN)r�rgri�
IndexError)rGZbeforeZafter�start�endr"r"r#�	is_spacedCs
zParser.is_spacedcCs|dd��dd��dd�S)Nr&r6z\'�'z\"�")r@)Zstring_literalr"r"r#r�UszParser.unescaperuc	
Ks�zFzd|vrtd|��Wnty8|j|}}Yn0|j|}Wn�t�y,||jvrx|dkrxtd||f��||d<|�dd�}t|t	�r�t
|�}|d<d�t|�t
|����dd��}|�d	|jf�}|�|j|d
d��tttt|||��}||j|<t�|�ttj|j||�Ynh0|��D]\\}}|dk�r\||jk�r\||_n4|d
k�rz||jk�rz||_nt|��r6t|||��q6|S)a
        Register/update a token class in the symbol table.

        :param symbol: The identifier symbol for a new class or an existent token class.
        :param kwargs: Optional attributes/methods for the token class.
        :return: A token class.
        r8z&%r: a symbol can't contain whitespacesrz$%r is not a symbol of the parser %r.r0rbz_{}{}r:r�N)rr Z
__return__r`ra) r�r�r0r�r�r��	NameError�getr��tuplerDr�rCr,r3r@r�r�rr	rr_rr�register�setattrr�r�r�r`ra�callable)	r�r0�kwargs�token_classrbZtoken_class_nameZtoken_class_bases�keyrBr"r"r#r�YsJ	

��


zParser.register)r0cCs|j|��=dS)z/Unregister a token class from the symbol table.N)r�r�)r�r0r"r"r#�
unregister�szParser.unregister)r0�
new_symbolr%cKs\|j|}|j|fi|��}|j��D]0\}}||vs&|dvs&|�d�rJq&t|||�q&|S)z*Duplicate a token class with a new symbol.)r0rcr()r�r�r�r�r\r�)r�r0r�r�r�Znew_token_classr�rBr"r"r#�	duplicate�s
zParser.duplicate)r0�bpcCs$dd�}dd�}|j|d|||d�S)z:Register a token for a symbol that represents a *literal*.cSs|Sr9r"rSr"r"r#r��szParser.literal.<locals>.nudc_s|jSr9r�)rGZ_argsZ_kwargsr"r"r#r��sz Parser.literal.<locals>.evaluater�)rbr`r�r��r�)r�r0r�r�r�r"r"r#r��szParser.literalcCsdd�}|j|d||d�S)zCRegister a token for a symbol that represents a *nullary* operator.cSs|Sr9r"rSr"r"r#r��szParser.nullary.<locals>.nud�operator)rbr`r�r��r�r0r�r�r"r"r#�nullary�szParser.nullarycs �fdd�}|j|d��|d�S)zHRegister a token for a symbol that represents a *prefix* unary operator.cs|jj�d�f|dd�<|S�N�ra�rer�rS�r�r"r#r��szParser.prefix.<locals>.nudzprefix operator)rbr`rar�r�r�r"r�r#�prefix�sz
Parser.prefixcCsdd�}|j|d|||d�S)zIRegister a token for a symbol that represents a *postfix* unary operator.cSs|f|dd�<|Sr9r"r�r"r"r#r��szParser.postfix.<locals>.ledzpostfix operator�rbr`rar�r��r�r0r�r�r"r"r#r}�szParser.postfixcs �fdd�}|j|d��|d�S)zIRegister a token for a symbol that represents an *infix* binary operator.cs||jj�d�f|dd�<|Sr�r�r�r�r"r#r��szParser.infix.<locals>.ledr�r�r�r�r"r�r#�infix�szParser.infixcs$�fdd�}|j|d��d|d�S)zJRegister a token for a symbol that represents an *infixr* binary operator.cs"||jj�dd�f|dd�<|S)Nr&r�r�r�r�r"r#r��szParser.infixr.<locals>.ledr�r&r�r�r�r"r�r#�infixr�sz
Parser.infixr)r0r�r%cs"|j|d||d���fdd�}|S)z�
        Register a token for a symbol that represents a custom operator or redefine
        a method for an existing token.
        r�)rbr`racsB|j�d�d}tt�|��s2td|�d�����t�||�|S)Nr(rzThe attribute z is not a callable of )r�	partitionr��getattrr�r�)�funcZmethod_name�r�r"r#�bind�s
zParser.method.<locals>.bindr�)r�r0r�rr"rr#�method�sz
Parser.methodcs\d�jvr��d��j��j���sJ�fdd��jD�}td�|f�����j��_dS)z�
        Builds the parser class. Checks if all declared symbols are defined
        and builds a the regex tokenizer using the symbol related patterns.
        rcsg|]}|�jvr|�qSr")r�)r'r$�r�r"r#�
<listcomp>�r*z Parser.build.<locals>.<listcomp>z*The parser %r has unregistered symbols: %rN)r�r�r��issubset�keysr��create_tokenizerr�)r�Zunregisteredr"rr#r��s

zParser.build)r�r%c

Cs8g}g}g}t�}|��D]|\}}|tvr.qq|jdurF|�|j�q|j�|�durh|�t�	|��qt
|�dkr�|�t�	|��q|�t�	|��qg}|r�|�d�t|dd�d���|r�|�d�
d�|���|r�|�d	�
d�t|d
d�d����|�r|�d�|��d�
|jjd�|�|jj�}	t�|	�S)a�
        Returns a regex based tokenizer built from a symbol table of token classes.
        The returned tokenizer skips extra spaces between symbols.

        A regular expression is created from the symbol table of the parser using a template.
        The symbols are inserted in the template putting the longer symbols first. Symbols and
        their patterns can't contain spaces.

        :param symbol_table: a dictionary containing the token classes of the formal language.
        Nr&�|cSs
t|�Sr9rw��xr"r"r#�<lambda>r*z)Parser.create_tokenizer.<locals>.<lambda>)r�z[{}]r:z\b(?:{})\b(?![\-\.])cSs
t|�Sr9rwr	r"r"r#rr*z({})|({})|({})|(\S)|\s+)r�r�r=rc�addr�r�r�r��escaperrr?�sortedr�r�r�)
r�r�Zcharacter_patternsZstring_patternsZ
name_patternsZcustom_patternsr0r�Zsymbols_patternsZtokenizer_patternr"r"r#r�s>
��zParser.create_tokenizer)r)TT)r)r)r)r)r)r)r)1rrr r!r=r�r_r�r�rrr�r�r
rr,rrr�rHrPr�r�r�r�r�r�r�r�r�r��staticmethodr��classmethodr�r�r�r�r�r�r}r�r�rrrr�Zbuild_tokenizerrr"r"r"r#rhmsd
	A(


:

"
rh)�	metaclass)+r!r�r��unicodedatarr2Zdecimalrr�	itertoolsr�abcr�collections.abcr�typingrr	r
rrr
rrrrrr�	frozensetr=r�Z
SPACE_PATTERN�SyntaxErrorrr,r�r/rCrDr_r�r�rhr"r"r"r#�<module>
s$8
'M$

Youez - 2016 - github.com/yon3zu
LinuXploit