3

X'íc€ã,@sÐdZddlmZddlZedddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.g+ed/d0Zd1d2d3d4d5d6œZejd7ej	ƒZ
ejd8ej	ƒZejd9ƒZejd:ej
ƒZejd;ƒZejd<ejƒZejd=ƒZejd>ƒZed?d@ƒZdejdAej	ƒfdejdBƒfdCejdDƒfdEejdFej	ej
BƒfdGefdHe
fdIejdJejƒfdKejdLejƒfdMejdNdjeejeƒƒƒfdOejdPej	ƒfdQejdRejej
BƒfgZdSdT„ZdUdV„ZdWdX„Zd[dYdZ„ZdS)\zí
    babel.messages.jslexer
    ~~~~~~~~~~~~~~~~~~~~~~

    A simple JavaScript 1.5 lexer which is used for the JavaScript
    extractor.

    :copyright: (c) 2013-2022 by the Babel Team.
    :license: BSD, see LICENSE for more details.
é)Ú
namedtupleNú+ú-Ú*ú%z!=z==ú<ú>z<=z>=ú=z+=z-=z*=z%=z<<z>>z>>>z<<=z>>=z>>>=ú&z&=ú|z|=z&&z||ú^z^=ú(ú)ú[ú]Ú{Ú}ú!z--z++ú~ú,ú;Ú.ú:T)ÚkeyÚreverseúúÚ
ú
ú	)ÚbÚfÚnÚrÚtz[\w$_][\w\d$_]*z[\w$_][\w\d$_.]*[\w\d$_.]z/=?z%/(?:[^/\\]*(?:\\.[^/\\]*)*)/[a-zA-Z]*z(\r\n|\n|\r)z\\z[a-fA-F0-9]{1,4}z[a-fA-F0-9]{1,2}ÚTokenztype value linenoz\s+z<!--.*Zlinecommentz//.*Zmultilinecommentz	/\*.*?\*/Údotted_nameÚnameÚnumberzb(
        (?:0|[1-9]\d*)
        (\.\d+)?
        ([eE][-+]?\d+)? |
        (0x[a-fA-F0-9]+)
    )Zjsx_tagz(?:</?[^>\s]+|/>)Úoperatorz(%s)Útemplate_stringz`(?:[^`\\]*(?:\\.[^`\\]*)*)`ÚstringzT(
        '(?:[^'\\]*(?:\\.[^'\\]*)*)'  |
        "(?:[^"\\]*(?:\\.[^"\\]*)*)"
    )cCs^g}xTtD]L\}}|r&|r&d|kr&q
|r6|dkr6q
|dkrH|sDq
d}|j||fƒq
W|S)ze
    Get a tokenization rule list given the passed syntax options.

    Internal to this module.
    Újsxr*r&r')Ú_rulesÚappend)r,Údottedr*ÚrulesÚ
token_typeÚrule©r3ú7/tmp/pip-build-gk9425m9/babel/babel/messages/jslexer.pyÚ	get_rules:sr5cCs|jdkr|jdkS|jdkS)
zzA helper function that helps the tokenizer to decide if the current
    token may be followed by a division operator.
    r)rrrú++ú--r'r(r+Úregexp)rrrr6r7)r'r(r+r8)ÚtypeÚvalue)Útokenr3r3r4Úindicates_divisionNs

r<cCsÀ|r |d|dkr |ddks(tdƒ‚tjd|dd…ƒ}g}|j}d}xJ|jd|ƒ}|dkrdP||||…ƒ||d}|tkr–|t|ƒnö|dkr(tj||dƒ}|d	k	r|jƒ}t	|ƒd
kry|t
t|dƒƒƒWntk
rúYnX|d}qN|||ƒ|j
ƒ}qNn||ƒnd|d
kr„tj||dƒ}|d	k	rz|jƒ}|t
t|dƒƒƒ|dt	|ƒ}qNn||ƒn||ƒ|d}qNW|t	|ƒkr¶|||d	…ƒdj|ƒS)z¥Unquote a string with JavaScript rules.  The string has to start with
    string delimiters (``'``, ``"`` or the back-tick/grave accent (for template strings).)
    réz"'`z)string provided is not properly delimitedz\1ú\ZuUéNéééÚxXÚéÿÿÿÿrE)ÚAssertionErrorÚline_join_reÚsubr.ÚfindÚescapesÚ
uni_escape_reÚmatchÚgroupÚlenÚchrÚintÚ
ValueErrorÚendÚ
hex_escape_reÚjoin)r+ÚresultÚaddÚposZ
escape_posZ	next_charÚescapedZ
escaped_valuer3r3r4Úunquote_stringWsT"





rYccsØd}d}d}t|ƒ}t|||d}x°||krÒx^|D]\}	}
|
j||ƒ}|dk	r2Pq2W|rjtj||ƒ}d}	ntj||ƒ}d}	|dkrŒ|d7}q$|jƒ}|	dk	r¶t|	||ƒ}
t|
ƒ}|
V|ttj	|ƒƒ7}|j
ƒ}q$WdS)zì
    Tokenize JavaScript/JSX source.  Returns a generator of tokens.

    :param jsx: Enable (limited) JSX parsing.
    :param dotted: Read dotted names as single name token.
    :param template_string: Support ES6 template strings
    Frr=)r,r/r*Nr)r8)rNr5rLÚdivision_reÚregex_rerMr%r<Úline_reÚfindallrR)Úsourcer,r/r*Z
may_dividerWÚlinenorRr0r1r2rLZtoken_valuer;r3r3r4Útokenizešs2
r`)TTT)Ú__doc__ÚcollectionsrÚreÚsortedrNÚ	operatorsrJÚcompileÚUNICODEZname_reZdotted_name_rerZÚDOTALLr[r\ÚpatternrGrKrSr%ÚVERBOSEÚIrTÚmapÚescaper-r5r<rYr`r3r3r3r4Ú<module>sF






	C