AlkantarClanX12

Your IP : 3.12.152.102


Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/pyparsing/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/pyparsing/__pycache__/helpers.cpython-311.pyc

�

�܋f٘����UddlZddlZddlZddlmZddlTddlmZm	Z	m
Z
				dXdd�d	eee
fd
eee
fdedejed
ejedede
fd�Z	dYdd�d	e
deje
deje
de
fd�Zd	e
de
fd�Zd	e
de
fd�Z			dZddd�deejeefdededededede
fd�Zd e
d!e
de
fd"�Z	d[dd#�d	e
d$ed%ede
fd&�Zd	e
de
fd'�Zd	e
de
fd(�Zd)d*de��fe��d+�d,eee
fd-eee
fd.eje
d/e
d0e
de
fd1�Zed2��ed3��fd4�Zd5eee
fdee
e
ffd6�Z d5eee
fdee
e
ffd7�Z!e
e"d8<e
e"d9<e e#e$e%d:z���&d;����\Z'Z(d<�ej)j*�+��D��Z,e-d=d>�.e,��zd?z���&d@��Z/dA�Z0GdB�dCe1��Z2ee
eeee
efee
efffZ3eee3ee2eje4fee3ee2ffZ5ed)��ed*��fdDe
dEe6e5dFeee
fdGeee
fde
f
dH�Z7dgfdI�Z8e9e-dJ��dKz���&dL��Z:	e-dM���&dN��Z;	e-dO���<���&dP��Z=e-dQ���&dR��Z>	e9e-dJ��dKze>z���&dS��Z?	e?Z@	e-dT���&dU��ZA	dV�eB���C��D��ZDe6e
e"dW<eZEeZFeZGeZHeZIeZJeZKeZLe ZMe!ZNe'e(cZOZPe/ZQe0ZRe2ZSe7ZTe:ZUe;ZVe=ZWe>ZXe?ZYe@ZZeAZ[dS)\�N�)�__diag__)�*)�_bslash�_flatten�_escape_regex_range_chars�,F)�allow_trailing_delim�expr�delim�combine�min�maxr
�returnc	��t|t��rt�|��}d�t|��������t|��|r"d�t|����nd���}|st|��}|�|dkrtd���|dz}|�|�||krtd���|dz}|||z||fz}|r|t|��z
}|r"t|���|��S|�|��S)	a/Helper to define a delimited list of expressions - the delimiter
    defaults to ','. By default, the list elements and delimiters can
    have intervening whitespace, and comments, but this can be
    overridden by passing ``combine=True`` in the constructor. If
    ``combine`` is set to ``True``, the matching tokens are
    returned as a single token string, with the delimiters included;
    otherwise, the matching tokens are returned as a list of tokens,
    with the delimiters suppressed.

    If ``allow_trailing_delim`` is set to True, then the list may end with
    a delimiter.

    Example::

        delimited_list(Word(alphas)).parse_string("aa,bb,cc") # -> ['aa', 'bb', 'cc']
        delimited_list(Word(hexnums), delim=':', combine=True).parse_string("AA:BB:CC:DD:EE") # -> ['AA:BB:CC:DD:EE']
    z{expr} [{delim} {expr}]...{end}z [{}]�)rr�endNrzmin must be greater than 0z)max must be greater than, or equal to min)
�
isinstance�str_type�
ParserElement�_literalStringClass�format�str�copy�
streamline�Suppress�
ValueError�Opt�Combine�set_name)rrr
rrr
�dlName�delimited_list_exprs        �b/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pyparsing/helpers.py�delimited_listr$sY��4�$��!�!�7��0�0��6�6��
.�
5�
5�
������'�'�)�)�
*�
*��%�j�j�*>�F�G�N�N�3�u�:�:�&�&�&�B�6���F�� ������
����7�7��9�:�:�:��q���
���?�s�c�z�z��H�I�I�I��q����%�$�,��S��!9�9���*��s�5�z�z�)���4��*�+�+�4�4�V�<�<�<�"�+�+�F�3�3�3�)�intExpr�int_exprr&c�b���|p|}t�����fd�}|�)tt���d���}n|���}|�d��|�|d���|�z�dt���zdz��S)	a~Helper to define a counted list of expressions.

    This helper defines a pattern of the form::

        integer expr expr expr...

    where the leading integer tells how many expr expressions follow.
    The matched tokens returns the array of expr tokens as a list - the
    leading count token is suppressed.

    If ``int_expr`` is specified, it should be a pyparsing expression
    that produces an integer value.

    Example::

        counted_array(Word(alphas)).parse_string('2 ab cd ef')  # -> ['ab', 'cd']

        # in this parser, the leading integer value is given in binary,
        # '10' indicating that 2 values are in the array
        binary_constant = Word('01').set_parse_action(lambda t: int(t[0], 2))
        counted_array(Word(alphas), int_expr=binary_constant).parse_string('10 ab cd ef')  # -> ['ab', 'cd']

        # if other fields must be parsed after the count but before the
        # list items, give the fields results names and they will
        # be preserved in the returned ParseResults:
        count_with_metadata = integer + Word(alphas)("type")
        typed_array = counted_array(Word(alphanums), int_expr=count_with_metadata)("items")
        result = typed_array.parse_string("3 bool True True False")
        print(result.dump())

        # prints
        # ['True', 'True', 'False']
        # - items: ['True', 'True', 'False']
        # - type: 'bool'
    c�R��|d}�|r�|zn
