a „oe¬ã@sàUddlZddlZddlmZddlmZmZmZmZm Z m Z ddl m Z eGdd„dƒƒZ Gdd „d eƒZd d d d dde dej¡dddde dej¡e e je jejejB¡ddddddddœZded<Gd d!„d!ƒZdS)"éN)Ú dataclass)ÚDictÚIteratorÚNoReturnÚOptionalÚTupleÚUnioné)Ú Specifierc@s&eZdZUeed<eed<eed<dS)ÚTokenÚnameÚtextÚpositionN)Ú__name__Ú __module__Ú __qualname__ÚstrÚ__annotations__Úint©rrúHC:\Program Files\Certbot\pkgs\setuptools\_vendor\packaging\_tokenizer.pyr s r csBeZdZdZeeeeefddœ‡fdd„ Zedœdd„Z‡Z S) ÚParserSyntaxErrorz7The provided source text could not be parsed correctly.N)ÚmessageÚsourceÚspanÚreturncs ||_||_||_tƒ ¡dS)N)rrrÚsuperÚ__init__)Úselfrrr©Ú __class__rrrszParserSyntaxError.__init__©rcCs>d|jdd|jd|jdd}d |j|j|g¡S)Nú rú~r ú^z )rÚjoinrr)rZmarkerrrrÚ__str__ s*zParserSyntaxError.__str__) rrrÚ__doc__rrrrr&Ú __classcell__rrrrrs ú rz\(z\)z\[z\]ú;ú,zk ( ('[^']*') | ("[^"]*") ) z(===|==|~=|!=|<=|>=|<|>)z \b(or|and)\bz\bin\bz\bnot\ba‡ \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 z\@z[^ \t]+z\b[a-zA-Z0-9][a-zA-Z0-9._-]*\bz\.\*z\+[a-z0-9]+(?:[-_\.][a-z0-9]+)*z[ \t]+ú$)ZLEFT_PARENTHESISZRIGHT_PARENTHESISZ LEFT_BRACKETZ RIGHT_BRACKETZ SEMICOLONÚCOMMAZ QUOTED_STRINGÚOPZBOOLOPÚINZNOTZVARIABLEZ SPECIFIERÚATZURLZ IDENTIFIERZVERSION_PREFIX_TRAILZVERSION_LOCAL_LABEL_TRAILZWSZENDú&Dict[str, Union[str, re.Pattern[str]]]Ú DEFAULT_RULESc@s¬eZdZdZedddœdd„Zeddœdd „Zd d œeeed œd d„Zeee dœdd„Z e dœdd„Z dddœee e e e edœdd„Zejeeeeddœdd„ƒZdS)Ú Tokenizerz„Context-sensitive token parsing. Provides methods to examine the input stream to check whether the next token matches. r0N)rÚrulesrcCs*||_dd„| ¡Dƒ|_d|_d|_dS)NcSsi|]\}}|t |¡“qSr)ÚreÚcompile)Ú.0r ÚpatternrrrÚ fsz&Tokenizer.__init__..r)rÚitemsr3Ú next_tokenr)rrr3rrrr_s ÿzTokenizer.__init__)r rcCs| |¡r| ¡dS)z8Move beyond provided token name, if at current position.N)ÚcheckÚread)rr rrrÚconsumels zTokenizer.consumeF)Úpeek)r r>rcCsz|jdus Jd|›d|j›�ƒ‚||jvs8Jd|›�ƒ‚|j|}| |j|j¡}|dur^dS|svt||d|jƒ|_dS)zÿCheck 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. NzCannot check for z, already have zUnknown token name: FrT)r:r3Úmatchrrr )rr r>Z expressionr?rrrr;qsÿþ zTokenizer.check)r ÚexpectedrcCs"| |¡s| d|›�¡‚| ¡S)zsExpect a certain token name next, failing with a syntax error otherwise. The token is *not* read. z Expected )r;Úraise_syntax_errorr<)rr r@rrrÚexpect†s zTokenizer.expectr!cCs0|j}|dusJ‚|jt|jƒ7_d|_|S)z%Consume the next token and return it.N)r:rÚlenr )rÚtokenrrrr<�s  zTokenizer.read)Ú span_startÚspan_end)rrErFrcCs8|dur|jn||dur|jn|f}t||j|d�‚dS)z.Raise ParserSyntaxError at the given position.N)rr)rrr)rrrErFrrrrrA™s þýzTokenizer.raise_syntax_error)Ú open_tokenÚ close_tokenÚaroundrccsf| |¡r|j}| ¡nd}dV|dur0dS| |¡sZ|jd|›d|›d|›�|d�| ¡dS)NzExpected matching z for z, after )rE)r;rr<rA)rrGrHrIZ open_positionrrrÚenclosing_tokens«s   þzTokenizer.enclosing_tokens)rrrr'rrr=Úboolr;r rBr<rrrrAÚ contextlibÚcontextmanagerrrJrrrrr2Xs*û  ûú þr2)rLr4Z dataclassesrÚtypingrrrrrrZ specifiersr r Ú Exceptionrr5ÚVERBOSEZ_operator_regex_strZ_version_regex_strÚ IGNORECASEr1rr2rrrrÚsL    ø  ò  þÑ3