U
    ]gs5                     @   s   d Z ddlZddl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 ddd	d
g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-2025 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)
RegexLexerincludebygroupsusingdefault)	TextCommentOperatorKeywordNameStringNumberPunctuation
Whitespace)	HtmlLexer)_stan_builtinsModelicaLexer	BugsLexer	JagsLexer	StanLexerc                   @   s,  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dejfdejfdejf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.
    ZModelicazhttp://www.modelica.org/Z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+al  (abs|acos|actualStream|array|asin|assert|AssertionLevel|atan|atan2|backSample|Boolean|cardinality|cat|ceil|change|Clock|Connections|cos|cosh|cross|delay|diagonal|div|edge|exp|ExternalObject|fill|floor|getInstanceName|hold|homotopy|identity|inStream|integer|Integer|interval|inverse|isPresent|linspace|log|log10|matrix|max|min|mod|ndims|noClock|noEvent|ones|outerProduct|pre|previous|product|Real|reinit|rem|rooted|sample|scalar|semiLinear|shiftSample|sign|sin|sinh|size|skew|smooth|spatialDistribution|sqrt|StateSelect|String|subSample|sum|superSample|symmetric|tan|tanh|terminal|terminate|time|transpose|vector|zeros)\bak  (algorithm|annotation|break|connect|constant|constrainedby|der|discrete|each|else|elseif|elsewhen|encapsulated|enumeration|equation|exit|expandable|extends|external|firstTick|final|flow|for|if|import|impure|in|initial|inner|input|interval|loop|nondiscrete|outer|output|parameter|partial|protected|public|pure|redeclare|replaceable|return|stream|then|when|while)\bz(and|not|or)\bzI(block|class|connector|end|function|model|operator|package|record|type)\bclassz(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   rootr   r   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   FloatIntegerr   Builtinr
   ReservedWordConstantZClassr   	NamespaceZEscaper   r   tokens r6   r6   </tmp/pip-unpacked-wheel-zak7uw41/pygments/lexers/modeling.pyr      sh   

 
!



c                   @   s   e Zd ZdZdZdddg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.
    ZBUGSZbugsZwinbugsZopenbugs*.bugz4https://www.mrc-bsu.cam.ac.uk/software/bugs/openbugs1.6)>absarccosarccosharcsinarcsinharctanarctanhcloglogcoscoshZ
cumulativeZcutZdensityZdevianceequalsexprZgammapilogiticloglogZintegralloglogfactloggamlogitmaxminphizpost.p.valuepowzprior.p.valueprobitzreplicate.postzreplicate.priorroundsinsinhZsolutionsqrtsteptantanhtruncinprod
interp.lininverselogdetmeanz
eigen.valsZodeprodzp.valueMrankZrankedzreplicate.postMsdsortsum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   rx   r   c                 C   s   t d| t jrdS dS d S )Nz^\s*model\s*{gffffff?        r&   searchMtextr6   r6   r7   analyse_text   s    zBugsLexer.analyse_textN)r   r   r   r   r    r"   r#   r!   r%   
_FUNCTIONS_DISTRIBUTIONSr   r   r+   r   r   r
   r4   r   r1   formatjoinr   r0   r   r	   r5   r   r6   r6   r6   r7   r   b   s<   
$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.
    ZJAGSZjagsz*.jagr8   z https://mcmc-jags.sourceforge.ior9   )2r:   r;   r<   r=   r>   r?   r@   rB   rC   rA   rD   exprG   ZifelserF   rH   rI   rJ   rK   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r\   rL   r]   rM   r^   rb   r`   r[   r_   ra   tacosacoshasinasinhatanrf   rd   c                 c   s   | ]}d | V  qdS )z[dpq]Nr6   ).0xr6   r6   r7   	<genexpr>   s     zJagsLexer.<genexpr>)ZbernbetaZdchiqsqrrl   rm   rn   gammaz	gen.gammaZlogisZlnormZnegbinZnchisqrZnormparZpoisZweib)ro   rp   Zdbetabinrh   ri   rj   rk   rr   rs   ru   rt   rq   ZdbinomZdchisqZdnbinomZdweibullZddirichrv   z[a-zA-Z][\w.]*\b(?s)/\*.*?\*/rw   rx   r   z(model|data)(\s+)(\{)zvar(?![\w.])ry   rz   r{   namesr|   r}   r~   z&\+|-|\*|\/|\|\|[&]{2}|[<>=]=?|\^|%.*?%r   )r   r   rx   r   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   r6   r6   r7   r     s    zJagsLexer.analyse_textN) r   r   r   r   r    r"   r#   r!   r%   r   tupler   Z_OTHER_DISTRIBUTIONSr   r   r   r,   r+   r   r   r
   r4   r   ZDeclarationr1   r   r   r0   r   r	   r5   r   r6   r6   r6   r7   r      sR   
+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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>`__.
    ZStanZstanz*.stanzhttps://mc-stan.orgr9   rv   r   z	(//|#).*$z"[^"]*"rx   r   z({})(\s*)(\{{)r{   )Z	functionsdataztransformed\s+?data
parametersztransformed\s+parametersmodelzgenerated\s+quantitiesztarget\s*\+=z({})\bz
T(?=\s*\[)z/(<)(\s*)(upper|lower|offset|multiplier)(\s*)(=)z(,)(\s*)(upper)(\s*)(=)z
[;,\[\]()]rz   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   r6   r6   r7   r   j  s    zStanLexer.analyse_textN)(r   r   r   r   r    r"   r#   r!   r%   r   r   r,   r+   r   r   r   r   r   r
   r4   r   r   ZKEYWORDSTYPESTyper	   r   Z	FUNCTIONSr   r0   ZDISTRIBUTIONSZPseudoZRESERVEDr1   ZFunctionr   r.   r/   r5   r   r6   r6   r6   r7   r     sb   
C)r   r&   Zpygments.lexerr   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   r6   r6   r6   r7   <module>   s   
,K_X