3
he)                 @   st   d dl Z d dlmZ d dlmZmZmZ G dd dZeeeeef ee f  Z	G dd dZ
G dd	 d	e
ZdS )
    N)filterfalse)ListTupleUnionc               @   s   e Zd Zdd Zdd ZdS )_lazyclasspropertyc             C   s   || _ |j| _|j| _d S )N)fn__doc____name__)selfr    r   6/tmp/pip-build-fibhr3ey/pyparsing/pyparsing/unicode.py__init__	   s    z_lazyclassproperty.__init__c                sn    d krt | t d s<t fdd jdd  D rBi  _| jj}| jkrd| j  j|<  j| S )N_internc             3   s    | ]} j t|d g kV  qdS )r   N)r   getattr).0Z
superclass)clsr   r   	<genexpr>   s   z-_lazyclassproperty.__get__.<locals>.<genexpr>   )typehasattrany__mro__r   r   r	   )r
   objr   attrnamer   )r   r   __get__   s    

z_lazyclassproperty.__get__N)r	   
__module____qualname__r   r   r   r   r   r   r      s   r   c               @   s   e Zd ZU dZg Zeeee dddZ	eedddZ
eedddZeedd	d
ZeedddZeedddZeedddZedd ZdS )unicode_seta  
    A set of Unicode characters, for language-specific strings for
    ``alphas``, ``nums``, ``alphanums``, and ``printables``.
    A unicode_set is defined by a list of ranges in the Unicode character
    set, in a class attribute ``_ranges``. Ranges can be specified using
    2-tuples or a 1-tuple, such as::

        _ranges = [
            (0x0020, 0x007e),
            (0x00a0, 0x00ff),
            (0x0100,),
            ]

    Ranges are left- and right-inclusive. A 1-tuple of (x,) is treated as (x, x).

    A unicode set can also be defined using multiple inheritance of other unicode sets::

        class CJK(Chinese, Japanese, Korean):
            pass
    )returnc             C   sf   g }xJ| j D ]@}|tkrP x0t|df D ] }|jt|d |d d  q(W qW tdd t|D S )N_rangesr   r   c             s   s   | ]}t |V  qd S )N)chr)r   cr   r   r   r   ?   s    z0unicode_set._chars_for_ranges.<locals>.<genexpr>)r   r   r   extendrangesortedset)r   retccZrrr   r   r   _chars_for_ranges7   s    $zunicode_set._chars_for_rangesc             C   s   dj ttj| jS )z+all non-whitespace characters in this range )joinr   strisspacer)   )r   r   r   r   
printablesA   s    zunicode_set.printablesc             C   s   dj ttj| jS )z'all alphabetic characters in this ranger*   )r+   filterr,   isalphar)   )r   r   r   r   alphasF   s    zunicode_set.alphasc             C   s   dj ttj| jS )z*all numeric digit characters in this ranger*   )r+   r/   r,   isdigitr)   )r   r   r   r   numsK   s    zunicode_set.numsc             C   s   | j | j S )z)all alphanumeric characters in this range)r1   r3   )r   r   r   r   	alphanumsP   s    zunicode_set.alphanumsc             C   s$   dj ttttj| jtdB S )zVall characters in this range that are valid identifier characters, plus underscore '_'r*   u   ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ_)r+   r%   r&   r/   r,   isidentifierr)   )r   r   r   r   
identcharsU   s
    zunicode_set.identcharsc             C   s4   t dd | jD }djt|t | jB t dB S )u   
        all characters in this range that are valid identifier body characters,
        plus the digits 0-9, and · (Unicode MIDDLE DOT)
        c             s   s   | ]}d | j  r|V  qdS )_N)r5   )r   r!   r   r   r   r   j   s    z-unicode_set.identbodychars.<locals>.<genexpr>r*   u   0123456789·)r&   r)   r+   r%   r6   )r   Zidentifier_charsr   r   r   identbodycharsc   s    zunicode_set.identbodycharsc             C   s   ddl m} || j| jS )z
        a pyparsing Word expression for an identifier using this range's definitions for
        identchars and identbodychars
        r   )Word)	pyparsingr9   r6   r8   )r   r9   r   r   r   
identifierp   s    zunicode_set.identifierN)r	   r   r   r   r   UnicodeRangeListr   r   r,   r)   r.   r1   r3   r4   r6   r8   r;   r   r   r   r   r      s"   
	r   c               @   s2  e Zd ZU dZdejfgZe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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e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eZeZeZeZeZeZeZeZ eZ!dS ) pyparsing_unicodezF
    A namespace class for defining common language unicode_sets.
        c               @   s   e Zd ZU dZdgZedS )z(pyparsing_unicode.BasicMultilingualPlanez,Unicode set for the Basic Multilingual Planer>     N)r>   r?   )r	   r   r   r   r   r<   r   r   r   r   BasicMultilingualPlane   s   
