3 pygments.lexers.modeling |
3 pygments.lexers.modeling |
4 ~~~~~~~~~~~~~~~~~~~~~~~~ |
4 ~~~~~~~~~~~~~~~~~~~~~~~~ |
5 |
5 |
6 Lexers for modeling languages. |
6 Lexers for modeling languages. |
7 |
7 |
8 :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. |
8 :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. |
9 :license: BSD, see LICENSE for details. |
9 :license: BSD, see LICENSE for details. |
10 """ |
10 """ |
11 |
11 |
12 import re |
12 import re |
13 |
13 |
282 |
282 |
283 class StanLexer(RegexLexer): |
283 class StanLexer(RegexLexer): |
284 """Pygments Lexer for Stan models. |
284 """Pygments Lexer for Stan models. |
285 |
285 |
286 The Stan modeling language is specified in the *Stan Modeling Language |
286 The Stan modeling language is specified in the *Stan Modeling Language |
287 User's Guide and Reference Manual, v2.4.0*, |
287 User's Guide and Reference Manual, v2.8.0*, |
288 `pdf <https://github.com/stan-dev/stan/releases/download/v2.4.0/stan-reference-2.4.0.pdf>`__. |
288 `pdf <https://github.com/stan-dev/stan/releases/download/v2.8.8/stan-reference-2.8.0.pdf>`__. |
289 |
289 |
290 .. versionadded:: 1.6 |
290 .. versionadded:: 1.6 |
291 """ |
291 """ |
292 |
292 |
293 name = 'Stan' |
293 name = 'Stan' |
330 + _stan_builtins.DISTRIBUTIONS), |
330 + _stan_builtins.DISTRIBUTIONS), |
331 Name.Builtin), |
331 Name.Builtin), |
332 # Special names ending in __, like lp__ |
332 # Special names ending in __, like lp__ |
333 (r'[A-Za-z]\w*__\b', Name.Builtin.Pseudo), |
333 (r'[A-Za-z]\w*__\b', Name.Builtin.Pseudo), |
334 (r'(%s)\b' % r'|'.join(_stan_builtins.RESERVED), Keyword.Reserved), |
334 (r'(%s)\b' % r'|'.join(_stan_builtins.RESERVED), Keyword.Reserved), |
|
335 # user-defined functions |
|
336 (r'[A-Za-z]\w*(?=\s*\()]', Name.Function), |
335 # Regular variable names |
337 # Regular variable names |
336 (r'[A-Za-z]\w*\b', Name), |
338 (r'[A-Za-z]\w*\b', Name), |
337 # Real Literals |
339 # Real Literals |
338 (r'-?[0-9]+(\.[0-9]+)?[eE]-?[0-9]+', Number.Float), |
340 (r'-?[0-9]+(\.[0-9]+)?[eE]-?[0-9]+', Number.Float), |
339 (r'-?[0-9]*\.[0-9]*', Number.Float), |
341 (r'-?[0-9]*\.[0-9]*', Number.Float), |