
    ,
iR                     <   d dl Z d dlZd dlZd dlmZ  ej        e          Z G d d          Z	edk    rd ej
                      e	d          Ze                    e j                                                  D ]Z eej        dej                   dS dS )	    N)JsonPathLexerErrorc                      e Zd ZdZd"dZd Zg dZdddZg d	 ee	                                          z   Z
g d
ZdZdZd Zd ZdZd Zd Zd Zd Zd ZdZd Zd Zd Zd Zd ZdZd Zd Zd Zd Z d Z!d Z"d  Z#d!S )#JsonPathLexerz*
    A Lexical analyzer for JsonPath.
    Fc                 @    || _         | j        t          d          d S )NzDocstrings have been removed! By design of PLY, jsonpath-rw requires docstrings. You must not use PYTHONOPTIMIZE=2 or python -OO.)debug__doc__r   )selfr   s     C:\Users\Dell Inspiron 16\Desktop\tws\AgrotaPowerBi\back-agrota-powerbi\mcp-client-agrota\venv\Lib\site-packages\jsonpath_ng/lexer.py__init__zJsonPathLexer.__init__   s4    
<$  &i  j  j  j      c              #   @  K   t           j        j                            | | j        t                    }d|_        d|_        |                    |           	 |                                }|n|j	        |j        z
  |_
        |V  0|j        t          d          dS )z]
        Maps a string to an iterator over tokens. In other words: [char] -> [token]
        )moduler   errorlogr   NTz.Unexpected EOF in string literal or identifier)jsonpath_ng_plylexr   loggerlatest_newlinestring_valueinputtokenlexposcolr   )r	   string	new_lexerts       r
   tokenizezJsonPathLexer.tokenize   s      
  $(,,D
U[,\\	#$	 !%		!!AyHy77AEGGG	 !-$%UVVV .-r   )*.[]()$,:|&~WHEREWHERENOT)wherewherenot)	DOUBLEDOTNUMBERIDNAMED_OPERATOR))singlequote	exclusive)doublequoter3   )	backquoter3   z\.\.z 	c                 P    | j                             |j        d          |_        |S )zn([a-zA-Z_@]|[\u4E00-\u9FA5]|[\U0001F600-\U0001F64F])([a-zA-Z0-9_@\-]|[\u4E00-\u9FA5]|[\U0001F600-\U0001F64F])*r0   )reserved_wordsgetvaluetyper	   r   s     r
   t_IDzJsonPathLexer.t_IDB   s%     $(($77r   c                 8    t          |j                  |_        |S )z-?\d+)intr9   r;   s     r
   t_NUMBERzJsonPathLexer.t_NUMBERI   s    ag,,r    c                 ~    |j         j        |j         _        d|j         _        |j                             d           dS )'r@   r2   Nlexerr   string_startr   
push_stater;   s     r
   t_singlequotezJsonPathLexer.t_singlequoteQ   6     w~!	=)))))r   c                 :    |j         xj        |j        z  c_        dS )z[^'\\]+NrD   r   r9   r;   s     r
   t_singlequote_contentz#JsonPathLexer.t_singlequote_contentW        	'r   c                 F    |j         xj        |j        d         z  c_        dS z\\.   NrJ   r;   s     r
   t_singlequote_escapez"JsonPathLexer.t_singlequote_escape[   $    	
*r   c                     |j         j        |_        d|_        d|j         _        |j                                          |S )rB   r0   NrD   r   r9   r:   	pop_stater;   s     r
   t_singlequote_endzJsonPathLexer.t_singlequote_end_   8    '&#	r   c           	          t          d|j        j        d|j        |j        j        z
  d|j        d         d          )NError on line , col z8 while lexing singlequoted field: Unexpected character: r    r   rD   linenor   r   r9   r;   s     r
   t_singlequote_errorz!JsonPathLexer.t_singlequote_errorg         z{  {B  {I  {I  {I  KL  KS  VW  V]  Vl  Kl  Kl  Kl  no  nu  vw  nx  nx  nx  "y  z  z  	zr   c                 ~    |j         j        |j         _        d|j         _        |j                             d           dS )"r@   r4   NrC   r;   s     r
   t_doublequotezJsonPathLexer.t_doublequotem   rH   r   c                 :    |j         xj        |j        z  c_        dS )z[^"\\]+NrJ   r;   s     r
   t_doublequote_contentz#JsonPathLexer.t_doublequote_contents   rL   r   c                 F    |j         xj        |j        d         z  c_        dS rN   rJ   r;   s     r
   t_doublequote_escapez"JsonPathLexer.t_doublequote_escapew   rQ   r   c                     |j         j        |_        d|_        d|j         _        |j                                          |S )r`   r0   NrS   r;   s     r
   t_doublequote_endzJsonPathLexer.t_doublequote_end{   rV   r   c           	          t          d|j        j        d|j        |j        j        z
  d|j        d         d          )NrX   rY   z8 while lexing doublequoted field: Unexpected character: r   rZ   r[   r;   s     r
   t_doublequote_errorz!JsonPathLexer.t_doublequote_error   r^   r   c                 ~    |j         j        |j         _        d|j         _        |j                             d           dS )`r@   r5   NrC   r;   s     r
   t_backquotezJsonPathLexer.t_backquote   s6     w~!	;'''''r   c                 F    |j         xj        |j        d         z  c_        dS rN   rJ   r;   s     r
   t_backquote_escapez JsonPathLexer.t_backquote_escape   rQ   r   c                 :    |j         xj        |j        z  c_        dS )z[^`\\]+NrJ   r;   s     r
   t_backquote_contentz!JsonPathLexer.t_backquote_content   rL   r   c                     |j         j        |_        d|_        d|j         _        |j                                          |S )rk   r1   NrS   r;   s     r
   t_backquote_endzJsonPathLexer.t_backquote_end   s8    '&!#	r   c           	          t          d|j        j        d|j        |j        j        z
  d|j        d         d          )NrX   rY   z9 while lexing backquoted operator: Unexpected character: r   rZ   r[   r;   s     r
   t_backquote_errorzJsonPathLexer.t_backquote_error   s      {|  |C  |J  |J  |J  LM  LT  WX  W^  Wm  Lm  Lm  Lm  op  ov  wx  oy  oy  oy  "z  {  {  	{r   c                 R    |j         xj        dz  c_        |j        |j         _        dS )z\nrO   N)rD   r\   r   r   r;   s     r
   	t_newlinezJsonPathLexer.t_newline   s&    	!!"r   c           	          t          d|j        j        d|j        |j        j        z
  d|j        d         d          )NrX   rY   z: Unexpected character: r   rZ   r[   r;   s     r
   t_errorzJsonPathLexer.t_error   s      Z[ZaZhZhZhjkjruvu|  vL  kL  kL  kL  NO  NU  VW  NX  NX  NX  "Y  Z  Z  	Zr   N)F)$__name__
__module____qualname__r   r   r   literalsr7   listvaluestokensstatest_DOUBLEDOTt_ignorer<   r?   t_singlequote_ignorerG   rK   rP   rU   r]   t_doublequote_ignorera   rc   re   rg   ri   t_backquote_ignorerl   rn   rp   rr   rt   rv   rx    r   r
   r   r      s        j j j j
W W W8 LKKH  N
 =<<ttNDYDYD[D[?\?\\F, , ,F
 KH     * * *( ( (+ + +  z z z
 * * *( ( (+ + +  z z z
 ( ( (+ + +( ( (  { { {
* * *
Z Z Z Z Zr   r   __main__T)r   20)sysloggingjsonpath_ng._ply.lexr   jsonpath_ng.exceptionsr   	getLoggerry   r   r   basicConfigrD   r   stdinreadr   printr9   r:   r   r   r
   <module>r      s   



      5 5 5 5 5 5		8	$	$_Z _Z _Z _Z _Z _Z _Z _ZB zGM%%%E	 0 011 5 55;;;

34444	 5 5r   