
    MhX                         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mZ ddlmZmZ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dZ G d d	e          Z G d
 de          Z G d de          ZdS )z
    pygments.lexers.ruby
    ~~~~~~~~~~~~~~~~~~~~

    Lexers for Ruby and related languages.

    :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)
Lexer
RegexLexerExtendedRegexLexerincludebygroupsdefaultLexerContextdo_insertionswordsline_re)TextCommentOperatorKeywordNameStringNumberPunctuationErrorGeneric
Whitespaceshebang_matches)	RubyLexerRubyConsoleLexer
FancyLexer)*z**-+z-@z+@/%&|^`~z[]z[]=<<z>><<>z<=>>z>=z==z===c                      e Zd ZdZdZdZg dZg dZddgZdZ	e
j        e
j        z  Zd	 Zd
 Zg dej        fdej        fdej        f edd          efd eeeej                  fd eee          dfdedfd eee          df edd          ej        fdej        f edd          ej        fdej        f eddd          ej        fdej        j        fd efd!efd"ej        d#fd$ eee j!                  d%fd&e j!        d%fd' eee j!                  d%fd( ee"j#        ee          fd) ee"j$        ee          fd* ee"j%        ee          fd+ ee"j&        ee          fd,ej'        j(        fd-ej'        j)        fd.ej'        j*        fd/ej'        j*        fd0ej'        j*        fd1ef e+d2          d3e j,        fd4ej-        f ee.d56           eeej                  fd7 eee          fd8efd9efd:efd;e/fd<efd=e/d>fd? eej(        eej0                  d@f e1d@          gd=e/d>fdAed@fdBej(        d@f e1d@          gdC ee/e          d@fd=edDf e+dE          gdFe j2        dDfdGe j2        d@f e+dE          gdHe j2        dIfdJe j2        fdKe j2        fg e+dL          dMe j3        fg e+dL          dNe j!        fdOe j!        fg e+dL          dNe j4        fdOe j4        fg e+dL          dPe j!        fdQe j!        fdNe j!        fdRe j!        fdSe j!        d@fgdTej        d@fgdUZ5e56                     e                       dV Z7dWS )Xr   z
    For Ruby source code.
    Rubyzhttp://www.ruby-lang.org)rubyrbduby)	z*.rbz*.rbwRakefilez*.rakez	*.gemspecz*.rbxz*.dubyGemfileVagrantfileztext/x-rubyzapplication/x-ruby c              #     K   |                     d          }|t          |                    d          fV  |                     d          t          j        |                    d          fV  |                     d          t          j        |                    d          fV  |                     d          t          j        |                    d          fV  |j                            dg           }t          |           }|	                    |                    d          dv |                    d          f           |                     d          |_
        |                    d          |_        t          |          dk     r|                     |	          E d {V  n)|j
        t          j        |                    d          fV  |                                |_
        |rw|D ]S\  }}g }t          j        |j        |j
                  D ]}|r'|                                                                }	n&|                                                                }	|	|k    r|D ]7}
|
                                 t          j        |
                                fV  8|                                 t          j        |                                fV  |                                |_
         nK|	                    |           |D ]2}
|
                                 t&          |
                                fV  3Ut          |j                  |_        |d d = d S d S )
N            heredocstack)z<<-z<<~   d   context)startr   groupr   Heredoc	Delimiter__dict__
setdefaultboolappendposendlenget_tokens_unprocessedr   finditertextstriprstripr   )selfmatchctxr>   r9   	outermosttoleranthdnamelinescheckamatchs              T/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pygments/lexers/ruby.pyheredoc_callbackzRubyLexer.heredoc_callback+   s      AXu{{1~~----kk!nnfnekk!nn<<<<kk!nnf.A>>>>kk!nnfnekk!nn<<<<|..~rBB\***	U[[^^~=u{{1~~NOOO++a..))A,,|s""2232??????????'6>5;;q>>9999))++ 	 $0 D D &$-ch@@ D DE 7 % 3 3 5 5 % 4 4 6 6&+ Q QF"(,,..&.&,,.."PPPPP#kkmmV-=u{{}}LLLL"'))++U++++ #( D D$llnneV\\^^CCCCC#(mmCGQQQ-	  	     c                  x   d } d }i }dt           j        ft          t          d          t           j        fdt           j        fdt           j        dfd	t	          t           j        t
                    fd
t           j        dfdt           j        dfdt           j        dfg|d<   dt           j        d
fdt           j        dfdt           j        d
fdt           j        dffD ]*\  }}}t          d          d| d|fd|f||dfg|d|z   <   +dD ]\  }}}}d|z   dz   t           j
        f|t           j
        df|t           j
        dft          d          d |z   dz   t           j
        fd!|z   d"z   t           j
        fg||d#z   <   |d                             d$|z   t           j
        |d#z   f           d|z   dz   t           j
        f|t           j
        df|t           j
        dfd |z   dz   t           j
        fd!|z   d"z   t           j
        fg||d%z   <   |d                             d&|z   t           j
        |d%z   f           d|z   dz   t           j        f|t           j        df|d'z   t           j        dft          d(          d |z   dz   t           j        fd!|z   d"z   t           j        fg||d)z   <   |d                             d*|z   t           j        |d)z   f           |dxx         d+| fd,t           j
        fd-|fd.t	          t          t           j
        d           fd/t	          t          t           j
        d           fd0|fgz  cc<   |S )1Nc              3     K   |                     d          t          j        |                    d          fV  t	          |                    d          ddg          }|                     |          D ]#\  }}}|                     d          |z   ||fV  $|                     d          t          j        |                    d          fV  |                                |_        d S )Nr5   r7   r   interpolated-regexr<   r8   )r>   r   Regexr?   r	   rI   rG   rF   rN   rO   rP   nctxitvs          rW   intp_regex_callbackz<RubyLexer.gen_rubystrings_rules.<locals>.intp_regex_callback[   s      ++a..&,A>>>>A4H3IJJD66t6DD - -1akk!nnQ&1,,,,,++a..&,A>>>>iikkCGGGrY   c              3     K   |                     d          t          j        |                    d          fV  t	          |                    d          ddg          }|                     |          D ]#\  }}}|                     d          |z   ||fV  $|                     d          t          j        |                    d          fV  |                                |_        d S )Nr5   r7   r   interpolated-stringr<   r8   )r>   r   Otherr?   r	   rI   rG   rF   r^   s          rW   intp_string_callbackz=RubyLexer.gen_rubystrings_rules.<locals>.intp_string_callbackc   s      ++a..&,A>>>>A4I3JKKD66t6DD - -1akk!nnQ&1,,,,,++a..&,A>>>>iikkCGGGrY   z\:@{0,2}[a-zA-Z_]\w*[!?]?z\:@{0,2}prefixz:'(\\\\|\\[^\\]|[^'\\])*'z:"z
simple-symz([a-zA-Z_]\w*)(:)(?!:)"zsimple-string-double'zsimple-string-singlez(?<!\.)`zsimple-backtickstringszstring-doublezstring-singlesymbacktickr%   string-intp-escapedz[^\\z#]+[\\#]#popzsimple-))\{\}z{}cb)z\[z\]z\[\]sb)\(z\)z()pa)r(   r*   r)   abz\\[\\]#pushz[\\#z[^\\#z]+z-intp-stringz%[QWx]?z-stringz%[qsw]z[mixounse]*string-intpz-regexz%rz-(%r([\W_]))((?:\\\2|(?!\2).)*)(\2[mixounse]*)z"%[qsw]([\W_])((?:\\\1|(?!\1).)*)\1z&(%[QWx]([\W_]))((?:\\\2|(?!\2).)*)(\2)z<(?<=[-+/*%=<>&!^|~,(])(\s*)(%([\t ])(?:(?:\\\3|(?!\3).)*)\3)z'^(\s*)(%([\t ])(?:(?:\\\3|(?!\3).)*)\3)z*(%([^a-zA-Z0-9\s]))((?:\\\2|(?!\2).)*)(\2))r   Symbolr   RUBY_OPERATORSr   r   DoubleSingleBacktickr   rf   rE   r]   r   )	rc   rg   statesnamettyperG   lbracerbracebraceccs	            rW   gen_rubystrings_ruleszRubyLexer.gen_rubystrings_rulesZ   s   	" 	" 	"	" 	" 	"  *6=9>+666F)6=9FM<0&fm[1136="896="89&/+<=
y "1&- E!0&- E!&s ;!+V_c B!C 		 		D%
 -..!!!!5)5!eV$	&F9T>""'!	6 !	6)FFGT G#c)6<8w/v.-..7"S(&,7G#d*FL9+F4&' 9$$j6&96<&*>&9&; < < < G#c)6<8w/v.7"S(&,7G#d*FL9&F4	>" 9$$i&&8&,&*9n&6 7 7 7 G#c)6<8w/-'v>&&7"S(&,7G#d*FL9%F4=! 9$$efnfl&*8m&5 6 6 6 6 	y= " 3FLA6!# Mj&,557 8j&,557 ;!##
 	
