�
JI�c�b���UddlmZmZmZmZddlZddlmZddl m
Z
mZee
fZe
edfed<ed�dD����ZGd �d
��ZGd�d��Zeje��eje��dS)
�)�MutableMapping�Mapping�MutableSequence�IteratorN)�ref)�Tuple�Any.�str_typec#�K�|]}|V��dS�N�)�.0�_s �3/usr/lib/python3/dist-packages/pyparsing/results.py� <genexpr>rs������a��������r
c�,�eZdZdgZd�Zd�Zd�Zd�ZdS)�_ParseResultsWithOffset�tupc��||f|_dSr�r)�self�p1�p2s r�__init__z _ParseResultsWithOffset.__init__s����8����rc��|j|Srr�r�is r�__getitem__z#_ParseResultsWithOffset.__getitem__s���x��{�rc��|jSrr�rs r�__getstate__z$_ParseResultsWithOffset.__getstate__s ���x�rc� �|d|_dS�Nrr)r�argss r�__setstate__z$_ParseResultsWithOffset.__setstate__s����7����rN)�__name__�
__module__�__qualname__� __slots__rrr"r&r
rrrrsW��������I��������������rrc���eZdZUdZdgddfZeedfed<gd�ZGd�d e ��Z
d3d
�Zddddefd�Z
d
�Zefd�Zd�Zdefd�Zdefd�Zdefd�Zdefd�Zdefd�Zd�Zd�Zd�Zdefd�Zd�Zd4d�Zd�Zd�Z d�Z!d�Z"d �Z#d5d!�Z$d5d"�Z%d5d#�Z&de'fd$�Z(de'fd%�Z)d6d&�Z*de fd'�Z+de,fd(�Z-d5d)�Z.d*�Z/d7de'fd,�Z0d-�Z1d.�Z2d/�Z3d0�Z4d1�Z5e6d4d5d2���Z7e+Z8e-Z9e/Z:dS)8�ParseResultsa�Structured parse results, to provide multiple means of access to
the parsed data:
- as a list (``len(results)``)
- by list index (``results[0], results[1]``, etc.)
- by attribute (``results.<results_name>`` - see :class:`ParserElement.set_results_name`)
Example::
integer = Word(nums)
date_str = (integer.set_results_name("year") + '/'
+ integer.set_results_name("month") + '/'
+ integer.set_results_name("day"))
# equivalent form:
# date_str = (integer("year") + '/'
# + integer("month") + '/'
# + integer("day"))
# parse_string returns a ParseResults object
result = date_str.parse_string("1999/12/31")
def test(s, fn=repr):
print("{} -> {}".format(s, fn(eval(s))))
test("list(result)")
test("result[0]")
test("result['month']")
test("result.day")
test("'month' in result")
test("'minutes' in result")
test("result.dump()", str)
prints::
list(result) -> ['1999', '/', '12', '/', '31']
result[0] -> '1999'
result['month'] -> '12'
result.day -> '31'
'month' in result -> True
'minutes' in result -> False
result.dump() -> ['1999', '/', '12', '/', '31']
- day: '31'
- month: '12'
- year: '1999'
N�r
.�_null_values)�_name�_parent�
_all_names�_modal�_toklist�_tokdict�__weakref__c��eZdZdZdd�ZdS)�ParseResults.Lista�
Simple wrapper class to distinguish parsed list results that should be preserved
as actual Python lists, instead of being converted to :class:`ParseResults`:
LBRACK, RBRACK = map(pp.Suppress, "[]")
element = pp.Forward()
item = ppc.integer
element_list = LBRACK + pp.delimited_list(element) + RBRACK
# add parse actions to convert from ParseResults to actual Python collection types
def as_python_list(t):
return pp.ParseResults.List(t.as_list())
element_list.add_parse_action(as_python_list)
element <<= item | element_list
element.run_tests('''
100
[2,3,4]
[[2, 1],3,4]
[(2, 1),3,4]
(2,3,4)
''', post_parse=lambda s, r: (r[0], type(r[0])))
prints:
100
(100, <class 'int'>)
[2,3,4]
([2, 3, 4], <class 'list'>)
[[2, 1],3,4]
([[2, 1], 3, 4], <class 'list'>)
(Used internally by :class:`Group` when `aslist=True`.)
Nc���|�g}t|t��s:td�|jt|��j�����t�|��S)Nz.{} may only be constructed with a list, not {})�
isinstance�list� TypeError�formatr'�type�__new__)�cls� containeds rr>zParseResults.List.__new__|sd��� �� ��i��.�.�
���$�f�S�\�4� �?�?�3K�L�L����
�<�<��$�$�$rr)r'r(r)�__doc__r>r
rr�Listr7Us3������$ �$ �L
%�
%�
%�
%�
%�
%rrBc��t|t��r|St�|��}d|_d|_t
��|_|�g|_n^t|ttf��r:t|tj��r|dd�gnt|��|_n|g|_t��|_
|Sr)r9r,�objectr>r/r0�setr1r3r:�_generator_typerB�dictr4)r?�toklist�name�kwargsrs rr>zParseResults.__new__�s����g�|�,�,� ��N��~�~�c�"�"����
�����%�%����?��D�M�M�
��$��!8�
9�
9� &��g�|�'8�9�9�#���������'�]�]�
�M�M�%�I�D�M�����
��rTc�4�||_|�� |dk�r||t��rt|��}|s|h|_||_||jvr�||ttf��r|g}|rl||t��r&tt|j
��d��||<n&tt|d��d��||<|||_dS |d||<dS#tttf$r||ur|||<YdS||_YdSwxYwdSdSdS)Nr-r)r2�int�strr1r/r.r
r=r,rr3�KeyErrorr;�
IndexError)rrHrI�asList�modalr9s rrzParseResults.__init__�sl���������
�
��z�$��$�$�
!��4�y�y���
)�#'�&����D�J��d�/�/�/��:�g��$�'7�8�8�(�&�i�G��.�!�z�'�<�8�8��%<�(��)9�:�:�A�&�&��T�
�
�&=�(����4�4�a�&�&��T�
�(,�D��J�$�$�$�.�%,�Q�Z��T�
�
�
��$�i��<�.�.�.�"�$�.�.�)0�D��J�J�J�J�)-�D�J�J�J�J� .����-��
�
�0�/s�C#�# D�D�Dc���t|ttf��r
|j|S||jvr|j|ddSt
d�|j|D����S)N���rc��g|]
}|d��S)rr
)r�vs r�
<listcomp>z,ParseResults.__getitem__.<locals>.<listcomp>�s��$D�$D�$D�a�Q�q�T�$D�$D�$Dr)r9rL�slicer3r1r4r,rs rrzParseResults.__getitem__�sn���a�#�u��&�&� F��=��#�#����'�'��}�Q�'��+�A�.�.�#�$D�$D�4�=��3C�$D�$D�$D�E�E�Erc��||t��r<|j�|t����|gz|j|<|d}nh||tt
f��r
||j|<|}nC|j�|t����t|d��gz|j|<|}||t��rt|��|_ dSdSr$)
rr4�getr:rLrWr3r,�wkrefr0)r�krUr9�subs r�__setitem__zParseResults.__setitem__�s����:�a�0�1�1�
�#�}�0�0��D�F�F�;�;�q�c�A�D�M�!���A�$�C�C�
�Z��C��<�
(�
(� � �D�M�!���C�C�#�}�0�0��D�F�F�;�;�'��1�-�-�?� �D�M�!���C��:�c�<�(�(� &���+�+�C�K�K�K� &� &rc ��t|ttf��r�t|j��}|j|=t|t��r|dkr||z
}t||dz��}tt
|�|�����}|���|j �
��D]<\}}|D]4}t|��D]"\}\}} t|| | |kz
��||<�#�5�=dS|j |=dS)Nr�)
r9rLrW�lenr3r:�range�indices�reverser4�items� enumerater)
rr�mylen�removedrI�occurrences�jr[�value�positions
r�__delitem__zParseResults.__delitem__�s1���a�#�u��&�&� !���
�&�&�E��
�a� ��!�S�!�!�
$��q�5�5���J�A��!�Q��U�O�O���5�!�)�)�E�"2�"2�3�4�4�G��O�O����%)�]�%8�%8�%:�%:�
�
�!��k� ���A�09�+�0F�0F���,��,�E�8�)@�!�8�x�!�|�#<�*�*��A�����
�
��
�a� � � r�returnc��||jvSr)r4)rr[s r�__contains__zParseResults.__contains__�s���D�M�!�!rc�*�t|j��Sr)r`r3r!s r�__len__zParseResults.__len__�s���4�=�!�!�!rc�"�|jp|jSr)r3r4r!s r�__bool__zParseResults.__bool__�s���
�6���7�7�7rc�*�t|j��Sr��iterr3r!s r�__iter__zParseResults.__iter__�����D�M�"�"�"rc�<�t|jddd���S)NrSrur!s r�__reversed__zParseResults.__reversed__�s���D�M�$�$�B�$�'�(�(�(rc�*�t|j��Sr)rvr4r!s r�keyszParseResults.keys�rxrc�D���fd�����D��S)Nc3�(�K�|]}�|V��
dSrr
�rr[rs �rrz&ParseResults.values.<locals>.<genexpr>s'�����-�-�A��Q��-�-�-�-�-�-r�r|r!s`r�valueszParseResults.valuess%���-�-�-�-������-�-�-�-rc�D���fd�����D��S)Nc3�,�K�|]}|�|fV��dSrr
rs �rrz%ParseResults.items.<locals>.<genexpr>s+�����2�2���D��G��2�2�2�2�2�2rr�r!s`rrdzParseResults.itemss%���2�2�2�2�d�i�i�k�k�2�2�2�2rc�*�t|j��S)z�
Since ``keys()`` returns an iterator, this method is helpful in bypassing
code that looks for the existence of any defined results names.)�boolr4r!s r�haskeyszParseResults.haskeyss���D�M�"�"�"rc�R�|sdg}|���D]7\}}|dkr|d|f}�td�|�����t|dt��st|��dks
|d|vr|d}||}||=|S|d}|S)a�
Removes and returns item at specified index (default= ``last``).
Supports both ``list`` and ``dict`` semantics for ``pop()``. If
passed no argument or an integer argument, it will use ``list``
semantics and pop tokens from the list of parsed tokens. If passed
a non-integer argument (most likely a string), it will use ``dict``
semantics and pop the corresponding value from any defined results
names. A second default return value argument is supported, just as in
``dict.pop()``.
Example::
numlist = Word(nums)[...]
print(numlist.parse_string("0 123 321")) # -> ['0', '123', '321']
def remove_first(tokens):
tokens.pop(0)
numlist.add_parse_action(remove_first)
print(numlist.parse_string("0 123 321")) # -> ['123', '321']
label = Word(alphas)
patt = label("LABEL") + Word(nums)[1, ...]
print(patt.parse_string("AAB 123 321").dump())
# Use pop() in a parse action to remove named result (note that corresponding value is not
# removed from list form of results)
def remove_LABEL(tokens):
tokens.pop("LABEL")
return tokens
patt.add_parse_action(remove_LABEL)
print(patt.parse_string("AAB 123 321").dump())
prints::
['AAB', '123', '321']
- LABEL: 'AAB'
['AAB', '123', '321']
rS�defaultrz-pop() got an unexpected keyword argument {!r}r_)rdr;r<r9rLr`)rr%rJr[rU�index�ret�defaultvalues r�popzParseResults.pops���P� ��4�D��L�L�N�N� � �D�A�q��I�~�~��Q���|����C�J�J�1�M�M�����d�1�g�s�#�#� �s�4�y�y�A�~�~��a��D�����G�E��u�+�C��U���J���7�L��rc��||vr||S|S)a^
Returns named result matching the given key, or if there is no
such name, then returns the given ``default_value`` or ``None`` if no
``default_value`` is specified.
Similar to ``dict.get()``.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
result = date_str.parse_string("1999/12/31")
print(result.get("year")) # -> '1999'
print(result.get("hour", "not specified")) # -> 'not specified'
print(result.get("hour")) # -> None
r
)r�key�
default_values rrYzParseResults.getFs��$�$�;�;���9�� � rc���|j�||��|j���D]7\}}t |��D]"\}\}}t||||kz��||<�#�8dS)a;
Inserts new element at location index in the list of parsed tokens.
Similar to ``list.insert()``.
Example::
numlist = Word(nums)[...]
print(numlist.parse_string("0 123 321")) # -> ['0', '123', '321']
# use a parse action to insert the parse location in the front of the parsed results
def insert_locn(locn, tokens):
tokens.insert(0, locn)
numlist.add_parse_action(insert_locn)
print(numlist.parse_string("0 123 321")) # -> [0, '0', '123', '321']
N)r3�insertr4rdrer)rr��
ins_stringrIrhr[rjrks rr�zParseResults.insert]s���"
�
���U�J�/�/�/�!%��!4�!4�!6�!6� � ��D�+�(1�+�(>�(>�
�
�$��$�E�8�!8��8�x�%�'7�8�"�"��A���
� � rc�:�|j�|��dS)a
Add single element to end of ``ParseResults`` list of elements.
Example::
numlist = Word(nums)[...]
print(numlist.parse_string("0 123 321")) # -> ['0', '123', '321']
# use a parse action to compute the sum of the parsed integers, and add it to the end
def append_sum(tokens):
tokens.append(sum(map(int, tokens)))
numlist.add_parse_action(append_sum)
print(numlist.parse_string("0 123 321")) # -> ['0', '123', '321', 444]
N)r3�append)r�items rr�zParseResults.appendvs ��
�
���T�"�"�"�"�"rc��t|t��r|�|��dS|j�|��dS)a
Add sequence of elements to end of ``ParseResults`` list of elements.
Example::
patt = Word(alphas)[1, ...]
# use a parse action to append the reverse of the matched strings, to make a palindrome
def make_palindrome(tokens):
tokens.extend(reversed([t[::-1] for t in tokens]))
return ''.join(tokens)
patt.add_parse_action(make_palindrome)
print(patt.parse_string("lskdj sdlkjf lksd")) # -> 'lskdjsdlkjflksddsklfjkldsjdksl'
N)r9r,�__iadd__r3�extend)r�itemseqs rr�zParseResults.extend�sJ���g�|�,�,� *��M�M�'�"�"�"�"�"��M� � ��)�)�)�)�)rc�L�|jdd�=|j���dS)z7
Clear all elements and results names.
N)r3r4�clearr!s rr�zParseResults.clear�s,��
�M�!�!�!���
�������rc�~� ||S#t$r(|�d��rt|���YdSwxYw)N�__r-)rN�
startswith�AttributeError)rrIs r�__getattr__zParseResults.__getattr__�sU�� ���:���� � � ����t�$�$�
+�$�T�*�*�*��2�2� ���s�
�.<�<c�8�|���}||z
}|Sr)�copy)r�otherr�s r�__add__zParseResults.__add__�s���i�i�k�k���u����
rc�p���|jr�t|j����fd��|j���}�fd�|D��}|D]?\}}|||<t |dt
��rt
|��|d_�@|xj|jz
c_|xj|jzc_|S)Nc���|dkr�n|�zSr$r
)�a�offsets �r�<lambda>z'ParseResults.__iadd__.<locals>.<lambda>�s���A��E�E�&�&�q�6�z�rc�n��g|]1\}}|D])}|t|d�|d����f��*�2S)rr_)r)rr[�vlistrU� addoffsets �rrVz)ParseResults.__iadd__.<locals>.<listcomp>�sd�������A�u������+�A�a�D�)�)�A�a�D�/�/�B�B�C����rr) r4r`r3rdr9r,rZr0r1)rr��
otheritems�otherdictitemsr[rUr�r�s @@rr�zParseResults.__iadd__�s������>� /����'�'�F�A�A�A�A�I���-�-�/�/�J����� *����N�
'�
/�
/���1���Q���a��d�L�1�1�/�#(��;�;�A�a�D�L���
�
���'�
�
����5�+�+����rc�j�t|t��r|dkr|���S||zSr$)r9rLr�)rr�s r�__radd__zParseResults.__radd__�s6���e�S�!�!� �e�q�j�j��9�9�;�;���4�<�rc��d�t|��j|j|�����S)Nz{}({!r}, {}))r<r=r'r3�as_dictr!s r�__repr__zParseResults.__repr__�s-���$�$�T�$�Z�Z�%8�$�-������X�X�Xrc�V�dd�d�|jD����zdzS)N�[z, c�t�g|]5}t|t��rt|��nt|����6Sr
)r9r,rM�repr)rrs rrVz(ParseResults.__str__.<locals>.<listcomp>�sG������)��L�9�9�F�C��F�F�F�t�A�w�w���r�])�joinr3r!s r�__str__zParseResults.__str__�sH����i�i���!�]������
��
�
rc���g}|jD]j}|r|r|�|��t|t��r||���z
}�H|�t|�����k|Sr)r3r�r9r,�
_asStringListrM)r�sep�outr�s rr�zParseResults._asStringList�s������M� &� &�D��
�s�
��
�
�3�����$��-�-�
&��t�)�)�+�+�+����
�
�3�t�9�9�%�%�%�%��
rc�$�d�|jD��S)ax
Returns the parse results as a nested list of matching tokens, all converted to strings.
Example::
patt = Word(alphas)[1, ...]
result = patt.parse_string("sldkj lsdkj sldkj")
# even though the result prints in string-like form, it is actually a pyparsing ParseResults
print(type(result), result) # -> <class 'pyparsing.ParseResults'> ['sldkj', 'lsdkj', 'sldkj']
# Use as_list() to create an actual list
result_list = result.as_list()
print(type(result_list), result_list) # -> <class 'list'> ['sldkj', 'lsdkj', 'sldkj']
c�d�g|]-}t|t��r|���n|��.Sr
)r9r,�as_list)r�ress rrVz(ParseResults.as_list.<locals>.<listcomp>�sC��
�
�
��(��\�:�:�C�C�K�K�M�M�M��
�
�
r)r3r!s rr�zParseResults.as_list�s%��
�
��}�
�
�
�
rc�h���fd��t�fd�|���D����S)a�
Returns the named parse results as a nested dictionary.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
result = date_str.parse_string('12/31/1999')
print(type(result), repr(result)) # -> <class 'pyparsing.ParseResults'> (['12', '/', '31', '/', '1999'], {'day': [('1999', 4)], 'year': [('12', 0)], 'month': [('31', 2)]})
result_dict = result.as_dict()
print(type(result_dict), repr(result_dict)) # -> <class 'dict'> {'day': '1999', 'year': '12', 'month': '31'}
# even though a ParseResults supports dict-like access, sometime you just need to have a dict
import json
print(json.dumps(result)) # -> Exception: TypeError: ... is not JSON serializable
print(json.dumps(result.as_dict())) # -> {"month": "31", "day": "1999", "year": "12"}
c���t|t��r6|���r|���n
�fd�|D��S|S)Nc�&��g|]
}�|����Sr
r
)rrU�to_items �rrVz9ParseResults.as_dict.<locals>.to_item.<locals>.<listcomp>s!���;T�;T�;T�1�G�G�A�J�J�;T�;T�;Tr)r9r,r�r�)�objr�s �rr�z%ParseResults.as_dict.<locals>.to_item
sO����#�|�,�,�
�(+���
�
�T�s�{�{�}�}�}�;T�;T�;T�;T�PS�;T�;T�;T�T��
rc3�8�K�|]\}}|�|��fV��dSrr
)rr[rUr�s �rrz'ParseResults.as_dict.<locals>.<genexpr>s3�����=�=���1�Q����
�
�O�=�=�=�=�=�=r)rGrd)rr�s @rr�zParseResults.as_dict�sI���* � � � � ��=�=�=�=��
�
���=�=�=�=�=�=rc���t|j��}|j���|_|j|_|xj|jzc_|j|_|S)zG
Returns a new copy of a :class:`ParseResults` object.
)r,r3r4r�r0r1r/)rr�s rr�zParseResults.copysQ���4�=�)�)���}�)�)�+�+����l������$�/�)����J�� ��
rc���|jr|jS|jr(|�����fd�}�r||��ndSt|��dkr�t|j��dkrtt t|j�������dddvr3t t|j�������SdS)a
Returns the results name for this token expression. Useful when several
different expressions might match at a particular location.
Example::
integer = Word(nums)
ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
house_number_expr = Suppress('#') + Word(nums, alphanums)
user_data = (Group(house_number_expr)("house_number")
| Group(ssn_expr)("ssn")
| Group(integer)("age"))
user_info = user_data[1, ...]
result = user_info.parse_string("22 111-22-3333 #221B")
for item in result:
print(item.get_name(), ':', item[0])
prints::
age : 22
ssn : 111-22-3333
house_number : 221B
c�l���t�fd��j���D��d��S)Nc3�:�K�|]\}}|D]
\}}�|u� |V���dSrr
)rr[r�rU�locr\s �rrz@ParseResults.get_name.<locals>.find_in_parent.<locals>.<genexpr>@sS�������$�A�u�&+���#�A�s��!�8�8��$�8�8�8�8� �r)�nextr4rd)r\�pars`�r�find_in_parentz-ParseResults.get_name.<locals>.find_in_parent>sO���������(+��(:�(:�(<�(<�������rNr_r)rrS)r/r0r`r4r�rvr�r|)rr�r�s @r�get_namezParseResults.get_name s����2�:� ��:��
�\� ��,�,�.�.�C�
�
�
�
�
�,/�8�>�>�$�'�'�'�D�8���I�I��N�N��D�M�"�"�a�'�'��T�$�-�.�.�0�0�1�1�2�2�1�5�a�8�G�C�C���T�]�/�/�1�1�2�2�3�3�3��4rrc�t�g}d}|�|r$|t|�����znd��|�r�|����rt d�|���D����}|D]�\}} |r|�|��|�d�|d|z|����t| t��rU| r0|�| � ||||dz�������|�t| ������|�t| ������td�|D����r�|} t| ��D]�\}
}t|t��rQ|�d �|d|z|
|d|dzz|� ||||dz��������k|�d
|d|z|
|d|dzzt|��fz����d�
|��S)aM
Diagnostic method for listing out the contents of
a :class:`ParseResults`. Accepts an optional ``indent`` argument so
that this string can be embedded in a nested display of other data.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
result = date_str.parse_string('1999/12/31')
print(result.dump())
prints::
['1999', '/', '12', '/', '31']
- day: '31'
- month: '12'
- year: '1999'
�
r-c3�>K�|]\}}t|��|fV��dSr)rM)rr[rUs rrz$ParseResults.dump.<locals>.<genexpr>ns0����D�D�t�q�!��A����{�D�D�D�D�D�Drz
{}{}- {}: z r_)�indent�full�include_list�_depthc3�@K�|]}t|t��V��dSr)r9r,)r�vvs rrz$ParseResults.dump.<locals>.<genexpr>�s,����?�?�B�:�b�,�/�/�?�?�?�?�?�?rz
{}{}[{}]:
{}{}{}z
%s%s[%d]:
%s%s%s)r�rMr�r��sortedrdr<r9r,�dumpr��anyrer�)rr�r�r�r�r��NLrdr[rUrr�s rr�zParseResults.dumpSs���*��
���
�
�<�G�6�C������/�/�/�/�R�H�H�H��3 ��|�|�~�~�
,��D�D�t�z�z�|�|�D�D�D�D�D��!�,�,�D�A�q��'��
�
�2�����J�J�|�2�2�6�D�6�M�A�N�N�O�O�O�!�!�\�2�2�
,��
/��J�J� !���+1�)-�1=�+1�A�:� !'�!"�!"����� �J�J�s�1�v�v�.�.�.�.��
�
�4��7�7�+�+�+�+��?�?�$�?�?�?�?�?�
���&�q�\�\���E�A�r�!�"�l�3�3���
�
�1�8�8� &�!%��� !� &�!%��!��!4� "���+1�)-�1=�+1�A�:� !(�!"�!"�
������ �
�
�1� &�!%��� !� &�!%��!��!4� #�B���
��
�
�
�
��w�w�s�|�|�rc�T�tj|���g|�Ri|��dS)a%
Pretty-printer for parsed results as a list, using the
`pprint <https://docs.python.org/3/library/pprint.html>`_ module.
Accepts additional positional or keyword args as defined for
`pprint.pprint <https://docs.python.org/3/library/pprint.html#pprint.pprint>`_ .
Example::
ident = Word(alphas, alphanums)
num = Word(nums)
func = Forward()
term = ident | num | Group('(' + func + ')')
func <<= ident + Group(Optional(delimited_list(term)))
result = func.parse_string("fna a,b,(fnb c,d,200),100")
result.pprint(width=40)
prints::
['fna',
['a',
'b',
['(', 'fnb', ['c', 'd', '200'], ')'],
'100']]
N)�pprintr�)rr%rJs rr�zParseResults.pprint�s2��2 �
�d�l�l�n�n�6�t�6�6�6�v�6�6�6�6�6rc��|j|j���|jdur|���pd|j|jffSr)r3r4r�r0r1r/r!s rr"zParseResults.__getstate__�sM���M��
�"�"�$�$���D�(�;�T�\�\�^�^�C�t����
�
�
�
rc��|\|_\|_}}|_t|��|_|�t|��|_dSd|_dSr)r3r4r/rEr1rZr0)r�stater��inAccumNamess rr&zParseResults.__setstate__�sK��HM�E��
�E��
�s�L�$�*��l�+�+����?� ��:�:�D�L�L�L��D�L�L�Lrc��|j|jfSr)r3r/r!s r�__getnewargs__zParseResults.__getnewargs__�s���}�d�j�(�(rc�~�tt|����t|�����zSr)�dirr=r:r|r!s r�__dir__zParseResults.__dir__�s)���4��:�:����d�i�i�k�k�!2�!2�2�2rc ��d�}|g��}|���D]P\}}t|t��r||�||���z
}�5|||g|||�����z
}�Q|�||g|���}|S)z�
Helper classmethod to construct a ``ParseResults`` from a ``dict``, preserving the
name-value relations as results names. If an optional ``name`` argument is
given, a nested ``ParseResults`` will be returned.
c�p� t|��t|t��S#t$rYdSwxYw)NF)rvr9r
� Exception)r�s r�is_iterablez+ParseResults.from_dict.<locals>.is_iterable�sK��
5��S� � � �&�c�8�4�4�4�4���
�
�
��u�u�
���s�'�
5�5)rI)rIrP)rdr9r� from_dict)r?r�rIr�r�r[rUs rr�zParseResults.from_dict�s��� 5� 5� 5��c�"�g�g���K�K�M�M� ?� ?�D�A�q��!�W�%�%�
?��s�}�}�Q�Q�}�/�/�/����s�s�A�3�Q�{�{�1�~�~�>�>�>�>������#�s�e�$�'�'�'�C��
r)NNr)rmr,)r-)r-TTr);r'r(r)rAr.rr �__annotations__r*r:rBr>r9rrr]rlr�rorLrqrsrrwrzr|r�rdr�r�rYr�r�r�r�r�r�r�r�rMr�r�r�r�rGr�r�r�r�r�r"r&r�r��classmethodr�rP�asDict�getNamer
rrr,r,s��������+�+�Z&*�2�r�2�$6�L�%��S��/�6�6�6����I�1%�1%�1%�1%�1%�t�1%�1%�1%�f����0��d�$�:�.�.�.�.�@F�F�F�,6�
&�
&�
&�
&�!�!�!�."��"�"�"�"�"��"�"�"�"�8�$�8�8�8�8�#�(�#�#�#�#�)�h�)�)�)�)�#�#�#�.�.�.�3�3�3�#��#�#�#�#�8 �8 �8 �t!�!�!�!�.���2#�#�#�"*�*�*�(����������
����& � � � �Y�#�Y�Y�Y�Y�
��
�
�
�
� � � � �
��
�
�
�
�(>��>�>�>�>�: � � � �1�1�1�fN�N��N�N�N�N�`7�7�7�8
�
�
� � � �)�)�)�3�3�3�������[��2�F�
�F��G�G�Grr,)�collections.abcrrrrr��weakrefrrZ�typingrr rM�bytesr
r=r�rFrr,�registerr
rr�<module>r�s��N�N�N�N�N�N�N�N�N�N�N�N�N�
�
�
�
� � � � � � ���������!�5�\��%��c� �
�)�)�)��$���2����'�'��
�
�
�
�
�
�
�
� Y�Y�Y�Y�Y�Y�Y�Y�x����%�%�%�����&�&�&�&�&r |