a
    ñ»jH9  ã                   @   s¼   d Z ddlZddl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 ddlmZ g 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dS )zÖ
    pygments.lexers.modeling
    ~~~~~~~~~~~~~~~~~~~~~~~~

    Lexers for modeling languages.

    :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
é    N)Ú
RegexLexerÚincludeÚbygroupsÚusingÚdefaultÚwords)	ÚTextÚCommentÚOperatorÚKeywordÚNameÚStringÚNumberÚPunctuationÚ
Whitespace)Ú	HtmlLexer)Ú_stan_builtins)ÚModelicaLexerÚ	BugsLexerÚ	JagsLexerÚ	StanLexerc                   @   sD  e Zd ZdZdZdZdgZdgZdgZdZ	e
je
jB ZdZd	efd
ejfdejfgedƒdejdfdefdefdejfdejfeddd�ejfeddd�ejfdej feddd�ejdfdej!fdejdfeefgedƒdejfdejdfeej"dfe#dƒgedƒeej$dfe#dƒgdejdfd ej%fd!e&e'ƒfd"ejfgd#œZ(d$S )%r   z#
    For Modelica source code.
    ÚModelicazhttp://www.modelica.org/Úmodelicaz*.moztext/x-modelicaz1.1z"(?:'(?:[^\\']|\\.)+'|[a-zA-Z_]\w*)z[\s\ufeff]+z//[^\n]*\n?z	/\*.*?\*/Ú
whitespaceú"Ústringz[()\[\]{},;]+z\.?[*^/+-]|\.|<>|[<>:=]=?z\d+(\.?\d*[eE][-+]?\d+|\.\d*)z\d+)SÚabsÚacosZactualStreamÚarrayÚasinÚassertZAssertionLevelÚatanÚatan2Z
backSampleÚBooleanZcardinalityÚcatÚceilZchangeZClockZConnectionsÚcosÚcoshÚcrossÚdelayZdiagonalÚdivÚedgeÚexpZExternalObjectÚfillÚfloorZgetInstanceNameZholdZhomotopyÚidentityZinStreamÚintegerÚIntegerÚintervalÚinverseZ	isPresentZlinspaceÚlogÚlog10ÚmatrixÚmaxÚminÚmodZndimsZnoClockZnoEventZonesZouterProductÚpreÚpreviousÚproductÚRealZreinitÚremZrootedÚsampleZscalarZ
semiLinearZshiftSampleÚsignÚsinÚsinhÚsizeZskewZsmoothZspatialDistributionÚsqrtZStateSelectr   Z	subSampleÚsumZsuperSampleZ	symmetricÚtanÚtanhZterminalÚ	terminateÚtimeZ	transposeZvectorZzerosz\b)Úsuffix)/Ú	algorithmÚ
annotationÚbreakÚconnectZconstantZconstrainedbyZderZdiscreteZeachÚelseZelseifZelsewhenZencapsulatedÚenumerationZequationÚexitÚ
expandableZextendsZexternalZ	firstTickÚfinalZflowÚforÚifÚimportZimpureÚinÚinitialÚinnerÚinputr2   ÚloopZnondiscreteÚouterÚoutputZ	parameterÚpartialZ	protectedÚpublicZpureZ	redeclareZreplaceableÚreturnÚstreamZthenÚwhenÚwhilez(and|not|or)\b)
ÚblockÚclassZ	connectorÚendÚfunctionÚmodelÚoperatorÚpackageÚrecordÚtypere   z(false|true)\bzwithin\búpackage-prefixz(function|record)\bz(if|for|when|while)\bz#popz\\[\'"?\\abfnrtv]z6(?i)<\s*html\s*>([^\\"]|\\.)+?(<\s*/\s*html\s*>|(?="))z<|\\?[^"\\<]+)r   Úrootre   rm   r   N))Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚnameÚurlÚaliasesÚ	filenamesÚ	mimetypesÚversion_addedÚreÚDOTALLÚ	MULTILINEÚflagsÚ_namer   r	   ÚSingleÚ	Multiliner   r   ÚDoubler   r
   r   ÚFloatr1   r   r   ÚBuiltinr   ÚReservedÚWordÚConstantÚClassr   Ú	NamespaceÚEscaper   r   Útokens© rŠ   rŠ   ú>E:\soccer\ml_env\Lib\site-packages\pygments/lexers/modeling.pyr      sr   ý
