File: //lib/python3/dist-packages/__pycache__/pyparsing.cpython-310.pyc
o
    ���^�+ �                   @   s�
  d Z dZdZdZddlZddlmZ ddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlmZ ddlmZ ddlZdd	lmZ dd
lmZ zddlmZ W n eyi   ddlmZ Y nw zdd
lmZ W n ey�   dd
lmZ Y nw zddlm Z  ddlm!Z!m"Z" W n ey�   ddl
m Z  ddl
m!Z!m"Z" Y nw zddl
m#Z$ W n ey�   zddl%m#Z$ W n ey�   dZ$Y nw Y nw zddlm&Z& W n ey�   G dd� d�Z&Y nw e&� Z'de'_ de'_(e&� Z)de)_ de)_*de)_+de)_,de)_-de)_.dd� e/e)�D �e)_0dd� Z1e1e)_2g d�Z3e4e	j5�dd� Z6e6d dkZ7e7�rGe	j8Z9e:Z;e<Z=e:Z>e:Z?e@eAeBeCeDe4eEeFeGeHeIgZJn,e	jKZ9eLZMdd� Z?g ZJddlNZNd �O� D ]ZPzeJ�QeReNeP�� W �qZ eS�yr   Y �qZw eTd!d"� eMd#�D ��ZUd$d%� ZVejWejX ZYd&ZZeZd' Z[eYeZ Z\e<d(�Z]d)�^d*d"� ej_D ��Z`�dCd+d,�ZaG d-d.� d.eb�ZcG d/d0� d0ec�ZdG d1d2� d2ec�ZeG d3d4� d4ee�ZfG d5d6� d6eb�ZgG d7d8� d8eh�ZiG d9d:� d:eh�Zje!�kej� d;d<� Zld=d>� Zmd?d@� ZndAdB� ZodCdD� ZpdEdF� ZqdGdH� Zr	 �dDdJdK�ZsG dLdM� dMeh�ZtG dNdO� dOet�ZuG dPdQ� dQet�ZvG dRdS� dSev�ZwG dTdU� dUev�ZxG dVdW� dWev�ZyG dXdY� dYey�ZzeyZ{eyet_|G dZd[� d[ev�Z}G d\d]� d]ey�Z~G d^d_� d_e}�ZG d`da� daev�Z�G dbdc� dcev�Z�G ddde� dee��Z�G dfdg� dge��Z�G dhdi� diev�Z�G djdk� dkev�Z�G dldm� dmev�Z�G dndo� doev�Z�G dpdq� dqev�Z�G drds� dse��Z�G dtdu� due��Z�G dvdw� dwe��Z�G dxdy� dye��Z�G dzd{� d{e��Z�G d|d}� d}e��Z�G d~d� de��Z�G d�d�� d�et�Z�G d�d�� d�e��Z�G d�d�� d�e��Z�G d�d�� d�e��Z�G d�d�� d�e��Z�G d�d�� d�et�Z�G d�d�� d�e��Z�G d�d�� d�e��Z�G d�d�� d�e��Z�G d�d�� d�e��Z�G d�d�� d�e��Z�G d�d�� d�e��Z�G d�d�� d�eh�Z�G d�d�� d�e��Z�G d�d�� d�e��Z�G d�d�� d�e��Z�G d�d�� d�e��Z�G d�d�� d�e��Z�G d�d�� d�e��Z�G d�d�� d�e��Z�G d�d�� d�e��Z�G d�d�� d�eh�Z�d�d�� Z��dEd�d��Z��dFd�d��Z�d�d�� Z�d�d�� Z�d�d�� Z�d�d�� Z��dGd�d��Z�d�d�� Z��dHd�d��Z�d�d Z�d�dĄ Z�ew� ��dšZ�e�� ��dơZ�e�� ��dǡZ�e�� ��dȡZ�e�� ��dɡZ�e�e]d�dIdˍ��d�d̈́ �Z�e�d��d�d̈́ �Z�e�dЃ��d�d̈́ �Z�e�e�B e�B e�d�d#dˍB Z�e�e�e�dӃ e� �Z�eydԃe�dՃ��d֡ e�e�e�e�B ����dס d� Z�d�dڄ Z�d�d܄ Z�d�dބ Z�d�d� Z�d�d� Z�e�d�d̈́ �Z�	 e�d�d̈́ �Z�	 e�d�e�d�fd�d�Z�d�d� Z�d�d� Z�d�d� Z�eh� e�_ːdId�d�Z�e&� Z�eh� e�_�eh� e�_�e�d�e�d�fd�d�Z�e�Z�	 e�e�d��d� ���d��Z�e�e�d��d� ���d��Z�e�e�d��d� e�d��d� B ���d��Z�e�e{d��eԠ�  ���d��Z�d�d�deԠ� fd�d��ZdH�d �d�Z�e��d�Z�e��d�Z�e�e�eYe\�d ����d��\Z�Z�e�eݐd�O� �d��Z�e��d�d	�^eޠߡ � �d
 ����d�Z�d�d
