3
-(#[ó  ã               @   sh   d dl mZ d dlmZ d dlmZ G dd„ deƒZG dd„ deeƒZe	dkrdeƒ Z
e
jƒ  e
jƒ  d	S )
é    )ÚDEFAULT_DEBUG)ÚPythonParserSingle)ÚPython15Parserc                   s@   e Zd Zdd„ Zef‡ fdd„	Z‡ fdd„Z‡ fdd„Z‡  ZS )	ÚPython14Parserc             C   s   dS )aU  
        # Not much here yet, but will probably need to add UNARY_CALL, BINARY_CALL,
        # RAISE_EXCEPTION, BUILD_FUNCTION, UNPACK_ARG, UNPACK_VARARG, LOAD_LOCAL,
        # SET_FUNC_ARGS, and RESERVE_FAST

        # Not strictly needed, but tidies up output
        stmt     ::= doc_junk
        doc_junk ::= LOAD_CONST POP_TOP

        # Not sure why later Python's omit the COME_FROM
        jb_pop14  ::= JUMP_BACK COME_FROM POP_TOP

        whileelsestmt ::= SETUP_LOOP testexpr l_stmts_opt
                          jb_pop14
                          POP_BLOCK else_suitel COME_FROM

        print_items_nl_stmt ::= expr PRINT_ITEM_CONT print_items_opt PRINT_NEWLINE_CONT


        # 1.4 doesn't have linenotab, and although this shouldn't
        # be a show stopper, our CONTINUE detection is off here.
        continue ::= JUMP_BACK
        N© )ÚselfÚargsr   r   úW/home/psgendb/BIRCHDEV/python/lib/python3.6/site-packages/uncompyle6/parsers/parse14.pyÚp_misc14	   s    zPython14Parser.p_misc14c                s   t t| ƒj|ƒ i | _d S )N)Úsuperr   Ú__init__Z
customized)r   Zdebug_parser)Ú	__class__r   r	   r   "   s    zPython14Parser.__init__c                s*   t t| ƒj||ƒ | jdƒ d| jd< d S )Nzž
        whileelsestmt ::= SETUP_LOOP testexpr l_stmts_opt
                          jb_pop
                          POP_BLOCK else_suitel COME_FROM
        ÚtokensÚdoc_junk)r   r   Úcustomize_grammar_rulesZremove_rulesZcheck_reduce)r   r   Z	customize)r   r   r	   r   &   s    z&Python14Parser.customize_grammar_rulesc                sJ   t t| ƒj|||||ƒ}|s$|d kr(|S |d dkrFt|| jtƒ S d S )Nr   r   )r   r   Úreduce_is_invalidÚ
isinstanceZpattrÚstr)r   ZruleÚastr   ÚfirstÚlastÚinvalid)r   r   r	   r   0   s    

z Python14Parser.reduce_is_invalid)	Ú__name__Ú
__module__Ú__qualname__r
   ÚPARSER_DEFAULT_DEBUGr   r   r   Ú__classcell__r   r   )r   r	   r      s   
r   c               @   s   e Zd ZdS )ÚPython14ParserSingleN)r   r   r   r   r   r   r	   r   ;   s   r   Ú__main__N)Zspark_parserr   r   Zuncompyle6.parserr   Zuncompyle6.parsers.parse15r   r   r   r   ÚpZcheck_grammarZdump_grammarr   r   r   r	   Ú<module>   s   4