o
    niz                     @   s&  d Z ddlZddlmZmZmZmZmZmZm	Z	m
Z
mZ ddlmZmZmZmZmZmZmZmZmZ ddlmZ g dZed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"G dd deZ#G dd deZ$dS )z
    pygments.lexers.shell
    ~~~~~~~~~~~~~~~~~~~~~

    Lexers for various shells.

    :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)	Lexer
RegexLexerdo_insertionsbygroupsincludedefaultthisusingwords)	PunctuationTextCommentOperatorKeywordNameStringNumberGeneric)shebang_matches)		BashLexerBashSessionLexer	TcshLexer
BatchLexerMSDOSSessionLexerPowerShellLexerPowerShellSessionLexerTcshSessionLexerFishShellLexerz.*?
c                   @   s  e Zd ZdZdZg dZg dZddgZedde	j
d	fed
edgdedfdedfde	jdfdejfdejfdefgdeeefdejfdejfdejfde	jfdeejeefdefdefde	fdefg
de	jfd e	jd!fd"e	jfd#e	jfd$efd%efd&efd'efd(efd)efd*efgd e	jd+fd,e	jfedgd-e	jd+fd.efd/ejfd0efd1efed2gd3ed+fed2gd4ed+fd5efd6efd7efd8efed2gde	j
d+fed2gd9	Zd:d; Zd<S )=r   zI
    Lexer for (ba|k|z|)sh shell scripts.

    .. versionadded:: 0.6
    Bash)bashshkshzshshell)z*.shz*.kshz*.bashz*.ebuildz*.eclassz*.exheres-0z*.exlibz*.zshz.bashrcbashrcz.bash_*zbash_*zshrcz.zshrcPKGBUILDzapplication/x-shzapplication/x-shellscriptbasic`	backticksdatainterp\$\(\(math\$\(paren\$\{#?curlyz\$[a-zA-Z_]\w*z\$(?:\d+|[#$?!_*@-])z\$za\b(if|fi|else|while|do|done|for|then|return|function|case|select|continue|until|esac|elif)(\s*)\baM  \b(alias|bg|bind|break|builtin|caller|cd|command|compgen|complete|declare|dirs|disown|echo|enable|eval|exec|exit|export|false|fc|fg|getopts|hash|help|history|jobs|kill|let|local|logout|popd|printf|pushd|pwd|read|readonly|set|shift|shopt|source|suspend|test|time|times|trap|true|type|typeset|ulimit|umask|unalias|unset|wait)(?=[\s)`])z\A#!.+\n#.*\n\\[\w\W]z(\b\w+)(\s*)(\+?=)z[\[\]{}()=]z<<<<<-?\s*(\'?)\\?(\w+)[\w\W]+?\2z&&|\|\|%(?s)\$?"(\\\\|\\[0-7]+|\\.|[^"\\$])*""string#(?s)\$'(\\\\|\\[0-7]+|\\.|[^'\\])*'	(?s)'.*?';&z\|\s+z\d+\b[^=\s\[\]{}()$"\'`\\<&|;]+<#pop (?s)(\\\\|\\[0-7]+|\\.|[^"\\$])+\}:-\w+z[^}:"\'`$\\]+:root\)\)\)[-+*/%^|&]|\*\*|\|\|\d+#\d+	\d+#(?! )\d+)	rE   r+   r'   r*   r7   r1   r/   r-   r)   c                 C   s    t | drdS | drdS d S )Nz	(ba|z|)sh   z$ g?)r   
