ok

Mini Shell

Direktori : /opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/__pycache__/shlex.cpython-311.pyc

�

�f�4���dZddlZddlZddlZddlmZddlmZgd�ZGd�d��Z	dd
�Z
d�Zejdej
��jZd
�Zd�Zedkrqeej��dkree	����dSejdZee��5Zee	ee����ddd��dS#1swxYwYdSdS)�8A lexical analyzer class for simple shell-like syntaxes.�N)�deque)�StringIO)�shlex�split�quote�joinc�n�eZdZdZ		dd�Zed���Zd�Zdd�Zd�Z	d	�Z
d
�Zd�Zdd�Z
d
�Zd�ZdS)rrNFc��t|t��rt|��}|�||_||_nt
j|_d|_||_|rd|_nd|_d|_	d|_
|jr|xj
dz
c_
d|_d|_d|_
d|_d	|_d
|_t#��|_d|_d|_d|_t#��|_d|_|sd}n|d
urd}||_|rvt#��|_|xj
dz
c_
|j
�t6�|����}|j
�|��|_
dSdS)N��#�?abcdfeghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_u|ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞz 	
Fz'"�\�"� �rTz();<>|&z~-./*?=)�
isinstance�strr�instream�infile�sys�stdin�posix�eof�
commenters�	wordchars�
whitespace�whitespace_split�quotes�escape�
escapedquotes�stater�pushback�lineno�debug�token�	filestack�source�_punctuation_chars�_pushback_chars�	maketrans�dict�fromkeys�	translate)�selfrrr�punctuation_chars�ts      �,/opt/alt/python311/lib64/python3.11/shlex.py�__init__zshlex.__init__s����h��$�$�	*���)�)�H���$�D�M� �D�K�K��I�D�M��D�K���
��	��D�H�H��D�H����B����:�	_��N�N� ^�
_�N�N�#��� %��������� �����
�����
������
���
��������� �	*� "���
�$�
&�
&� )��"3����	9�#(�7�7�D� ��N�N�i�'�N�N���(�(����7H�)I�)I�J�J�A�!�^�5�5�a�8�8�D�N�N�N�	9�	9�c��|jS�N)r)�r/s r2r0zshlex.punctuation_charsDs���&�&r4c��|jdkrtdt|��z��|j�|��dS)z:Push a token onto the stack popped by the get_token methodrzshlex: pushing token N)r%�print�reprr#�
appendleft)r/�toks  r2�
push_tokenzshlex.push_tokenHsC���:��?�?��)�D��I�I�5�6�6�6��
� � ��%�%�%�%�%r4c�F�t|t��rt|��}|j�|j|j|jf��||_||_d|_|jr4|�td|j����dStd|j����dSdS)z9Push an input source onto the lexer's input source stack.rNzshlex: pushing to file zshlex: pushing to stream )
rrrr'r;rrr$r%r9)r/�	newstream�newfiles   r2�push_sourcezshlex.push_sourceNs����i��%�%�	,� ��+�+�I���!�!�4�;��
�t�{�"K�L�L�L����!��
�����:�	H��"���T�[�[�B�C�C�C�C�C���t�}�}�F�G�G�G�G�G�		H�	Hr4c���|j���|j���\|_|_|_|jrtd|j|jfz��d|_dS)zPop the input source stack.zshlex: popping to %s, line %drN)	r�closer'�popleftrr$r%r9r"r7s r2�
pop_sourcezshlex.pop_source\sq���
������48�N�4J�4J�4L�4L�1���d�m�T�[��:�	2��1��]�D�K�0�1�
2�
2�
2���
�
�
r4c���|jrE|j���}|jdkrtdt	|��z��|S|���}|j�n||jkrc|�|�����}|r|\}}|�||��|�	��}||jk�c||j
krA|js|j
S|���|�	��}||j
k�A|jdkr:||j
kr tdt	|��z��ntd��|S)zBGet a token from the input stream (or from stack if it's nonempty)rzshlex: popping token Nz
shlex: token=zshlex: token=EOF)
r#rDr%r9r:�
read_tokenr(�
sourcehookrA�	get_tokenrr'rE)r/r<�raw�specr@r?s      r2rIzshlex.get_tokenes`���=�	��-�'�'�)�)�C��z�Q����-��S�	�	�9�:�:�:��J��o�o�����;�"����$�$����t���'8�'8�9�9���9�+/�(�W�i��$�$�Y��8�8�8��n�n�&�&�����$�$��T�X�o�o��>�
'��x�����!�!�!��n�n�&�&���T�X�o�o��:��?�?��d�h����o��S�	�	�1�2�2�2�2��(�)�)�)��
r4c�"
�d}d}	|jr!|jr|j���}n|j�d��}|dkr|xjdz
c_|jdkrtd|j�d|����|j�	d	|_	�n!|jdk�r|s	d|_�n
||j
vr-|jd
krtd��|j	s	|jr|r�nՌ�||jvr+|j�
��|xjdz
c_�n�|jr||jvrd}||_�n�||jvr||_	d|_�nj||jvr||_	d
|_�nQ||jvr|js||_	||_�n1|jr||_	d|_�n||_	|j	s	|jr|r�n���|j|jvr�d}|s)|jd
krtd��t%d���||jkr)|js|xj	|z
c_	d|_�n�d|_�n�|jr'||jvr|j|jvr|j}||_�nb|xj	|z
c_	�nP|j|jvrs|s)|jd
krtd��t%d���||jvr&||jkr||kr|xj	|jz
c_	|xj	|z
c_	||_�n�|jdv�r�|s	d|_�n�||j
vr5|jd
krtd��d|_|j	s	|jr|r�n���1||jvrM|j�
��|xjdz
c_|jrd|_|j	s	|jr|r�n,����n&|jd
krF||jvr|xj	|z
c_	�n||j
vr|j�|��d|_n�|jr||jvr||_n�|jr||jvr
d}||_n�||jvs||jvs|jr||jvr|xj	|z
c_	np|jr|j�|��n|j�|��|jd
krtd��d|_|j	s	|jr|rn������|j	}d	|_	|jr
|s|d	krd}|jdkr1|r tdt/|��z��ntd��|S)NFrTr�
�zshlex: in state z I see character: r�z+shlex: I see whitespace in whitespace state�a�cz shlex: I see EOF in quotes statezNo closing quotationz shlex: I see EOF in escape statezNo escaped character)rPrQz%shlex: I see whitespace in word statez&shlex: I see punctuation in word statezshlex: raw token=zshlex: raw token=EOF)r0r*�popr�readr$r%r9r"r&rrr�readliner rrr�
ValueErrorr!�appendr#r;r:)r/�quoted�escapedstate�nextchar�results     r2rGzshlex.read_token�s"������C	!��%�
1�$�*>�
1��/�3�3�5�5����=�-�-�a�0�0���4������q� ����z�Q�����$�*�*�*�BJ�(�L�M�M�M��z�!���
����s�"�"��"!�!%�D�J�����0�0��z�Q����K�L�L�L��z�!�d�j�!�V�!�� ����0�0��M�*�*�,�,�,��K�K�1�$�K�K�K��Z�!�H���$;�$;�#&�L�!)�D�J�J����/�/�!)�D�J�!$�D�J�J���!7�7�7�!)�D�J�!$�D�J�J����,�,��:�.�%-��
�!)�D�J�J��*�!�!)�D�J�!$�D�J�J�!)�D�J��z�!�d�j�!�V�!�� ���t�{�*�*����=��z�Q����@�A�A�A�$�%;�<�<�<��t�z�)�)��:�)��
�
�h�.�
�
�%(��
��%(��
�
��j�+�X���%<�%<����+�B,�B,�#'�:�L�!)�D�J�J��J�J�(�*�J�J�J���t�{�*�*��=��z�Q����@�A�A�A�$�%;�<�<�<�!�D�K�/�/� �D�J�.�.�8�|�3K�3K��J�J�$�*�,�J�J��
�
�h�&�
�
�)��
�
���z�)�)��0!�!%�D�J�����0�0��z�Q����E�F�F�F�!$�D�J��z�!�d�j�!�V�!�� ����0�0��M�*�*�,�,�,��K�K�1�$�K�K��z�%�%(��
��:�%�$�*�%��%�!�$�%��Z�3�&�&��4�#9�9�9��
�
�h�.�
�
�
�#�4�?�:�:� �0�7�7��A�A�A�%(��
���Z�!�H���$;�$;�!)�D�J�J��Z�!�H���$;�$;�#&�L�!)�D�J�J��$�.�0�0�H���4K�4K��/�5L�"�$�*@�@�@��J�J�(�*�J�J�J��-�;��,�3�3�H�=�=�=�=��
�0�0��:�:�:��z�Q����F�G�G�G�!$�D�J��z�!�d�j�!�V�!�� �GC	!�H�����
��:�	�f�	��2����F��:��>�>��
.��)�D��L�L�8�9�9�9�9��,�-�-�-��
r4c�H�|ddkr
|dd�}t|jt��ratj�|��sBtj�tj�|j��|��}|t|d��fS)z(Hook called on a filename to be sourced.rrr����r)	rrr�os�path�isabsr	�dirname�open)r/r@s  r2rHzshlex.sourcehooks����1�:�����a��d�m�G��d�k�3�'�'�	J���
�
�g�0F�0F�	J��g�l�l�2�7�?�?�4�;�#?�#?��I�I�G���g�s�+�+�,�,r4c�4�|�|j}|�|j}d||fzS)z<Emit a C-compiler-like, Emacs-friendly error-message leader.Nz"%s", line %d: )rr$)r/rr$s   r2�error_leaderzshlex.error_leader s*���>��[�F��>��[�F�"�f�f�%5�5�5r4c��|Sr6�r7s r2�__iter__zshlex.__iter__(s���r4c�R�|���}||jkrt�|Sr6)rIr�
StopIteration)r/r&s  r2�__next__zshlex.__next__+s)����� � ���D�H������r4)NNFFr6)NN)�__name__�
__module__�__qualname__�__doc__r3�propertyr0r=rArErIrGrHrdrgrjrfr4r2rrs�������>�>�9>�#(�-9�-9�-9�-9�^�'�'��X�'�&�&�&�H�H�H�H�������@P�P�P�d-�-�-�6�6�6�6��������r4rFTc��|�!ddl}|�dtd���t||���}d|_|sd|_t
|��S)	z-Split the string *s* using shell-like syntax.Nrz4Passing None for 's' to shlex.split() is deprecated.rO)�
stacklevel)rTr)�warnings�warn�DeprecationWarningrrr�list)�s�commentsrrr�lexs     r2rr1sh���y������
�
�L�(�Q�	�	8�	8�	8�
���
�
�
�C��C���������9�9�r4c�@�d�d�|D����S)z3Return a shell-escaped string from *split_command*.rc3�4K�|]}t|��V��dSr6)r)�.0�args  r2�	<genexpr>zjoin.<locals>.<genexpr>@s(����8�8�3�E�#�J�J�8�8�8�8�8�8r4)r	)�
split_commands r2r	r	>s#���8�8�8�8�-�8�8�8�8�8�8r4z[^\w@%+=:,./-]c�d�|sdSt|���|Sd|�dd��zdzS)z1Return a shell-escaped version of the string *s*.z''N�'z'"'"')�_find_unsafe�replace)rvs r2rrEs@�����t��A����������3�	�*�*�*�S�0�0r4c�t�	|���}|sdStdt|��z���8)NrzToken: )rIr9r:)�lexer�tts  r2�
_print_tokensr�QsA��$�
�_�_�
�
���	��E�
�i�$�r�(�(�"�#�#�#�	$r4�__main__r)FT)rnr^�rer�collectionsr�ior�__all__rrr	�compile�ASCII�searchr�rr�rk�len�argv�fnrb�frfr4r2�<module>r�s���>�>�
�	�	�	�	�	�	�	�
�
�
�
�������������
-�
-�
-��\�\�\�\�\�\�\�\�|
�
�
�
�9�9�9�
�r�z�+�R�X�6�6�=��	1�	1�	1�$�$�$��z���
�s�3�8�}�}�����
�e�e�g�g������
�X�a�[��
�T�"�X�X�	(���M�%�%��2�,�,�'�'�'�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(����	(�	(�	(�	(�	(�	(��s�B>�>C�C

Zerion Mini Shell 1.0