§
    ,P„j¢.  ã                   óˆ   — d Z ddlZ ej        eeee¬¦  «         ddlmZ ddlmZmZm	Z	  e¦   «         Z
 G d„ d¦  «        ZdS )	z3
Python Lexical Analyser

Scanning an input stream
é    N)ÚBOLÚEOLÚEOFÚ	NOT_FOUNDé   )ÚErrors)r   r   r   c                   óŽ   — e Zd ZdZdd„Zd„ Zd„ Zd„ Zd„ Ze	j
        d	„ ¦   «         Zd
efd„Zd„ Zd„ Zdd„Zd„ Zed„ ¦   «         ZdS )ÚScanneraÖ  
    A Scanner is used to read tokens from a stream of characters
    using the token set specified by a Plex.Lexicon.

    Constructor:

      Scanner(lexicon, stream, name = '')

        See the docstring of the __init__ method for details.

    Methods:

      See the docstrings of the individual methods for more
      information.

      read() --> (value, text)
        Reads the next lexical token from the stream.

      position() --> (name, line, col)
        Returns the position of the last token read using the
        read() method.

      begin(state_name)
        Causes scanner to change state.

      produce(value [, text])
        Causes return of a token value to the caller of the
        Scanner.

    Ú Nc                 ó   — d| _         d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _	        d| _
        || _        || _        || _        g | _        d| _        |                      d¦  «         d| _        d| _        d| _        t$          | _        d| _        |�|d         |d          c| _        | _        dS dS )aƒ  
        Scanner(lexicon, stream, name = '')

          |lexicon| is a Plex.Lexicon instance specifying the lexical tokens
          to be recognised.

          |stream| can be a file object or anything which implements a
          compatible read() method.

          |name| is optional, and may be the name of the file being
          scanned or any other identifying string.
        r   r   r   )r   r   r   Né   )ÚtraceÚbufferÚbuf_start_posÚnext_posÚcur_posÚcur_lineÚ	start_posÚcurrent_scanner_position_tupleÚlast_token_position_tupleÚtextÚ
state_nameÚlexiconÚstreamÚnameÚqueueÚinitial_stateÚbeginÚcur_line_startr   Úcur_charÚinput_state)Úselfr   r   r   Úinitial_poss        úY/root/disk_3tb/conda_envs/Huy-visual/lib/python3.11/site-packages/Cython/Plex/Scanners.pyÚ__init__zScanner.__init__J   sÛ   € ð ˆŒ
àˆŒØˆÔØˆŒØˆŒØˆŒØˆŒØ.8ˆÔ+Ø)3ˆÔ&ØˆŒ	ØˆŒàˆŒØˆŒØˆŒ	ØˆŒ
Ø!ˆÔØ�
Š
�2‰ŒˆØˆŒØˆŒØˆÔÝˆŒØˆÔØÐ"Ø1<¸Q´À+ÈaÄ.ÀÐ.ˆDŒM˜4Ô.Ð.Ð.ð #Ð"ó    c                 ó6  — | j         }|s||                      ¦   «         \  | _        }|€*|                      d¦  «         |                      ¦   «          n2|                     | | j        ¦  «        }|�|                      |¦  «         |¯||d         \  }| _        |d= |S )a"  
        Read the next lexical token from the stream and return a
        tuple (value, text), where |value| is the value associated with
        the token as specified by the Lexicon, and |text| is the actual
        string read from the stream. Returns (None, '') on end of file.
        Nr   )r   Úscan_a_tokenr   ÚproduceÚeofÚperformr   )r"   r   ÚactionÚvalueÚresults        r$   ÚreadzScanner.readr   s§   € ð ”
