3

V'ícâJã@sÂdZddlZddlmZmZmZmZmZmZm	Z	m
Z
ddlmZm
Z
mZmZmZmZmZmZmZddddgZGd	d„deƒZGd
d„deƒZdd„Zddd„ZGdd„deƒZGdd„deƒZdS)zÃ
    pygments.lexers.erlang
    ~~~~~~~~~~~~~~~~~~~~~~

    Lexers for Erlang.

    :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
éN)ÚLexerÚ
RegexLexerÚbygroupsÚwordsÚ
do_insertionsÚincludeÚdefaultÚline_re)	ÚCommentÚOperatorÚKeywordÚNameÚStringÚNumberÚPunctuationÚGenericÚ
WhitespaceÚErlangLexerÚErlangShellLexerÚElixirConsoleLexerÚElixirLexerc{@sNeZdZdZdZdZdgZddddgZd	gZdÙZ	dÚZ
d“ZdÛZd¢Z
d£Zd¤Zd¥Zd¦Zd§Zd¨ed©ed©ed©edªZd«ed©e
d¬Zd­Zd®efd¯eeeƒfee	d°d±efee
d°d±ejfeed°d±ejfd²ed³feefd´e dµfd¶ej!fd·ej!fd¸e
d¹eej"eƒfdºe
d»eej#eeƒfd¼ed½e$j%fd¾e$j%fd¿e$j&fdÀefeej'fe
efdÁeej(fdÂedÃe j)fdÄe
dÅe
dÆej!fdÇej*fdÈedÉfgee j+fd´e dÊfdËe j,fdÌe fdÍe fgdÎed¬eej-eeej(ƒdÊfdÏed¬eej-eeej!ƒdÊfe
ej-dÊfge.dЃdÑedÒfdÓedÒfdÔedÊfge.dЃdÕedÊfdÖedÊfgdלZ/dØS)ÜrzT
    For the Erlang functional programming language.

    .. versionadded:: 0.9
    ZErlangzhttps://www.erlang.org/Zerlangz*.erlz*.hrlz*.esz	*.escriptz
text/x-erlangÚafterÚbeginÚcaseÚcatchÚcondÚendÚfunÚifÚletÚofÚqueryÚreceiveÚtryÚwhenÚabsÚappend_elementÚapplyÚatom_to_listÚbinary_to_listÚbitstring_to_listÚbinary_to_termÚbit_sizeÚbump_reductionsÚ	byte_sizeÚcancel_timerÚcheck_process_codeÚ
delete_moduleÚ	demonitorÚdisconnect_nodeÚdisplayÚelementÚeraseÚexitÚfloatÚ
float_to_listÚfun_infoÚfun_to_listÚfunction_exportedÚgarbage_collectÚgetÚget_keysÚgroup_leaderÚhashÚhdÚinteger_to_listÚiolist_to_binaryÚiolist_sizeÚis_atomÚ	is_binaryÚis_bitstringÚ
is_booleanÚ
is_builtinÚis_floatÚis_functionÚ
is_integerÚis_listÚ	is_numberÚis_pidÚis_portÚis_process_aliveÚ	is_recordÚis_referenceÚis_tupleÚlengthÚlinkÚlist_to_atomÚlist_to_binaryÚlist_to_bitstringÚlist_to_existing_atomÚ
list_to_floatÚlist_to_integerÚlist_to_pidÚ
list_to_tupleÚload_moduleÚlocaltime_to_universaltimeÚ
make_tupleÚmd5Ú	md5_finalÚ
md5_updateÚmemoryÚ
module_loadedÚmonitorÚmonitor_nodeÚnodeÚnodesÚ	open_portÚphashÚphash2Úpid_to_listÚ
port_closeÚport_commandÚport_connectÚport_controlÚ	port_callÚ	port_infoÚport_to_listÚprocess_displayÚprocess_flagÚprocess_infoÚpurge_moduleÚputÚ
read_timerÚref_to_listÚregisterÚresume_processÚroundÚsendÚ
send_afterÚsend_nosuspendÚ
set_cookieÚ
setelementÚsizeÚspawnÚ
spawn_linkÚ
spawn_monitorÚ	spawn_optÚsplit_binaryÚstart_timerÚ
statisticsÚsuspend_processÚsystem_flagÚsystem_infoÚsystem_monitorÚsystem_profileÚterm_to_binaryÚtlÚtraceÚtrace_deliveredÚ
trace_infoÚ
trace_patternÚtruncÚ
tuple_sizeÚ
tuple_to_listÚuniversaltime_to_localtimeÚunlinkÚ
unregisterÚwhereisz1(\+\+?|--?|\*|/|<|>|/=|=:=|=/=|=<|>=|==?|<-|!|\?)ÚandÚandalsoÚbandÚbnotÚborÚbslÚbsrÚbxorÚdivÚnotÚorÚorelseÚremÚxorz(?:[a-z]\w*|'[^\n']*[^\\]')z
(?:[A-Z_]\w*)z[bdefnrstv\'"\\]z[0-7][0-7]?[0-7]?z%(?:x[0-9a-fA-F]{2}|x\{[0-9a-fA-F]+\})z
\^[a-zA-Z]z(?:\\(?:ú|z))z(?:ú)z(?:[2-9]|[12][0-9]|3[0-6])z\s+z	(%.*)(\n)z\b)Úsuffixz^-Ú	directiveú"Ústringz<<z>>ú(z)(:)z
(?:^|(?<=:))(z
)(\s*)(\()z[+-]?z
#[0-9a-zA-Z]+z[+-]?\d+z[+-]?\d+.\d+z[]\[:_@\".{}()|;,]z\?z\$(?:z|\\[ %]|[^\\])ú#z(:?\.z)?z\A#!.+\nz#\{Úmap_keyz#popz~[0-9.*]*[~#+BPWXb-ginpswx]z[^"\\~]+ú~z(define)(\s*)(\()(z(record)(\s*)(\()(Úrootz=>Úmap_valz:=z\}ú,z(?=\}))r¸r³r±r¶r¹N)rrrrrrrrrr r!r"r#r$){r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rr€rr‚rƒr„r…r†r‡rˆr‰rŠr‹rŒrrŽrrr‘r’r“r”r•r–r—r˜r™ršr›rœrržrŸ)r r¡r¢r£r¤r¥r¦r§r¨r©rªr«r¬r­)0Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚnameÚurlÚaliasesÚ	filenamesÚ	mimetypesÚkeywordsÚbuiltinsÚ	operatorsZword_operatorsZatom_reZvariable_reZesc_char_reZesc_octal_reZ
esc_hex_reZesc_ctrl_reZ	escape_reZmacro_reZbase_rerrr
rrr
ÚBuiltinrÚWordrrZLabelÚ	NamespaceZFunctionrÚIntegerÚFloatÚVariableÚConstantÚCharZHashbangÚEscapeÚInterpolÚEntityrÚtokens©rÓrÓú:/tmp/pip-build-gk9425m9/Pygments/pygments/lexers/erlang.pyrs°$




c@s8eZdZdZdZdgZdgZdgZej	dƒZ
dd„Zd	S)
rzM
    Shell sessions in erl (for Erlang code).

    .. versionadded:: 1.1
    zErlang erl sessionZerlz*.erl-shztext/x-erl-shellsessionz(?:\([\w@_.]+\))?\d+>(?=\s|\Z)c	csòtf|jŽ}d}g}x¾tj|ƒD]°}|jƒ}|jj|ƒ}|dk	r~|jƒ}|jt	|ƒdt