* rY   z\A#!.+?$z#.*?$z=begin\s.*?\n=end.*?$)BEGINENDaliasbeginbreakcasezdefined?doelseelsifrG   ensureforifinnextredorescueraiseretryreturnsuperthenundefunlessuntilwhenwhileyield\bsuffixz.(module)(\s+)([a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*)z
(def)(\s+)funcnamezdef(?=[*%&^`~+-/\[<>=])z(class)(\s+)	classname)
initializenewloopr   extendr   attr_readerattr_writerattr_accessorattrcatchthrowprivatemodule_functionpublic	protectedtruefalsenilz(not|and|or)\b)autoloadblock_givenconst_definedeqlequalfrozenr   instance_ofis_aiteratorkind_ofmethod_definedr   private_method_definedprotected_method_definedpublic_method_defined
respond_totaintedz\?z(chomp|chop|exit|gsub|sub)!)eArrayFloatIntegerr   __id____send__abort	ancestorsat_exitr   bindingcallcccallerr   chompchop
class_evalclass_variablesclonezconst_defined?	const_getconst_missing	const_set	constantsdisplaydupevalexecexitr   failforkformatfreezegetcgetsglobal_variablesgsubhashidincluded_modulesinspectinstance_evalinstance_methodinstance_methodsinstance_variable_getinstance_variable_setinstance_variableslambdaloadlocal_variablesr   methodmethod_missingmethodsmodule_evalr   	object_idopenpprintprintfprivate_class_methodprivate_instance_methodsprivate_methodsprocprotected_instance_methodsprotected_methodspublic_class_methodpublic_instance_methodspublic_methodsputcputsr   randreadline	readlinesrequirescanselectrN   sendset_trace_funcsingleton_methodssleepsplitsprintfsrandsubsyscallsystemtainttestr   to_ato_s	trace_vartrapuntaintuntrace_varwarnz(?<!\.))ri   r   z__(FILE|LINE)__\bz2(?<!\w)(<<[-~]?)(["`\']?)([a-zA-Z_]\w*)(\2)(.*?\n)z(<<[-~]?)("|\')()(\2)(.*?\n)__END__end-partab  (?:^|(?<=[=<>~!:])|(?<=(?:\s|;)when\s)|(?<=(?:\s|;)or\s)|(?<=(?:\s|;)and\s)|(?<=\.index\s)|(?<=\.scan\s)|(?<=\.sub\s)|(?<=\.sub!\s)|(?<=\.gsub\s)|(?<=\.gsub!\s)|(?<=\.match\s)|(?<=(?:\s|;)if\s)|(?<=(?:\s|;)elsif\s)|(?<=^when\s)|(?<=^index\s)|(?<=^scan\s)|(?<=^sub\s)|(?<=^gsub\s)|(?<=^sub!\s)|(?<=^gsub!\s)|(?<=^match\s)|(?<=^if\s)|(?<=^elsif\s))(\s*)(/)multiline-regexz(?<=\(|,|\[)/z(\s+)(/)(?![\s=])z#(0_?[0-7]+(?:_[0-7]+)*)(\s*)([/?])?z.(0x[0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*)(\s*)([/?])?z (0b[01]+(?:_[01]+)*)(\s*)([/?])?([\d]+(?:_\d+)*)(\s*)([/?])?@@[a-zA-Z_]\w*@[a-zA-Z_]\w*z\$\w+z\$[!@&`\'+~=/\\,;.<>_*$?:"^-]z\$-[0adFiIlpvw]z::rl   zI\?(\\[MC]-)*(\\([\\abefnrstv#"\']|x[a-fA-F0-9]{1,2}|[0-7]{1,3})|\S)(?!\w)z[A-Z]\w+z(\.|::)rh   z,(\.|::)([a-zA-Z_]\w*[!?]?|[*%&^`~+\-/\[<>=])z[a-zA-Z_]\w*[!?]?z:(\[|\]|\*\*|<<?|>>?|>=|<=|<=>|=~|={3}|!~|&&?|\|\||\.{1,3})z[-+/*%=<>&!^|~]=?z[(){};,/?:\\]\s+rv   defexprz(?:([a-zA-Z_]\w*)(\.))?([a-zA-Z\u0080-\uffff][a-zA-Z0-9_\u0080-\uffff]*[!?=]?|!=|!~|=~|\*\*?|[-+!~]@?|[/%&|^]|<=>|<[<=]?|>[>=]?|===?|\[\]=?|`)rq   r'   z	[A-Z_]\w*z(\))(\.|::)?rz   rootrr   rs   z#\{in-intpz#@@?[a-zA-Z_]\w*z#\$[a-zA-Z_]\w*r{   z2\\([\\abefnrstv#"\']|x[a-fA-F0-9]{1,2}|[0-7]{1,3})rp   z[^\\#]+z\\\\z\\/z[^\\/#]+z/[mixounse]*z.+)r,  r   r   r+  r-  r{   ro   r\   re   r&  r%  c                 "    t          | d          S )Nzruby(1\.\d)?r   )rK   s    rW   analyse_textzRubyLexer.analyse_text  s    t_555rY   N)8__name__
__module____qualname____doc__r   urlaliases	filenames	mimetypesversion_addedreDOTALL	MULTILINEflagsrX   r   r   Hashbangr   	Multiliner   r   r   r   r   	NamespacePseudor   WordBuiltinPreprocr   r   r]   r   OctHexBinr   VariableClassInstanceGlobalr   CharConstantr}   r   Functionr   InterpolEscaperf   tokensupdater/   rY   rW   r   r      s         D
$C$$$G> > >I 45IMI$E-  -  - ^e e ePG
'*+G
w~&G
 &w'89G

 U = FK	L L L
 G