ˆØð 	(Ø $× 1Ò 1Ñ 3Ô 3ÑˆDŒI�vØˆ~Ø—’˜TÑ"Ô"Ð"Ø—’‘
”
�
�
àŸš t¨T¬YÑ7Ô7�ØÐ$Ø—L’L Ñ'Ô'Ð'ð ð 	(ð 27°q´Ñ.ˆ�Ô.Ø�!ˆHØˆr&   c                 óD   — | j                              d||f|f¦  «         d S )Nr   )r   Úinsert)r"   Útokenr-   Úpositions       r$   ÚunreadzScanner.unread‡   s)   € ØŒ
×Ò˜!˜u e˜n¨hÐ7Ñ8Ô8Ð8Ð8Ð8r&   c                 ó   — | j         S ©N)r   ©r"   s    r$   Úget_current_scan_poszScanner.get_current_scan_posŠ   s   € àÔ2Ð2r&   c                 ó°  — | j         | _        | j        | j        | j         | j        z
  f| _        |                      ¦   «         }|�S| j        rt          d|| j        | j         fz  ¦  «         | j	        | j        | j
        z
  | j         | j
        z
  …         }||fS | j         | j        k    r| j        �| j        t          u rdS t          j        | | j        ¦  «        ‚)z–
        Read the next input sequence recognised by the machine
        and return (text, action). Returns ('', None) on end of
        file.
        Nz"Scanner: read: Performing %s %d:%d©r   N)r   r   r   r   r   r   Úrun_machine_inlinedr   Úprintr   r   r    r   r   ÚUnrecognizedInputr   )r"   r,   r   s      r$   r(   zScanner.scan_a_tokenŽ   sí   € ð œˆŒàŒI�t”} d¤l°TÔ5HÑ&Hð/
ˆÔ+ð ×)Ò)Ñ+Ô+ˆØÐØŒzð ;ÝÐ:Ø˜DœN¨D¬Lð>:ñ :ñ ;ô ;ð ;à”;Ø” Ô!3Ñ3Ø”˜tÔ1Ñ1ð2ô3ˆDð ˜&�>Ð!àŒ|˜tœ~Ò-Ð-Ø”=Ð(¨D¬M½SÐ,@Ð,@Ø%˜:ÝÔ*¨4°´ÑAÔAÐAr&   c           	      óª  — | j         }| j        }| j        }| j        }| j        }| j        }| j        }| j        }| j        }	t          |¦  «        }
d\  }}}}}}}| j
        }	 |r)t          d|d         ||t          |¦  «        fz  ¦  «         |d         }|�|||||||f\  }}}}}}}|}|                     |t          ¦  «        }|t          u r|o|                     d¦  «        }|�r|rt          d|d         z  ¦  «         |}|dk    r©|}||	z
  }||
k     r||         }|dz  }no| j        |	z
  }| j                             d	¦  «        }| j        |d…         |z   }|| _        |	|z  }	|	| _        t          |¦  «        }
||z  }|r||         }|dz  }nd
}|dk    r
t$          }d}nn|s
t$          }d}nb|}n_|dk    rd}d}nT|dk    r|dz  }|x}}t&          }d}n;|dk    r
t(          }d}n+d
}n(|rt          d¦  «         |�|||||||f\  }}}}}}}nd}n�Œ²|| _        || _        || _        || _        || _        || _        |r|�t          d|z  ¦  «         |S )z;
        Inlined version of run_machine for speed.
        )Nr   r   r   r   r   r   r   zState %d, %d/%d:%s -->Únumberr,   NÚelsezState %di   r   ú
