
    |e4                         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 g dZ G d d	e      Z G d
 de      Z G d de      Z G d de      Zy)z
    pygments.lexers.modeling
    ~~~~~~~~~~~~~~~~~~~~~~~~

    Lexers for modeling languages.

    :copyright: Copyright 2006-2023 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                      e Zd ZdZdZdZdgZdgZdgZe	j                  e	j                  z  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j0                  fdej2                  fdej6                  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jD                  df e!d      gdej(                  dfdejF                  fd e$e%      fdej(                  fgd Z&y!)"r   z>
    For Modelica source code.

    .. versionadded:: 1.1
    Modelicazhttp://www.modelica.org/modelicaz*.moztext/x-modelicaz"(?:'(?:[^\\']|\\.)+'|[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reDOTALL	MULTILINEflags_namer   r	   Single	Multiliner   r   Doubler   r
   r   FloatIntegerr   Builtinr   ReservedWordConstantClassr   	NamespaceEscaper   r   tokens     :/usr/lib/python3/dist-packages/pygments/lexers/modeling.pyr   r      s   
 D
$ClGI"#III$E1E T"W^^,7,,-
 L!6==(+{+)84-v||<V^^$
* ,0<<
9=  . ' 0 0'; 0 01'**,<=DM=
B L!#W%5%56%w'7'7@DJJ'FO
 L!DNNF+FO
 6==&)!6==1F9v}}-
e9Fr<   r   c                   (   e Zd ZdZdZg dZdg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j%                  eez         z  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 Zy)r   zX
    Pygments Lexer for OpenBugs and WinBugs
    models.

    .. versionadded:: 1.6
    BUGS)bugswinbugsopenbugs*.bug)>absarccosarccosharcsinarcsinharctanarctanhcloglogcoscosh
cumulativecutdensitydevianceequalsexprgammapilogiticloglogintegralloglogfactloggamlogitmaxminphizpost.p.valuepowzprior.p.valueprobitzreplicate.postzreplicate.priorroundsinsinhsolutionsqrtsteptantanhtruncinprod
interp.lininverselogdetmeanz
eigen.valsodeprodzp.valueMrankrankedzreplicate.postMsdsortsumDIFTC)dberndbindcatdnegbindpoisdhyperdbetadchisqrddexpdexpdflatdgammadgevdfdggammadgpardloglikdlnormdlogisdnormdpardtdunifdweibdmultiddirchdmnormdmtdwish\s+#.*$commentsr   z(model)(\s+)(\{)(for|in)(?![\w.])(%s)(?=\s*\()|z[A-Za-z][\w.]*&[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\[|\]|\(|\)|:|,|;<-|~z	\+|-|\*|/[{}]r   r   r   c                 P    t        j                  d| t         j                        ryy)Nz^\s*model\s*{gffffff?        r)   searchMtexts    r=   analyse_textzBugsLexer.analyse_text   s    99%tRTT2r<   N)r    r!   r"   r#   r$   r&   r'   
_FUNCTIONS_DISTRIBUTIONSr   r	   r.   r   r   r   r8   r   r4   joinr   r3   r   r
   r:   r   r;   r<   r=   r   r   c   s     D-G	I!J&N TN

 gnn%
 JL! g''{;= "7#3#34yyn456\\ %6?!;/ h8$k"3
#FJr<   r   c                      e Zd ZdZdZdgZddgZdZ e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j/                  ee	z   e
z         z  ej0                  f ed      defdefdefdefdefgdZd Zy)r   z=
    Pygments Lexer for JAGS.

    .. versionadded:: 1.6
    JAGSjagsz*.jagrC   )2rD   rE   rF   rG   rH   rI   rJ   rL   rM   rK   rR   exprV   ifelserU   rX   rY   rZ   r[   r^   r_   r`   ra   rb   rc   re   rf   rg   rh   ri   rj   rk   rm   r\   rn   r]   rp   ru   rs   rl   rq   rt   tacosacoshasinasinhatanry   rw   c              #   &   K   | ]	  }d |z    yw)z[dpq]%sNr;   ).0xs     r=   	<genexpr>zJagsLexer.<genexpr>   s      QQ9q= Qs   )bernbetadchiqsqrr   r   r   gammaz	gen.gammalogislnormnegbinnchisqrnormparpoisweib)r   r   dbetabinr{   r|   r}   r   r   r   r   r   r   dbinomdchisqdnbinomdweibull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   r   c                     t        j                  d| t         j                        rMt        j                  d| t         j                        ryt        j                  d| t         j                        ryyy)Nz^\s*model\s*\{z^\s*data\s*\{g?z^\s*varg333333?r   r   r   s    r=   r   zJagsLexer.analyse_text  sL    99&bdd3yy)46:tRTT2r<   N)r    r!   r"   r#   r$   r&   r'   r   tupler   _OTHER_DISTRIBUTIONSr   r   r	   r/   r.   r   r   r   r8   r   Declarationr4   r   r3   r   r
   r:   r   r;   r<   r=   r   r      sO    DhG'"I	J  QPQ QN
* TN

 !$'
 w001gnn%	
 JL!%g''{;=g112!7#3#34 		*,:+;,@+A !B B \\
 G6?!;/h6Ak"3
)FV	r<   r   c                      e Zd ZdZdZdgZdgZdefgdej                  fdej                  fgdef ed	       ed
      ddj                  d      z   eej                   ee      fdefddj                  ej&                        z  efdefddj                  ej(                        z  ej*                  fd eeeeee      fd eeeeee      fdefddj                  ej0                        z  ej4                  fddj                  ej6                        z   eeeej4                        fdej4                  j8                  fddj                  ej:                        z  ej<                  fdej>                  fde jB                  fde jB                  fde jB                  fde jB                  fde jB                  fde jD                  fdefdefd efd!efd"efgd#Z#d$ Z$y%)&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>`__.

    .. versionadded:: 1.6
    Stanstanz*.stanr   r   z	(//|#).*$z"[^"]*"r   r   z(%s)(\s*)(\{)r   )	functionsdataztransformed\s+?data
parametersztransformed\s+parametersmodelzgenerated\s+quantitiesztarget\s*\+=z(%s)\bz
T(?=\s*\[)z/(<)(\s*)(upper|lower|offset|multiplier)(\s*)(=)z(,)(\s*)(upper)(\s*)(=)z
[;,\[\]()]r   z(~)(\s*)(%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                 P    t        j                  d| t         j                        ryy)Nz^\s*parameters\s*\{g      ?r   r   r   s    r=   r   zStanLexer.analyse_textm  s    99+T2448r<   N)%r    r!   r"   r#   r$   r&   r'   r   r	   r/   r.   r   r   r   r   r   r8   r   r   KEYWORDSTYPESTyper
   r   	FUNCTIONSr   r3   DISTRIBUTIONSPseudoRESERVEDr4   Functionr   r1   r2   r:   r   r;   r<   r=   r   r     s6    DhG
I TN
 w0017>>*
  JL!YY < == g''{;	= g&>#:#:;;WEG$>#7#788',,G @h
GZMO'k:w
KPR K()A)A BBDLLQ%1M1M(NN:t||<>  !4!45>#:#:;;W=M=MN%t}}54fllC+V\\:&3V\\B*FLL9't$,h7KXVk"K o8
BFHr<   r   )r#   r)   pygments.lexerr   r   r   r   r   pygments.tokenr   r	   r
   r   r   r   r   r   r   pygments.lexers.htmlr   pygments.lexersr   __all__r   r   r   r   r;   r<   r=   <module>r      sl    
 H H$ $ $ + *
BIJ IX]
 ]@U
 UpV
 Vr<   