%Xgz4>::<G
 HHWj99:FG
  (*=!G
" hhw
;;[I#G
& U R 	  
 ^'G
2 .3G
4 U B KP	Q Q Q
 \5G
@ ,T\:AG
B U '* 0:%+I I I, \-CG
p "4<#67qG
t CuG
z -.>?{G
| *5}G
@. $8D&,779J/LAG
r v|->?sG
v "88J#E#E wG
J 4Xfj*h779KG
N ?Xfj*h779OG
R 1Xfj*h779SG
V -Xfnj(;;=WG
\  34]G
^ t}56_G
` t}+,aG
b .t}/CDcG
d  !56eG
f HgG
h GIiG
l [mG
t $-(uG
z U>*555Xh..0{G
~ =Xh%%'G
B "4(CG
D%&.0EG
H "8,IG
J {+KG
L Z MG
R K+ Xdj(DM::FD GFOO
 K+Hf%4:v.GFOO	
 hh{H==vFHg&GFOO
 FOW-FOV,GFOO
 V_i0 &/21
 GM""B] 
 GM""v|$&
 GM""v|$& 
 GM""fl#V\"v|$&,'flF3
 GOV,
CD DFJ MM''))***6 6 6 6 6rY   r   c                   V    e Zd ZdZdZddgZdgZdZdZdZ	 e
j        d	          Zd
 ZdS )r   z8
    For Ruby interactive console (**irb**) output.
    zRuby irb sessionrbconirbztext/x-ruby-shellsessionzhttps://www.ruby-lang.orgr3   zrbcon/consolez.irb\([a-zA-Z_]\w*\):\d{3}:\d+[>*"\'] |>> |\?> c           	   #   x  K   t          di | j        }d}g }t          j        |          D ]}|                                }| j                            |          }|\|                                }|                    t          |          dt          j        |d |         fgf           |||d          z  }|r-t          ||                    |                    E d {V  d}g }|                                t          j        |fV  |r+t          ||                    |                    E d {V  d S d S )Nr3   r   rR  )r   optionsr   rJ   r?   
_prompt_rerO   rG   rE   rH   r   Promptr
   rI   r>   Output)	rN   rK   rblexercurcode
insertionsrO   linemrG   s	            rW   rI   z'RubyConsoleLexer.get_tokens_unprocessed  s     ++dl++
%d++ 	: 	:E;;==D%%d++A}eegg!!3w<<%&TcT
$C#D#F G G G4:% $,"G$B$B7$K$K M  M M M M M M M M G!#JkkmmW^T99999 	E$G::7CCE E E E E E E E E E E	E 	ErY   N)r0  r1  r2  r3  r   r5  r7  r4  r8  _exampler9  compilerX  rI   rR  rY   rW   r   r     sr          DG+,I
%CMH ) * *JE E E E ErY   r   c                       e Zd ZdZdZdZddgZddgZdgZd	Z	d
e
j        dfde
j        dfde
j        dfde
j        dfde
j        dfde
j        dfde
j        dfde
j        dfde
j        dfde
j        dfg
defde
j        dfde
j        dfde
j        dfde
j        df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j        fd#ef ed$d%&          ej        fd'ej        fd(efd)ej        fd*ej        j        fd+ej        j        fd,efd-efd. eej        ee          fd/ eej        ee          fd0 eej        ee          fd1 eej         ee          fd2ej!        fd3ej         fgd4Z"d5S )6r   z
    Pygments Lexer For Fancy.

    Fancy is a self-hosted, pure object-oriented, dynamic,
    class-based, concurrent general-purpose programming language
    running on Rubinius, the Ruby VM.
    Fancyz!https://github.com/bakkdoor/fancyz*.fyz*.fancypackfancyfyztext/x-fancysrcz1.5z"/(\\\\|\\[^\\]|[^/\\])*/[egimosx]*rq   z"!(\\\\|\\[^\\]|[^!\\])*![egimosx]*z\\(\\\\|[^\\])*\\[egimosx]*z$\{(\\\\|\\[^\\]|[^}\\])*\}[egimosx]*z"<(\\\\|\\[^\\]|[^>\\])*>[egimosx]*z%\[(\\\\|\\[^\\]|[^\]\\])*\][egimosx]*z$\((\\\\|\\[^\\]|[^)\\])*\)[egimosx]*z"@(\\\\|\\[^\\]|[^@\\])*@[egimosx]*z"%(\\\\|\\[^\\]|[^%\\])*%[egimosx]*z$\$(\\\\|\\[^\\]|[^$\\])*\$[egimosx]*r*  zs\{(\\\\|\\[^\\]|[^}\\])*\}\s*balanced-regexzs<(\\\\|\\[^\\]|[^>\\])*>\s*zs\[(\\\\|\\[^\\]|[^\]\\])*\]\s*zs\((\\\\|\\[^\\]|[^)\\])*\)\s*z&m?/(\\\\|\\[^\\]|[^///\n])*/[gcimosx]*zm(?=[/!\\{<\[(@%$])z#(.*?)\nz\'([^\'\s\[\](){}]+|\[\])z"""(\\\\|\\[^\\]|[^\\])*?"""z"(\\\\|\\[^\\]|[^"\\])*"zJ(def|class|try|catch|finally|retry|return|return_local|match|case|->|=>)\bz(self|super|nil|false|true)\bz[(){};,/?|:\\])Objectr   Hash	DirectoryFilerH  r   r   
EnumerableFancyEnumerableBlock	TrueClassNilClass
FalseClassTupler|   StackSet	FancySpecMethodPackageRanger   r   z[a-zA-Z](\w|[-+?!=*/^><%])*:z[-+*/~,<>=&!?%^\[\].$]+z[A-Z]\w*r)  r(  z@@?z[a-zA-Z_]\w*z&(0[oO]?[0-7]+(?:_[0-7]+)*)(\s*)([/?])?z1(0[xX][0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*)(\s*)([/?])?z#(0[bB][01]+(?:_[01]+)*)(\s*)([/?])?r'  z/\d+([eE][+-]?[0-9]+)|\d+\.\d+([eE][+-]?[0-9]+)?z\d+)rf  r,  N)#r0  r1  r2  r3  r   r4  r6  r5  r7  r8  r   r]   r   r   r   r|   r   r   rL  r   r   rB  rM  r   rG  rI  rH  r   r   rD  rE  rF  r   r   rP  rR  rY   rW   r   r     sn         D
-C'IoG"#IM
 3FL&I2FL&I+V\6B4flFK2FL&I5v|VL4flFK2FL&I2FL&I4flFK
 Z  />NO,fl<LM/?OP.>NO6E#V\3CD '.))6=9,f5(&1&( .t}=,U ; DI	J J J
 \ -dm<'2$-(t}56 34Hd# 7Xfj*h779AXfj*h7793Xfj*h779,Xfnj(;;=?NV^$i5
D DFFFrY   r   ) r3  r9  pygments.lexerr   r   r   r   r   r   r	   r
   r   r   pygments.tokenr   r   r   r   r   r   r   r   r   r   r   pygments.utilr   __all__r}   r   r   r   rR  rY   rW   <module>r|     s    
			C C C C C C C C C C C C C C C C C C C C C C C C4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 ) ) ) ) ) )
9
9
9m6 m6 m6 m6 m6" m6 m6 m6`$E $E $E $E $Eu $E $E $ENS S S S S S S S S SrY   