3

V'ícÔ4ã@s¼dZddlZddlmZmZmZmZmZddlm	Z	m
Z
mZmZm
Z
mZmZmZmZddlmZddlmZddd	d
gZGdd„deƒZGdd„deƒZGd
d	„d	eƒZGdd
„d
eƒZdS)zÓ
    pygments.lexers.modeling
    ~~~~~~~~~~~~~~~~~~~~~~~~

    Lexers for modeling languages.

    :copyright: Copyright 2006-2022 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(eZdZdZdZdZdgZdgZdgZe	j
e	jBZdZ
defd	ejfd
ejfgedƒdejd
fdefdefdejfdejfdejfdejfdejfdejdfdejfdejdfe
efg
edƒdejfdejdfe
ej dfe!dƒgedƒe
ej"dfe!dƒgdejdfdej#fde$e%ƒfdejfgd œZ&d!S)"rz>
    For Modelica source code.

    .. versionadded:: 1.1
    ZModelicazhttp://www.modelica.org/Zmodelicaz*.moztext/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)\bzwithin\bzpackage-prefixz(function|record)\bz(if|for|when|while)\bz#popz\\[\'"?\\abfnrtv]z6(?i)<\s*html\s*>([^\\"]|\\.)+?(<\s*/\s*html\s*>|(?="))z
<|\\?[^"\\<]+)rÚrootrzpackage-prefixrN)'Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚnameÚurlÚaliasesÚ	filenamesÚ	mimetypesÚreÚDOTALLÚ	MULTILINEÚflagsÚ_namerrÚSingleÚ	MultilinerrÚDoublerr	r
ÚFloatÚIntegerrÚBuiltinr
ÚReservedÚWordÚConstantZClassrÚ	NamespaceZEscaperrÚtokens©r4r4ú</tmp/pip-build-gk9425m9/Pygments/pygments/lexers/modeling.pyrsP







c>@s¬eZdZdZdZdddgZdgZdtZduZdbe	fgdce
jfgeddƒedeƒdfe
eje	eƒfdgejfdhdijeeƒejfdjefdkefdlefdmefdnefdoefgdpœZdqdr„ZdsS)vrzX
    Pygments Lexer for OpenBugs and WinBugs
    models.

    .. versionadded:: 1.6
    ZBUGSZbugsZwinbugsZopenbugsz*.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Úphiúpost.p.valueÚpowú
prior.p.valueÚprobitúreplicate.postúreplicate.priorÚroundÚsinÚsinhÚsolutionÚsqrtÚstepÚtanÚtanhÚtruncÚinprodú
interp.linÚinverseÚlogdetÚmeanú
eigen.valsÚodeÚprodúp.valueMÚrankÚrankedú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Údwishz\s+z#.*$Úcommentsrz(model)(\s+)(\{)z(for|in)(?![\w.])z
(%s)(?=\s*\()ú|z[A-Za-z][\w.]*z&[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?z\[|\]|\(|\)|:|,|;z<-|~z	\+|-|\*|/z[{}])rr‘rcCstjd|tjƒrdSdSdS)Nz
^\s*model\s*{gffffffæ?g)r$ÚsearchÚM)Útextr4r4r5Úanalyse_text¼szBugsLexer.analyse_textN)>r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrs)rtrurvrwrxryrzr{r|r}r~rr€rr‚rƒr„r…r†r‡rˆr‰rŠr‹rŒrrŽrr)rrrrrr!r"Ú
_FUNCTIONSÚ_DISTRIBUTIONSrrr)rrr
r2rr/Újoinrr.r
r	r3r–r4r4r4r5rcsL
	
c2@sØeZdZdZdZdgZddgZdpZed8d9„dqDƒƒZ	drZ
d[efgd\efgd]e
jfd^e
jfged_ƒed`ƒdaeejeeƒfdbejfdcejfdddejee	e
ƒejfedfƒdgefdhefdiefdjefdkefgdlœZdmdn„ZdoS)srz=
    Pygments Lexer for JAGS.

    .. versionadded:: 1.6
    ZJAGSZjagsz*.jagz*.bugr6r7r8r9r:r;r<r>r?r=rDÚexprHÚifelserGrJrKrLrMrPrRrTrWrXrYr[r\r]r^r_r`ú