r   é   é   é   ÚblockedzDoing %s)r   r   r   r   r    r!   r   r   r   Úlenr   r<   ÚreprÚgetr   r   r   r/   r   r   r   )r"   Ústater   r   r   r    r!   r   r   r   Úbuf_lenÚb_actionÚ	b_cur_posÚ
b_cur_lineÚb_cur_line_startÚ
b_cur_charÚb_input_stateÚ
b_next_posr   r,   ÚcÚ	new_stateÚ	buf_indexÚdiscardÚdatas                            r$   r;   zScanner.run_machine_inlined§   s`  € ð
 Ô(ˆØ%)¤\ˆØ&*¤mˆØ,0Ô,?ˆØ”=ˆØ#'Ô#3ˆØ&*¤mˆà”kˆØ+/Ô+=ˆÝ%(¨¡[¤[ˆð
 $ñ 	aˆ�)˜ZÐ)9¸:À}ÐV`ð "œZˆðM	Øð LÝÐ.Ø˜(”O [°'½4À¹>¼>ð2Kñ Kñ Lô Lð Lð ˜8”_ˆFØÐ!à˜G X¨~¸xÈÐV^Ð^ñ i�˜) ZÐ1AÀ:È}Ð^hð ˆAØŸ	š	 !¥YÑ/Ô/ˆIØ�IÐ%Ð%ØÐ3 %§)¢)¨FÑ"3Ô"3�	àñ <Øð <Ý˜* y°Ô':Ñ:Ñ;Ô;Ð;Ø!�à !Ò#Ð#Ø&�Gà (¨=Ñ 8�IØ  7Ò*Ð*Ø" 9Ô-˜Ø  A™˜˜à"&¤.°=Ñ"@˜Ø#œ{×/Ò/°Ñ7Ô7˜Ø!%¤¨W¨X¨XÔ!6¸Ñ!=˜Ø&,˜œØ%¨Ñ0˜Ø-:˜Ô*Ý"% f¡+¤+˜Ø! WÑ,˜	Øð #Ø & yÔ 1˜AØ$¨™M˜H˜Hà "˜Aà˜D’y�yÝ#&˜Ø&'˜˜Øð %Ý#&˜Ø&'˜˜à#$˜˜Ø  AÒ%Ð%Ø#�HØ"#�K�KØ  AÒ%Ð%Ø ‘M�HØ/7Ð7�N WÝ"�HØ"#�K�KØ  AÒ%Ð%Ý"�HØ"#�K�Kà!�H�Hð ð %Ý˜)Ñ$Ô$Ð$àÐ'ð " 9¨jÐ:JØ# ]°Jð@ñ6�V˜W h°Ø˜{¨H¨Hð "�FØñ[M	ð` ˆŒØ ˆŒØ,ˆÔØ ˆŒØ&ˆÔØ ˆŒØð 	+ØÐ!Ý�j 6Ñ)Ñ*Ô*Ð*Øˆr&   Úreturnc                 ó   — | j         S )am  
        Return a tuple (name, line, col) representing the location of
        the last token read using the read() method. |name| is the
        name that was provided to the Scanner constructor; |line|
        is the line number in the stream (1-based); |col| is the
        position within the line of the first character of the token
        (0-based).
        ©r   r7   s    r$   r3   zScanner.position  s   € ð Ô-Ð-r&   c                 ó*   — |                       ¦   «         S )zX
        Python accessible wrapper around position(), only for error reporting.
        )r3   r7   s    r$   Úget_positionzScanner.get_position$  s   € ð �}Š}‰ŒÐr&   c                 óR   — | j                              |¦  «        | _        || _        dS )z8Set the current state of the scanner to the named state.N)r   Úget_initial_stater   r   )r"   r   s     r$   r   zScanner.begin*  s*   € ð ŒL×*Ò*¨:Ñ6Ô6ð 	Ôà$ˆŒˆˆr&   c                 ó^   — |€| j         }| j                             ||f| j        f¦  «         dS )aÐ  
        Called from an action procedure, causes |value| to be returned
        as the token value from read(). If |text| is supplied, it is
        returned in place of the scanned text.

        produce() can be called more than once during a single call to an action
        procedure, in which case the tokens are queued up and returned one
        at a time by subsequent calls to read(), until the queue is empty,
        whereupon scanning resumes.
        N)r   r   Úappendr   )r"   r-   r   s      r$   r)   zScanner.produce0  s8   € ð ˆ<Ø”9ˆDØŒ
×Ò˜E 4˜=¨$Ô*MÐNÑOÔOÐOÐOÐOr&   c                 ó   — dS )z_
        Override this method if you want something to be done at
        end of file.
        N© r7   s    r$   r*   zScanner.eof?  s	   € ð
 	ˆr&   c                 ó   — | j         d         S )Nr   rY   r7   s    r$   Ú
start_linezScanner.start_lineF  s   € àÔ-¨aÔ0Ð0r&   r:   r6   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r%   r/   r4   r8   r(   ÚcythonÚfinalr;   Útupler3   r[   r   r)   r*   Úpropertyrc   ra   r&   r$   r
   r
      s  € € € € € ðð ðp&Qð &Qð &Qð &QðPð ð ð*9ð 9ð 9ð3ð 3ð 3ðBð Bð Bð2 „\ðoð oñ „\ðoðb	.˜%ð 	.ð 	.ð 	.ð 	.ðð ð ð%ð %ð %ðPð Pð Pð Pðð ð ð ð1ð 1ñ „Xð1ð 1ð 1r&   r
   )rg   rh   ÚdeclareÚobjectr   r   ÚRegexpsr   r   r   r   r
   ra   r&   r$   ú<module>ro      s¬   ððð ð €€€à €„�6˜v¨6¸VÐ DÑ DÔ DÐ Dà Ð Ð Ð Ð Ð Ø "Ð "Ð "Ð "Ð "Ð "Ð "Ð "Ð "Ð "àˆF‰HŒH€	ðw1ð w1ð w1ð w1ð w1ñ w1ô w1ð w1ð w1ð w1r&   