êêôóÿÿ
Ï4

û
ý
ÿû»r   c                   @   s´   e Zd ZdZdZg d¢ZdgZdZdZdZ	dZ
d	efgd
ejfgedƒedƒdeejeeƒfdejfd d e	e
 ¡¡ejfdefdefdefdefdefdefgdœZdd„ ZdS )r   z=
    Pygments Lexer for OpenBugs and WinBugs
    models.
    ÚBUGS)ÚbugsÚwinbugsÚopenbugsú*.bugz4https://www.mrc-bsu.cam.ac.uk/software/bugs/openbugsú1.6)>r   ÚarccosÚarccoshÚarcsinÚarcsinhÚarctanÚarctanhÚcloglogr&   r'   Z
cumulativeÚcutZdensityZdevianceÚequalsÚexprZgammapÚilogitÚicloglogZintegralr4   ÚlogfactÚloggamÚlogitr7   r8   Úphizpost.p.valueÚpowzprior.p.valueÚprobitzreplicate.postzreplicate.priorÚroundrA   rB   ZsolutionrD   ÚsteprF   rG   ÚtruncÚinprodú
interp.linr3   ÚlogdetÚmeanz
eigen.valsZodeÚprodzp.valueMÚrankZrankedzreplicate.postMÚsdÚsortrE   ÚDÚIÚFÚTÚC)ÚdbernÚdbinÚdcatZdnegbinZdpoisÚdhyperZdbetaZdchisqrÚddexpÚdexpZdflatZdgammaZdgevÚdfZdggammaZdgparZdloglikZdlnormZdlogisZdnormZdparÚdtÚdunifZdweibÚdmultiÚddirchÚdmnormÚdmtÚdwishú\s+ú#.*$Úcommentsr   z(model)(\s+)(\{)ú(for|in)(?![\w.])ú({})(?=\s*\()ú|z[A-Za-z][\w.]*ú&[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?ú\[|\]|\(|\)|:|,|;ú<-|~z	\+|-|\*|/ú[{}]©r   rÄ   rn   c                 C   s   t  d| t j¡rdS dS d S )Nz^\s*model\s*{gffffffæ?ç        ©ry   ÚsearchÚM©ÚtextrŠ   rŠ   r‹   Úanalyse_textÍ   s    zBugsLexer.analyse_textN)ro   rp   rq   rr   rs   ru   rv   rt   rx   Ú
_FUNCTIONSÚ_DISTRIBUTIONSr   r	   r~   r   r   r   r‡   r   rƒ   ÚformatÚjoinr   r‚   r   r
   r‰   rÓ   rŠ   rŠ   rŠ   r‹   r   u   s<   ÿþÿÿèø$r   c                   @   sâ   e Zd ZdZdZdgZddgZdZdZdZ	e
d	d
„ dD ƒƒZdZdefgdefgdejfdejfgedƒedƒdeejeeƒfdejfdejfd d e	e e ¡¡ejfedƒdefdefdefdefdefgdœZdd „ Zd!S )"r   z"
    Pygments Lexer for JAGS.
    ÚJAGSÚjagsz*.jagr�   z https://mcmc-jags.sourceforge.ior‘   )2r   r’   r“   r”   r•   r–   r—   r&   r'   r˜   rš   r,   r�   Zifelserœ   r4   rž   rŸ   r    r¡   r¢   r£   r¤   rA   rB   rD   r¥   rF   rG   r¦   r§   r¨   r©   r7   rª   r8   r«   rE   r­   r3   r¬   r®   Útr   Úacoshr   Úasinhr!   r²   r°   c                 c   s   | ]}d |› �V  qdS )z[dpq]NrŠ   )Ú.0ÚxrŠ   rŠ   r‹   Ú	<genexpr>ë   ó    zJagsLexer.<genexpr>)ZbernÚbetaZdchiqsqrr¸   r¹   rº   Úgammaz	gen.gammaZlogisZlnormZnegbinZnchisqrZnormZparZpoisZweib)r»   r¼   Zdbetabinr´   rµ   r¶   r·   r¾   r¿   rÁ   rÀ   r½   ZdbinomZdchisqZdnbinomZdweibullZddirichrÂ   z[a-zA-Z][\w.]*\bú(?s)/\*.*?\*/rÃ   rÄ   r   z(model|data)(\s+)(\{)zvar(?![\w.])rÅ   rÆ   rÇ   ÚnamesrÈ   rÉ   rÊ   z&\+|-|\*|\/|\|\|[&]{2}|[<>=]=?|\^|%.*?%rË   )r   rä   rÄ   rn   c                 C   sF   t  d| t j¡r>t  d| t j¡r$dS t  d| t j¡r8dS dS ndS d S )Nz^\s*model\s*\{z^\s*data\s*\{gÍÌÌÌÌÌì?z^\s*varg333333Ó?r   rÎ   rÑ   rŠ   rŠ   r‹   rÓ      s    zJagsLexer.analyse_textN) ro   rp   rq   rr   rs   ru   rv   rt   rx   rÔ   ÚtuplerÕ   Z_OTHER_DISTRIBUTIONSr   r   r	   r   r~   r   r   r   r‡   r   ÚDeclarationrƒ   rÖ   r×   r‚   r   r
   r‰   rÓ   rŠ   rŠ   rŠ   r‹   r   Ô   sR   ÿÿþüÿ