t��z�|dd�=dS�Nr)�Empty)�s�l�t�n�
array_exprrs    ��r#�count_field_parse_actionz/counted_array.<locals>.count_field_parse_actionss6���
�a�D���Q�3��q���E�G�G�3�
�
�a�a�a�D�D�Dr%Nc�,�t|d��Sr*)�int�r.s r#�<lambda>zcounted_array.<locals>.<lambda>{s���A�a�D�	�	�r%�arrayLenT)�call_during_tryz(len) z...)�Forward�Word�nums�set_parse_actionrr �add_parse_actionr)rr'r&r1r0s`   @r#�
counted_arrayr=Gs�����R�!��G����J����������t�*�*�-�-�.A�.A�B�B����,�,�.�.�����Z� � � ����5�t��L�L�L��j� �*�*�8�c�$�i�i�+?�%�+G�H�H�Hr%c���t����fd�}|�|d�����dt|��z���S)a9Helper to define an expression that is indirectly defined from
    the tokens matched in a previous expression, that is, it looks for
    a 'repeat' of a previous expression.  For example::

        first = Word(nums)
        second = match_previous_literal(first)
        match_expr = first + ":" + second

    will match ``"1:1"``, but not ``"1:2"``.  Because this
    matches a previous literal, will also match the leading
    ``"1:1"`` in ``"1:10"``. If this is not desired, use
    :class:`match_previous_expr`. Do *not* use with packrat parsing
    enabled.
    c����|r_t|��dkr
�|dzdSt|�����}�td�|D����zdS�t	��zdS)Nrrc3�4K�|]}t|��V��dS�N)�Literal)�.0�tts  r#�	<genexpr>zImatch_previous_literal.<locals>.copy_token_to_repeater.<locals>.<genexpr>�s(����7�7�2�7�2�;�;�7�7�7�7�7�7r%)�lenr�as_list�Andr+)r,r-r.�tflat�reps    �r#�copy_token_to_repeaterz6match_previous_literal.<locals>.copy_token_to_repeater�s{����	��1�v�v��{�{��q��t�����!������-�-���s�7�7��7�7�7�7�7�7�7�7�7��5�7�7�N�N�N�Nr%T��
callDuringTry�(prev) )r8r<r r)rrKrJs  @r#�match_previous_literalrO�se����)�)�C�	�	�	�	�	�	���0���E�E�E��L�L��S��Y�Y�&�'�'�'��Jr%c����t���|���}�|z��fd�}|�|d�����dt	|��z���S)aWHelper to define an expression that is indirectly defined from
    the tokens matched in a previous expression, that is, it looks for
    a 'repeat' of a previous expression.  For example::

        first = Word(nums)
        second = match_previous_expr(first)
        match_expr = first + ":" + second

    will match ``"1:1"``, but not ``"1:2"``.  Because this
    matches by expressions, will *not* match the leading ``"1:1"``
    in ``"1:10"``; the expressions are evaluated first, and then
    compared, so ``"1"`` is compared with ``"10"``. Do *not* use
    with packrat parsing enabled.
    c����t|�������fd�}��|d���dS)Nc���t|�����}|�kr%t||d��|�����dS)NzExpected {}, found{})rrG�ParseExceptionr)r,r-r.�theseTokens�matchTokenss    �r#�must_match_these_tokenszTmatch_previous_expr.<locals>.copy_token_to_repeater.<locals>.must_match_these_tokens�sU���"�1�9�9�;�;�/�/�K��k�)�)�$��q�0�7�7��[�Q�Q����*�)r%TrL)rrGr;)r,r-r.rVrUrJs    @�r#rKz3match_previous_expr.<locals>.copy_token_to_repeater�sT�����q�y�y�{�{�+�+��	�	�	�	�	�	���4�D��I�I�I�I�Ir%TrLrN)r8rr<r r)r�e2rKrJs   @r#�match_previous_exprrX�s�����)�)�C�	
�����B��B�J�C�
J�
J�
J�
J�
J�	���0���E�E�E��L�L��S��Y�Y�&�'�'�'��Jr%T)�useRegex�	asKeyword�strs�caseless�	use_regex�
as_keywordrYrZc����|p|}|o|}t|t��r(tjrt�dd���|rd�}d�}|rtnt�nd�}d�}|rtnt�g}t|t��r|�
��}n4t|t��rt|��}ntd���|st��Std	�|D����r�d
}	|	t!|��dz
kr�||	}
t#||	dzd���D]I\}}|||
��r||	|zdz=n3||
|��r!||	|zdz=|�|	|��n�J|	dz
}	|	t!|��dz
k��|�r#|rt&jnd
}
	t+d
