   }
 ]
 'repository':
-  'comment-double-slash':
-    'match': '//.*$'
-    'name': 'comment.line.double-slash.stan'
-  'comment-number-sign':
-    'match': '#.*$'
-    'name': 'comment.line.number-sign.stan'
-  'comment-block-comment':
-    'begin': '/\\*'
-    'end': '\\*/'
-    'name': 'comment.block.slashes'
-  'string':
-    'begin': '"'
-    'end': '"'
-    'name': 'string.quoted.double.stan'
-    'patterns': [
-      {
-        'match': '(\\p{^ASCII}|\\p{Cntrl}|\\\\)+'
-        'name': 'invalid.illegal.quoted.bad-char.stan'
+  'docblock':
+    'patterns': [
+      {
+        'match': '(?<!\\w)@(param|return)\\b'
+        'name': 'storage.type.class.stan'
+      }
+    ]
+  'comments':
+    'patterns': [
+        {
+          'begin': '/\\*\\*(?!/)'
+          'captures':
+            '0':
+              'name': 'punctuation.definition.comment.stan'
+          'patterns': [
+            {
+              'include': '#docblock'
+            }
+          ]
+          'end': '\\*/'
+          'name': 'comment.block.documentation.stan'
+        }
+      }
+      {
+        'comment': '/* comment block */'
+        'begin': '/\\*'
+        'beginCaptures':
+          '0':
+            'name': 'punctuation.definition.comment.stan'
+        'end': '\\*/'
+        'endCaptures':
+          '0':
+            'name': 'punctuation.definition.comment.stan'
+        'name': 'comment.block.stan'
+      }
+      {
+        'comment': '// comment'
+        'begin': '//'
+        'beginCaptures':
+          '0':
+            'name': 'punctuation.definition.comment.stan'
+        'end': '\\n'
+        'name': 'comment.line.double-slash.stan'
+      }
+      {
+        'comment': '# comment'
+        'begin': '#'
+        'beginCaptures':
+          '0':
+            'name': 'punctuation.definition.comment.stan'
+        'end': '\\n'
+        'name': 'comment.line.number-sign.stan'
       }
     ]
   'semicolon':
     'match': ';'
     'name': 'punctuation.separator.stan'
+
   'assignment':
     'match': '<-'
     'name': 'keyword.operator.assignment.stan'

      )\\b
    '
    'name': 'constant.numeric.real.stan'
  'operators':
    'patterns': [
      {

  'block-declaration':
    'match': '\\b(functions|data|transformed\\s+data|parameters|transformed\\s+parameters|model|generated\\s+quantities)\\b'
    'name': 'entity.name.type.stan'

  'type':
    'match': '\\b(int|real|vector|simplex|ordered|positive_ordered|row_vector|matrix|corr_matrix|cov_matrix|cholesky_factor_cov|cholesky_factor_corr|void)\\b'
    'name': 'storage.type.stan'

  'keywords-control-flow':
    'match': '\\b(for|in|while|if|else)\\b'
    'name': 'keyword.control.stan'

  'keywords-range-constraints':
    'match': '\\b(lower|upper)\\b'
    'name': 'keyword.other.range.stan'

  'keywords-special-functions':
    'match': '\\b(print|increment_log_prob|reject|integrate_ode)\\b'
    'name': 'keyword.other.special-functions.stan'

  'keywords-other':
    'match': '\\b(return)\\b'
    'name': 'keyword.other.other.stan'

  'truncation-operator':
    'match': '\\bT(?=\\s*\[)'
    'name': 'keyword.other.truncation.stan'

  'reserved-cpp':
    'match': '\\b(alignas|alignof|and|and_eq|asm|auto|bitand|bitor|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|false|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|noexcept|not|not_eq|nullptr|operator|or|or_eq|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|true|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while|xor|xor_eq)\\b'
    'name': 'invalid.illegal.reserved.stan'
    'comment': 'reserved words in C++ that are invalid in Stan'

  'reserved-stan':
    'match': '\\b(for|in|while|repeat|until|if|then|else|true|false|var|fvar|STAN_MAJOR|STAN_MINOR|STAN_PATCH|STAN_MATH_MAJOR|STAN_MATH_MINOR|STAN_MATH_PATCH)\\b'
    'name': 'invalid.illegal.reserved.stan'
    'comment': 'Words reserved for internal Stan use'

  'lp':
    'match': '\\blp__\\b'
    'name': 'invalid.deprecated.lp.stan'

  'functions':
    'match': '\\b(Phi|Phi_approx|abs|acos|acosh|append_col|append_row|asin|asinh|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|csr_extract_u|csr_extract_v|csr_extract_w|csr_matrix_times_vector|csr_to_dense_matrix|cumulative_sum|determinant|diag_matrix|diag_post_multiply|diag_pre_multiply|diagonal|digamma|dims|dirichlet_log|dirichlet_rng|distance|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|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|frechet_ccdf_log|frechet_cdf|frechet_cdf_log|frechet_log|frechet_rng|gamma_ccdf_log|gamma_cdf|gamma_cdf_log|gamma_log|gamma_p|gamma_q|gamma_rng|gaussian_dlm_obs_log|get_lp|gumbel_ccdf_log|gumbel_cdf|gumbel_cdf_log|gumbel_log|gumbel_rng|head|hypergeometric_log|hypergeometric_rng|hypot|if_else|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_phi|inv_sqrt|inv_square|inv_wishart_log|inv_wishart_rng|inverse|inverse_spd|is_inf|is_nan|lbeta|lgamma|lkj_corr_cholesky_log|lkj_corr_cholesky_rng|lkj_corr_log|lkj_corr_rng|lmgamma|log|log10|log1m|log1m_exp|log1m_inv_logit|log1p|log1p_exp|log2|log_determinant|log_diff_exp|log_falling_factorial|log_inv_logit|log_mix|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_gp_cholesky_log|multi_gp_log|multi_normal_cholesky_log|multi_normal_cholesky_rng|multi_normal_log|multi_normal_prec_log|multi_normal_rng|multi_student_t_log|multi_student_t_rng|multinomial_log|multinomial_rng|multiply_log|multiply_lower_tri_self_transpose|neg_binomial_2_ccdf_log|neg_binomial_2_cdf|neg_binomial_2_cdf_log|neg_binomial_2_log|neg_binomial_2_log_log|neg_binomial_2_log_rng|neg_binomial_2_rng|neg_binomial_ccdf_log|neg_binomial_cdf|neg_binomial_cdf_log|neg_binomial_log|neg_binomial_rng|negative_infinity|normal_ccdf_log|normal_cdf|normal_cdf_log|normal_log|normal_rng|not_a_number|num_elements|ordered_logistic_log|ordered_logistic_rng|owens_t|pareto_ccdf_log|pareto_cdf|pareto_cdf_log|pareto_log|pareto_rng|pareto_type_2_ccdf_log|pareto_type_2_cdf|pareto_type_2_cdf_log|pareto_type_2_log|pareto_type_2_rng|pi|poisson_ccdf_log|poisson_cdf|poisson_cdf_log|poisson_log|poisson_log_log|poisson_log_rng|poisson_rng|positive_infinity|pow|prod|qr_Q|qr_R|quad_form|quad_form_diag|quad_form_sym|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|sort_indices_asc|sort_indices_desc|sqrt|sqrt2|square|squared_distance|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_array_1d|to_array_2d|to_matrix|to_row_vector|to_vector|trace|trace_gen_quad_form|trace_quad_form|trigamma|trunc|uniform_ccdf_log|uniform_cdf|uniform_cdf_log|uniform_log|uniform_rng|variance|von_mises_log|von_mises_rng|weibull_ccdf_log|weibull_cdf|weibull_cdf_log|weibull_log|weibull_rng|wiener_log|wishart_log|wishart_rng)\\b'
    'name': 'support.function.function.stan'

  'distributions':
    'match': '(~)\\s*(bernoulli|bernoulli_logit|beta|beta_binomial|binomial|binomial_logit|categorical|categorical_logit|cauchy|chi_square|dirichlet|double_exponential|exp_mod_normal|exponential|frechet|gamma|gaussian_dlm_obs|gumbel|hypergeometric|inv_chi_square|inv_gamma|inv_wishart|lkj_corr|lkj_corr_cholesky|logistic|lognormal|multi_gp|multi_gp_cholesky|multi_normal|multi_normal_cholesky|multi_normal_prec|multi_student_t|multinomial|neg_binomial|neg_binomial_2|neg_binomial_2_log|normal|ordered_logistic|pareto|pareto_type_2|poisson|poisson_log|rayleigh|scaled_inv_chi_square|skew_normal|student_t|uniform|von_mises|weibull|wiener|wishart)\\b'
    'captures':