startswith)text rO   `/home/ubuntu/SoloSpeech/.venv/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/shell.pyanalyse_textz   s
   

zBashLexer.analyse_textN)__name__
__module____qualname____doc__namealiases	filenames	mimetypesr   r   Backtickr   Interpolr   Variabler   r   Builtinr   HashbangSingleEscaper   Doubler   r   tokensrQ   rO   rO   rO   rP   r      s    

	


	
	Or   c                   @   s   e Zd ZdZdd ZdS )ShellSessionBaseLexerzN
    Base lexer for simplistic shell sessions.

    .. versionadded:: 2.1
    c              
   c   s   | j di | j}d}d}g }d}t|D ]}| }t| j|}	|r0||7 }|d}q|	rV|s8|	 }|
t|dtj|	dfgf ||	d7 }|d}q|| jr|
t|dtj|d t| j fgf ||t| jd  7 }|d}q|r||}
t||
D ]\}}}|| ||fV  q|	 tj|fV  g }d}q|rt|||D ]\}}}|| ||fV  qd S d S )Nr    Fz\
rL      rO   )_innerLexerClsoptionsline_refinditergrouprematch_ps1rgxendswithstartappendlenr   PromptrM   _ps2get_tokens_unprocessedr   Output)selfrN   
innerlexerposcurcode
insertionsbackslash_continuationrl   linemtoksitvrO   rO   rP   rt      sP   


z,ShellSessionBaseLexer.get_tokens_unprocessedN)rR   rS   rT   rU   rt   rO   rO   rO   rP   rc      s    rc   c                   @   s8   e Zd ZdZdZddgZddgZddgZeZ	d	Z
d
ZdS )r   zI
    Lexer for simplistic shell sessions.

    .. versionadded:: 1.1
    zBash Sessionconsolezshell-sessionz*.sh-sessionz*.shell-sessionzapplication/x-shell-sessionzapplication/x-sh-sessionzh^((?:(?:\[.*?\])|(?:\(\S+\))?(?:| |sh\S*?|\w+\S+[@:]\S+(?:\s+\S+)?|\[\S+[@:][^\n]+\].+))\s*[$#%])(.*\n?)>N)rR   rS   rT   rU   rV   rW   rX   rY   r   rf   rm   rs   rO   rO   rO   rP   r      s    r   c                   @   s  e Zd ZdZdZg dZddgZdgZej	ej
B ZdZdZd	Zd
eef Zdeeeef Zdeeef Zde Zdeeeef Zdeeeef Zde ZdZdeef Zdeeeeeeeeeeeef Zdeeeef Zdeeeef Zdeef Zdeef Zdeeeef ZeeeeeeeeeeeefddZeeeeeeeefddZeeeeefddZ eefddZ!eeeeeefd d!Z"eeeeeeeefd"d#Z#i d$ed%d&ed%d'e d%d(e!d%d)e"d%d*e#d%d+ed,d-ed,d.e d,d/e!d,d0e"d,d1e#d,d2ee$j%fd3e e&j'fgd4d5e&j(d6fee$j%fd7e&j'fd8e e&j(fe)d6gd9e*d2d:e&j+fgd;e*d2d:e&j,fgd<d5e&j(d4fe*d2d=eeef e-fgd5e&j(d4fe*d2d>e e$j%fgd?eef e.e/e0d<d@e1e/e0d<d@e2d6fe*d&gdAe2fdBeef e.e/e0d<d@e1d6fdCe e-fe*d&gdDeeef e.e&j(e/e0d4d@e-e2fd5e&j(dEfdFeeef e.e/e0d9d@e-e2fdGeeef e.e/e0d;d@e-e2fe*dHgdIe3j4fe*dHgdJeef e.e1e/e0d<d@e3j4d6fdKeeef e.e1e/e0d<d@e/e0dLd@d6fdMeeef e.e1e/e0d<d@d6fdNeeeeef e.e/e0d'd@e5j6e/e0d'd@d6fee/e0d<d@dOfgdPeeef e.e/e0d<d@e5e/e0d<d@d6fdQeeeef e.e/e0d<d@e5j6e/e0d<d@d6fgee/e0d<d@fdRe2dSfe)d6gee/e0d<d@fdTe e1d6fe)d6gdU	Z7dVS )Wr   zQ
    Lexer for the DOS/Windows Batch file format.

    .. versionadded:: 0.7
    	Batchfile)batbatchdosbatchwinbatchz*.batz*.cmdzapplication/x-dos-batchz\n\x1az&<>|z\t\v\f\r ,;=\xa0z(?:(?:(?:\^[%s])?[%s])+)z%(?=(?:\^[%s]?)?[%s+./:[\\\]]|[%s%s(])z(?=\^?[%s]|[%s%s])z((?:(?<=^[^:])|^[^:]?)[%s]*)(:)z#(?:(?:[^%s%s%s+:^]|\^[%s]?[\w\W])*)z"(?:(?:[^%s%s%s+:^)]|\^[%s]?[^)])*)z"(?:-?(?:0[0-7]+|0x[\da-f]+|\d+)%s)z(?:equ|geq|gtr|leq|lss|neq)z(?:"[^%s"]*(?:"|(?=[%s])))a  (?:(?:%%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|[^%%:%s]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%%%s^]|\^[^%%%s])[^=%s]*=(?:[^%%%s^]|\^[^%%%s])*)?)?%%))|(?:\^?![^!:%s]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^!%s^]|\^[^!%s])[^=%s]*=(?:[^!%s^]|\^[^!%s])*)?)?\^?!))z(?:(?:(?:\^[%s]?)?[^"%s%s%s])+)z (?:(?:(?:\^[%s]?)?[^"%s%s%s)])+)z(?:[%s]+|%s)(?:[%s]+|(?:%s|%s|%s)+)c                 C   s  d||||| r	dndf }d||f }d||f }d| }d}| r+d| }d|
 }
d}| r2d	t d
fnd|
|f tjfd| td| f|ttddftd| d| tfdt dfdt fd||
|| rb|n|||f ttttddd| fd|||||f ttttddd| ft	d|dtd| fd| ttttddt d| fd| tfd|
||
f ttttddtdfd|
||
f ttttddtdfd|
 td fd!||f ttttddt d"| fd#|
||
||
|f ttttddtttddtttddd$fd%|
||	|| r	|n|f tjd| fd&||f ttttddtd'| fd(||||||| r0dnd||f	 ttttddtttddttd)dt d| ft
d| gS )*Nz(?:%s|%s|[^"%%%s%s%s])*)rd   z(?:(?:[^%s^]|\^[%s]?[\w\W])*)z(?:(?:[^%s^)]|\^[%s]?[^)])*)z((?:(?:\^[%s]?)?[^\S\n])*)z(?:(?=\))|%s)	/compoundrF   r?   z\)((?=\()|%s)%sz(?=%s)zfollow%srN   state
redirect%s[%s]+\(root/compoundz@+zg((?:for|if|rem)(?:(?=(?:\^[%s]?)?/)|(?:(?!\^)|(?<=m))(?:(?=\()|%s)))(%s?%s?(?:\^[%s]?)?/(?:\^[%s]?)?\?)z)(goto%s)(%s(?:\^[%s]?)?/(?:\^[%s]?)?\?%s))'assocbreakcdchdirclscolorcopydatedeldirdpathechoendlocaleraseexitftypekeysmdmkdirmklinkmovepathpausepopdpromptpushdrdrenrenamermdirsetlocalshiftro   timetitletypeververifyvol)suffixz(call)(%s?)(:)zcall%sz(for%s(?!\^))(%s)(/f%s))for/fforz(for%s(?!\^))(%s)(/l%s))for/lr   zfor%s(?!\^))for2r   z(goto%s)(%s?)(:?)zlabel%sz=(if(?:(?=\()|%s)(?!\^))(%s?)((?:/i%s)?)(%s?)((?:not%s)?)(%s?))(?ifzrem(((?=\()|%s)%s?%s?.*|%s%s)z(set%s)%s(/a)zarithmetic%szY(set%s)%s((?:/p)?)%s((?:(?:(?:\^[%s]?)?[^"%s%s^=%s]|\^[%s]?[^"=])+)?)((?:(?:\^[%s]?)?=)?)variable)r   r   r_   r   r	   r   r   r   r   r
   r   )compound_core_token_core_token_compound_keyword_terminator_nl_punct_string_space_start_label_stoken_token_terminator	_variable_wsrestrest_of_linerest_of_line_compound	set_spacer   rO   rO   rP   _make_begin_state   s   










zBatchLexer._make_begin_statec	                 C   s|   | rdnd}	g }
| r|
 dtdf |
d||| r|n|f tttttjtjftd|	 d| tdfdtdftd	g7 }
|
S )
Nr   rd   (?=\))r?   z%s([%s]*)(%s)(.*)r   z(?=[%s])z	\|\|?|&&?rN   )	rp   r   r   r   r   Labelr   r_   r   )r   _label_label_compoundr   r   r   _token_token_compoundr   r   r   rO   rO   rP   _make_follow_stateC  s    
	zBatchLexer._make_follow_statec                 C   s   d}g }| r| dtdf |dtjfdtjfdtjfdtfd| tfd	|||||||||| r1d
ndf
 tt	ddfdtdft
dg7 }|S )Nz=+\-*/!~r   r?   z0[0-7]+z
0x[\da-f]+rK   z[(),]+z([%s]|%%|\^\^)+z0(%s|%s|(\^[%s]?)?[^()%s%%^"%s%s%s]|\^[%s%s]?%s)+[^)][\w\W]r   r   z(?=[\x00|&])follow)rp   r   r   OctHexIntegerr   r   r	   r   r   )r   r   r   r   r   r   opr   rO   rO   rP   _make_arithmetic_stateW  s*   


z!BatchLexer._make_arithmetic_statec                 C   s@   g }| r| dtdf | d| r|n| tttjdf |S )Nr   r?   z(:?)(%s))rp   r   r   r   r   r   )r   r   r   r   rO   rO   rP   _make_call_statel  s   zBatchLexer._make_call_statec                 C   sb   g }| r| dtdf | d| r|n||||| rdnd||| r"dndf ttjtjdf |S )Nr   r?   z)(%s?)((?:%s|%s|\^[%s]?%s|[^"%%^%s%s%s])*)r   r   r   rd   )rp   r   r   r   r   r   r_   )r   r   r   r   r   r   r   r   rO   rO   rP   _make_label_stateu  s   zBatchLexer._make_label_statec	           
   	   C   sb   d||||f }	d||||f t tjtttjfd||||| r!|	n|f t tjtttddfgS )Nr   z*((?:(?<=[%s%s])\d)?)(>>?&|<&)([%s%s]*)(\d)z-((?:(?<=[%s%s])(?<!\^[%s])\d)?)(>>?|<)(%s?%s)rN   r   )r   r   r   r   r   r	   r   )
r   r   r   r   r   r   r   r   r   stoken_compoundrO   rO   rP   _make_redirect_state  s   

zBatchLexer._make_redirect_staterE   Fr   
arithmeticcalllabelredirectr   Tzfollow/compoundzarithmetic/compoundzcall/compoundzlabel/compoundzredirect/compoundzvariable-or-escapez%%%%|\^[%s]?(\^!|[\w\W])r7   r6   r?   z\^!|%%z[^"%%^%s]+|[%%^]sqstringz[^%]+|%bqstringrN   z[^"%%^%s%s%s\d)]+|.z[^"%%^%s]+|.z(%s)(in)(%s)(\()r   rF   z
(%s)(do%s)r   z (")((?:%s|[^"])*?")([%s%s]*)(\)))r?   r   r7   z%('(?:%%%%|%s|[\w\W])*?')([%s%s]*)(\))z%(`(?:%%%%|%s|[\w\W])*?`)([%s%s]*)(\))r   z-?\d+z)((?:cmdextversion|errorlevel)%s)(%s)(\d+)z(defined%s)(%s)(%s)r   z(exist%s)(%s%s)z(%s%s)(%s)(%s%s))r?   if2z(%s?)(==)(%s?%s)z(%s)(%s)(%s%s)r   )r?   else?r   zelse%s)	r   r   r   r   r   r   r   r   r   N)8rR   rS   rT   rU   rV   rW   rX   rY   rk   	MULTILINE
IGNORECASEflagsr   r   r   r   r   r   r   r   r   _number_opwordr   r   r   r   r   r   r   r   r   r   r   r   r   r   r\   r   r`   ra   r   r   r_   rZ   r   r   r	   r   r   r   r   r   r   Wordrb   rO   rO   rO   rP   r      s   