�|D����r3d�d�d�|D������}nd�d�|D����}|rd�|��}t1||
����d�|����}|r$d�|D���|��fd���|S#t&j$rt�dd���YnwxYwt9�fd�|D�����d�|����S)a Helper to quickly define a set of alternative :class:`Literal` s,
    and makes sure to do longest-first testing when there is a conflict,
    regardless of the input order, but returns
    a :class:`MatchFirst` for best performance.

    Parameters:

    - ``strs`` - a string of space-delimited literals, or a collection of
      string literals
    - ``caseless`` - treat all literals as caseless - (default= ``False``)
    - ``use_regex`` - as an optimization, will
      generate a :class:`Regex` object; otherwise, will generate
      a :class:`MatchFirst` object (if ``caseless=True`` or ``asKeyword=True``, or if
      creating a :class:`Regex` raises an exception) - (default= ``True``)
    - ``as_keyword`` - enforce :class:`Keyword`-style matching on the
      generated expressions - (default= ``False``)
    - ``asKeyword`` and ``useRegex`` are retained for pre-PEP8 compatibility,
      but will be removed in a future release

    Example::

        comp_oper = one_of("< = > <= >= !=")
        var = Word(alphas)
        number = Word(nums)
        term = var | number
        comparison_expr = term + comp_oper + term
        print(comparison_expr.search_string("B = 12  AA=23 B<=AA AA>12"))

    prints::

        [['B', '=', '12'], ['AA', '=', '23'], ['B', '<=', 'AA'], ['AA', '>', '12']]
    z`More than one string argument passed to one_of, pass choices as a list or space-delimited string�)�
stacklevelc�V�|���|���kSrA)�upper��a�bs  r#r5zone_of.<locals>.<lambda>�s��q�w�w�y�y�A�G�G�I�I�5�r%c�t�|����|�����SrA)rc�
startswithrds  r#r5zone_of.<locals>.<lambda>s$��Q�W�W�Y�Y�1�1�!�'�'�)�)�<�<�r%c��||kSrA�rds  r#r5zone_of.<locals>.<lambda>s
��q�A�v�r%c�,�|�|��SrA)rhrds  r#r5zone_of.<locals>.<lambda>s��Q�\�\�!�_�_�r%z7Invalid argument to one_of, expected string or iterablec3�<K�|]}t|��dkV��dS�rN�rF�rC�syms  r#rEzone_of.<locals>.<genexpr>s,����
+�
+�C�3�s�8�8�a�<�
+�
+�
+�
+�
+�
+r%rrNc3�<K�|]}t|��dkV��dSrmrnros  r#rEzone_of.<locals>.<genexpr>&s,����4�4�S�3�s�8�8�q�=�4�4�4�4�4�4r%z[{}]rc3�4K�|]}t|��V��dSrA)rros  r#rEzone_of.<locals>.<genexpr>)s+����N�N�s�5�c�:�:�N�N�N�N�N�Nr%�|c3�>K�|]}tj|��V��dSrA)�re�escaperos  r#rEzone_of.<locals>.<genexpr>,s*����B�B�3��	�#���B�B�B�B�B�Br%z
\b(?:{})\b)�flagsz | c�8�i|]}|���|��Srj��lowerros  r#�
<dictcomp>zone_of.<locals>.<dictcomp>7s"��B�B�B�3�c�i�i�k�k�3�B�B�Br%c�D���|d���Sr*ry)r,r-r.�
symbol_maps   �r#r5zone_of.<locals>.<lambda>8s���Z��!��
�
���5M�r%z8Exception creating Regex for one_of, building MatchFirstc3�.�K�|]}�|��V��dSrArj)rCrp�parseElementClasss  �r#rEzone_of.<locals>.<genexpr>Bs/�����@�@��'�'��,�,�@�@�@�@�@�@r%)rrr�%warn_on_multiple_string_args_to_oneof�warnings�warn�CaselessKeyword�CaselessLiteral�KeywordrB�split�Iterable�list�	TypeError�NoMatch�anyrF�	enumerate�insertru�
IGNORECASE�allr�join�Regexr r<�error�
MatchFirst)r[r\r]r^rYrZ�isequal�masks�symbols�i�cur�j�other�re_flags�patt�retrr}s                @@r#�one_ofr��s�����R�'�Z�I��%�I�H�	�8�X�&�&�
��:�
�	�
�
�
;��	�	
�	
�	
��>�5�5��<�<��/8�M�O�O�o���%�%��,�,��'0�=�G�G�g���G��$��!�!�S��*�*�,�,���	�D�(�	#�	#�S��t�*�*����Q�R�R�R����y�y���
+�
+�7�
+�
+�
+�+�+�
�
���#�g�,�,��"�"�"��!�*�C�%�g�a�!�e�g�g�&6�7�7�	
�	
���5��7�5�#�&�&����A���	�*��E��U�3��&�&����A���	�*��N�N�1�e�,�,�,��E��
�Q����#�g�,�,��"�"�"���)1�8��
�
�q��	��4�4�G�4�4�4�4�4�
C��}�}��G�G�N�N�g�N�N�N�N�N������x�x�B�B�'�B�B�B�B�B���
2�$�+�+�D�1�1����H�-�-�-�6�6�u�z�z�'�7J�7J�K�K�C��
O�C�B�'�B�B�B�
��$�$�%M�%M�%M�%M�N�N�N��J���x�	�	�	��M�M�J�WX�
�
�
�
�
�
�	�����@�@�@�@��@�@�@�@�@�I�I�
�
�
�7�����s�3C J�+K�K�key�valuec�Z�ttt||z������S)a�Helper to easily and clearly define a dictionary by specifying
    the respective patterns for the key and value.  Takes care of
    defining the :class:`Dict`, :class:`ZeroOrMore`, and
    :class:`Group` tokens in the proper order.  The key pattern
    can include delimiting markers or punctuation, as long as they are
    suppressed, thereby leaving the significant key text.  The value
    pattern can include named results, so that the :class:`Dict` results
    can include named token fields.

    Example::

        text = "shape: SQUARE posn: upper left color: light blue texture: burlap"
        attr_expr = (label + Suppress(':') + OneOrMore(data_word, stop_on=label).set_parse_action(' '.join))
        print(attr_expr[1, ...].parse_string(text).dump())

        attr_label = label
        attr_value = Suppress(':') + OneOrMore(data_word, stop_on=label).set_parse_action(' '.join)

        # similar to Dict, but simpler call format
        result = dict_of(attr_label, attr_value).parse_string(text)
        print(result.dump())
        print(result['shape'])
        print(result.shape)  # object attribute access works too
        print(result.as_dict())

    prints::

        [['shape', 'SQUARE'], ['posn', 'upper left'], ['color', 'light blue'], ['texture', 'burlap']]
        - color: 'light blue'
        - posn: 'upper left'
        - shape: 'SQUARE'
        - texture: 'burlap'
        SQUARE
        SQUARE
        {'color': 'light blue', 'shape': 'SQUARE', 'posn': 'upper left', 'texture': 'burlap'}
    )�Dict�	OneOrMore�Group)r�r�s  r#�dict_ofr�Gs'��J�	�%��e��,�,�-�-�.�.�.r%)�asString�	as_stringr�c�N�|o|}t���d���}|���}d|_|d��|z|d��z}|rd�}nd�}|�|��|j|_|�tj��|S)aHelper to return the original, untokenized text for a given
    expression.  Useful to restore the parsed fields of an HTML start
    tag into the raw tag text itself, or to revert separate tokens with
    intervening whitespace back to the original matching input text. By
    default, returns astring containing the original parsed text.

    If the optional ``as_string`` argument is passed as
    ``False``, then the return value is
    a :class:`ParseResults` containing any results names that
    were originally matched, and a single token containing the original
    matched text from the input string.  So if the expression passed to
    :class:`original_text_for` contains expressions with defined
    results names, you must set ``as_string`` to ``False`` if you
    want to preserve those results name values.

    The ``asString`` pre-PEP8 argument is retained for compatibility,
    but will be removed in a future release.

    Example::

        src = "this is test <b> bold <i>text</i> </b> normal text "
        for tag in ("b", "i"):
            opener, closer = make_html_tags(tag)
            patt = original_text_for(opener + SkipTo(closer) + closer)
            print(patt.search_string(src)[0])

    prints::

        ['<b> bold <i>text</i> </b>']
        ['<i>text</i>']
    c��|SrArj)r,�locr.s   r#r5z#original_text_for.<locals>.<lambda>�s��3�r%F�_original_start�
_original_endc�*�||j|j�SrA)r�r��r,r-r.s   r#r5z#original_text_for.<locals>.<lambda>�s��a��(9�A�O�(K�&L�r%c�r�||�d��|�d���g|dd�<dS)Nr�r���popr�s   r#�extractTextz&original_text_for.<locals>.extractText�s9���a�e�e�-�.�.�����1G�1G�G�H�I�A�a�a�a�D�D�Dr%)r+r;r�callPreparse�ignoreExprs�suppress_warning�Diagnostics�)warn_ungrouped_named_tokens_in_collection)rr�r��	locMarker�endlocMarker�	matchExprr�s       r#�original_text_forr�os���D�%�I�H����(�(�)>�)>�?�?�I��>�>�#�#�L� %�L���	�+�,�,�t�3�l�l�?�6S�6S�S�I��J�L�L���	J�	J�	J����{�+�+�+� �,�I��
���{�T�U�U�U��r%c�H�t|���d���S)zkHelper to undo pyparsing's default grouping of And expressions,
    even if all but one are non-empty.
    c��|dSr*rjr4s r#r5zungroup.<locals>.<lambda>�s
��1�Q�4�r%)�TokenConverterr<)rs r#�ungroupr��s"���$���0�0���@�@�@r%c���t���d���}t|d��|d��z|������d��z��S)a�
    (DEPRECATED - future code should use the Located class)
    Helper to decorate a returned token with its starting and ending
    locations in the input string.

    This helper adds the following results names:

    - ``locn_start`` - location where matched expression begins
    - ``locn_end`` - location where matched expression ends
    - ``value`` - the actual parsed results

    Be careful if the input text contains ``<TAB>`` characters, you
    may want to call :class:`ParserElement.parseWithTabs`

    Example::

        wd = Word(alphas)
        for match in locatedExpr(wd).searchString("ljsdf123lksdjjf123lkkjj1222"):
            print(match)

    prints::

        [[0, 'ljsdf', 5]]
        [[8, 'lksdjjf', 15]]
        [[18, 'lkkjj', 23]]
    c��|SrArj)�ss�llrDs   r#r5zlocatedExpr.<locals>.<lambda>�s��"�r%�
locn_startr��locn_end)r+r;r�r�leaveWhitespace)r�locators  r#�locatedExprr��st��6�g�g�&�&�'<�'<�=�=�G�������
�$�w�-�-�	�
*�'�,�,�.�.�
(�
(�
*�
*�:�
6�
6�	7���r%�(�))�
ignoreExpr�opener�closer�content�ignore_exprr�c	��||kr|t��kr|n|}||krtd���|���t|t���r�t|t���r�t	|��dkr�t	|��dkr�|�Utt
|t||ztj	zd���z�����
d���}�n;t���t||ztj	z���
d���z}n�|�ptt
|t|��zt|��zttj	d���z�����
d���}n{tt
t|��t|��zttj	d���z�����
d���}ntd	���t��}|�F|tt!|��t#||z|z��zt!|��z��z}nB|tt!|��t#||z��zt!|��z��z}|�d
|�|�d���|S)a&
Helper method for defining nested lists enclosed in opening and
    closing delimiters (``"("`` and ``")"`` are the default).

    Parameters:
    - ``opener`` - opening character for a nested list
      (default= ``"("``); can also be a pyparsing expression
    - ``closer`` - closing character for a nested list
      (default= ``")"``); can also be a pyparsing expression
    - ``content`` - expression for items within the nested lists
      (default= ``None``)
    - ``ignore_expr`` - expression for ignoring opening and closing delimiters
      (default= :class:`quoted_string`)
    - ``ignoreExpr`` - this pre-PEP8 argument is retained for compatibility
      but will be removed in a future release

    If an expression is not provided for the content argument, the
    nested expression will capture all whitespace-delimited content
    between delimiters as a list of separate values.

    Use the ``ignore_expr`` argument to define expressions that may
    contain opening or closing characters that should not be treated as
    opening or closing characters for nesting, such as quoted_string or
    a comment expression.  Specify multiple expressions using an
    :class:`Or` or :class:`MatchFirst`. The default is
    :class:`quoted_string`, but if no expressions are to be ignored, then
    pass ``None`` for this argument.

    Example::

        data_type = one_of("void int short long char float double")
        decl_data_type = Combine(data_type + Opt(Word('*')))
        ident = Word(alphas+'_', alphanums+'_')
        number = pyparsing_common.number
        arg = Group(decl_data_type + ident)
        LPAR, RPAR = map(Suppress, "()")

        code_body = nested_expr('{', '}', ignore_expr=(quoted_string | c_style_comment))

        c_function = (decl_data_type("type")
                      + ident("name")
                      + LPAR + Opt(delimited_list(arg), [])("args") + RPAR
                      + code_body("body"))
        c_function.ignore(c_style_comment)

        source_code = '''
            int is_odd(int x) {
                return (x%2);
            }

            int dec_to_hex(char hchar) {
                if (hchar >= '0' && hchar <= '9') {
                    return (ord(hchar)-ord('0'));
                } else {
                    return (10+ord(hchar)-ord('A'));
                }
            }
        '''
        for func in c_function.search_string(source_code):
            print("%(name)s (%(type)s) args: %(args)s" % func)


    prints::

        is_odd (int) args: [['int', 'x']]
        dec_to_hex (int) args: [['char', 'hchar']]
    z.opening and closing strings cannot be the sameNr)�exactc�6�|d���Sr*��stripr4s r#r5znested_expr.<locals>.<lambda>(����1������r%c�6�|d���Sr*r�r4s r#r5znested_expr.<locals>.<lambda>,r�r%c�6�|d���Sr*r�r4s r#r5znested_expr.<locals>.<lambda>6r�r%c�6�|d���Sr*r�r4s r#r5znested_expr.<locals>.<lambda>>r�r%zOopening and closing arguments must be strings if no content expression is givenznested z expression)�
quoted_stringrrrrFrr��
CharsNotInr�DEFAULT_WHITE_CHARSr;�emptyrrBr8r�r�
ZeroOrMorer )r�r�r�r�r�r�s      r#�nested_exprr��s���T�[� � �$.�-�/�/�$A�$A�[�[�z�
�
�����I�J�J�J����f�h�'�'�%	�J�v�x�,H�,H�%	��6�{�{�a���C��K�K�1�$4�$4��)�%�!�'�K�(� &���-�2S� S�&'���������'�&�'=�'=�>�>��G�$�j�j�l�l�Z����-�*K�K�.�.�&�&�'=�'=�>�>�?�G�G��)�%�!�'�K�&�v���.�/�&�v���.�/�)��)J�RS�T�T�T�U�����'�&�'=�'=�>�>��G�&�!�$�V�_�_�,�&�v���.�/�(��)J�RS�T�T�T�U�����'�&�'=�'=�>�>�
�G��a���
��)�)�C������V���z�*�s�*:�W�*D�E�E�E��QW�HX�HX�X�
�
�	
���	��h�v�&�&��C�'�M�)B�)B�B�X�f�EU�EU�U�V�V�V���L�L�L�V�V�V�V�V�<�=�=�=��Jr%�<�>c
���t|t��r|�t||���}n|j�t	t
tdz��}|r�t����	t��}||d��zttt|td��z|z������ztddg���d���	d	���z|z}n�t ����	t��t	t"d
���z}||d��zttt|�	d���ttd��|z��z������ztddg���d���	d
���z|z}t%t'd��|zd
zd���}|�d�z��|��fd���|dd���dd����������z���d�z��}�|_�|_t7|����|_||fS)zRInternal helper to construct opening and closing tag expressions, given a tag name)r\z_-:�tag�=�/F)�defaultr�c��|ddkS�Nrr�rjr�s   r#r5z_makeTags.<locals>.<lambda>^����!����r%r�)�
exclude_charsc�6�|d���Sr*ryr4s r#r5z_makeTags.<locals>.<lambda>ls��q��t�z�z�|�|�r%c��|ddkSr�rjr�s   r#r5z_makeTags.<locals>.<lambda>rr�r%z</)�adjacentz<%s>c	����|�dd���dd����������z|�����S)N�startr�:� )�__setitem__r��replace�titler�r)r.�resnames �r#r5z_makeTags.<locals>.<lambda>{sY���!�-�-��b�g�g�g�o�o�c�3�7�7�=�=�?�?�E�E�G�G�H�H�H�!�&�&�(�(�
�
�r%rrr�r�z</%s>)rrr��namer9�alphas�	alphanums�dbl_quoted_stringrr;�
remove_quotesr�r�r�rrr��
printablesrrBr r<r�r�r�r�r��SkipTo�tag_body)	�tagStr�xml�suppress_LT�suppress_GT�tagAttrName�tagAttrValue�openTag�closeTagr�s	        @r#�	_makeTagsrNs�����&�(�#�#������c�'�2�2�2����+���v�y�5�0�1�1�K�
�
�(�-�-�/�/�@�@��O�O����f�U�m�m�
��:�e�K�(�3�-�-�$?�,�$N�O�O�P�P�Q�Q�
R�(�c�#��w�'�'�'��0�0�A�A�+�+���
��

�	��%�)�)�+�+�<�<�]�K�K�d��c�O
�O
�O
�
��
��f�U�m�m�
����#�4�4�5K�5K�L�L��h�s�m�m�l�:�;�;�<�������	
�(�c�#��w�'�'�'��0�0�A�A�+�+���
��

�	� �w�t�}�}�v�-��3�e�D�D�D�H����V�g�%�&�&�&����	
�	
�	
�	
����
�x�
��������S�1�1�7�7�9�9�?�?�A�A�B�B�B����h�w�� �!�!�
��G�K��H�L��h�h�j�j�)�)�G���H��r%�tag_strc�"�t|d��S)aPHelper to construct opening and closing tag expressions for HTML,
    given a tag name. Matches tags in either upper or lower case,
    attributes with namespaces and with quoted or unquoted values.

    Example::

        text = '<td>More info at the <a href="https://github.com/pyparsing/pyparsing/wiki">pyparsing</a> wiki page</td>'
        # make_html_tags returns pyparsing expressions for the opening and
        # closing tags as a 2-tuple
        a, a_end = make_html_tags("A")
        link_expr = a + SkipTo(a_end)("link_text") + a_end

        for link in link_expr.search_string(text):
            # attributes in the <A> tag (like "href" shown here) are
            # also accessible as named results
            print(link.link_text, '->', link.href)

    prints::

        pyparsing -> https://github.com/pyparsing/pyparsing/wiki
    F�r�rs r#�make_html_tagsr
�s��0�W�e�$�$�$r%c�"�t|d��S)z�Helper to construct opening and closing tag expressions for XML,
    given a tag name. Matches tags only in the given upper/lower case.

    Example: similar to :class:`make_html_tags`
    Trr	s r#�
make_xml_tagsr�s���W�d�#�#�#r%�any_open_tag�
any_close_tagz_:zany tagc�@�i|]\}}|�d��|��S)�;)�rstrip)rC�k�vs   r#r{r{�s(��K�K�K�t�q�!�!�(�(�3�-�-��K�K�Kr%z&(?P<entity>rsz);zcommon HTML entityc�@�t�|j��S)zRHelper parser action to replace common HTML entities with their special characters)�_htmlEntityMap�get�entityr4s r#�replace_html_entityr�s�����a�h�'�'�'r%c��eZdZdZdZdS)�OpAssocrr`N)�__name__�
__module__�__qualname__�LEFT�RIGHTrjr%r#rr�s�������D�
�E�E�Er%r�	base_expr�op_list�lpar�rparc	�Z�Gd�dt��}d|_t��}t|t��rt|��}t|t��rt|��}t|t
��rt|t
��s|t
||z|z��z}n|||z|zz}t|��D�]V\}}|dzdd�\}	}
}}t|	t��rt�
|	��}	|
dkrZt|	ttf��rt|	��dkrtd	���|	\}
}d
�|
|��}nd�|	��}d|
cxkrdksntd
���|t jt jfvrtd���t���|��}|t jur�|
dkr)|||	z��t
||	dz��z}�n�|
dkrW|	�/|||	z|z��t
||	|zdz��z}�nc|||z��t
|d��z}�n=|
dkr@|||
z|z|z|z��t
|t)|
|z|z|z��z��z}n�|t jur�|
dkrKt|	t*��st+|	��}	||	j|z��t
|	|z��z}n�|
dkrX|	�.|||	z|z��t
||	|zdz��z}na|||z��t
||dz��z}n9|
dkr3|||
z|z|z|z��t
||
z|z|z|z��z}|r<t|ttf��r|j|�n|�|��|||z�|��z}|}��X||z}|S)aJHelper method for constructing grammars of expressions made up of
    operators working in a precedence hierarchy.  Operators may be unary
    or binary, left- or right-associative.  Parse actions can also be
    attached to operator expressions. The generated parser will also
    recognize the use of parentheses to override operator precedences
    (see example below).

    Note: if you define a deep operator list, you may see performance
    issues when using infix_notation. See
    :class:`ParserElement.enable_packrat` for a mechanism to potentially
    improve your parser performance.

    Parameters:
    - ``base_expr`` - expression representing the most basic operand to
      be used in the expression
    - ``op_list`` - list of tuples, one for each operator precedence level
      in the expression grammar; each tuple is of the form ``(op_expr,
      num_operands, right_left_assoc, (optional)parse_action)``, where:

      - ``op_expr`` is the pyparsing expression for the operator; may also
        be a string, which will be converted to a Literal; if ``num_operands``
        is 3, ``op_expr`` is a tuple of two expressions, for the two
        operators separating the 3 terms
      - ``num_operands`` is the number of terms for this operator (must be 1,
        2, or 3)
      - ``right_left_assoc`` is the indicator whether the operator is right
        or left associative, using the pyparsing-defined constants
        ``OpAssoc.RIGHT`` and ``OpAssoc.LEFT``.
      - ``parse_action`` is the parse action to be associated with
        expressions matching this operator expression (the parse action
        tuple member may be omitted); if the parse action is passed
        a tuple or list of functions, this is equivalent to calling
        ``set_parse_action(*fn)``
        (:class:`ParserElement.set_parse_action`)
    - ``lpar`` - expression for matching left-parentheses; if passed as a
      str, then will be parsed as Suppress(lpar). If lpar is passed as
      an expression (such as ``Literal('(')``), then it will be kept in
      the parsed results, and grouped with them. (default= ``Suppress('(')``)
    - ``rpar`` - expression for matching right-parentheses; if passed as a
      str, then will be parsed as Suppress(rpar). If rpar is passed as
      an expression (such as ``Literal(')')``), then it will be kept in
      the parsed results, and grouped with them. (default= ``Suppress(')')``)

    Example::

        # simple example of four-function arithmetic with ints and
        # variable names
        integer = pyparsing_common.signed_integer
        varname = pyparsing_common.identifier

        arith_expr = infix_notation(integer | varname,
            [
            ('-', 1, OpAssoc.RIGHT),
            (one_of('* /'), 2, OpAssoc.LEFT),
            (one_of('+ -'), 2, OpAssoc.LEFT),
            ])

        arith_expr.run_tests('''
            5+3*6
            (5+3)*6
            -2--11
            ''', full_dump=False)

    prints::

        5+3*6
        [[5, '+', [3, '*', 6]]]

        (5+3)*6
        [[[5, '+', 3], '*', 6]]

        -2--11
        [[['-', 2], '-', ['-', 11]]]
    c��eZdZdd�ZdS)�infix_notation.<locals>._FBTc�@�|j�||��|gfSrA)r�	try_parse)�self�instringr��	doActionss    r#�	parseImplz%infix_notation.<locals>._FB.parseImpl(s#���I����#�.�.�.���7�Nr%N�T)rrrr,rjr%r#�_FBr&'s(������	�	�	�	�	�	r%r.zFollowedBy>rAN��r`z@if numterms=3, opExpr must be a tuple or list of two expressionsz	{}{} termz{} termrz6operator must be unary (1), binary (2), or ternary (3)z2operator must indicate right or left associativity)r.)r`.)�
FollowedByrr8rrrr�r�rrr�tupler�rFrrrrrr r�rrr;�setName)r r!r"r#r.r��lastExprr��operDef�opExpr�arity�rightLeftAssoc�pa�opExpr1�opExpr2�	term_name�thisExprr�s                  r#�infix_notationr>�s���b�����j����
!�C�L�
�)�)�C��$�������~�~���$�������~�~��
�t�X�&�&�3�:�d�H�+E�+E�3��u�T�C�Z�$�%6�7�7�7�����s�
�T� 1�2����(�(�<�<�
��7�-4�w�->����,C�)���~�r��f�h�'�'�	?�"�6�6�v�>�>�F��A�:�:��f�u�d�m�4�4�
��F���q�8H�8H� �V���� &��G�W�#�*�*�7�G�<�<�I�I�!�(�(��0�0�I��E�����Q������U�V�V�V��'�,��
�!>�>�>��Q�R�R�R�#�I�I�.�.�y�9�9���W�\�)�)���z�z��C��6� 1�2�2�U�8�f�V�n�;T�5U�5U�U�	�	��!����%� #��H�v�$5��$@� A� A�E� �F�X�$5�v�#>�>�E�E�!�I�I�!$��H�x�$7� 8� 8�5��&�AQ�;R�;R� R�I�I��!����C��w�&��1�G�;�h�F����(�Y�w��/A�G�/K�h�/V�%W�%W�W�X�X�Y�	���w�}�
,�
,���z�z�!�&�#�.�.�)� ��[�[�F��C���h� 6�7�7�%���@Q�:R�:R�R�	�	��!����%� #��H�v�$5��$@� A� A�E� �F�X�$5�v�#>�>�E�E�!�I�I�!$��H�x�$7� 8� 8�5� �8�F�#3�3�<�<�!�I�I��!����C��w�&��1�G�;�h�F����(�W�,�x�7�'�A�H�L�M�M�N�	��	/��"�u�d�m�,�,�
/�*�	�*�B�/�/�/��*�*�2�.�.�.��i�(�*�3�3�I�>�>�>������H��C��Jr%c	��������dd�����fd���fd�}�fd�}�fd�}tt���d�������}t��t���|��z�d��}t���|���d��}	t���|���d	��}
|rStt|��|zt|	t|��zt|��z��z|
z��}n\tt|��t|	t|��zt|��z��zt|
��z��}|�
�fd
���|��fd���|�tt��z��|�d��S)
a�	
    (DEPRECATED - use IndentedBlock class instead)
    Helper method for defining space-delimited indentation blocks,
    such as those used to define block statements in Python source code.

    Parameters:

    - ``blockStatementExpr`` - expression defining syntax of statement that
      is repeated within the indented block
    - ``indentStack`` - list created by caller to manage indentation stack
      (multiple ``statementWithIndentedBlock`` expressions within a single
      grammar should share a common ``indentStack``)
    - ``indent`` - boolean indicating whether block must be indented beyond
      the current level; set to ``False`` for block of left-most statements
      (default= ``True``)

    A valid block must contain at least one ``blockStatement``.

    (Note that indentedBlock uses internal parse actions which make it
    incompatible with packrat parsing.)

    Example::

        data = '''
        def A(z):
          A1
          B = 100
          G = A2
          A2
          A3
        B
        def BB(a,b,c):
          BB1
          def BBA():
            bba1
            bba2
            bba3
        C
        D
        def spam(x,y):
             def eggs(z):
                 pass
        '''


        indentStack = [1]
        stmt = Forward()

        identifier = Word(alphas, alphanums)
        funcDecl = ("def" + identifier + Group("(" + Opt(delimitedList(identifier)) + ")") + ":")
        func_body = indentedBlock(stmt, indentStack)
        funcDef = Group(funcDecl + func_body)

        rvalue = Forward()
        funcCall = Group(identifier + "(" + Opt(delimitedList(rvalue)) + ")")
        rvalue << (funcCall | identifier | Word(nums))
        assignment = Group(identifier + "=" + rvalue)
        stmt << (funcDef | assignment | identifier)

        module_body = stmt[1, ...]

        parseTree = module_body.parseString(data)
        parseTree.pprint()

    prints::

        [['def',
          'A',
          ['(', 'z', ')'],
          ':',
          [['A1'], [['B', '=', '100']], [['G', '=', 'A2']], ['A2'], ['A3']]],
         'B',
         ['def',
          'BB',
          ['(', 'a', 'b', 'c', ')'],
          ':',
          [['BB1'], [['def', 'BBA', ['(', ')'], ':', [['bba1'], ['bba2'], ['bba3']]]]]],
         'C',
         'D',
         ['def',
          'spam',
          ['(', 'x', 'y', ')'],
          ':',
          [[['def', 'eggs', ['(', 'z', ')'], ':', [['pass']]]]]]]
    Nc�"���d�dd�<dS�N���rj)�
backup_stacks�indentStacks��r#�reset_stackz"indentedBlock.<locals>.reset_stack�s���&�r�*��A�A�A���r%c����|t|��krdSt||��}|�dkr.|�dkrt||d���t||d���dS)NrBzillegal nestingznot a peer entry)rF�colrS�r,r-r.�curColrDs    �r#�checkPeerIndentz&indentedBlock.<locals>.checkPeerIndent�sp�����A���;�;��F��Q������[��_�$�$���B��'�'�$�Q��+<�=�=�=� ��A�'9�:�:�:�%�$r%c���t||��}|�dkr��|��dSt||d���)NrBznot a subentry)rG�appendrSrHs    �r#�checkSubIndentz%indentedBlock.<locals>.checkSubIndent�sL����Q������K��O�#�#����v�&�&�&�&�&� ��A�'7�8�8�8r%c����|t|��krdSt||��}�r|�vst||d���|�dkr����dSdS)Nznot an unindentrB)rFrGrSr�rHs    �r#�
checkUnindentz$indentedBlock.<locals>.checkUnindent�sv�����A���;�;��F��Q������	:��+� 5� 5� ��A�'8�9�9�9��K��O�#�#��O�O������$�#r%z	 �INDENTr�UNINDENTc�:���r��d��odndSrAr�)rCs�r#r5zindentedBlock.<locals>.<lambda>s"���-�I�
�!�!�"�%�%�.�$��T�r%c������SrArj)rerf�c�drEs    �r#r5zindentedBlock.<locals>.<lambda>s
���k�k�m�m�r%zindented block)rLr��LineEnd�set_whitespace_chars�suppressr+r;r r�rr<�set_fail_action�ignorer)
�blockStatementExprrD�indentrCrJrMrO�NLrP�PEER�UNDENT�smExprrEs
 ` `        @r#�
indentedBlockra{sX�����l����Q�Q�Q��(�(�(�+�+�+�+�+�+�;�;�;�;�;�9�9�9�9�9������
�7�9�9�1�1�%�8�8�A�A�C�C�	D�	D�B��g�g����0�0��@�@�@�
J�
J�8�
T�
T�F��7�7�#�#�O�4�4�=�=�b�A�A�D�
�W�W�
%�
%�m�
4�
4�
=�
=�j�
I�
I�F�
�
����G�G��
���u�%7�8�8�8�3�r�7�7�B�C�C�
D��
�
�
������G�G���u�%7�8�8�8�3�r�7�7�B�C�C�
D��&�k�k�
�
�
�����I�I�I�I�������;�;�;�;�<�<�<����g��	�	�1�2�2�2��?�?�+�,�,�,r%z/\*(?:[^*]|\*(?!/))*z*/zC style commentz<!--[\s\S]*?-->zHTML commentz.*zrest of linez//(?:\\\n|[^\n])*z
// commentzC++ style commentz#.*zPython style commentc�<�g|]}t|t���|��Srj)rr)rCrs  r#�
<listcomp>rc%s7��'�'�'�
�*�Q�
�">�">�'��'�'�'r%�_builtin_exprs)r	FNNrA)FTFr-)\�
html.entities�htmlru�typingrr�core�utilrrr�Unionrr�bool�Optionalr3r$r=rOrXr�r�r�r�r�r�r�r�rr�Tupler
r�__annotations__r9r�r�r r
r�entities�html5�itemsrr�r��common_html_entityr�Enumr�InfixNotationOperatorArgType�ParseAction�InfixNotationOperatorSpec�Listr>rar�c_style_comment�html_comment�leave_whitespace�rest_of_line�dbl_slash_comment�cpp_style_comment�java_style_comment�python_style_comment�vars�valuesrd�
delimitedList�countedArray�matchPreviousLiteral�matchPreviousExpr�oneOf�dictOf�originalTextFor�
nestedExpr�makeHTMLTags�makeXMLTags�
anyOpenTag�anyCloseTag�commonHTMLEntity�replaceHTMLEntity�opAssoc�
infixNotation�
cStyleComment�htmlComment�
restOfLine�dblSlashComment�cppStyleComment�javaStyleComment�pythonStyleCommentrjr%r#�<module>r�s&�������	�	�	�	�
�
�
�
�����������>�>�>�>�>�>�>�>�>�>�(+�� $� $�64�"'�64�64�64�
��]�"�
#�64���m�#�$�64��64�
���	�	64�

���	�64��64��64�64�64�64�v04�9I�/3�	9I�9I�9I�
�9I��o�m�,�9I��_�]�
+�	9I�
�9I�9I�9I�9I�x���=�����B!�m�!�
�!�!�!�!�L���	|���|�|�|�
����$�c�)�
*�|��|��|��	|��
|��|��|�|�|�|�~%/��%/�}�%/��%/�%/�%/�%/�R,0�2�EI�2�2�2�
�2�$(�2�>B�2��2�2�2�2�jA�-�A�M�A�A�A�A� �m� �
� � � � �H),�(+�.2�!.����	}�!.�
���
}�}�}��#�}�$�%�}��#�}�$�%�}��_�]�
+�}��	}��
}��}�}�}�}�@(0�x��}�}�(�(�3�-�-�7�7�7�7�t%�
�3�
�%�
&�%�
�=�-�'�(�%�%�%�%�6$�
�3�
�%�
&�$�
�=�-�'�(�$�$�$�$���������,�n��D���T�!�"�"�+�+�I�6�6�����m�L�K�t�}�/B�/H�/H�/J�/J�K�K�K���U�>�C�H�H�^�,D�,D�D�t�K�L�L�U�U�����
(�(�(�
�����d����
 %��3��e�M�3�$6�7��}�c�?Q�9R�R�S�S� ��"�	�$������$�	&��
�$���	��
���$'/�h�s�m�m�&.�h�s�m�m�	b�b��b�
�+�
,�b���]�"�
#�b���]�"�
#�	b�
�b�b�b�b�J;?�b�L-�L-�L-�L-�`�'�%�%� 7�8�8�4�?�@�@�I�I�����$��u�'�(�(�1�1�.�A�A��&��u�U�|�|�,�,�.�.�7�7��G�G���E�.�/�/�8�8��F�F��1��G�	�E�
!�"�"�T�)�,=�=���
�(�����P�&��$��u�V�}�}�-�-�.D�E�E��0�
'�'��t�v�v�}�}���'�'�'���]�#�����
���-��'����	��#��
�
�����&�
��
�K�%��'��
���
��
���
�
�#��#��%��)���r%