R" fUddlZddlZddlmZddlmZmZmZmZm Z m Z ddl m Z eGddZ Gdd eZid d d d dddddddddej dej"ddddddddd ej d!ej"d"ej e j$e j&zej"ej(zd#d$d%d&d'd(d)d*d+d,d-d.Zd/ed0<Gd1d2Zy)3N) dataclass)DictIteratorNoReturnOptionalTupleUnion) Specifierc,eZdZUeed<eed<eed<y)TokennametextpositionN)__name__ __module__ __qualname__str__annotations__int6/usr/lib/python3/dist-packages/packaging/_tokenizer.pyr r s I IMrr cJeZdZdZdededeeefddffd ZdefdZxZ S) ParserSyntaxErrorz7The provided source text could not be parsed correctly.messagesourcespanreturnNcL||_||_||_t|y)N)rrrsuper__init__)selfrrr __class__s rr"zParserSyntaxError.__init__s%    rcd|jdzd|jd|jdz zzdz}dj|j|j|gS)N r~r ^z )rjoinrr)r#markers r__str__zParserSyntaxError.__str__ sVtyy|#cTYYq\DIIaL-H&IICO}}dllDKK@AAr) rrr__doc__rrrr"r+ __classcell__)r$s@rrrsGA    CHo   BBrrLEFT_PARENTHESISz\(RIGHT_PARENTHESISz\) LEFT_BRACKETz\[ RIGHT_BRACKETz\] SEMICOLON;COMMA, QUOTED_STRINGzk ( ('[^']*') | ("[^"]*") ) OPz(===|==|~=|!=|<=|>=|<|>)BOOLOPz \b(or|and)\bINz\bin\bNOTz\bnot\bVARIABLEa \b( python_version |python_full_version |os[._]name |sys[._]platform |platform_(release|system) |platform[._](version|machine|python_implementation) |python_implementation |implementation_(name|version) |extra )\b SPECIFIERATz\@URLz[^ \t]+ IDENTIFIERz\b[a-zA-Z0-9][a-zA-Z0-9._-]*\bVERSION_PREFIX_TRAILz\.\*z\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*z[ \t]+$)VERSION_LOCAL_LABEL_TRAILWSEND&Dict[str, Union[str, re.Pattern[str]]] DEFAULT_RULESc eZdZdZdeddddfdZdeddfd Zd d ded edefd Zdedede fdZ de fdZ ddddede e de e defdZej"dededededfdZy) TokenizerzContext-sensitive token parsing. Provides methods to examine the input stream to check whether the next token matches. rrulesrErNc||_|jDcic]\}}|tj|c}}|_d|_d|_ycc}}w)Nr)ritemsrecompilerI next_tokenr)r#rrIrpatterns rr"zTokenizer.__init___sO  ;@;;=2 *7$D"**W% %2  ,0 2 s ArcH|j|r|jyy)z8Move beyond provided token name, if at current position.N)checkread)r#rs rconsumezTokenizer.consumels ::d  IIK rF)peekrTc,|jJd|d|j||jvs Jd||j|}|j|j|j}|y|st ||d|j|_y)zCheck whether the next token has the provided name. By default, if the check succeeds, the token *must* be read before another check. If `peek` is set to `True`, the token is not loaded and would need to be checked again. zCannot check for z, already have zUnknown token name: FrT)rNrImatchrrr )r#rrT expressionrVs rrQzTokenizer.checkqs OO # J thodoo5H I J #tzz!B%9$#BB!ZZ%   dmm< =#D%(DMMBDOrexpectedcl|j|s|jd||jS)zsExpect a certain token name next, failing with a syntax error otherwise. The token is *not* read. z Expected )rQraise_syntax_errorrR)r#rrXs rexpectzTokenizer.expects4 zz$))IhZ*@A Ayy{rc|j}|J|xjt|jz c_d|_|S)z%Consume the next token and return it.N)rNrlenr)r#tokens rrRzTokenizer.reads9    UZZ(  r) span_startspan_endrr_r`cr| |jn|| |jn|f}t||j|)z.Raise ParserSyntaxError at the given position.)rr)rrr)r#rr_r`rs rrZzTokenizer.raise_syntax_errorsC(/DMMZ%-DMM8  ;;  r open_token close_tokenaroundc#K|j|r|j}|jnd}d|y|j|s|jd|d|d|||jyw)NzExpected matching z for z, after )r_)rQrrRrZ)r#rbrcrd open_positions renclosing_tokenszTokenizer.enclosing_tokenssz ::j ! MMM IIK M  zz+&  # #$[Mzl(6(S( $  sA6A8)rrrr,rr"rSboolrQr r[rRrrrrZ contextlibcontextmanagerrrgrrrrHrHXs  8   CD 05#*3SUe%)"&   SM  3-    $,/rss !CC!   B B*0;0;0;E0;U 0;  0;  T 0;ZRZZ   0;" %#0;$ o%0;& )'0;( :)0;*    +0;J%% (D(DD R]]"K0;R %S0;T :U0;V3W0;XGY0;Z"D  _0; 70fhhr