§
    r°Û_  ã                   ój   — d Z ddlmZ ddlmZ ddlmZmZmZ ddl	m
Z
 ddlmZ  G d„ de¦  «        Zd	S )
zIImplement statemachine and state that are needed to Generate Derivatives.é    )ÚStateMachineWS)Ú	languages)ÚStructÚRSTStateÚInliner)Úrole)Ú	directivec                   ó@   — e Zd ZdZd„ Zd„ Z	 	 	 dd„Z	 	 d	d„Zd
d„ZdS )ÚDummyStateMachinea  A dummy state machine that mimicks the property of statemachine.

    This state machine cannot be used for parsing, it is only used to generate
    directive and roles. Usage:
    - Call `reset` to reset the state
    - Then call `run_directive` or `run_role` to generate the node.
    c                 óh   — t          g d ¬¦  «        | _        t          | ¦  «        | _        d| _        d S )N)Útitle_stylesÚinlinerr   )r   Úmemor   ÚstateÚinput_offset)Úselfs    ú5/usr/lib/python3/dist-packages/recommonmark/states.pyÚ__init__zDummyStateMachine.__init__   s8   € Ý¨Ø#'ð)ñ )ô )ˆŒ	å˜d‘^”^ˆŒ
ØˆÔÐÐó    c                 ó>  — t          j        |j        j        ¦  «        | _        || j        _        |j        | j        _        | j        | j        _        || j        _        | j        j	        €<t          ¦   «         | j        _	        | j        j	                             |j        ¦  «         | j        j	        }|j        |_        ||_        | j        |_        ||_        || _        | j        j        | _        || _        | j                             ¦   «          |d         | _        dS )a«  Reset the state of state machine.

        After reset, self and self.state can be used to
        passed to docutils.parsers.rst.Directive.run

        Parameters
        ----------
        document: docutils document
            Current document of the node.
        parent: parent node
            Parent node that will be used to interpret role and directives.
        level: int
            Current section level.
        NÚsource)r   Úget_languageÚsettingsÚlanguage_codeÚlanguager   ÚdocumentÚreporterÚsection_levelr   r   Úinit_customizationsÚparentÚnoder   Úruntime_initÚinput_lines)r   r   r    Úlevelr   s        r   ÚresetzDummyStateMachine.reset   sô   € õ "Ô.ØÔÔ+ñ-ô -ˆŒð &ˆŒ	ÔØ%Ô.ˆŒ	ÔØ!œ]ˆŒ	ÔØ"'ˆŒ	ÔàŒ9ÔÐ$Ý '¡	¤	ˆDŒIÔØŒIÔ×1Ò1°(Ô2CÑDÔDÐDØ”)Ô#ˆØ#Ô,ˆÔØ#ˆÔØœ=ˆÔØˆŒà ˆŒØœ	Ô*ˆŒØˆŒ	ØŒ
×ÒÑ!Ô!Ð!Ø# HÔ-ˆÔÐÐr   Nc                 óÄ   — |€i }|€g }|€g }t          || j        | j        ¦  «        \  }} |||||| j        j        dd| j        | ¬¦	  «	        }|                     ¦   «         S )a®  Generate directive node given arguments.

        Parameters
        ----------
        name : str
            name of directive.
        arguments : list
            list of positional arguments.
        options : dict
            key value arguments.
        content : content
            content of the directive

        Returns
        -------
        node : docutil Node
            Node generated by the arguments.
        Nr   zDummy BlockText)	ÚnameÚ	argumentsÚoptionsÚcontentÚlinenoÚcontent_offsetÚ
block_textr   Ústate_machine)r	   r   r   r!   Úliner   Úrun)r   r'   r(   r)   r*   ÚdirecÚ_s          r   Úrun_directivezDummyStateMachine.run_directive@   s‚   € ð, ˆ?ØˆGØˆ?ØˆGØÐØˆIÝ˜T 4¤=°$´-Ñ@Ô@‰ˆˆqØ�˜4Ø )Ø%Ø%Ø!œYœ^Ø%&Ø!2Ø œJØ$(ð*ñ *ô *ˆð �yŠy‰{Œ{Ðr   c           	      ó4  — |€i }|€g }t          || j        | j        j        | j        ¦  «        \  }} ||t          |¦  «        t          |¦  «        | j        j        | j        j        ||¬¦  «        \  }}t          |¦  «        dk    s
J d¦   «         ‚|d         S )a   Generate a role node.

        options : dict
            key value arguments.
        content : content
            content of the directive

        Returns
        -------
        node : docutil Node
            Node generated by the arguments.
        N)ÚrawtextÚtextr+   r   r)   r*   é   zonly support one list in roler   )	r   r   r!   r/   r   Ústrr   r   Úlen)r   r'   r)   r*   Úrole_fnr2   Úvecs          r   Úrun_rolezDummyStateMachine.run_roleh   s¨   € ð ˆ?ØˆGØˆ?ØˆGÝ˜$Øœ-Øœ)œ.Øœ-ñ)ô )‰
ˆ�ð �˜Ý!$ W¡¤Ý! '™lœlØ $¤	¤Ø!%¤Ô!2Ø!(Ø!(ð*ñ *ô *‰ˆˆQõ �3‰xŒx˜1Š}ˆ}ˆ}Ð=‰}Œ}ˆ}Ø�1Œvˆr   c                 óV   — |r| j         d         |fS | j         d         | j        j        fS )Nr   )r   r!   r/   )r   r+   s     r   Úget_source_and_linez%DummyStateMachine.get_source_and_line‰   s2   € Øð 	=Ø”M (Ô+¨VÐ4Ð4à”M (Ô+¨T¬Y¬^Ð<Ð<r   )NNN)NN)N)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r%   r3   r<   r>   © r   r   r   r   
   sŽ   € € € € € ðð ðð ð ð$.ð $.ð $.ðN !%Ø"Ø"ð&ð &ð &ð &ðR Øðð ð ð ðB=ð =ð =ð =ð =ð =r   r   N)rB   Údocutils.statemachiner   Údocutils.parsers.rstr   Údocutils.parsers.rst.statesr   r   r   Údocutils.parsers.rst.rolesr   Údocutils.parsers.rst.directivesr	   r   rC   r   r   ú<module>rI      s¯   ðØ OÐ Oà 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø *Ð *Ð *Ð *Ð *Ð *Ø AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ AØ +Ð +Ð +Ð +Ð +Ð +Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5ðC=ð C=ð C=ð C=ð C=˜ñ C=ô C=ð C=ð C=ð C=r   