o a@s2dZddlZddlmZmZmZmZmZmZm Z ddl m Z m Z m Z mZmZmZmZmZmZmZddlmZgdZedZGdd d eZGd d d eZGd d d eZGdddeZGdddeZGdddeZ Gddde Z!Gddde Z"Gddde Z#Gddde Z$GdddeZ%dS)z pygments.lexers.haskell ~~~~~~~~~~~~~~~~~~~~~~~ Lexers for Haskell and related languages. :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. N)Lexer RegexLexerbygroups do_insertionsdefaultincludeinherit) TextCommentOperatorKeywordNameStringNumber PunctuationGeneric Whitespace) unistring) HaskellLexer HspecLexer IdrisLexer AgdaLexer CryptolLexerLiterateHaskellLexerLiterateIdrisLexerLiterateAgdaLexerLiterateCryptolLexer KokaLexerz.*? c@seZdZdZdZddgZdgZdgZej ej BZ dZ dZ gd efd ejfd ejd fd ejdfdejdfdejfdde ejfdejfdejdejfdejdefdejdejfdejdejfdejfdejfdejfdejfdejfd ejfd!efd"e j!fd#e j!fd$e j!fd%e j!fd&e j"fd'e j#fd(e j$fd)e j%fd*ejd+fd,ed-fd.ejfd/ej&fd0e'fd efd,ed-fd1e'd2fd3efd4ejd5ejd6e(ej)eeeed2fd4ejd7e(ej)eeee'd8fd4ejd9e(ej)ee'd8fd:ej)d2fgd efd4ejd9e(ej)ee'd8fd;ejd<ej)d2fgd efd;ejd=ejfd>ejd?ejfd ejfd ejd fd@e'fd!efdAe'dBfd1e'dCfg dDejfd ejdEfdFejd2fdGejfgdHejd2fdIej*dJfd*ejd2fgdKefdIej*dJfd,ed2fgdLej*d2fdMejdNej*d2fde ej*d2fdOej*d2fdPej*d2fdQej*d2fdRe(eej*d2fgdSZ+dTS)Urzk A Haskell lexer based on the lexemes defined in the Haskell 98 Report. .. versionadded:: 0.8 Haskellhaskellhsz*.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\']*),\(rcrc#pop:2[^-{}]+#push-\}[-{}][^\\']'\\escape[^\\"]+[abfnrtv"\'&\\]z\^[][z@^_]o[0-7]+ x[\da-fA-F]+\d+ (\s+)(\\)rootrOrQrcrMrZr\rpN),__name__ __module__ __qualname____doc__namealiases filenames mimetypesre MULTILINEUNICODEflagsreservedasciirr Single Multiliner Reservedr ExceptionjoinrCharuniLlFunctionLuTyper WordrFloatBinOctHexIntegerBuiltinrr NamespaceEscapetokensrr9/usr/lib/python3/dist-packages/pygments/lexers/haskell.pyrs         !" $%'()-               rc@s\eZdZdZdZdgZgZgZddee e e j fdee e e j fdee e e j fe giZdS) rzY A Haskell lexer with support for Hspec constructs. .. versionadded:: 2.4.0 Hspechspecrxz(it)(\s*)("[^"]*")z(describe)(\s*)("[^"]*")z(context)(\s*)("[^"]*")N)ryrzr{r|r}r~rrrr rrDocrrrrrrrsrc@s0eZdZdZdZddgZdgZdgZdZdZ d Z d d e e e ejfd e e ejfd e e ejfde e ejdfde e eje eje fdd eejfde eje dfdejfdefdejfdejfdejfdejfdejfdejfdejdfdedfd efd!e fgd"e fd#e eje e d$fd%ejd&fgd"e fd'ejfd(ejfd)ejfd*ejdfd+e fd,efd-e d.fd/e d0fg d1ejfd*ejd2fd3ejd&fd4ejfgd5ejfd6ej!d7fdejd&fgd8efd6ej!d7fded&fgd9ej!d&fd:ej!d&fd e ej!d&fd;ej!d&fdZ"d?S)@rz A lexer for the dependently typed programming language Idris. Based on the Haskell and Agda Lexer. .. versionadded:: 2.0 Idrisidrisidrz*.idrz text/x-idris)3r!r"r#rusingr%r&r(r)r*r+rewriteauto namespacecodatamutualprivatepublicabstracttotalpartial interfaceimplementationexportcovering constructorr,proofr.r/staticr1r2withpatterntermsyntaxprefix postulate parametersrecorddsl impossibleimplicittacticsintrosintrocomputerefineexacttrivialr3) liblinkflagrhidefreezeaccessrloggingdynamicr}error_handlerslanguagez^(\s*)(%%(%s))rTz((\s*)(--(?![!#$%&*+./<=>?@^|_~:\\]).*?)$z(\s*)(\|{3}.*?)$z (\s*)(\{-)rM^(\s*)([^\s(){}]+)(\s*)(:)(\s*)rS(import|module)(\s+)rQ('')?[A-Z][\w\']*z [a-z][\w\']*z(<-|::|->|=>|=)z"([(){}\[\]:!#$%&*+.\\/<=>?@^|~-]+)\d+[eE][+-]?\d+\d+\.\d+([eE][+-]?\d+)?0[xX][\da-fA-F]+rurYrZr[r\ [^\s(){}]+\s+?rJ([A-Z][\w.]*)(\s+)(\()rc [A-Z][\w.]*ra[A-Z]\w*(_[\w\']+|[a-z][\w\']*)z--.*$rLrfrXrgrhr`rirjrkrlrmz[^\\']rorprqrr \^[][A-Z@^_]rsrtrv)rxrQrcrMrZr\rpN)#ryrzr{r|r}r~rrrr directivesrrrr rr rrr rr rrr rrrrrrrrrrrrrrrs                 rc@s>eZdZdZdZdgZdgZdgZgdZde e e j e e je fdejfd ejd fd ejd fd deejfde eje dfdejfde fde jfdejfdejfdejfdejfdejdfdedfdefde fgdejfd ejdfd ejd!fd"ejfgd ejd fd#e d!fd$efgejd ejdejdejd%d&Zd'S)(rz For the `Agda `_ dependently typed functional programming language and proof assistant. .. versionadded:: 2.0 Agdaagdaz*.agdaz text/x-agda)"rr coinductiverr#fieldforallhidingr) inductiveinfixinfixlinfixrr+r,ropenrr primitiverquote quoteGoal quoteTermrrenamingrrtacticunquote unquoteDeclrr1rrrKrLrMz\{!holerSrTrrQz\b(Set|Prop)[\u2080-\u2089]*\bz (\(|\)|\{|\})z((\.{1,3}|\||\u03BB|\u2200|\u2192|:|=|->)rrrrurYrZr[r\rrz[^!{}]+rkz!\}raz[!{}]z[a-zA-Z][\w.]*z [\W0-9_]+rp)rxrrQrMrZr\rpN) ryrzr{r|r}r~rrrrrr rr rr rr Directiverr rrrrrrrrr rrrrrrr&sR        rc@seZdZdZdZddgZdgZdgZdZdZ d e fd e j fd e j d fd ejdfdejdfdejfddeejfdejfdefdejfdejfdejfdejfdefdejfdejfdejfdejfdejfd ejd!fd"ed#fd$ejfd%ejfd&efgd e fd"ed#fd'ed(fd)efd*e ej!e ee ed(fd+e ej!e ee ed,fd-e ej!e ed,fd.ej!d(fgd e fd-e ej!e ed,fd/ej!d(fgd e fd0ejfd1ejfd2efdefd3ed4fd'ed5fgd6e j fd e j d7fd8e j d(fd9e j fgd:ejd(fd;ej"dej"d(fd?ej"d(fde ej"d(fd@ej"d(fdAej"d(fdej"d(fdBe e ej"d(fgdCZ#hdDZ$dEdFZ%dGS)Hrzs FIXME: A Cryptol2 lexer based on the lexemes defined in the Haskell 98 Report. .. versionadded:: 2.0 Cryptolcryptolcryz*.cryztext/x-cryptol)ArithBitCmpFalseInfTruer&rexternfinr(rOinflg2maxminrQr-pragmapropertyr/r0r1widthr3rJ//.*$/\*rMrNrOrPrQrRrSrTz^[_a-z][\w\']*z'?[_a-z][\w']*rrUrVrWrXrrz 0[oO][0-7]+rrurYrZr[r\r]r^r_r`rarbz(([A-Z][\w.]*)(\s+)(as)(\s+)([A-Z][\w.]*)z#([A-Z][\w.]*)(\s+)(hiding)(\s+)(\()rcrrdrrrrfrgrhri[^/*]+rk\*/[*/]rnrorprqrrrrsrtrvrw><<>><<<>>>parregseqrtailconsterrorsplittracerASSERTlengthreverse transpose undefinedccsTdg}t|||D]\}}}|tur!||jvr!|tj|fVq |||fVq dS)Nrx)rget_tokens_unprocessedr EXTRA_KEYWORDSr)selftextstackindextokenvaluerrrrs  z#CryptolLexer.get_tokens_unprocessedN)&ryrzr{r|r}r~rrrrrr rrr rr rrrrr rrrrrrrrrrrrrrrrrrrrrks    $            f rc@s*eZdZdZedZddZddZdS) 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)cKs||_tj|fi|dS)N) baselexerr__init__)rr&optionsrrrr'szLiterateLexer.__init__c cs|jd}|dur|dddvrdpd}d}g}|dkr\t|D]4}|}|j|}|rM|t |dt j |dfgf||d7}q&|t |dt |fgfq&ncdd l m}|d i|j} d} d} t|D]=}|}| r|d rd} | |7} qs||7}qs|d rd} | |7} |t |t| | fd} qs| |7} qs|t |t| | ft||j|EdHdS) Nlitstylerz%\latexbird)TexLexerz \end{code}z \begin{code}r)r(getlstripline_refinditergroupbird_rematchappendlenr Specialr pygments.lexers.markupr/ startswithlistrrr&) rr stylecode insertionsr6linemr/lxlexer codelinesr+rrrrsP           z$LiterateLexer.get_tokens_unprocessedN) ryrzr{r|rcompiler5r'rrrrrr%s   r%c@0eZdZdZdZgdZdgZdgZddZdS) 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-haskellcK&tdi|}tj||fi|dSNr)rr%r'rr(hslexerrrrr'FzLiterateHaskellLexer.__init__N ryrzr{r|r}r~rrr'rrrrr4  rc@rE) 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-idriscKrHrI)rr%r'rJrrrr']rLzLiterateIdrisLexer.__init__NrMrrrrrKrNrc@s0eZdZdZdZddgZdgZdgZddZd S) 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-agdacKs*tdi|}tj||fddi|dS)Nr)r+r)rr%r')rr( agdalexerrrrr'tszLiterateAgdaLexer.__init__NrMrrrrrbrNrc@rE) 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-cryptolcKrHrI)rr%r')rr(crylexerrrrr'rLzLiterateCryptolLexer.__init__NrMrrrrryrNrc@seZdZdZdZdgZddgZdgZgdZgdZ gd Z gd Z d Z d e d Z dZejZejZejZedde edfdeeeedfdeeeedfdde deeeedfdeeeeeejfdeeeejeeeeeej fde deeeeeejfde deeeeeeeejfdde eejfddeeefdde eejfde efdeejefd eejefd!e deejefd"ej fd#e!j"d$fe d%e#fd&e#fd'e$fd(e%j&fd)e%j'fd*e%j(fd+e!j)d,fd-e!j"d.fgd/efedgd0e$d1fedgd2ed3fed4gd5ed1fd2ed3fd6efd7eeeefed4geddde eefd8deed9ed1fd:eefd;efd"ej fdeejefdeee+j,fd?efd@e+j-dAfdBe+j.fgdCe+j-fd@e+j-dDfdEe+j-d1fdFe+j-fgdGe!j"fdHe!j/fd-e!j"d1fgdIe!j"fedJdKe!j"d1fgdLe!j)fedJdMe!j)d1fgdNe!j/fdOe!j/fdPe!j/fdQe!j/fgdR Z0dSS)Trzc Lexer for the `Koka `_ language. .. versionadded:: 1.6 Kokakokaz*.kkz*.kkiz text/x-koka)"rrrr0cotyperectypealiasstructconfunfunctionvalvarexternalr(r/r&elifreturnr6rrrrQrOasrinlinerectryyieldenumrr+)r0rXrYrZr[ri)rexistssomer) forwhilerepeatforeachzforeach-indexedrcatchfinallycsjsfilerefassignedz[$%&*+@!/\\^~=.:\-?|<>]+z(?!)z (?![\w/]) whitespacez::?r0z(alias)(\s+)([a-z]\w*)? alias-typez(struct)(\s+)([a-z]\w*)? struct-typez(%s)rTz(\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]+rYcharr[r\=z(?=\((?!,*\)))raz[(\[<] type-nested type-contentz[)\]>]rfz([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*)(#.*)$rJrrMrr rkr r z[^"]+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}) rxryrzr0rrrxrMr{r\r}rN)1ryrzr{r|r}r~rrkeywordstypeStartKeywords typekeywordsbuiltinsymbols sboundaryboundaryr Attribute tokenTypeClass tokenTypeDefrEmphtokenConstructorrrr rrrrrPseudoVariablerDoubler rrrrrrrr Preprocrrrrrrrrrs              ?            r)&r|rpygments.lexerrrrrrrrpygments.tokenr r r r r rrrrrpygmentsrr__all__rDr2rrrrrr%rrrrrrrrrs( $0  oE @