� Z�e�e��d��d ����d�Z�	 e��d����d�Z�	 e��d��� ���d�Z�e��d����d�Z�	 e�e��d��d e�B ����d�Z�	 e�Z�	 e��d����d�Z�	 e�e�e�e`d��d�e�e��d�eyd��  e��   � ���� ���d�Z�e�e�eԠ� e�B d)�d�����d�Z�	 G �d�d � �d �Z�G �d!�d"� �d"eh�Z�G �d#�d$� �d$eh�Z�G �d%�d&� �d&e�Z�e�j�j�j�e�j�j�j� e�j�j�j� e�j�_�e7�r4e�e�d'e�j�� e�e�d(e�j�� e�e�d)e�j�� e�e�d*e�j�� e�e�d+e�j�� e�e�d,e�j� e�e�j�d-e�j�j� e�e�j�d.e�j�j�� e�e�j�d/e�j�j� e�e�d0e�j�� e�e�d1e�j�� e�e�d2e�j�� G �d3�d4� �d4�Z��e �d5k�r�e~�d6��Ze~�d7��Ze�eYe\�d8 ��Ze��e�d9d�d:���eš�Ze�e��e�����d;��Z�d<�eB �Ze��e�d9d�d:���eš�Ze�e��e�����d=��Z�e�d>��e�d;� �e �e�d=� �Z	�e	��
�d?� e�j��
�d@� e�j��
�d@� e�j
��
�dA� dd�l�Ze�j��eĐe�j�� e�j��
�dB� dS dS (J  a�
  
pyparsing module - Classes and methods to define and execute parsing grammars
=============================================================================
The pyparsing module is an alternative approach to creating and
executing simple grammars, vs. the traditional lex/yacc approach, or the
use of regular expressions.  With pyparsing, you don't need to learn
a new syntax for defining grammars or matching expressions - the parsing
module provides a library of classes that you use to construct the
grammar directly in Python.
Here is a program to parse "Hello, World!" (or any greeting of the form
``"<salutation>, <addressee>!"``), built up using :class:`Word`,
:class:`Literal`, and :class:`And` elements
(the :class:`'+'<ParserElement.__add__>` operators create :class:`And` expressions,
and the strings are auto-converted to :class:`Literal` expressions)::
    from pyparsing import Word, alphas
    # define grammar of a greeting
    greet = Word(alphas) + "," + Word(alphas) + "!"
    hello = "Hello, World!"
    print (hello, "->", greet.parseString(hello))
The program outputs the following::
    Hello, World! -> ['Hello', ',', 'World', '!']
The Python representation of the grammar is quite readable, owing to the
self-explanatory class names, and the use of '+', '|' and '^' operators.
The :class:`ParseResults` object returned from
:class:`ParserElement.parseString` can be
accessed as a nested list, a dictionary, or an object with named
attributes.
The pyparsing module handles some of the problems that are typically
vexing when writing text parsers:
  - extra or missing whitespace (the above program will also handle
    "Hello,World!", "Hello  ,  World  !", etc.)
  - quoted strings
  - embedded comments
Getting Started -
-----------------
Visit the classes :class:`ParserElement` and :class:`ParseResults` to
see the base classes that most other pyparsing
classes inherit from. Use the docstrings for examples of how to:
 - construct literal match expressions from :class:`Literal` and
   :class:`CaselessLiteral` classes
 - construct character word-group expressions using the :class:`Word`
   class
 - see how to create repetitive expressions using :class:`ZeroOrMore`
   and :class:`OneOrMore` classes
 - use :class:`'+'<And>`, :class:`'|'<MatchFirst>`, :class:`'^'<Or>`,
   and :class:`'&'<Each>` operators to combine simple expressions into
   more complex ones
 - associate names with your parsed results using
   :class:`ParserElement.setResultsName`
 - access the parsed data, which is returned as a :class:`ParseResults`
   object
 - find some helpful expression short-cuts like :class:`delimitedList`
   and :class:`oneOf`
 - find more useful common expressions in the :class:`pyparsing_common`
   namespace class
z2.4.7z30 Mar 2020 00:43 UTCz*Paul McGuire <ptmcg@users.sourceforge.net>�    N)�ref)�datetime)�
itemgetter)�wraps)�contextmanager)�filterfalse)�ifilterfalse)�RLock)�Iterable)�MutableMapping�Mapping)�OrderedDict)�SimpleNamespacec                   @   s   e Zd ZdS )r   N)�__name__�
__module__�__qualname__� r   r   �+/usr/lib/python3/dist-packages/pyparsing.pyr   �   �    r   aA  
    A cross-version compatibility configuration for pyparsing features that will be
    released in a future version. By setting values in this configuration to True,
    those features can be enabled in prior versions for compatibility development
    and testing.
     - collect_all_And_tokens - flag to enable fix for Issue #63 that fixes erroneous grouping
       of results names when an And expression is nested within an Or or MatchFirst; set to
       True to enable bugfix released in pyparsing 2.3.0, or False to preserve
       pre-2.3.0 handling of named results
Ta�  
Diagnostic configuration (all default to False)
     - warn_multiple_tokens_in_named_alternation - flag to enable warnings when a results
       name is defined on a MatchFirst or Or expression with one or more And subexpressions
       (only warns if __compat__.collect_all_And_tokens is False)
     - warn_ungrouped_named_tokens_in_collection - flag to enable warnings when a results
       name is defined on a containing expression with ungrouped subexpressions that also
       have results names
     - warn_name_set_on_empty_Forward - flag to enable warnings whan a Forward is defined
       with a results name, but has no contents defined
     - warn_on_multiple_string_args_to_oneof - flag to enable warnings whan oneOf is
       incorrectly called with multiple str arguments
     - enable_debug_on_named_expressions - flag to auto-enable debug on all subsequent
       calls to ParserElement.setName()
Fc                 C   s$   g | ]}|� d �s|� d�r|�qS )�enable_�warn_��
startswith)�.0�nmr   r   r   �
<listcomp>�   �   $ r   c                   C   s   dt _dt _dt _dt _d S �NT)�__diag__�)warn_multiple_tokens_in_named_alternation�)warn_ungrouped_named_tokens_in_collection�warn_name_set_on_empty_Forward�%warn_on_multiple_string_args_to_oneofr   r   r   r   �_enable_all_warnings�   s   
r#   )t�__version__�__versionTime__�
__author__�
__compat__r   �And�CaselessKeyword�CaselessLiteral�
CharsNotIn�Combine�Dict�Each�Empty�
FollowedBy�Forward�
GoToColumn�Group�Keyword�LineEnd�	LineStart�Literal�
PrecededBy�
MatchFirst�NoMatch�NotAny�	OneOrMore�OnlyOnce�Optional�Or�ParseBaseException�ParseElementEnhance�ParseException�ParseExpression�ParseFatalException�ParseResults�ParseSyntaxException�
ParserElement�QuotedString�RecursiveGrammarException�Regex�SkipTo�	StringEnd�StringStart�Suppress�Token�TokenConverter�White�Word�WordEnd�	WordStart�
ZeroOrMore�Char�	alphanums�alphas�
alphas8bit�anyCloseTag�
anyOpenTag�
cStyleComment�col�commaSeparatedList�commonHTMLEntity�countedArray�cppStyleComment�dblQuotedString�dblSlashComment�
delimitedList�dictOf�downcaseTokens�empty�hexnums�htmlComment�javaStyleComment�line�lineEnd�	lineStart�lineno�makeHTMLTags�makeXMLTags�matchOnlyAtCol�matchPreviousExpr�matchPreviousLiteral�
nestedExpr�nullDebugAction�nums�oneOf�opAssoc�operatorPrecedence�
printables�punc8bit�pythonStyleComment�quotedString�removeQuotes�replaceHTMLEntity�replaceWith�
restOfLine�sglQuotedString�srange�	stringEnd�stringStart�traceParseAction�
unicodeString�upcaseTokens�
withAttribute�
indentedBlock�originalTextFor�ungroup�
infixNotation�locatedExpr�	withClass�
CloseMatch�tokenMap�pyparsing_common�pyparsing_unicode�unicode_set�conditionAsParseAction�re�   c                 C   s`   t | t�r| S zt| �W S  ty/   t| ��t�� d�}td�}|�dd� � |�	|� Y S w )a  Drop-in replacement for str(obj) that tries to be Unicode
        friendly. It first tries str(obj). If that fails with
        a UnicodeEncodeError, then it tries unicode(obj). It then
        < returns the unicode object | encodes it with the default
        encoding | ... >.
        �xmlcharrefreplacez&#\d+;c                 S   s$   dt t| d dd� ��dd �  S )Nz\ur   �   ���)�hex�int��tr   r   r   �<lambda>�   r   z_ustr.<locals>.<lambda>)
