AlkantarClanX12
Current Path : /proc/self/root/opt/alt/python33/lib64/python3.3/idlelib/__pycache__/ |
Current File : //proc/self/root/opt/alt/python33/lib64/python3.3/idlelib/__pycache__/HyperParser.cpython-33.pyo |
� ��fB) c @ sE d Z d d l Z d d l Z d d l m Z Gd d � d � Z d S( uk HyperParser =========== This module defines the HyperParser class, which provides advanced parsing abilities for the ParenMatch and other extensions. The HyperParser uses PyParser. PyParser is intended mostly to give information on the proper indentation of code. HyperParser gives some information on the structure of code, used by extensions to help the user. i N( u PyParsec B s� | Ee Z d Z d d � Z d d � Z d d � Z d d � Z d d d d � Z d Z e j e j d Z e j d Z d d � Z d d � Z d S( u HyperParserc s� | � _ | j � _ } t j | j | j � } d d � } | | j | � � } | j sx� | j D]� } t | | d � } t | � d } d | } | j | j | | � d � | j | j | � � } | d k s� | d k re Pqe qe W| j | p� d � n_ | j d | � } | r(| d } n d } d | } | j | j | | � d � | j d � | j d d � � _ | � _ | j � � _ � f d d � t t � j � � D� � _ � j | � d S( u[ Initialize the HyperParser to analyze the surroundings of the given index. c S s t t | � � S( N( u intu float( u index( ( u8 /opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyu index2line s u( HyperParser.__init__.<locals>.index2linei u .0u %d.endu i u consoleu 1.0Ni c sB g | ]8 } | d k o; � j | d � j | d d k � q S( i i ( u bracketing( u .0u i( u self( u8 /opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyu <listcomp>C s u( HyperParser.__init__.<locals>.<listcomp>i����( u editwinu textu PyParseu Parseru indentwidthu tabwidthu indexu context_use_ps1u num_context_linesu maxu repru set_stru getu find_good_parse_startu _build_char_in_string_funcu Noneu set_lou tag_prevrangeu stru rawtextu stopatindexu get_last_stmt_bracketingu bracketingu rangeu lenu isopeneru set_index( u selfu editwinu indexu textu parseru index2lineu lnou contextu startatu startatindexu stopatindexu bodu r( ( u selfu8 /opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyu __init__ s: u HyperParser.__init__c C s t | j � t | j j | | j � � } | d k rF t d � � n | | _ d | _ xP | j t | j � d k r� | j | j d d | j k r� | j d 7_ q[ W| j t | j � d k r| j | j d d | j k r| j | j d r| j d 7_ n d S( ui Set the index to which the functions relate. Note that it must be in the same statement. i u0 The index given is before the analyzed statementi N( u lenu rawtextu textu getu stopatindexu ValueErroru indexinrawtextu indexbracketu bracketingu isopener( u selfu indexu indexinrawtext( ( u8 /opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyu set_indexH s + !!u HyperParser.set_indexc C s/ | j | j o. | j | j | j d d k S( u5 Is the index given to the HyperParser is in a string?i u "u '( u "u '( u isopeneru indexbracketu rawtextu bracketing( u self( ( u8 /opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyu is_in_string[ s u HyperParser.is_in_stringc C s0 | j | j p/ | j | j | j d d k S( u: Is the index given to the HyperParser is in a normal code?i u #u "u '( u #u "u '( u isopeneru indexbracketu rawtextu bracketing( u self( ( u8 /opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyu is_in_codeb s u HyperParser.is_in_codeu ([{c C s� | j | j d } | j } x{ | j | sc | j | j | d | k sc | j | d | k r� | d 8} | d k r} d St | | j | d � } q W| j d } x: | t | j � k r� | j | d | k r� | d 7} q� W| j j d | j t | j � | j | d f � } | t | j � k sQ| j | d t | j � k rg| r[d S| j } n; | j j d | j t | j � | j | d d f � } | | f S( u� If the index given to the HyperParser is surrounded by a bracket defined in openers (or at least has one before it), return the indices of the opening bracket and the closing bracket (or the end of line, whichever comes first). If it is not surrounded by brackets, or the end of line comes before the closing bracket and mustclose is True, returns None. i i u %s-%dcN( u bracketingu indexbracketu isopeneru rawtextu Noneu minu lenu textu indexu stopatindex( u selfu openersu mustcloseu bracketinglevelu beforeu afteru beforeindexu afterindex( ( u8 /opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyu get_surrounding_bracketsh s0 + )u$ HyperParser.get_surrounding_bracketsu \u _c C s� | } x1 | | k r9 | | d | j k r9 | d 8} q W| | k r{ | | | j k sr t j | | | � � r{ | } n | | S( Ni ( u _id_charsu _id_first_charsu keywordu iskeyword( u selfu stru limitu posu i( ( u8 /opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyu _eat_identifier� s & u HyperParser._eat_identifierc C su | j � s t d � � n | j } | j } | j } | | d } | j } | } d } xx� | | k r� | | d | j k r� | d 8} q_ | r� | | k r� | | d d k r� | d 8} d } q_ | | k r*| d k r*| | | d d d k r*| d 8} | | d } | | d d } q_ Pq_ | s8Pn | j | | | � } | rl| | } | } d } q\ | | k r`| | d } x2 | d k r�| | d d | k r�| d 8} q�W| | d | k r�Pn | | d } | d 8} | | d } | } | | d k rqa| | d k r\x. | d k rR| | d d k rR| d 8} q%W| } n Pq\ Pq\ | | | j � S( u� Return a string with the Python expression which ends at the given index, which is empty if there is no real one. u? get_expression should only be called if index is inside a code.i i u .u #i u ([u '"u rRbBuUTF( u is_in_codeu ValueErroru rawtextu bracketingu indexbracketu indexinrawtextu Trueu _whitespace_charsu _eat_identifieru False( u selfu rawtextu bracketingu brck_indexu brck_limitu posu last_identifier_posu postdot_phaseu retu level( ( u8 /opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyu get_expression� sb # ' # u HyperParser.get_expressionNF( u __name__u __module__u __qualname__u __init__u set_indexu is_in_stringu is_in_codeu Falseu get_surrounding_bracketsu _whitespace_charsu stringu ascii_lettersu digitsu _id_charsu _id_first_charsu _eat_identifieru get_expression( u __locals__( ( u8 /opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyu HyperParser s 7' u HyperParser( u __doc__u stringu keywordu idlelibu PyParseu HyperParser( ( ( u8 /opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyu <module> s