r@   c               @   s   e Zd ZU dZddgZedS )	zpyparsing_unicode.Latin1z/Unicode set for Latin-1 Unicode Character Ranger>   ~         N)r>   rA   )rB   rC   )r	   r   r   r   r   r<   r   r   r   r   Latin1   s   
rD   c               @   s   e Zd ZU dZdgZedS )zpyparsing_unicode.LatinAz/Unicode set for Latin-A Unicode Character Range     N)rE   rF   )r	   r   r   r   r   r<   r   r   r   r   LatinA   s   
rG   c               @   s   e Zd ZU dZdgZedS )zpyparsing_unicode.LatinBz/Unicode set for Latin-B Unicode Character Range  O  N)rH   rI   )r	   r   r   r   r   r<   r   r   r   r   LatinB   s   
rJ   c            $   @   s`   e Zd ZU dZd@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbg#Zed?S )czpyparsing_unicode.Greekz.Unicode set for Greek Unicode Character RangesB  E  p  w  z                      &  *  ^  `  f  j              E  H  M  P  W  Y  [  ]  _  }                              )!  '  '  e  @     E   N)rK   rL   )rM   rN   )rO   rP   )rQ   rR   )rS   )rT   rU   )rV   rW   )rX   rY   )rZ   r[   )r\   )r]   )r^   r_   )r`   ra   )rb   rc   )rd   re   )rf   rg   )rh   ri   )rj   )rk   )rl   )rm   rn   )ro   rp   )rq   rr   )rs   rt   )ru   rv   )rw   rx   )ry   rz   )r{   r|   )r}   )r~   r   )r   )r   r   )r   )r   r   )r   r   )r	   r   r   r   r   r<   r   r   r   r   Greek   sH   
r   c            	   @   s*   e Zd ZU dZddddddddgZedS )zpyparsing_unicode.Cyrillicz0Unicode set for Cyrillic Unicode Character Range   /      +  x  -  -  @  r  t  韦  .  /  N)r   r   )r   r   )r   )r   )r   r   )r   r   )r   r   )r   r   )r	   r   r   r   r   r<   r   r   r   r   Cyrillic   s   
r   c               @   s>   e Zd ZU dZd'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8gZed&S )9zpyparsing_unicode.Chinesez/Unicode set for Chinese Unicode Character Range.  .  .  .  1  1   4  M   N            m  p    o o    ; @ H    ֦   4 @          N)r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r	   r   r   r   r   r<   r   r   r   r   Chinese   s&   
r   c               @   s^   e Zd ZdZG dd deZG dd deZG dd deZeZeZ	eZ
ejej ej ZdS )	zpyparsing_unicode.Japanesez`Unicode set for Japanese Unicode Character Range, combining Kanji, Hiragana, and Katakana rangesc               @   s   e Zd ZU dZddgZedS )	z pyparsing_unicode.Japanese.Kanjiz-Unicode set for Kanji Unicode Character Range N  鿟   0  ?0  N)r   r   )r   r   )r	   r   r   r   r   r<   r   r   r   r   Kanji   s   
r   c               @   s(   e Zd ZU dZdddddddgZedS )z#pyparsing_unicode.Japanese.Hiraganaz0Unicode set for Hiragana Unicode Character RangeA0  0  0  0  0  p   P R   N)r   r   )r   r   )r   )r   )r   )r   r   )r   )r	   r   r   r   r   r<   r   r   r   r   Hiragana   s   
r   c            	   @   s,   e Zd ZU dZdddddddddg	ZedS )z#pyparsing_unicode.Japanese.Katakanaz1Unicode set for Katakana  Unicode Character Range0  0  0  0  1  1  2  2  e      d g    N)r   r   )r   r   )r   r   )r   r   )r   r   )r   )r   r   )r   r   )r   )r	   r   r   r   r   r<   r   r   r   r   Katakana  s   
r   N)r	   r   r   r   r   r   r   r   t   漢字t   カタカナt   ひらがなr   r   r   r   r   Japanese   s   r   c               @   s8   e Zd ZU dZd d!d"d#d$d%d&d'd(d)d*d+d,d-d.gZedS )/zpyparsing_unicode.Hangulz7Unicode set for Hangul (Korean) Unicode Character Range     .0  /0  11  1   2  2  `2  {2  ~2  `  |                                   N)r   r   )r   r   )r   r   )r   r   )r   r   )r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r	   r   r   r   r   r<   r   r   r   r   Hangul  s    
r   c               @   s   e Zd ZdZdS )zpyparsing_unicode.CJKzTUnicode set for combined Chinese, Japanese, and Korean (CJK) Unicode Character RangeN)r	   r   r   r   r   r   r   r   CJK0  s   r   c               @   s   e Zd ZU dZddgZedS )	zpyparsing_unicode.Thaiz,Unicode set for Thai Unicode Character Range  :  ?  [  N)r   r   )r   r  )r	   r   r   r   r   r<   r   r   r   r   Thai3  s   
r  c               @   s    e Zd ZU dZd	d
dgZedS )zpyparsing_unicode.Arabicz.Unicode set for Arabic Unicode Character Range              N)r  r  )r  r  )r  r  )r	   r   r   r   r   r<   r   r   r   r   Arabic:  s   
r	  c            
   @   s,   e Zd ZU dZdddddddddg	ZedS )zpyparsing_unicode.Hebrewz.Unicode set for Hebrew Unicode Character Range              6  8  <  >  @  A  C  D  F  O  N)r
  r  )r  r  )r  r  )r  r  )r  r  )r  )r  r  )r  r  )r  r  )r	   r   r   r   r   r<   r   r   r   r   HebrewB  s   
r  c               @   s   e Zd ZU dZddgZedS )	zpyparsing_unicode.Devanagariz2Unicode set for Devanagari Unicode Character Range 	  	      N)r  r  )r  r  )r	   r   r   r   r   r<   r   r   r   r   
DevanagariP  s   
r   N)"r	   r   r   r   sys
maxunicoder   r<   r   r@   rD   rG   rJ   r   r   r   r   r   Koreanr   r  r	  r  r   ZBMPt   العربيةt   中文t   кириллицаt   Ελληνικάt   עִברִיתt	   日本語t	   한국어t	   ไทยt   देवनागरीr   r   r   r   r=   {   s6   
(.r=   )r!  	itertoolsr   typingr   r   r   r   intr<   r   r=   r   r   r   r   <module>   s   \