interp.linrcrNrdrOrgrnrlrbrirmÚtÚacosÚacoshÚasinÚasinhÚatanrrrpccs|]}d|VqdS)z[dpq]%sNr4)Ú.0Úxr4r4r5ú	<genexpr>ÚszJagsLexer.<genexpr>ÚbernÚbetaÚdchiqsqrr|r}rÚgammaú	gen.gammaÚlogisÚlnormÚnegbinÚnchisqrÚnormÚparÚpoisÚweibr‰rŠÚdbetabinrtrurvryrrŽrrrŒÚdbinomÚdchisqÚdnbinomÚdweibullÚddirichz\s+z[a-zA-Z][\w.]*\bz
(?s)/\*.*?\*/z#.*$r‘rz(model|data)(\s+)(\{)zvar(?![\w.])z(for|in)(?![\w.])z
(%s)(?=\s*\()r’Únamesz&[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?z\[|\]|\(|\)|:|,|;z<-|~z&\+|-|\*|\/|\|\|[&]{2}|[<>=]=?|\^|%.*?%z[{}])rr¹r‘rcCsFtjd|tjƒr>tjd|tjƒr$dStjd|tjƒr8dSdSndSdS)Nz^\s*model\s*\{z
^\s*data\s*\{gÍÌÌÌÌÌì?z^\s*varg333333Ó?r)r$r“r”)r•r4r4r5r–szJagsLexer.analyse_textN)2r6r7r8r9r:r;r<r>r?r=rDršrHr›rGrJrKrLrMrPrRrTrWrXrYr[r\r]r^r_r`rœrcrNrdrOrgrnrlrbrirmrržrŸr r¡r¢rrrp)r¦r§r¨r|r}rr©rªr«r¬r­r®r¯r°r±r²)r‰rŠr³rtrurvryrrŽrrrŒr´rµr¶r·r¸)rrrrrr!r"r—Útupler˜Z_OTHER_DISTRIBUTIONSrrrr*r)rrr
r2rZDeclarationr/r™r.r
r	r3r–r4r4r4r5rÃsN

c@sveZdZdZdZdgZdgZdefgdej	fdej
fgdefed	ƒed
ƒddj
d-ƒeejeeƒfdefddj
ejƒefdefddj
ejƒejfdeeeeeeƒfdeeeeeeƒfdefddj
ejƒejfddj
ejƒeeeejƒfdejjfddj
ejƒejfdejfde j!fde j!fd e j!fd!e j!fd"e j!fd#e j"fd$efd%efd&efd'efd(efgd)œZ#d*d+„Z$d,S).ra 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
    ZStanZstanz*.stanz\s+z
(?s)/\*.*?\*/z	(//|#).*$z"[^"]*"r‘rz
(%s)(\s*)(\{)r’Ú	functionsÚdataútransformed\s+?dataÚ
parametersútransformed\s+parametersÚmodelúgenerated\s+quantitiesztarget\s*\+=z(%s)\bz
T(?=\s*\[)z/(<)(\s*)(upper|lower|offset|multiplier)(\s*)(=)z(,)(\s*)(upper)(\s*)(=)z
[;,\[\]()]z
(%s)(?=\s*\()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;\+|-|\.?\*|\.?/|\\|'|\.?\^|!=?|<=?|>=?|\|\||&&|%|\?|:|%/%|!z[{}]z\|)rr‘rcCstjd|tjƒrdSdSdS)Nz^\s*parameters\s*\{gð?g)r$r“r”)r•r4r4r5r–mszStanLexer.analyse_textN)r»r¼r½r¾r¿rÀrÁ)%rrrrrr!r"rrr*r)rrr™rr
r2rrZKEYWORDSÚTYPESÚTyper	rZ	FUNCTIONSrr.Z
DISTRIBUTIONSZPseudoZRESERVEDr/ZFunctionr
r,r-r3r–r4r4r4r5rsT

)rr$Zpygments.lexerrrrrrZpygments.tokenrrr	r
rrr
rrZpygments.lexers.htmlrZpygments.lexersrÚ__all__rrrrr4r4r4r5Ú<module>	s,L`X