summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey B. Arnold <jeffrey.arnold@gmail.com>2013-11-24 20:18:02 -0500
committerJeffrey B. Arnold <jeffrey.arnold@gmail.com>2013-11-24 20:18:02 -0500
commit6dff857474123310c8a49e21778ff284c6234244 (patch)
treedeb1c3a577b0cbb36ce7e8848c2b6cd8c840d6d2
parent0e187dc6d5b3735c7fe82d79e6c2ceebeebc2d55 (diff)
downloadpygments-6dff857474123310c8a49e21778ff284c6234244.tar.gz
updated StanLexer to Stan version 2.0.1 language.
-rw-r--r--pygments/lexers/_stan_builtins.py111
-rw-r--r--pygments/lexers/math.py4
-rw-r--r--tests/examplefiles/example.stan2
3 files changed, 106 insertions, 11 deletions
diff --git a/pygments/lexers/_stan_builtins.py b/pygments/lexers/_stan_builtins.py
index 637072e4..1cea6ba4 100644
--- a/pygments/lexers/_stan_builtins.py
+++ b/pygments/lexers/_stan_builtins.py
@@ -10,9 +10,10 @@ This file contains the names of functions for Stan used by
:license: BSD, see LICENSE for details.
"""
-KEYWORDS = ['else', 'for', 'if', 'in', 'lower', 'lp__', 'print', 'upper', 'while']
+KEYWORDS = ['else', 'for', 'if', 'in', 'lp__', 'print', 'while']
-TYPES = [ 'corr_matrix',
+TYPES = [ 'cholesky_factor_cov',
+ 'corr_matrix',
'cov_matrix',
'int',
'matrix',
@@ -34,35 +35,53 @@ FUNCTIONS = [ 'Phi',
'atan',
'atan2',
'atanh',
+ 'bernoulli_ccdf_log',
'bernoulli_cdf',
+ 'bernoulli_cdf_log',
'bernoulli_log',
'bernoulli_logit_log',
'bernoulli_rng',
+ 'bessel_first_kind',
+ 'bessel_second_kind',
+ 'beta_binomial_ccdf_log',
'beta_binomial_cdf',
+ 'beta_binomial_cdf_log',
'beta_binomial_log',
'beta_binomial_rng',
+ 'beta_ccdf_log',
'beta_cdf',
+ 'beta_cdf_log',
'beta_log',
'beta_rng',
'binary_log_loss',
+ 'binomial_ccdf_log',
'binomial_cdf',
+ 'binomial_cdf_log',
'binomial_coefficient_log',
'binomial_log',
'binomial_logit_log',
'binomial_rng',
'block',
'categorical_log',
+ 'categorical_logit_log',
'categorical_rng',
+ 'cauchy_ccdf_log',
'cauchy_cdf',
+ 'cauchy_cdf_log',
'cauchy_log',
'cauchy_rng',
'cbrt',
'ceil',
+ 'chi_square_ccdf_log',
+ 'chi_square_cdf',
+ 'chi_square_cdf_log',
'chi_square_log',
'chi_square_rng',
'cholesky_decompose',
'col',
'cols',
+ 'columns_dot_product',
+ 'columns_dot_self',
'cos',
'cosh',
'crossprod',
@@ -77,55 +96,78 @@ FUNCTIONS = [ 'Phi',
'dirichlet_rng',
'dot_product',
'dot_self',
+ 'double_exponential_ccdf_log',
+ 'double_exponential_cdf',
+ 'double_exponential_cdf_log',
'double_exponential_log',
'double_exponential_rng',
'e',
'eigenvalues_sym',
'eigenvectors_sym',
- 'epsilon',
'erf',
'erfc',
'exp',
'exp2',
+ 'exp_mod_normal_ccdf_log',
'exp_mod_normal_cdf',
+ 'exp_mod_normal_cdf_log',
'exp_mod_normal_log',
'exp_mod_normal_rng',
'expm1',
+ 'exponential_ccdf_log',
'exponential_cdf',
+ 'exponential_cdf_log',
'exponential_log',
'exponential_rng',
'fabs',
+ 'falling_factorial',
'fdim',
'floor',
'fma',
'fmax',
'fmin',
'fmod',
+ 'gamma_ccdf_log',
+ 'gamma_cdf',
+ 'gamma_cdf_log',
'gamma_log',
+ 'gamma_p',
+ 'gamma_q',
'gamma_rng',
+ 'gaussian_dlm_obs_log',
+ 'gumbel_ccdf_log',
'gumbel_cdf',
+ 'gumbel_cdf_log',
'gumbel_log',
'gumbel_rng',
+ 'head',
'hypergeometric_log',
'hypergeometric_rng',
'hypot',
'if_else',
+ 'increment_log_prob',
'int_step',
+ 'inv',
+ 'inv_chi_square_ccdf_log',
'inv_chi_square_cdf',
+ 'inv_chi_square_cdf_log',
'inv_chi_square_log',
'inv_chi_square_rng',
'inv_cloglog',
+ 'inv_gamma_ccdf_log',
'inv_gamma_cdf',
+ 'inv_gamma_cdf_log',
'inv_gamma_log',
'inv_gamma_rng',
'inv_logit',
+ 'inv_sqrt',
+ 'inv_square',
'inv_wishart_log',
'inv_wishart_rng',
'inverse',
+ 'inverse_spd',
'lbeta',
'lgamma',
- 'lkj_corr_cholesky_log',
- 'lkj_corr_cholesky_rng',
'lkj_corr_log',
'lkj_corr_rng',
'lkj_cov_log',
@@ -133,96 +175,145 @@ FUNCTIONS = [ 'Phi',
'log',
'log10',
'log1m',
+ 'log1m_exp',
'log1m_inv_logit',
'log1p',
'log1p_exp',
'log2',
'log_determinant',
+ 'log_diff_exp',
+ 'log_falling_factorial',
'log_inv_logit',
+ 'log_rising_factorial',
+ 'log_softmax',
'log_sum_exp',
+ 'logistic_ccdf_log',
'logistic_cdf',
+ 'logistic_cdf_log',
'logistic_log',
'logistic_rng',
'logit',
+ 'lognormal_ccdf_log',
'lognormal_cdf',
+ 'lognormal_cdf_log',
'lognormal_log',
'lognormal_rng',
+ 'machine_precision',
'max',
'mdivide_left_tri_low',
'mdivide_right_tri_low',
'mean',
'min',
+ 'modified_bessel_first_kind',
+ 'modified_bessel_second_kind',
'multi_normal_cholesky_log',
'multi_normal_log',
'multi_normal_prec_log',
'multi_normal_rng',
'multi_student_t_log',
'multi_student_t_rng',
- 'multinomial_cdf',
'multinomial_log',
'multinomial_rng',
'multiply_log',
'multiply_lower_tri_self_transpose',
+ 'neg_binomial_ccdf_log',
'neg_binomial_cdf',
+ 'neg_binomial_cdf_log',
'neg_binomial_log',
'neg_binomial_rng',
- 'negative_epsilon',
'negative_infinity',
+ 'normal_ccdf_log',
'normal_cdf',
+ 'normal_cdf_log',
'normal_log',
'normal_rng',
'not_a_number',
'ordered_logistic_log',
'ordered_logistic_rng',
'owens_t',
+ 'pareto_ccdf_log',
'pareto_cdf',
+ 'pareto_cdf_log',
'pareto_log',
'pareto_rng',
'pi',
+ 'poisson_ccdf_log',
'poisson_cdf',
+ 'poisson_cdf_log',
'poisson_log',
'poisson_log_log',
'poisson_rng',
'positive_infinity',
'pow',
'prod',
+ 'quad_form',
+ 'rank',
+ 'rayleigh_ccdf_log',
+ 'rayleigh_cdf',
+ 'rayleigh_cdf_log',
+ 'rayleigh_log',
+ 'rayleigh_rng',
'rep_array',
'rep_matrix',
'rep_row_vector',
'rep_vector',
+ 'rising_factorial',
'round',
'row',
'rows',
+ 'rows_dot_product',
+ 'rows_dot_self',
+ 'scaled_inv_chi_square_ccdf_log',
'scaled_inv_chi_square_cdf',
+ 'scaled_inv_chi_square_cdf_log',
'scaled_inv_chi_square_log',
'scaled_inv_chi_square_rng',
'sd',
+ 'segment',
'sin',
'singular_values',
'sinh',
'size',
+ 'skew_normal_ccdf_log',
'skew_normal_cdf',
+ 'skew_normal_cdf_log',
'skew_normal_log',
'skew_normal_rng',
'softmax',
+ 'sort_asc',
+ 'sort_desc',
'sqrt',
'sqrt2',
'square',
'step',
+ 'student_t_ccdf_log',
'student_t_cdf',
+ 'student_t_cdf_log',
'student_t_log',
'student_t_rng',
+ 'sub_col',
+ 'sub_row',
'sum',
+ 'tail',
'tan',
'tanh',
'tcrossprod',
'tgamma',
+ 'to_vector',
'trace',
+ 'trace_gen_quad_form',
+ 'trace_quad_form',
'trunc',
+ 'uniform_ccdf_log',
+ 'uniform_cdf',
+ 'uniform_cdf_log',
'uniform_log',
'uniform_rng',
'variance',
+ 'von_mises_log',
+ 'weibull_ccdf_log',
'weibull_cdf',
+ 'weibull_cdf_log',
'weibull_log',
'weibull_rng',
'wishart_log',
@@ -236,6 +327,7 @@ DISTRIBUTIONS = [ 'bernoulli',
'binomial_coefficient',
'binomial_logit',
'categorical',
+ 'categorical_logit',
'cauchy',
'chi_square',
'dirichlet',
@@ -243,13 +335,13 @@ DISTRIBUTIONS = [ 'bernoulli',
'exp_mod_normal',
'exponential',
'gamma',
+ 'gaussian_dlm_obs',
'gumbel',
'hypergeometric',
'inv_chi_square',
'inv_gamma',
'inv_wishart',
'lkj_corr',
- 'lkj_corr_cholesky',
'lkj_cov',
'logistic',
'lognormal',
@@ -265,10 +357,12 @@ DISTRIBUTIONS = [ 'bernoulli',
'pareto',
'poisson',
'poisson_log',
+ 'rayleigh',
'scaled_inv_chi_square',
'skew_normal',
'student_t',
'uniform',
+ 'von_mises',
'weibull',
'wishart']
@@ -357,4 +451,3 @@ RESERVED = [ 'alignas',
'wchar_t',
'xor',
'xor_eq']
-
diff --git a/pygments/lexers/math.py b/pygments/lexers/math.py
index f0e49fef..cbdacb4d 100644
--- a/pygments/lexers/math.py
+++ b/pygments/lexers/math.py
@@ -1308,9 +1308,9 @@ class JagsLexer(RegexLexer):
class StanLexer(RegexLexer):
"""Pygments Lexer for Stan models.
- The Stan modeling language is specified in the *Stan 1.3.0
+ The Stan modeling language is specified in the *Stan 2.0.1
Modeling Language Manual* `pdf
- <http://code.google.com/p/stan/downloads/detail?name=stan-reference-1.3.0.pdf>`_.
+ <https://github.com/stan-dev/stan/releases/download/v2.0.1/stan-reference-2.0.1.pdf>`__
*New in Pygments 1.6.*
"""
diff --git a/tests/examplefiles/example.stan b/tests/examplefiles/example.stan
index e936f54a..7eb6fdfc 100644
--- a/tests/examplefiles/example.stan
+++ b/tests/examplefiles/example.stan
@@ -19,6 +19,7 @@ data {
positive_ordered[3] wibble;
corr_matrix[3] grault;
cov_matrix[3] garply;
+ cholesky_factor_cov[3] waldo;
real<lower=-1,upper=1> foo1;
real<lower=0> foo2;
@@ -94,6 +95,7 @@ model {
// lp__ should be highlighted
// normal_log as a function
lp__ <- lp__ + normal_log(plugh, 0, 1);
+ increment_log_prob(normal_log(plugh, 0, 1));
// print statement and string literal
print("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_~@#$%^&*`'-+={}[].,;: ");