ÿþýçò+r   c                   @   s�  e Zd ZdZdZdgZdgZdZdZde	fgde
jfd	e
jfgd
efedƒedƒd d d¡¡eeje	eƒfdefdefd d ej¡¡efdefd d ej¡¡ejfdeeeeeeƒfdeeeeeeƒfdefd d ej¡¡ejfd d ej¡¡eeeejƒfdejjfd d ej ¡¡ej!fdej"fde#j$fde#j$fde#j$fde#j$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&œZ&d'd(„ Z'd)S )*r   a  Pygments Lexer for Stan models.

    The Stan modeling language is specified in the *Stan Modeling Language
    User's Guide and Reference Manual, v2.17.0*,
    `pdf <https://github.com/stan-dev/stan/releases/download/v2.17.0/stan-reference-2.17.0.pdf>`__.
    ÚStanÚstanz*.stanzhttps://mc-stan.orgr‘   rÂ   rã   z	(//|#).*$z"[^"]*"rÄ   r   z({})(\s*)(\{{)rÇ   )Z	functionsÚdataztransformed\s+?dataÚ
parametersztransformed\s+parametersrh   zgenerated\s+quantitiesztarget\s*\+=zjacobian\s*\+=z({})\bz
T(?=\s*\[)z/(<)(\s*)(upper|lower|offset|multiplier)(\s*)(=)z(,)(\s*)(upper)(\s*)(=)z
[;,\[\]()]rÆ   z(~)(\s*)({})(?=\s*\()z[A-Za-z]\w*__\bz[A-Za-z]\w*(?=\s*\()]z$[0-9]+(\.[0-9]*)?([eE][+-]?[0-9]+)?iz\.[0-9]+([eE][+-]?[0-9]+)?iz[0-9]+iz#[0-9]+(\.[0-9]*)?([eE][+-]?[0-9]+)?z\.[0-9]+([eE][+-]?[0-9]+)?z[0-9]+z[A-Za-z]\w*\bz<-|(?:\+|-|\.?/|\.?\*|=)?=|~z;\+|-|\.?\*|\.?/|\\|'|\.?\^|!=?|<=?|>=?|\|\||&&|%|\?|:|%/%|!rË   z\|rÌ   c                 C   s   t  d| t j¡rdS dS d S )Nz^\s*parameters\s*\{g      ð?rÍ   rÎ   rÑ   rŠ   rŠ   r‹   rÓ     s    zStanLexer.analyse_textN)(ro   rp   rq   rr   rs   ru   rv   rt   rx   r   r	   r   r~   r   r   rÖ   r×   r   r   r‡   r   r   ÚKEYWORDSÚTYPESÚTyper
   r   Z	FUNCTIONSr   r‚   ZDISTRIBUTIONSÚPseudoZRESERVEDrƒ   ÚFunctionr   r�   r1   r‰   rÓ   rŠ   rŠ   rŠ   r‹   r   ,  sd   ÿýýÿÿÿ
È÷Er   )rr   ry   Zpygments.lexerr   r   r   r   r   r   Zpygments.tokenr   r	   r
   r   r   r   r   r   r   Zpygments.lexers.htmlr   Zpygments.lexersr   Ú__all__r   r   r   r   rŠ   rŠ   rŠ   r‹   Ú<module>   s   
 ,^_X