B
    0ӛYe                 @   s  d dl mZ ddlmZmZmZmZ ddlm	Z	 d dl
mZmZm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ee	jfee	jfee	jfee	j fee	j!fee	j"fee	j#fee	j$fee	j%fee	j&fee	j'fee	j(fee	j)fee	j*ffZ+edd,dd e+D  d ee Z-dgdd e+D  Z.e	j/e	j0e	j1e	j2e	j3e	j4e	j5e	j6e	j7e	j8e	j9e	j:e	j;e	j<e	j=e	j>dZ?G dd deZ@eAdkry xe@d D ]ZBeCeB qW W n. ek
r ZD zeCd!eD W ddZD[DX Y nX dS )"    )print_function   )EOFCommonTokenTokenStreamTokenStreamException)ExcelFormulaParser)compile
IGNORECASEVERBOSEz\d+\bz
    (?:
        (?: \d* \. \d+ ) # .1 .12 .123 etc 9.1 etc 98.1 etc
        |
        (?: \d+ \. ) # 1. 12. 123. etc
    )
    # followed by optional exponent part
    (?: [Ee] [+-]? \d+ ) ?
    z"(?:[^"]|"")*"z"[Rr]0*[1-9][0-9]*[Cc]0*[1-9][0-9]*z\$?[A-I]?[A-Z]\$?0*[1-9][0-9]*zTRUE\bzFALSE\bzIF\bzCHOOSE\bz	\w[\.\w]*z'(?:[^']|'')*'z<>z>=z<=(z)|(c             c   s   | ]}|d  V  qdS )r   N ).0ir   r   5lib/python3.7/site-packages/xlwt/ExcelFormulaLexer.py	<genexpr>4   s    r   )Nc             C   s   g | ]}|d  qS )r   r   )r   r   r   r   r   
<listcomp>7   s    r   )=<>+-*/:;,r   r   &%^!c               @   sF   e Zd Zdd Zdd Zdd Zddd	Zd
d Zdd Zdd Z	dS )Lexerc             C   s   |d d  | _ d| _d| _d S )Nr   )_text_pos_line)selftextr   r   r   __init__N   s    zLexer.__init__c             C   s   t | j| jkS )N)lenr#   r$   )r&   r   r   r   isEOFS   s    zLexer.isEOFc             C   s   | j | j S )N)r#   r$   )r&   r   r   r   curr_chV   s    zLexer.curr_chr   c             C   s   |  j |7  _ d S )N)r$   )r&   nr   r   r   next_chY   s    zLexer.next_chc             C   s   |   dkS )Nz 	
)r+   )r&   r   r   r   is_whitespace\   s    zLexer.is_whitespacec             C   sH   t | j| j}|sd S |d| _tt|j |d|	dd dS )Nr   r   )typer'   col)
_rematchr#   r$   endTok_toktype	lastindexgroupstart)r&   mr   r   r   match_pattern_   s
    zLexer.match_patternc             C   s   x|   s|  r|   qW |   r0ttdS |  }|r@|S |  }yt| }W n* tk
r~   t	d|  | j
f Y nX |   t||| j
dS )N)r/   z Unexpected char %r in column %u.)r/   r'   r0   )r*   r.   r-   r4   r   r:   r+   single_char_lookupKeyErrorr   r$   )r&   tZteZtyr   r   r   	nextTokenf   s    
zLexer.nextTokenN)r   )
__name__
__module____qualname__r(   r*   r+   r-   r.   r:   r>   r   r   r   r   r"   M   s   
r"   __main__zN 1.23 456 "abcd" R2C2 a1 iv65536 true false if choose a_name 'qname' <> >= <= zerror:)EZ
__future__r   Zantlrr   r   r4   r   r    r   rer	   Z	recompiler
   r   Zint_const_patternZflt_const_patternZstr_const_patternZref2d_r1c1_patternZref2d_patternZtrue_patternZfalse_patternZ
if_patternZchoose_patternZname_patternZquotename_patternZ
ne_patternZ
ge_patternZ
le_patternZ	NUM_CONSTZ	INT_CONSTZ	STR_CONSTZ
REF2D_R1C1ZREF2DZ
TRUE_CONSTZFALSE_CONSTZFUNC_IFZFUNC_CHOOSENAMEZ	QUOTENAMEZNEZGEZLEZpattern_type_tuplesjoinr1   r5   ZEQZLTZGTZADDZSUBZMULZDIVCOLONZ	SEMICOLONCOMMAZLPZRPZCONCATPERCENTZPOWERZBANGr;   r"   r?   r=   printer   r   r   r   <module>   st   	

-