T


	

	

 

&







	r   c                   @   .   e Zd ZdZdZdgZg Zg ZeZ	dZ
dZdS )r   zI
    Lexer for simplistic MSDOS sessions.

    .. versionadded:: 2.1
    zMSDOS Sessiondoscon^([^>]+>)(.*\n?)zMore? N)rR   rS   rT   rU   rV   rW   rX   rY   r   rf   rm   rs   rO   rO   rO   rP   r         r   c                
   @   s  e Zd ZdZdZddgZddgZdgZedd	e	d
fde	dfde
jdfedgde	fdejfdefde
jfdeejeefdefde
fdefgde
jfde
jfdefdefdefdejfgde	dfd e	fd!ejfd"efd#efed$gd%e	dfed$gde
jdfed$gd&Zd'S )(r   z=
    Lexer for tcsh scripts.

    .. versionadded:: 0.10
    Tcshtcshcshz*.tcshz*.cshzapplication/x-cshr'   r.   r/   r0   r1   r(   r)   r*   z]\b(if|endif|else|while|then|foreach|case|default|continue|goto|breaksw|end|switch|endsw)\s*\ba  \b(alias|alloc|bg|bindkey|break|builtins|bye|caller|cd|chdir|complete|dirs|echo|echotc|eval|exec|exit|fg|filetest|getxvers|glob|getspath|hashstat|history|hup|inlib|jobs|kill|limit|log|login|logout|ls-F|migrate|newgrp|nice|nohup|notify|onintr|popd|printenv|pushd|rehash|repeat|rootnode|popd|pushd|set|shift|sched|setenv|setpath|settc|setty|setxvers|shift|source|stop|suspend|source|suspend|telltc|time|umask|unalias|uncomplete|unhash|universe|unlimit|unset|unsetenv|ver|wait|warp|watchlog|where|which)\s*\bz#.*r3   (\b\w+)(\s*)(=)z[\[\]{}()=]+z<<\s*(\'?)\\?(\w+)[\w\W]+?\2r:   z!(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"z!(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'r<   z[^=\s\[\]{}()$"\'`\\;#]+\d+(?= |\Z)\$#?(\w+|.)rA   r?   rB   rC   z[^}:"\'`$]+rD   rE   rF   )rE   r'   r*   r1   r/   r)   N)rR   rS   rT   rU   rV   rW   rX   rY   r   r   r   rZ   r   r]   r   r`   r   r\   r   r   r   ra   r_   r   rb   rO   rO   rO   rP   r     s\    
	
		

r   c                   @   r   )r   z=
    Lexer for Tcsh sessions.

    .. versionadded:: 2.1
    zTcsh Sessiontcshconr   z? N)rR   rS   rT   rU   rV   rW   rX   rY   r   rf   rm   rs   rO   rO   rO   rP   r   Q  r   r   c                   @   s  e Zd ZdZdZg dZddgZdgZej	ej
B ejB Zd Zd Zd	 Zd
 Zdedfdefdde eeejefdefdejdfdejdfdejfdefdejdfdejfdejfdde efdde e fdde ej!fdej"fdefd efd!efgd"ed#fe#d$gd%ejfd&ejd#fd'de ejfd(ejfgd)ej$fd*ejfd+edfd,ejfd-ejfdejd#fgd.ejd#fd+edfd/ejfd0ejfgd1Z%d2S )3r   zA
    For Windows PowerShell code.

    .. versionadded:: 1.5
    
PowerShell)
powershellposhps1psm1z*.ps1z*.psm1ztext/x-powershella  while validateset validaterange validatepattern validatelength validatecount until trap switch return ref process param parameter in if global: function foreach for finally filter end elseif else dynamicparam do default continue cmdletbinding break begin alias \? % #script #private #local #global mandatory parametersetname position valuefrompipeline valuefrompipelinebypropertyname valuefromremainingarguments helpmessage try catch throwaN  and as band bnot bor bxor casesensitive ccontains ceq cge cgt cle clike clt cmatch cne cnotcontains cnotlike cnotmatch contains creplace eq exact f file ge gt icontains ieq ige igt ile ilike ilt imatch ine inotcontains inotlike inotmatch ireplace is isnot le like lt match ne not notcontains notlike notmatch or regex replace wildcarda  write where wait use update unregister undo trace test tee take suspend stop start split sort skip show set send select scroll resume restore restart resolve resize reset rename remove register receive read push pop ping out new move measure limit join invoke import group get format foreach export expand exit enter enable disconnect disable debug cxnew copy convertto convertfrom convert connect complete compare clear checkpoint aggregate addzcomponent description example externalhelp forwardhelpcategory forwardhelptargetname functionality inputs link notes outputs parameter remotehelprunspace role synopsisr   childr<   z ^(\s*#[#\s]*)(\.(?:%s))([^\n]*$)|z	#[^\n]*?$z	(&lt;|<)#multlinez@"\nheredoc-doublez@'\n.*?\n'@z	`[\'"$@-]r6   r7   z'([^']|'')*'z+(\$|@@|@)((global|script|private|env):)?\w+z(%s)\bz-(%s)\bz(%s)-[a-z_]\w*\bz\[[a-z_\[][\w. `,\[\]]*\]z
-[a-z_]\w*rC   z#[.,;@{}\[\]$()=+*/\\&%!~?^`|<>-]|::rF   r?   rE   z[^#&.]+z	#(>|&gt;)z\.(%s)z[#&.]z`[0abfnrtv'\"$`]z[^$`"]+r.   z""z[`$]z\n"@z	[^@\n]+"].)rE   r  r  r7   r  N)&rR   rS   rT   rU   rV   rW   rX   rY   rk   DOTALLr   r   r   splitkeywords	operatorsverbscommenthelpr   r   joinr   r   r   Doc	MultilineHeredocra   r_   r   r\   r   r   r]   Constantr   r`   rb   rO   rO   rO   rP   r   b  s~    
	
	





	
r   c                   @   r   )r   zV
    Lexer for simplistic Windows PowerShell sessions.

    .. versionadded:: 2.1
    zPowerShell Sessionps1conz^(PS [^>]+> )(.*\n?)z>> N)rR   rS   rT   rU   rV   rW   rX   rY   r   rf   rm   rs   rO   rO   rO   rP   r     r   r   c                   @   s2  e Zd ZdZdZddgZddgZdgZeded	ed
gde	dfde	dfde
jfgdee	efde
jfdefdejfdee
jeefdefdefgdejfdejdfdejfdejfdefdefdefdefd efg	dejd!fd"ejfed
gd#e	d!fed$gd%e	d!fd&efd'efd(efd)efed$gd*Zd+S ),r   zB
    Lexer for Fish shell scripts.

    .. versionadded:: 2.1
    Fishfish	fishshellz*.fishz*.loadzapplication/x-fishr'   r*   r+   r,   r-   r   r/   r   z\b(begin|end|if|else|while|break|for|in|return|function|block|case|continue|switch|not|and|or|set|echo|exit|pwd|true|false|cd|count|test)(\s*)\ba  \b(alias|bg|bind|breakpoint|builtin|command|commandline|complete|contains|dirh|dirs|emit|eval|exec|fg|fish|fish_config|fish_indent|fish_pager|fish_prompt|fish_right_prompt|fish_update_completions|fishd|funced|funcsave|functions|help|history|isatty|jobs|math|mimedb|nextd|open|popd|prevd|psub|pushd|random|read|set_color|source|status|trap|type|ulimit|umask|vared|fc|getopts|hash|kill|printf|time|wait)\s*\b(?!\.)r2   r3   r   z	[\[\]()=]r4   r5   r6   r7   r8   r9   r:   z&|\||\^|<|>r<   r   r=   r?   r@   rF   rE   rG   rH   rI   rJ   rK   )rE   r+   r'   r*   r7   r/   r-   N)rR   rS   rT   rU   rV   rW   rX   rY   r   r   r   r\   r   r   r]   r   r   r`   r   ra   r_   r   r   rb   rO   rO   rO   rP   r     sf    


r   )%rU   rk   pygments.lexerr   r   r   r   r   r   r   r	   r
   pygments.tokenr   r   r   r   r   r   r   r   r   pygments.utilr   __all__compilerh   r   rc   r   r   r   r   r   r   r   r   rO   rO   rO   rP   <module>   s&   
,,
e2  8Da