j|d|…fgfƒ|||d…7}q |r t||j
|ƒƒEdHd}g}|jdƒr¾|jƒt
j|fVq |jƒt
j|fVq W|rît||j
|ƒƒEdHdS)NÚrÚ*)rÚoptionsr	ÚfinditerÚgroupÚ
_prompt_reÚmatchrÚappendÚlenrÚPromptrÚget_tokens_unprocessedÚ
startswithÚstartÚ	TracebackÚOutput)	ÚselfÚtextZerlexerÚcurcodeÚ
insertionsrÛÚlineÚmrrÓrÓrÔrߣs,

z'ErlangShellLexer.get_tokens_unprocessedN)r»r¼r½r¾r¿rÁrÂrÃÚreÚcompilerÚrßrÓrÓrÓrÔr–s
cCsDi}d|f|ftdƒd|fd|ft|ƒdftdƒg|d|<|S)Nz	[^#%s\\]+Úescapesz\\.z(%s)z#popÚinterpolZstring_)rr)r¿ÚsymbolÚtokenÚstatesrÓrÓrÔÚgen_elixir_string_rules¿srñTcCs\|r4d|f|ftdƒd|fd|f|dftdƒgSd|f|fd|fd|f|dfgSdS)Nz	[^#%s\\]+rìz\\.z%s[a-zA-Z]*z#popríz[^%s\\]+)r)ÚtermZ
term_classrïrírÓrÓrÔÚgen_elixir_sigstr_rulesËs
róc#@s¾eZdZdZdZdZdddgZddd	d
gZdgZd¶Z	d·Z
d¸Zd¹ZdºZ
d»Zd¼Zd½Zd¾Zd¿ZdÀZdndo„Zdpdq„ZdUjdrds„eDƒƒZdUjdtds„eDƒƒZdUjduds„eDƒƒZdveeefZdUjdwds„eDƒƒZdxZdyeZdzd{eiZdveeefZd|Z d}Z!d~Z"dZ#d€e$fde%j&fd‚e!e'e(j)e(j*e+j,e(j*ƒfd‚e"e'e(j)e(j*ƒfd‚e#e'e(j)e(j*ƒfdƒe(j)fd„e(j-fd…e.fdie e(j-fdiee(j-fd†e(j-d‡fdˆe(j-d‰fdŠe efe'e(j-e/ƒfd‹ee0j1fee0fdŒefe'e/e0j2ƒfee.fee.fee/fde0j3fee.fdŽe+j4fde+j5fde+j,fd‘e+j6fd’e+j7fd“e'e(j8e$ƒd”fd•e'e(j8e$ƒd–fd—e(j9d˜fd™e(j&dšfe:d›ƒdœe/dfdže/dŸfg!d e'e$e(j8ƒd¡fe:d¢ƒgd£e(j8d¡fe:d¢ƒgd¤e(j8fe:d¥ƒd¦e(j8fd§e(j8fe:d¨ƒgd©e(j8fd¦e(j8fd§e$fge!e'e(j*e+j,e(j*ƒfe"e(j*fe#e(j*fgdªe(j;d«fgd¬e(j;d¡fe:d­ƒge:d­ƒdie/d®fdfe/d®fd¬e/d¡fge:d­ƒdke/d¡fd¯e/d¡fge:d­ƒd¬e/d¡fgd°œZ<e<j=e>d±d—e(j9ƒƒe<j=e>d²d™e(j&ƒƒe<j=e>d³d—e(j-ƒƒe<j=e>d´d™e(j-ƒƒe<j=eƒƒdµS)Árz=
    For the Elixir language.

    .. versionadded:: 1.5
    ZElixirzhttp://elixir-lang.orgZelixirÚexZexsz*.exz*.eexz*.exsz*.leexz
text/x-elixirÚfnÚdorrÚelseÚrescuerr©r rªr$ÚinrrÚforrÚunlessr#r"ÚraiseÚquoteÚunquoteÚunquote_splicingÚthrowÚsuperÚdefÚdefpÚ	defmoduleÚdefprotocolÚdefmacroÚ	defmacropÚdefdelegateÚdefexceptionÚ	defstructÚdefimplÚdefcallbackÚimportÚrequireÚuseÚaliasÚnilÚtrueÚfalseÚ_Ú
__MODULE__Ú__DIR__Ú__ENV__Ú
__CALLER__ú<<<ú>>>ú|||ú&&&ú^^^ú~~~ú===ú!==ú~>>ú<~>ú|~>ú<|>ú==ú!=ú<=ú>=ú&&ú||ú<>ú++ú--ú|>ú=~ú->ú<-r®Ú.ú=ú~>ú<~ú<ú>ú+ú-rÖú/ú!ú^ú&ú\\ú<<ú>>ú=>r´r¯ú:ú;rºú[ú]ccsöxðtj||ƒD]à\}}}|tkrâ||jkr8|t|fVqî||jkrR|tj|fVqî||jkrj|t|fVqî||j	kr„|tj
|fVqî||jkrž|tj|fVqî||j
kr¸|tj|fVqî||jkrÔ|tjj|fVqî|||fVq|||fVqWdS)N)rrßr
ÚKEYWORDrÚKEYWORD_OPERATORrrÈÚBUILTINÚBUILTIN_DECLARATIONZDeclarationÚBUILTIN_NAMESPACErÉÚCONSTANTrÍÚ
PSEUDO_VARrÇZPseudo)räråÚindexrïÚvaluerÓrÓrÔrßs$






z"ElixirLexer.get_tokens_unprocessedc	Csvd+d,d-d.d/d0d1d2g}d3d4g}tj}dgi}xÒ|D]Ê\}}|dd|ft|tjƒ|d|dffd |ft|tjƒ|d|d!ffg7<d"|d#ftd#ƒg||d<d$|d
tttjƒd#ftd%ƒg||d<d$|d
tttjƒd#ftd&ƒg||d!<q0Wxr|D]j\}}}}|dd'|||dfd(|||d!fg7<t|||ƒ||d<t|||d)d*||d!<qW|S)5Nú\{ú\}Ú}Úcbú\[ú\]Úsbú\(ú\)r¯Úpar6r7Úabr:Úslasú\|r®Úpiper²Úquotú'Úaposú"""Útriquotú'''ÚtriaposÚsigilsz(~[a-z])(%s)z-endz-intpz(~[A-Z])(%s)z-no-intpz	[a-zA-Z]+z#popz^(\s*)(Úheredoc_interpolÚheredoc_no_interpolz~[a-z]z~[A-Z]F)rí)rOrPrQrR)rSrTrTrU)rVrWr¯rX)r6r7r7rY)r:r:r:rZ)r[r[r®r\)r²r²r²r])r^r^r^r_)r`ra)rbrc)rZOtherrÚHeredocrrrró)	ZterminatorsZ	triquotesrïrðròr¿ZltermZrtermZrterm_classrÓrÓrÔÚgen_elixir_sigil_ruless<z"ElixirLexer.gen_elixir_sigil_rulesccs|]}tj|ƒVqdS)N)rêÚescape)Ú.0ÚsrÓrÓrÔú	<genexpr>QszElixirLexer.<genexpr>ccs|]}tj|ƒVqdS)N)rêri)rjrkrÓrÓrÔrlRsccs|]}tj|ƒVqdS)N)rêri)rjrkrÓrÓrÔrlSsz(?:%s|%s|%s)ccs|]}tj|ƒVqdS)N)rêri)rjrkrÓrÓrÔrlUsz\wz(?:\.\.\.|[a-z_]%s*[!?]?)z%[A-Z]%(alnum)s*(?:\.[A-Z]%(alnum)s*)*Úalnumz(?:\.\.\.|<<>>|%\{\}|%|\{\})z(\\x\{)([\da-fA-F]+)(\})z(\\x[\da-fA-F]{1,2})z(\\[abdefnrstv])z\s+z#.*$z(\?)z\?\\?.z:::z::z:"Zstring_double_atomz:'Zstring_single_atomz(%s|%s)(:)(?=\s|\n)ú@z	(%%?)(%s)z&\dz0b[01]+z0o[0-7]+z
0x[\da-fA-F]+z)\d(_?\d)*\.\d(_?\d)*([eE][-+]?\d(_?\d)*)?z	\d(_?\d)*z
(""")(\s*)Úheredoc_doublez(''')(\s*)$Úheredoc_singler²Z
string_doubler^Z
string_singlerdz%\{r¶z\{Útuplez^(\s*)(""")z#poprez^\s*'''z	[^#\\\n]+rìz\\.z\n+ríz[^\\\n]+z#\{Úinterpol_stringz\}r¸r¹z(?=\}))r¸rorprerfrìrírrr¶r¹rqÚdoubleZsingleZdouble_atomZsingle_atomN)rõrörrr÷rør)r©r rªr$rù)
rrrúrrûr#r"rürýrþrÿrr)rrrrrrrr	r
rr)r
rrr)rrr)rrrrr)rrrrrrrr r!r"r#r$)r%r&r'r(r)r*r+r,r-r.r/r0r1r®r2r3r4r5)	r6r7r8r9rÖr:r;r<r=)r>r?r@rAr´r¯rBrCrºrDrE)?r»r¼r½r¾r¿rÀrÁrÂrÃrFrGrHrIrJrKrLZ
OPERATORS3Z
OPERATORS2Z
OPERATORS1ÚPUNCTUATIONrßrhÚjoinZop3_reZop2_reZop1_reZops_reZpunctuation_rermZname_reZ
modname_reZcomplex_name_reZspecial_atom_reZlong_hex_char_reZhex_char_reZescape_char_rerr
ÚSinglerrrÎrÏrZHexZSymbolrrr
Ú	AttributeZClassrÑZBinÚOctrËrÊrgÚDoublerrÐrÒÚupdaterñrÓrÓrÓrÔrÜsÚ
4










