VULN_CHECK_I913V6 j:XdZddlZddlZddlZddlmZmZddlmZddl m Z m Z m Z m Z mZddlmZmZmZmZmZmZddlmZgdZej2d Zgd Zed ZGd d eZGddeZ Gdde Z!Gdde"Z#GddZ$e$Z%Gdde&Z'GddZ(dZ)GddZ*e*Z+dZ,Gdd Z-Gd!d"eZ.Gd#d$eZ/Gd%d&e e/Z0Gd'd(Z1Gd)d*e0Z2d+Z3Gd,d-e/Z4Gd.d/e0e4Z5y)0z pygments.lexer ~~~~~~~~~~~~~~ Base lexer classes. :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. N) apply_filtersFilter)get_filter_by_name)ErrorTextOther Whitespace _TokenType) get_bool_opt get_int_opt get_list_optmake_analysatorFuture guess_decode) regex_opt) Lexer RegexLexerExtendedRegexLexerDelegatingLexer LexerContextincludeinheritbygroupsusingthisdefaultwordsline_rez.*? ))sutf-8)szutf-32)szutf-32be)szutf-16)szutf-16becy)N)xs ?/usr/lib/python3.12/site-packages/pip/_vendor/pygments/lexer.pyr%"s#ceZdZdZdZy) LexerMetaz This metaclass automagically converts ``analyse_text`` methods into static methods which always return float values. c\d|vrt|d|d<tj||||S)N analyse_text)rtype__new__)mcsnamebasesds r$r,zLexerMeta.__new__+s3 Q  /.0A BAn ||Cua00r&N)__name__ __module__ __qualname____doc__r,r"r&r$r(r(%s  1r&r(cReZdZdZdZgZgZgZgZdZ dZ dZ dZ dZ dZd dZd Zy) rau Lexer for a specific language. See also :doc:`lexerdevelopment`, a high-level guide to writing lexers. Lexer classes have attributes used for choosing the most appropriate lexer based on various criteria. .. autoattribute:: name :no-value: .. autoattribute:: aliases :no-value: .. autoattribute:: filenames :no-value: .. autoattribute:: alias_filenames .. autoattribute:: mimetypes :no-value: .. autoattribute:: priority Lexers included in Pygments should have an additional attribute: .. autoattribute:: url :no-value: You can pass options to the constructor. The basic options recognized by all lexers and processed by the base `Lexer` class are: ``stripnl`` Strip leading and trailing newlines from the input (default: True). ``stripall`` Strip all leading and trailing whitespace from the input (default: False). ``ensurenl`` Make sure that the input ends with a newline (default: True). This is required for some lexers that consume input linewise. .. versionadded:: 1.3 ``tabsize`` If given and greater than 0, expand tabs in the input (default: 0). ``encoding`` If given, must be an encoding name. This encoding will be used to convert the input string to Unicode, if it is not already a Unicode string (default: ``'guess'``, which uses a simple UTF-8 / Locale / Latin1 detection. Can also be ``'chardet'`` to use the chardet library, if it is installed. ``inencoding`` Overrides the ``encoding`` if given. Nrc l||_t|dd|_t|dd|_t|dd|_t |dd|_|jdd |_|jd xs |j|_g|_ t|d d D]}|j|y )a This constructor takes arbitrary options as keyword arguments. Every subclass must first process its own options and then call the `Lexer` constructor, since it processes the basic options like `stripnl`. An example looks like this: .. sourcecode:: python def __init__(self, **options): self.compress = options.get('compress', '') Lexer.__init__(self, **options) As these options must all be specifiable as strings (due to the command line usage), there are various utility functions available to help with that, see `Utilities`_. stripnlTstripallFensurenltabsizerencodingguess inencodingfiltersr"N) optionsr r7r8r9r r:getr;r>r add_filter)selfr?filter_s r$__init__zLexer.__init__s& #GY= $Wj%@ $Wj$? "7Iq9  J8  L1BT]]  #GY;G OOG $z)r? __class__r1rBs r$__repr__zLexer.__repr__s@ <<59^^5L5L59\\C C*DNN,C,CC Cr&c rt|ts t|fi|}|jj |y)z8 Add a new stream filter to this lexer. N) isinstancerrr>append)rBrCr?s r$rAzLexer.add_filters/'6*(.streamers+66t<1ad =s"%)rKstrr;r pip._vendorrP ImportError _encoding_map startswithlendecodedetectr@rQr8stripr7r: expandtabsr9endswithrr>) rBrN unfilteredrWrPedecodedbomr;encrZstreams `` r$ get_tokenszLexer.get_tokenss$$}}'&t,a)+T3 %2MCs+"&s3xy/"8"89"M&3 ?!..et5C"kk#''**=*H*35G{{4==1??8,H /Dx(CMN+||FD)||D$' ==::F U#T%'LMRSTTsG22 H ; HH ct)aS This method should process the text and return an iterable of ``(index, tokentype, value)`` tuples where ``index`` is the starting position of the token within the input text. It must be overridden by subclasses. It is recommended to implement it as a generator to maximize effectiveness. )NotImplementedError)rBrNs r$rVzLexer.get_tokens_unprocesseds "!r&)F)r1r2r3r4r.aliases filenamesalias_filenames mimetypespriorityurlrDrIrAr*rlrVr"r&r$rr1sY1h DG IOIH C%<D% ">@ "r&r) metaclassc eZdZdZefdZdZy)ra  This lexer takes two lexer as arguments. A root lexer and a language lexer. First everything is scanned using the language lexer, afterwards all ``Other`` tokens are lexed using the root lexer. The lexers from the ``template`` lexer package use this base lexer. c r|di||_|di||_||_tj|fi|yNr") root_lexerlanguage_lexerneedlerrD)rB _root_lexer_language_lexer_needler?s r$rDzDelegatingLexer.__init__s9%00-88  t'w'r&cld}g}g}|jj|D]N\}}}||jur&|r|jt ||fg}||z };|j|||fP|r|jt ||ft ||j j|S)N)rzrVr{rLr` do_insertionsry)rBrNbuffered insertions lng_bufferirXrYs r$rVz&DelegatingLexer.get_tokens_unprocesseds  **AA$GGAq!DKK%%s8}j&AB!#JA !!1a),H    s8}j9 :Z!__CCHMO Or&N)r1r2r3r4rrDrVr"r&r$rr s>C( Or&rceZdZdZy)rzI Indicates that a state should include rules from another state. Nr1r2r3r4r"r&r$rr4s  r&rceZdZdZdZy)_inheritzC Indicates the a state should inherit from its superclass. cy)Nrr"rHs r$rIz_inherit.__repr__?sr&N)r1r2r3r4rIr"r&r$rr;s r&rceZdZdZdZdZy)combinedz: Indicates a state combined from multiple states. c.tj||SrU)tupler,)clsargss r$r,zcombined.__new__Js}}S$''r&cyrUr")rBrs r$rDzcombined.__init__Ms r&N)r1r2r3r4r,rDr"r&r$rrEs( r&rc:eZdZdZdZd dZd dZd dZdZdZ y) _PseudoMatchz: A pseudo match object constructed from a string. c ||_||_yrU)_text_start)rBstartrNs r$rDz_PseudoMatch.__init__Ws  r&Nc|jSrU)rrBargs r$rz_PseudoMatch.start[s {{r&cF|jt|jzSrU)rr`rrs r$endz_PseudoMatch.end^s{{S_,,r&c4|r td|jS)Nz No such group) IndexErrorrrs r$groupz_PseudoMatch.groupas _- -zzr&c|jfSrU)rrHs r$groupsz_PseudoMatch.groupsfs }r&ciSrUr"rHs r$ groupdictz_PseudoMatch.groupdictis r&rU) r1r2r3r4rDrrrrrr"r&r$rrRs%- r&rcdfd }|S)zL Callback that yields multiple actions for each group in the match. c 3KtD]\}}| t|tur1|j|dz}|s1|j |dz||fK|j|dz}|b|r|j |dz|_||t |j |dz||D] }|s| |r|j|_yyw)N) enumerater+r rrposrr)lexermatchctxractiondataitemrs r$callbackzbygroups..callbackqs"4IAv~f+{{1q5)++a!e,fd::{{1q5)#"'++a!e"4 &u'3EKKA4F'Ms!T"&J!T) iikCG s.callbacks emm,$U__.v. A4244U[[]PiP1a!eQk!Q))+sBBc3 K j|jdi }|j}|j|j fi D]\}}}||z||f|r|j |_yywrx)rr?rrVrrr) rrrrrrrXrY_otherrrs r$rzusing..callbacks} MM%-- (!&!B A4244U[[]PiP1a!eQk!Q))+sBBrU)poprKlistrr)rrrrrs`` @r$rrseI& JJw  a$ '!"Ig "(!Ig  ~ &2 O & Or&ceZdZdZdZy)rz Indicates a state or state action (e.g. #pop) to apply. For example default('#pop') is equivalent to ('', Token, '#pop') Note that state tuples may be used as well. .. versionadded:: 2.0 c||_yrU)r)rBrs r$rDzdefault.__init__s  r&N)r1r2r3r4rDr"r&r$rrs r&rceZdZdZddZdZy)rz Indicates a list of literal words that is transformed into an optimized regex that matches any of the words. .. versionadded:: 2.0 c.||_||_||_yrU)rprefixsuffix)rBrrrs r$rDzwords.__init__s   r&cZt|j|j|jS)Nrr)rrrrrHs r$r@z words.getsDKK LLr&N)rr)r1r2r3r4rDr@r"r&r$rrs  Mr&rc<eZdZdZdZdZdZdZd dZdZ d Z y) RegexLexerMetazw Metaclass for RegexLexer, creates the self._tokens attribute from self.tokens on the first instantiation. ct|tr|j}tj||j S)zBPreprocess the regular expression component of a token definition.)rKrr@recompiler)rregexrflagsrs r$_process_regexzRegexLexerMeta._process_regexs. eV $IIKEzz%(...r&c|S)z5Preprocess the token component of a token definition.r")rtokens r$_process_tokenzRegexLexerMeta._process_tokens  r&c|t|tr,|dk(ry||vr|fS|dk(r|S|dddk(rt|dd Syt|trWd|jz}|xjdz c_g}|D]$}|j |j |||&|||<|fSt|tr |D]}|Sy) z=Preprocess the state transition action of a token definition.#pop#pushNz#pop:z_tmp_%dr)rKr[intr_tmpnameextend_process_stater)r new_state unprocessed processed tmp_stateitokensistates r$_process_new_statez!RegexLexerMeta._process_new_states i %F"k)!|#g%  2A')IabM**** 8 ,!CLL0I LLA LG#s11+2;V EF$$+Ii <   5 )#)  *r&c ||vr||Sgx}||<|j}||D]}t|tr,|j|j ||t |@t|t rQt|trO|j|j||}|jtjdjd|f |j|d||}|j#|d} t%|d k(rd}n|j|d ||}|j|| |f|S#t$r } t!d|dd|d|d| | d} ~ wwxYw) z%Preprocess a single state definition.rNrzuncompilable regex z in state z of z: r)flagsrKrrrr[rrrrrLrrrr Exception ValueErrorrr`) rrrrtokensrtdefrrexerrrs r$rzRegexLexerMeta._process_states{ I U# #$&&5!&D$( c00i14T<=$)$(224::{IV  rzz"~33T9EF F((a&%@ &&tAw/E4yA~ 22473> K  MM3y1 2C'D  F "&q'5#s"<=BEF FsD== E&E!!E&Ncix}|j|<|xs|j|}t|D]}|j||||S)z-Preprocess a dictionary of token definitions.) _all_tokensrrr)rr. tokendefsrrs r$process_tokendefzRegexLexerMeta.process_tokendef?sN,.. COOD)1D!1 )_E   y)U ;%r&ci}i}|jD]}|jjdi}|jD]t\}}|j|}|!|||< |j t }|||<:|j|d}|O||||dz |j t } || z||<v|S#t $rYwxYw#t $rYwxYw)a Merge tokens from superclasses in MRO order, returning a single tokendef dictionary. Any state that is not defined by a subclass will be inherited automatically. States that *are* defined by subclasses will, by default, override that state in the superclass. If a subclass wishes to inherit definitions from a superclass, it can use the special value "inherit", which will cause the superclass' state definition to be included at that point in the state. rNr)__mro____dict__r@itemsindexrrr) rr inheritablectoksrrcuritems inherit_ndx new_inh_ndxs r$ get_tokendefszRegexLexerMeta.get_tokendefsGs A::>>(B/D $ u!::e,# %*F5M!&+kk'&: *5K&)ooeT: &7<[]3C#(++g"6K*5{)BK&9!-B )&! !"s$B;C ; CC CCcd|jvrLi|_d|_t|dr |jrn%|j d|j |_tj|g|i|S)z:Instantiate cls after preprocessing its token definitions._tokensrtoken_variantsr) rrrhasattrrrrrr+__call__)rrkwdss r$rzRegexLexerMeta.__call__xsh CLL ( COCLs,-#2D2D!222s7H7H7JK }}S040400r&rU) r1r2r3r4rrrrrrrr"r&r$rrs. /  !AF*X/b 1r&rc4eZdZdZej ZiZddZy)rz Base for simple stateful regular expression-based lexers. Simplifies the lexing process so that you need only provide a list of states and regular expressions. c#$Kd}|j}t|}||d} |D]\}}} |||} | s|8t|tur||| j fn||| Ed{| j }| t | trX| D]R} | dk(r t|dkDs|j(| dk(r|j|dB|j| TnLt | tr#t| t|k\r|dd=n|| d=n| dk(r|j|d||d}n7 ||dk(rdg}|d}|tdf|dz }E|t||f|dz }Y7#t$rYywxYww) z~ Split ``text`` into (tokentype, text) pairs. ``stack`` is the initial stack (default: ``['root']``) rrrNrrrRr)rrr+r rrrKrr`rrLrabsr rr) rBrNrrr statestack statetokensrexmatchrrmrs r$rVz!RegexLexer.get_tokens_unprocesseds LL %[  2/ /:+&)T3')<:5"%vqwwy"88'-dA66%%'C ,%i7)2#(F?'*:':(2(8%*g%5$.$5$5jn$E$.$5$5e$<*3( 37 #9~Z@$.qrN$.yz$:&'1&--jn='0 2&? C0;J CyD(&,X &/&7 !:t33q ud3i//1HC_7P"sM8F5F0E>1>F0BF F'F)F<F F  F F  FN)r) r1r2r3r4r MULTILINErrrVr"r&r$rrs LLE0F;r&rceZdZdZddZdZy)rz9 A helper object that holds lexer position data. Nc`||_||_|xs t||_|xsdg|_y)Nr)rNrr`rr)rBrNrrrs r$rDzLexerContext.__init__s. ##d)&vh r&cVd|jd|jd|jdS)Nz LexerContext(z, ))rNrrrHs r$rIzLexerContext.__repr__s IItxx- -r&NN)r1r2r3r4rDrIr"r&r$rrs' -r&rceZdZdZddZy)rzE A RegexLexer that uses a context object to store its state. Nc#K|j}|st|d}|d}n |}||jd}|j} |D]\}}}|||j|j } | s)|lt |tur5|j|| jf| j |_n&||| |Ed{|s||jd}|*t|tr|D]} | dk(r4t|jdkDs!|jj<| dk(r)|jj|jdj|jj| n~t|trAt|t|jk\r|jdd=n=|j|d=n-|dk(r(|jj|jd||jd}n |j|j k\ry||jdk(r9dg|_|d}|jt df|xjdz c_0|jt"||jf|xjdz c_h7#t$$rYywxYww) z Split ``text`` into (tokentype, text) pairs. If ``context`` is given, use this lexer context instead. rrrrNrrrR)rrrrNrrr+r rrKrr`rrLrrrrr) rBrNcontextrrrrrrrrs r$rVz)ExtendedRegexLexer.get_tokens_unprocesseds] LL tQ'C#F+KC#CIIbM2K88D/:+&)T377CGG4)<:5"%''61779"<<&'eegCG'-dAs';;;#,.7 " .F  ,%i7)2#(F?'*399~'9(+ %*g%5$'II$4$4SYYr]$C$'II$4$4U$;*3( 37"9~SYY?$'IIabM$'IIij$9&'1II,,SYYr];'0 " &> G0;J ww#'')CGG},%+H &/&7 !ggtT111  ''5$sww-77GGqLGc/AJ>J,A J>C:J>J/'J>(A J/1J>37J/*J>/ J;8J>:J;;J>r)r1r2r3r4rVr"r&r$rrs @r&rc#Kt|} t|\}}d}d}|D]\}}}||}d} |rx|t|z|k\rg|| ||z } | r||| f|t| z }|D]\} } } || | f|t| z }||z } t|\}}|r|t|z|k\rg| t|ks|||| df|t|| z z }|r9|xsd}|D]\}}}|||f|t|z } t|\}}|r8yy#t$r|Ed{7YywxYw#t$rd}YwxYw#t$rd}YywxYww)ag Helper for lexers which must combine the results of several sublexers. ``insertions`` is a list of ``(index, itokens)`` pairs. Each ``itokens`` iterable should be inserted at position ``index`` into the token stream given by the ``tokens`` argument. The result is a combined token stream. TODO: clean up the code here. NTrF)iternext StopIterationr`)rrrrrealposinsleftrrXrYolditmpvalit_indexit_tokenit_valueps r$rr?sj!Jj)w GG1a ?G!c!f*-tEAI&Fq&((3v;&07,(Hx113x=(1819D !%j!1w!c!f*- #a&=1ah& & s1v} $G+0 ,QGAq!1a-  s1v G !*-NE7 E 4!    G  s EDA*ED,E*E9AE?D= EED) D#!D)&E(D))E, D:7E9D::E= E E E  EceZdZdZdZy)ProfilingRegexLexerMetaz>Metaclass for ProfilingRegexLexer, collects regex timing info.ct|tr-t|j|j|jn|t j |tjffd }|S)Nrcjdj fddg}tj}j|||}tj}|dxxdz cc<|dxx||z z cc<|S)Nrrr!r) _prof_data setdefaulttimer) rNrendposinfot0rest1rcompiledrrs r$ match_funcz:ProfilingRegexLexerMeta._process_regex..match_funcsr>>"%00%3xHDB..sF3CB GqLG GrBw GJr&) rKrrrrrrsysmaxsize)rrrrr,r+rs` ` @@r$rz&ProfilingRegexLexerMeta._process_regexsZ eU #EKK #(<<1CC::c6*),  r&N)r1r2r3r4rr"r&r$r r s Hr&r c eZdZdZgZdZddZy)ProfilingRegexLexerzFDrop-in replacement for RegexLexer that does profiling of its regexes.c#JKjjjitj ||Ed{jjj }t d|jDfdd}td|D}ttdjjt||fztdtdd ztd |D]}td |ztdy7ݭw) Nc3K|]H\\}}\}}|t|jdjdddd|d|zd|z|z fJyw)zu'z\\\NAi)reprrcrQ).0rrnrXs r$ z=ProfilingRegexLexer.get_tokens_unprocessed..sa@/>+FQFQ47==/77EcrJ4!8TAX\3/>sAAc"|jSrU)_prof_sort_index)r#rBs r$r%z.sAd&;&;$.s+d!dsz2Profiling result for %s lexing %d chars in %.3f mszn==============================================================================================================z$%-20s %-64s ncalls tottime percall)rrzn--------------------------------------------------------------------------------------------------------------z%-20s %-65s %5d %8.4f %8.4f) rGr#rLrrVrsortedrsumprintr1r`)rBrNrrawdatar sum_totalr0s` r$rVz*ProfilingRegexLexer.get_tokens_unprocesseds !!((,44T4GGG..++//1@/6}}@=" $ +d++   B~~&&D 9=> ? i 47IIJ iA /!3 4 i# HsAD#D!CD#Nr )r1r2r3r4r#r<rVr"r&r$r0r0sPJr&r0)6r4rr-r%pip._vendor.pygments.filterrrpip._vendor.pygments.filtersrpip._vendor.pygments.tokenrrrr r pip._vendor.pygments.utilr r r rrrpip._vendor.pygments.regexoptr__all__rrr^ staticmethod_default_analyser+r(rrr[rrrrrrrrrrrrrrrrrr r0r"r&r$rNsJ =;QQ**3 * "**W ,  . 1 1Y"iY"xOeON c  *  u  64  w/d   MF M e1Ye1P^.^B - - EEP=@n,*0Gr&