%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/orca/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/orca/__pycache__/find.cpython-312.pyc

�

g
f�#���dZdZdZdZdZdZddlZddlZdd	lm	Z	dd
lm
Z
ddlmZddlmZdd
l
mZGd�d�ZGd�d�Zd�Zy)z(Provides support for a flat review find.z$Id$z
$Revision$z$Date$zLCopyright (c) 2006-2008 Sun Microsystems Inc.Copyright (c) 2022 Igalia, S.L.�LGPL�N�)�debug)�messages)�
orca_state)�script_manager)�Contextc�"�eZdZdZd�Zd�Zd�Zy)�_SearchQueryMatchzRepresents a SearchQuery match.c���|j|_|j|_|j|_|j|_||_|jtj�d|_y)Nr)
�	lineIndex�_line�	zoneIndex�_zone�	wordIndex�_word�	charIndex�_char�_pattern�
getCurrentr	�LINE�_lineString)�self�context�patterns   �+/usr/lib/python3/dist-packages/orca/find.py�__init__z_SearchQueryMatch.__init__-sY���&�&��
��&�&��
��&�&��
��&�&��
���
�"�-�-�g�l�l�;�A�>���c��d|j|j|j|j|j|j
fzS)NzFSEARCH QUERY MATCH: '%s' (line %i, zone %i, word %i, char %i) for '%s')rrrrrr�rs r�__str__z_SearchQueryMatch.__str__5s>��W��!�!�4�:�:�t�z�z�4�:�:�t�z�z�SW�S`�S`�a�b�	brc��|sy|j|jk(xrj|j|jk(xrO|j|jk(xr4|j|jk(xr|j|jk(S)NF)rrrrr)r�others  r�__eq__z_SearchQueryMatch.__eq__9sy�������5�#4�#4�4�)��z�z�U�[�[�(�)��z�z�U�[�[�(�)��z�z�U�[�[�(�)��z�z�U�[�[�(�		)rN)�__name__�
__module__�__qualname__�__doc__rr!r$�rrrr*s��)�?�b�)rrc�L�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
y)
�SearchQueryz3Represents a search that the user wants to perform.c��d|_d|_d|_d|_d|_d|_tj|_gd�|_	d|_
d|_y)a�Creates a new SearchQuery. A searchQuery has the following
           properties:

           searchString     - the string to find
           searchBackwards  - if true, search upward for matches
           caseSensitive    - if true, case counts
           matchEntireWord  - if true, only match on the entire string
           startAtTop       - if true, begin the search from the top of
                              the window, rather than at the current
                              location
           windowWrap       - if true, when the top/bottom edge of the
                              window is reached wrap to the bottom/top
                              and continue searching
        �F�rrrrN)�searchString�searchBackwards�
caseSensitive�matchEntireWord�
windowWrap�
startAtTopr�
LEVEL_INFO�
debugLevel�_contextLocation�_match�_wrappedr s rrzSearchQuery.__init__FsU�� ���$���"���$����������*�*��� ,��������
rc��d|j�d�}g}|jr|jd�|jr|jd�|jr|jd�|j
r|jd�|jr|jd�|r|dd	j|���z
}|jr|d
|j��z
}|S)Nz
FIND QUERY: 'z'.zsearch backwardszcase sensitivezmatch entire word�wrapzstart at topz
 Options: z, z
 Last match: )	r/r0�appendr1r2r3r4�joinr8)r�string�optionss   rr!zSearchQuery.__str__as��� ��!2�!2� 3�2�6��������N�N�-�.�����N�N�+�,�����N�N�.�/��?�?��N�N�6�"��?�?��N�N�>�*���
�4�9�9�W�#5�"6�7�7�F��;�;��
�d�k�k�]�3�3�F��
rc�X�tjsytjjS�N)r�searchQueryr8r s r�
previousMatchzSearchQuery.previousMatchts ���%�%���%�%�,�,�,rc�j�|j|j|j|jg|_yrA)r
rrrr7�rrs  r�_saveContextLocationz SearchQuery._saveContextLocationys0��!(�!2�!2�!(�!2�!2�!(�!2�!2�!(�!2�!2�!4��rc�H�|j|j�gd�|_y)Nr.)�
setCurrentr7rEs  r�_restoreContextLocationz#SearchQuery._restoreContextLocations ������D�1�1�2� ,��rc�j�|tjk(rd}n-|tjk(rd}n|tjk(rd}ny|j	|�d}tj||�}d|�d|jdd	��d
|��}tj|j|d�t|�S)Nr�ZONE�WORDFrzFIND: z='�
z\nz
'. Match: T)r	rrKrLr�re�search�replacer�printlnr6�bool)rrr�contextType�
typeStringr>�match�msgs        r�_currentContextMatchesz"SearchQuery._currentContextMatches�s����'�,�,�&��J�
�G�L�L�
(��J�
�G�L�L�
(��J���#�#�K�0��3���	�	�'�6�*��,6����t�U�8S�UZ�[��
�
�
�d�o�o�s�D�1��E�{�rc�H�|tjk(rh|jr.|jtjtj�S|jtjtj�S|tjk(r�|jrO|jtjtj�}|jtj�|S|jtjtj�S|tjk(�rw|jrN|jtjtj�}|jtj�n.|jtjtj�}|ry|jr|jryd|_
tj�j�}|jrO|jtj �|jtjtj"�}|S|jtj$�|jtjtj"�}|Sy)NTF)r	rLr0�
goPrevious�	WRAP_LINE�goNextrK�goEndrr3r9r�
getManager�getActiveScript�presentMessager�WRAPPING_TO_BOTTOM�WRAP_ALL�WRAPPING_TO_TOP)rrrS�moved�scripts     r�_movezSearchQuery._move�s����'�,�,�&��#�#��)�)�'�,�,��8I�8I�J�J��>�>�'�,�,��0A�0A�B�B��'�,�,�&��#�#��*�*�7�<�<��9J�9J�K���
�
�g�l�l�+����>�>�'�,�,��0A�0A�B�B��'�,�,�&��#�#��*�*�7�<�<��9J�9J�K���
�
�g�l�l�+����w�|�|�W�5F�5F�G�����?�?�d�m�m�� �D�M�#�.�.�0�@�@�B�F��#�#��%�%�h�&A�&A�B��*�*�7�<�<��9I�9I�J���L��%�%�h�&>�&>�?����w�|�|�W�5E�5E�F���L�rc��|j|||�}|s+|j||�s	|S|j|||�}|s�+|SrA)rWre)rrrrS�founds     r�_findMatchInzSearchQuery._findMatchIn�sS���+�+�G�W�k�J����:�:�g�{�3�����/�/���+�N�E��
�rc��|j||tj�sy|j||tj�sy|j||tj�sy|j�syt
||�}||j�k7ry|j|tj�r"|j||tj�ry|j|tj�r"|j||tj�ry|j|tj�r|j||�Sy)NFT)	rhr	rrKrLrCrre�
_findMatch)rrr�candidateMatchs    rrjzSearchQuery._findMatch�s���� � ��'�7�<�<�@��� � ��'�7�<�<�@��� � ��'�7�<�<�@���!�!�#��*�7�G�<���T�/�/�1�1���:�:�g�w�|�|�,��!�!�'�7�G�L�L�A���:�:�g�w�|�|�,��!�!�'�7�G�L�L�A���:�:�g�w�|�|�,��?�?�7�G�4�4�rc��tj|jt|�d�tj
}|js|tjz}|jrd|jzdz}n|j}t	j||�}|j|�|jr|jtj�d}|j!||�r?|j|�t#||�|_d|_t)j(|�}n|j+|�t)j(|�t,_|S)z�Performs a search on the string specified in searchQuery.

           Arguments:
           - context: The context from active script

           Returns:
           - The context of the match, if found
        Tz\bNF)rrQr6�strrN�Ur1�
IGNORECASEr2r/�compilerFr4�goBeginr	�WINDOWrjrr8r9�copyrIrrB)rr�flags�regexpr�locations      r�	findQueryzSearchQuery.findQuery�s��	�
�
�d�o�o�s�4�y�$�7������!�!��B�M�M�)�E�����T�.�.�.��6�F��&�&�F��*�*�V�U�+���!�!�'�*��?�?��O�O�G�N�N�+����?�?�7�G�,��%�%�g�.�+�G�W�=�D�K�!�D�M��y�y��)�H��(�(��1�!%���4��
���rN)r%r&r'r(rr!rCrFrIrWrerhrjrwr)rrr+r+Cs8��=��6�&-�
4�-�� !�F��<!rr+c�L�tjtj�}|S)z�Grabs the last search query performed from orca_state.

       Returns:
       - A copy of the last search query, if it exists
    )rsrrB)�	lastQuerys r�getLastQueryrzs���	�	�*�0�0�1�I��r)r(�__id__�__version__�__date__�
__copyright__�__license__rsrNr-rrrr�flat_reviewr	rr+rzr)rr�<module>r�sX��*/�������2�
����	����� �)�)�2{�{�zr

Zerion Mini Shell 1.0