U
    {±Ëh%  ã                   @   s‚   d Z G dd„ dƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG d	d
„ d
eƒZG dd„ deƒZeƒ ZG dd„ deƒZeƒ Z	dS )zB
Python Lexical Analyser

Actions for use in token specifications
c                   @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )ÚActionc                 C   s   d S ©N© ©ÚselfÚtoken_streamÚtextr   r   ú7/tmp/pip-unpacked-wheel-fhl22ezh/Cython/Plex/Actions.pyÚperform   s    zAction.performc                 C   s   | S r   r   ©r   r   r   r   Ú__copy__   s    zAction.__copy__c                 C   s   | S r   r   )r   Úmemor   r   r   Ú__deepcopy__   s    zAction.__deepcopy__N)Ú__name__Ú
__module__Ú__qualname__r	   r   r   r   r   r   r   r      s   r   c                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚReturnzk
    Internal Plex action which causes |value| to
    be returned as the value of the associated token
    c                 C   s
   || _ d S r   ©Úvalue)r   r   r   r   r   Ú__init__   s    zReturn.__init__c                 C   s   | j S r   r   r   r   r   r   r	      s    zReturn.performc                 C   s
   d| j  S )Nz
Return(%r)r   r
   r   r   r   Ú__repr__   s    zReturn.__repr__N©r   r   r   Ú__doc__r   r	   r   r   r   r   r   r      s   r   c                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚCallzD
    Internal Plex action which causes a function to be called.
    c                 C   s
   || _ d S r   ©Úfunction)r   r   r   r   r   r   '   s    zCall.__init__c                 C   s   |   ||¡S r   r   r   r   r   r   r	   *   s    zCall.performc                 C   s   d| j j S )NzCall(%s))r   r   r
   r   r   r   r   -   s    zCall.__repr__Nr   r   r   r   r   r   "   s   r   c                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚMethodz‘
    Plex action that calls a specific method on the token stream,
    passing the matched text and any provided constant keyword arguments.
    c                 K   s   || _ |pd | _d S r   )ÚnameÚkwargs)r   r   r   r   r   r   r   7   s    zMethod.__init__c                 C   s,   t || jƒ}| jd k	r$||f| jŽS ||ƒS r   )Úgetattrr   r   )r   r   r   Úmethodr   r   r   r	   ;   s    zMethod.performc                 C   sD   | j d k	r(d tdd„ | j  ¡ D ƒƒ¡nd}d| j|r:dnd|f S )Nz, c                 S   s   g | ]}d | ‘qS )z%s=%rr   )Ú.0Úitemr   r   r   Ú
<listcomp>B   s     z#Method.__repr__.<locals>.<listcomp>Ú zMethod(%s%s%s))r   ÚjoinÚsortedÚitemsr   )r   r   r   r   r   r   @   s
    ÿ þzMethod.__repr__Nr   r   r   r   r   r   1   s   r   c                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚBeginz¦
    Begin(state_name) is a Plex action which causes the Scanner to
    enter the state |state_name|. See the docstring of Plex.Lexicon
    for more information.
    c                 C   s
   || _ d S r   ©Ú
state_name)r   r)   r   r   r   r   N   s    zBegin.__init__c                 C   s   |  | j¡ d S r   )Úbeginr)   r   r   r   r   r	   Q   s    zBegin.performc                 C   s
   d| j  S )Nz	Begin(%s)r(   r
   r   r   r   r   T   s    zBegin.__repr__Nr   r   r   r   r   r'   G   s   r'   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚIgnorez“
    IGNORE is a Plex action which causes its associated token
    to be ignored. See the docstring of Plex.Lexicon  for more
    information.
    c                 C   s   d S r   r   r   r   r   r   r	   _   s    zIgnore.performc                 C   s   dS )NÚIGNOREr   r
   r   r   r   r   b   s    zIgnore.__repr__N©r   r   r   r   r	   r   r   r   r   r   r+   X   s   r+   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚTextz«
    TEXT is a Plex action which causes the text of a token to
    be returned as the value of the token. See the docstring of
    Plex.Lexicon  for more information.
    c                 C   s   |S r   r   r   r   r   r   r	   p   s    zText.performc                 C   s   dS )NÚTEXTr   r
   r   r   r   r   s   s    zText.__repr__Nr-   r   r   r   r   r.   i   s   r.   N)
r   r   r   r   r   r'   r+   r,   r.   r/   r   r   r   r   Ú<module>   s   