�
isinstance�unicode�str�UnicodeEncodeError�encode�sys�getdefaultencodingrJ   �setParseAction�transformString)�obj�ret�
xmlcharrefr   r   r   �_ustr�   s   
�r�   z6sum len sorted reversed list tuple set any all min maxc                 c   s   � | ]}|V  qd S �Nr   )r   �yr   r   r   �	<genexpr>  s   � r�   �   c                 C   s:   d}dd� d� � D �}t||�D ]
\}}| �||�} q| S )z/Escape &, <, >, ", ', etc. in a string of data.z&><"'c                 s   s   � | ]	}d | d V  qdS )�&�;Nr   )r   �sr   r   r   r�     �   � z_xml_escape.<locals>.<genexpr>zamp gt lt quot apos)�split�zip�replace)�data�from_symbols�
to_symbols�from_�to_r   r   r   �_xml_escape  s
   r�   �
0123456789�ABCDEFabcdef�\   � c                 c   s   � | ]
}|t jvr|V  qd S r�   )�string�
whitespace�r   �cr   r   r   r�     �   � c                    s@   |d ur|nd�|rt nt� t���t��� ��fdd��}|S )Nzfailed user-defined conditionc                    s    t �| ||��s� | |���d S r�   )�bool�r�   �lr�   ��exc_type�fn�msgr   r   �pa%  s   �z"conditionAsParseAction.<locals>.pa)rD   rB   �_trim_arityr   )r�   �message�fatalr�   r   r�   r   r�      s   r�   c                   @   sP   e Zd ZdZddd�Zedd� �Zdd	� Zd
d� Zdd
� Z	ddd�Z
dd� ZdS )r@   z7base exception class for all parsing runtime exceptionsr   Nc                 C   s>