c@s2eZdZdZdZdgZdgZejdƒZ	dd„Z
dS)	ra8
    For Elixir interactive console (iex) output like:

    .. sourcecode:: iex

        iex> [head | tail] = [1,2,3]
        [1,2,3]
        iex> head
        1
        iex> tail
        [2,3]
        iex> [head | tail]
        [1,2,3]
        iex> length [head | tail]
        3

    .. versionadded:: 1.5
    zElixir iex sessionZiexztext/x-elixir-shellsessionz,(iex|\.{3})((?:\([\w@_.]+\))?\d+|\(\d+\))?> ccs0tf|jŽ}d}d}g}xötj|ƒD]è}|jƒ}|jdƒrtd}|jt|ƒdtj	|dd…fgfƒ||dd…7}q$|j
j|ƒ}|dk	rÊd}|jƒ}	|jt|ƒdtj
|d|	…fgfƒ|||	d…7}q$|rìt||j|ƒƒEdHd}g}|rötj	ntj}
|jƒ|
|fVq$W|r,t||j|ƒƒEdHdS)	NrÕFz** Trééÿÿÿÿr|)rr×r	rØrÙràrÜrÝrÚErrorrÚrÛrrÞrrßrãrá)räråZexlexerræZin_errorrçrÛrèrérrïrÓrÓrÔrßñs8


z)ElixirConsoleLexer.get_tokens_unprocessedN)r»r¼r½r¾r¿rÁrÃrêrërÚrßrÓrÓrÓrÔr×s
)T)r¾rêZpygments.lexerrrrrrrrr	Zpygments.tokenr
rrr
rrrrrÚ__all__rrrñrórrrÓrÓrÓrÔÚ<module>	s(,)
|