|endZddlZddlmZmZmZmZmZmZm Z m Z ddl m Z m Z mZmZmZmZmZmZmZmZddlmZgdZGddeZGd d eZGd d eZGd deZGddeZGddeZGddeZ GddeZ!GddeZ"GddeZ#GddeZ$y)z pygments.lexers.haskell ~~~~~~~~~~~~~~~~~~~~~~~ Lexers for Haskell and related languages. :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. N)Lexer RegexLexerbygroups do_insertionsdefaultincludeinheritline_re) TextCommentOperatorKeywordNameStringNumber PunctuationGeneric Whitespace) unistring) HaskellLexer HspecLexer IdrisLexer AgdaLexer CryptolLexerLiterateHaskellLexerLiterateIdrisLexerLiterateAgdaLexerLiterateCryptolLexer KokaLexerceZdZdZdZdZddgZdgZdgZdZ d Z gd e fd e jfd e jd fdej dfdej dfdej$fddj'e zej fdej*fdej.zdzej0fdej.zdzefdej2zdzej4fdej2zdzej4fdej4fdej4fdej4fdej0fd ej8fd!ej4fd"efd#ej<fd$ej<fd%ej<fd&ej<fd'ej>fd(ej@fd)ejBfd*ejDfd+ej*d,fd-ed.fd/ej4fd0ejFfd1e$fd e fd-ed.fd2e$d3fd4efd5ej2zd6zej2zd7ze%ejLe ee ed3fd5ej2zd8ze%ejLe ee e$d9fd5ej2zd:ze%ejLe e$d9fd;ejLd3fgd e fd5ej2zd:ze%ejLe e$d9fdzej4fd?ej.zd@zej0fd e jfd e jd fdAe$fd"efdBe$dCfd2e$dDfg dEe jfd e jdFfdGe jd3fdHe jfgdIej*d3fdJejNdKfd+ej*d3fgdLefdJejNdKfd-ed3fgdMejNd3fdNej2zdOzejNd3fdj'e ejNd3fdPejNd3fdQejNd3fdRejNd3fdSe%e ejNd3fgdTZ(yU)Vrzk A Haskell lexer based on the lexemes defined in the Haskell 98 Report. .. versionadded:: 0.8 Haskellzhttps://www.haskell.org/haskellhsz*.hsztext/x-haskell)caseclassdatarderivingdoelsefamilyifin infix[lr]?instanceletnewtypeofthentypewhere_NULSOHz[SE]TXEOTENQACKBELBSHTLFVTFFCRzS[OI]DLEzDC[1-4]NAKSYNETBCANEMSUBESCz[FGRU]SSPDEL\s+!--(?![!#$%&*+./<=>?@^|_~:\\]).*?$\{-comment \bimport\bimport \bmodule\bmodule \berror\b\b(%s)(?!\')\b|z'[^\\]'z^[_z][\w\']*z'?[_z][\w']*z('')?[z(')[z (')\[[^\]]*\]z (')\([^)]*\)z(')[:!#$%&*+.\\/<=>?@^|~-]+\\(?![:!#$%&*+.\\/<=>?@^|~-]+)+(<-|::|->|=>|=)(?![:!#$%&*+.\\/<=>?@^|~-]+):[:!#$%&*+.\\/<=>?@^|~-]*[:!#$%&*+.\\/<=>?@^|~-]+z40[xX]_*[\da-fA-F](_*[\da-fA-F])*_*[pP][+-]?\d(_*\d)*zR0[xX]_*[\da-fA-F](_*[\da-fA-F])*\.[\da-fA-F](_*[\da-fA-F])*(_*[pP][+-]?\d(_*\d)*)?z\d(_*\d)*_*[eE][+-]?\d(_*\d)*z+\d(_*\d)*\.\d(_*\d)*(_*[eE][+-]?\d(_*\d)*)?z0[bB]_*[01](_*[01])*z0[oO]_*[0-7](_*[0-7])*z 0[xX]_*[\da-fA-F](_*[\da-fA-F])*z \d(_*\d)*' character"string\[\]\(\) [][(),;`{}]\)#pop qualified\bz([z][\w.]*)(\s+)(as)(\s+)([z][\w.]*)z][\w.]*)(\s+)(hiding)(\s+)(\()funclistz][\w.]*)(\s+)(\()[\w.]+[z][\w.]*z]\w*z (_[\w\']+|[z ][\w\']*),\(rfrf#pop:2[^-{}]+#push-\}[-{}][^\\']'\\escape[^\\"]+[abfnrtv"\'&\\]z\^[][z@^_]o[0-7]+ x[\da-fA-F]+\d+ (\s+)(\\)rootrRrTrfrPr]r_rsN))__name__ __module__ __qualname____doc__nameurlaliases filenames mimetypesreservedasciirr Single MultilinerReservedr ExceptionjoinrCharuniLlFunctionLuTyper WordrFloatBinOctHexIntegerBuiltinrr NamespaceEscapetokens9/usr/lib/python3/dist-packages/pygments/lexers/haskell.pyrrs D $C$GI!"IFH 9E * Z * 27>> B * W&& 2 * G,,h 7* G,,h 7* 4>> ** (!3 3W5E5E F*  %* cff_{ *DMM :* svv  *D 1*  + -w|| <* svv  +W\\ :!* "w|| ,#* $gll +%* &,W\\ :'* */ >+* ,%fjj 1?* @' 3A* B1&** =C* D6>> *E* H6;; ,I* J68 $K* Ngll #O* Pdll #Q* R[ )S* ZZ 68 $ K ( W % SVV^9 9CFF B[ P dnnj':t Lf VSVV^? ? dnnj':{ SU_ aSVV^2 2 dnnj+ >  L /# (Z SVV^2 2 dnnj+ >  L CFF]Z ' @  Z CFF]W $gll 3 cff $| 3T]] C 17>> B W&& 2 ;  (( 3 K!9 : K *  ** + W&& 0 W&& / w(( )  f - FMM8 , &++v &   FMM8 , && !   7   (&-- @ XXe_fmmV 4  / fmmV 4 V]]F + 8J > G KnFrrc eZdZdZdZdgZdgZgZddee e e jfdee e e jfdee e e jfe giZy ) rzY A Haskell lexer with support for Hspec constructs. .. versionadded:: 2.4.0 Hspechspecz*Spec.hsr{z(it)(\s*)("[^"]*")z(describe)(\s*)("[^"]*")z(context)(\s*)("[^"]*")N)r|r}r~rrrrrrr rrDocr rrrrrrst DiG II  "HT:vzz$J K ((4VZZ*P Q '$ FJJ)O P   FrrcZeZdZdZdZdZddgZdgZdgZdZ d Z d Z d d je ze eej fd e eej$fde eej$fde eej&dfde eej*eej.efdd je zej fde ej edfdej0fdefdej.fdej.fdej6fdej6fdej8fdej:fdej>dfded fd!efd"efgd#efd$e ej@ee!d%fd&ej@d'fgd#efd(ej0fd)ej*fd*ej$fd+ej&dfd,e!fd-efd.e!d/fd0e!d1fg d2ej&fd+ej&d3fd4ej&d'fd5ej&fgd6ej>fd7ejDd8fdej>d'fgd9efd7ejDd8fded'fgd:ejDd'fd;ejDd'fd je ejDd'fde eejDd'fgd?Z#y@)Arz A lexer for the dependently typed programming language Idris. Based on the Haskell and Agda Lexer. .. versionadded:: 2.0 Idriszhttps://www.idris-lang.org/idrisidrz*.idrz text/x-idris)3r$r%r&rusingr(r)r+r,r-r.rewriteauto namespacecodatamutualprivatepublicabstracttotalpartial interfaceimplementationexportcovering constructorr/proofr1r2staticr4r5withpatterntermsyntaxprefix postulate parametersrecorddsl impossibleimplicittacticsintrosintrocomputerefineexacttrivialr6) liblinkflagrhidefreezeaccessrloggingdynamicrerror_handlerslanguagez^(\s*)(%%(%s))rWz((\s*)(--(?![!#$%&*+./<=>?@^|_~:\\]).*?)$z(\s*)(\|{3}.*?)$z (\s*)(\{-)rP^(\s*)([^\s(){}]+)(\s*)(:)(\s*)rV(import|module)(\s+)rT('')?[A-Z][\w\']*z [a-z][\w\']*z(<-|::|->|=>|=)z"([(){}\[\]:!#$%&*+.\\/<=>?@^|~-]+)\d+[eE][+-]?\d+\d+\.\d+([eE][+-]?\d+)?0[xX][\da-fA-F]+rxr\r]r^r_ [^\s(){}]+\s+?rM([A-Z][\w.]*)(\s+)(\()rf [A-Z][\w.]*rd[A-Z]\w*(_[\w\']+|[a-z][\w\']*)z--.*$rOrir[rjrkrcrlrmrnrorpz[^\\']rrrsrtru \^[][A-Z@^_]rvrwry)r{rTrfrPr]r_rsN)$r|r}r~rrrrrrrr directivesrrrrrr rrrrr rrr rrrrrrrrrrrrrrrsA D 'CG I IWH 9E YJ *!5 5 j'"2"2 3 5 8(:w~~:^ _ (:w~~"F G HZ1B1BCY O / j$--X]]J W Y(!3 3W5E5E F $hw/?/?&Lh W !7<< 0 d #  / 2HMM B  . ' 6 &** - V^^ $ 6;; , 68 $ D ! j !7 <Z & dnnj+ >  L T^^V 4  Z ',, ' ' 7 w~~ & W&& 2 ;  (( 3 K!9 : K *  ** + W&& 0 W&& / w(( )   $ FMM8 , &++v &   FMM8 , && !   7 fmmV 4 XXe_fmmV 4  / fmmV 4 V]]F + 8J > G IMFrrceZdZdZdZdZdgZdgZdgZdZ de e e je eje fd ej"fd ej$d fd ej&d fddj)e zej,fde ej,e dfdej.fdefdejfdej2fdej2fdej4fdej6fdej:dfdedfdefde fgdej&fd ej&d fd!ej&d"fd#ej&fgd ej$d fd$e d"fd%efgej@d ej@dej@dej@d&d'Z y())rz| For the Agda dependently typed functional programming language and proof assistant. .. versionadded:: 2.0 Agdaz.http://wiki.portal.chalmers.se/agda/pmwiki.phpagdaz*.agdaz text/x-agda))rr coinductiverr&r(z eta-equalityfieldforallhidingr, inductiveinfixinfixlinfixrr. interleavedr/macrorzno-eta-equalityopenoverlaprr primitiverquote quoteTermrrenamingrrtacticunquote unquoteDecl unquoteDefrvariabler4rrrNrOrPz\{!holerVrWrrTz\b(Set|Prop)[\u2080-\u2089]*\bz (\(|\)|\{|\})z((\.{1,3}|\||\u03BB|\u2200|\u2192|:|=|->)rrrrxr\r]r^r_rrz[^!{}]+rnz!\}rdz[!{}]z[a-zA-Z][\w.\']*z [\W0-9_]+rs)r{rrTrPr]r_rsN)!r|r}r~rrrrrrrrrrrr rr rr Directiverrrrrrrrrrr rrrrrrr#s D :ChG IIH0 j$--mmZ1 227>> B W&& 2 W&& /(!3 3W5E5E F $hw/?/?&L   . = x ( 8(-- H  . ' 6 &** - V^^ $ 6;; , 68 $ D ! j !9 @** + W&& 0 W&& / w(( )  W&& 2 $ / 4   &&y1!((5%%h/%%h/]/FrrceZdZdZdZddgZdgZdgZdZdZ d e fd e jfd e jd fd ejdfdejdfdej"fddj%ezejfdej&fdefdej(fdej&fdej,fdej(fdefdej0fdej0fdej2fdej4fdej6fd ej:d!fd"ed#fd$ej(fd%ej<fd&efgd e fd"ed#fd'ed(fd)efd*e ejBe ee ed(fd+e ejBe ee ed,fd-e ejBe ed,fd.ejBd(fgd e fd-e ejBe ed,fd/ejBd(fgd e fd0ej(fd1ej&fd2efdefd3ed4fd'ed5fgd6e jfd e jd7fd8e jd(fd9e jfgd:ej:d(fd;ejDdejDd(fd?ejDd(fdj%e ejDd(fd@ejDd(fdAejDd(fdejDd(fdBe e ejDd(fgdCZ#hdDZ$dEZ%yF)Grzs FIXME: A Cryptol2 lexer based on the lexemes defined in the Haskell 98 Report. .. versionadded:: 2.0 Cryptolcryptolcryz*.cryztext/x-cryptol)ArithBitCmpFalseInfTruer)rexternfinr+rRinflg2maxminrTr0pragmapropertyr2r3r4widthr6rM//.*$/\*rPrQrRrSrTrUrVrWz^[_a-z][\w\']*z'?[_a-z][\w']*rrXrYrZr[rrz 0[oO][0-7]+rrxr\r]r^r_r`rarbrcrdrez(([A-Z][\w.]*)(\s+)(as)(\s+)([A-Z][\w.]*)z#([A-Z][\w.]*)(\s+)(hiding)(\s+)(\()rfrrgrrrrirjrkrl[^/*]+rn\*/[*/]rqrrrsrtrurrvrwryrz><<>><<<>>>parregseqrtailconsterrorsplittracerASSERTlengthreverse transpose undefinedc#Kdg}tj|||D]9\}}}|tur$||jvr|tj|f3|||f;yw)Nr{)rget_tokens_unprocessedrEXTRA_KEYWORDSr)selftextstackindextokenvalues rr'z#CryptolLexer.get_tokens_unprocessedsd11$eD * E5%}$*=*=!=T\\500UE))  *sAAN)&r|r}r~rrrrrrrrr rrrrrrrrrr rrrrrrrrrrrrrrr(r'rrrrrms D% G I!"I2H 9EZ w~~ & W&& 2G,,h 7 G,,h 7 4>> * (!3 3W5E5E F  .  % !7<< 0 . > ;X]] K )7<< 8 (( 3  . ' 6 VZZ ( &** - V^^ $ 6;; , 68 $ gll # dll # [ )A! HZ 68 $ K ( W % 8 dnnj':t Lf V4 dnnj':{ SU_ a' dnnj+ >  L /# (Z & dnnj+ >  L T^^V 4  Z ',, ' ' 7;  (( 3 K!9 : K *  )) * W&& 0 W&& / g'' (  f - FMM8 , &++v &   FMM8 , && !   7 fmmV 4 XXe_fmmV 4  / fmmV 4 V]]F + 8J > G wdFLN *rrc@eZdZdZej dZdZdZy) LiterateLexera Base class for lexers of literate file formats based on LaTeX or Bird-style (prefixing each code line with ">"). Additional options accepted: `litstyle` If given, must be ``"bird"`` or ``"latex"``. If not given, the style is autodetected: if the first non-whitespace character in the source is a backslash or percent character, LaTeX is assumed, else Bird. z(>[ \t]*)(.*\n)c >||_tj|fi|y)N) baselexerr__init__)r)r2optionss rr3zLiterateLexer.__init__s" t'w'rc #K|jjd}||jdddvxrdxsd}d}g}|dk(rtj|D]}|j }|j j|}|rR|jt|dtj|j dfgf||j dz }|jt|dt|fgfn dd l m}|d i|j} d} d} tj|D]}|j }| r-|jjd rd} | |z } <||z }B|jjd r>d} | |z } |jt|t!| j#| fd} | |z } |jt|t!| j#| ft%||j&j#|Ed{y7w) Nlitstylerz%\latexbird)TexLexerz \end{code}z \begin{code}r)r4getlstripr finditergroupbird_rematchappendlenr Specialr pygments.lexers.markupr< startswithlistr'rr2) r)r*stylecode insertionsrBlinemr<lxlexer codelinesr8s rr'z$LiterateLexer.get_tokens_unprocessed s   , =[[]1Q'50=gGE F? ))$/ F{{}LL&&t,%%s4y)*GOOQWWQZ(H'I'KLAGGAJ&D%%s4yAtT?2C&DE F 8..GIE ))$/ "{{}{{}// >$%   [[]--o> !ITME%%s4y'+G,J,J5,Q'R'TUETME "   s4y#G$B$B5$IJL M T^^-R-RSW-XYYYsH6I8H>9IN) r|r}r~rrecompilerAr3r'rrrr0r0s% bjj+,G(*Zrr0c.eZdZdZdZgdZdgZdgZdZy)ran For Literate Haskell (Bird-style or LaTeX) source. Additional options accepted: `litstyle` If given, must be ``"bird"`` or ``"latex"``. If not given, the style is autodetected: if the first non-whitespace character in the source is a backslash or percent character, LaTeX is assumed, else Bird. .. versionadded:: 0.9 zLiterate Haskell)zliterate-haskelllhaskelllhsz*.lhsztext/x-literate-haskellc Htdi|}tj||fi|yNr)rr0r3r)r4hslexers rr3zLiterateHaskellLexer.__init__Hs$))tW88rN r|r}r~rrrrrr3rrrrr6s'  D5G I*+I9rrc.eZdZdZdZgdZdgZdgZdZy)ral For Literate Idris (Bird-style or LaTeX) source. Additional options accepted: `litstyle` If given, must be ``"bird"`` or ``"latex"``. If not given, the style is autodetected: if the first non-whitespace character in the source is a backslash or percent character, LaTeX is assumed, else Bird. .. versionadded:: 2.0 zLiterate Idris)zliterate-idrislidrislidrz*.lidrztext/x-literate-idrisc Htdi|}tj||fi|yrV)rr0r3rWs rr3zLiterateIdrisLexer.__init___s$'w'tW88rNrYrrrrrMs'  D2G I()I9rrc.eZdZdZdZddgZdgZdgZdZy) raU For Literate Agda source. Additional options accepted: `litstyle` If given, must be ``"bird"`` or ``"latex"``. If not given, the style is autodetected: if the first non-whitespace character in the source is a backslash or percent character, LaTeX is assumed, else Bird. .. versionadded:: 2.0 z Literate Agdaz literate-agdalagdaz*.lagdaztext/x-literate-agdac Ltdi|}tj||fddi|y)Nr6r8r)rr0r3)r)r4 agdalexers rr3zLiterateAgdaLexer.__init__vs)(( tYLLGLrNrYrrrrrds-  D(G I'(IMrrc.eZdZdZdZgdZdgZdgZdZy)ran For Literate Cryptol (Bird-style or LaTeX) source. Additional options accepted: `litstyle` If given, must be ``"bird"`` or ``"latex"``. If not given, the style is autodetected: if the first non-whitespace character in the source is a backslash or percent character, LaTeX is assumed, else Bird. .. versionadded:: 2.0 zLiterate Cryptol)zliterate-cryptollcryptollcryz*.lcryztext/x-literate-cryptolc Htdi|}tj||fi|yrV)rr0r3)r)r4crylexers rr3zLiterateCryptolLexer.__init__s$*'*tX99rNrYrrrrr{s'  D6G I*+I:rrceZdZdZdZdZdgZddgZdgZgdZ gd Z gd Z gd Z d Z d e zdzZdZej"Zej&Zej,Zeddezedfdeeeedfdeeeedfddj9e zdzeeeedfdeeeeeej:fdeeeej:eeeeeej: fde zdzeeeeeej<fde zdzeeeeeeeej<fddj9e zezej>fddj9e zezefddj9e zezej@fdezefd eej:efd!eej:efd"e zdzeej:efd#ejBfd$e"jFd%fe d&ze$fd'e$fd(e%fd)e&jNfd*e&jPfd+e&jRfd,e"jTd-fd.e"jFd/fgd0efedgd1e%d2fedgd3ed4fed5gd6ed2fd3ed4fd7efd8eeeefed5gedddj9e zezefd9dj9e zezd:zed2fd;ezefdefe+d2g d?eee,jZfd@efdAe,j\dBfdCe,j^fgdDe,j\fdAe,j\dEfdFe,j\d2fdGe,j\fgdHe"jFfdIe"j`fd.e"jFd2fgdJe"jFfedKdLe"jFd2fgdMe"jTfedKdNe"jTd2fgdOe"j`fdPe"j`fdQe"j`fdRe"j`fgdS Z1yT)UrzA Lexer for the Koka language. .. versionadded:: 1.6 Kokaz/https://koka-lang.github.io/koka/doc/index.htmlkokaz*.kkz*.kkiz text/x-koka)"rrrr3cotyperectypealiasstructconfunfunctionvalvarexternalr+r2r)elifreturnrBrrrrTrRasrinlinerectryyieldenumrr.)r3rjrkrlrmr{)rexistssomer) forwhilerepeatforeachzforeach-indexedrcatchfinallycsjsfilerefassignedz[$%&*+@!/\\^~=.:\-?|<>]+z(?!)z (?![\w/]) whitespacez::?r3z(alias)(\s+)([a-z]\w*)? alias-typez(struct)(\s+)([a-z]\w*)? struct-typez(%s)rWz(\s+)([a-z]\w*)?z=(module)(\s+)(interface(?=\s))?(\s+)?((?:[a-z]\w*/)*[a-z]\w*)z`(import)(\s+)((?:[a-z]\w*/)*[a-z]\w*)(?:(\s*)(=)(\s*)(qualified)?(\s*)((?:[a-z]\w*/)*[a-z]\w*))?z>^(public|private)?(\s+)?(function|fun|val)(\s+)([a-z]\w*|\((?:z|/)\))zd^(?:(public|private)(?=\s+external))?((?|[=.]z((?:[a-z]\w*/)*)([A-Z]\w*)z((?:[a-z]\w*/)*)([a-z]\w*)z((?:[a-z]\w*/)*)(\((?:z_\w*z@" litstringz |/(?![*/])`z [{}()\[\];,]z![0-9]+\.[0-9]+([eE][\-+]?[0-9]+)?z0[xX][0-9a-fA-F]+z[0-9]+r\charr^r_=z(?=\((?!,*\)))rdz[(\[<] type-nested type-contentz[)\]>]riz([a-z]\w*)(\s*)(:)(?!:)z(?=((%s)z))z[EPHVX]z[a-z][0-9]*(?![\w/])z((?:[a-z]\w*/)*)([a-z]\w+)z ::|->|[.:|]z (\n\s*)(#.*)$rMrrPrrrnrrz[^"]+z""z [^\\"\n]+escape-sequencez["\n]z [^\\\'\n]+z[\'\n]z \\[nrt\\"\']z\\x[0-9a-fA-F]{2}z\\u[0-9a-fA-F]{4}z\\U[0-9a-fA-F]{6}) r{rrr3rrrrPrr_rrN)2r|r}r~rrrrrrkeywordstypeStartKeywords typekeywordsbuiltinsymbols sboundaryboundaryr Attribute tokenTypeClass tokenTypeDefrEmphtokenConstructorrrrrrrrrPseudoVariablerDoubler rrrrrrrr Preprocrrrrrrrrrsd D ;ChG!II H  L G*G#%IHI::L|| L !i F 3 '':|)T   ((7J *U  !233 !"*7J "M   N gz7J O Q+gz4>>:wPZz4>>; < %'./1:; gz7J N P ")*,56 gz7JUYUbUb c e sxx - - 8',, G sxx) )H 4g > sxx( (8 3W^^ D ) +W 5+ dnn&6 7 9 *HT^^T,J K & 09 < dnnd + - dmm $FMM; /| #X . 8  k *26<< @ !6:: .  ' 6;; ' 6==( +u; ~7O FO  V 4 FO  = 1 N #  6 *  = 1 9  ' dJ 2 4 N #   L !sxx - - 8' B 388H- - 84 ? f ( "I .%i 0 i(( ) * dnni 0 2 * dnni 0 2Y ' FO/ 8x GOOD E Z W&& 2 w~~ &  )) * W&& 0 W&& / g'' (  v}} % FMM " 6==& ) 6== ) % & v}}f - FKK ( % &  V , fmm , !6== 1 !6== 1 !6== 1  cXFrr)%rrPpygments.lexerrrrrrrr r pygments.tokenr r r rrrrrrrpygmentsrr__all__rrrrrr0rrrrrrrrrs '''---% 0 B:BJ,mm`G GTF*:F*R=ZE=Z@9=9.99.M M.:=:.U Ur