1 |
|
2 |
|
3 | Prism.languages.stan = {
|
4 | 'comment': /\/\/.*|\/\*[\s\S]*?\*\/|#(?!include).*/,
|
5 | 'string': {
|
6 |
|
7 |
|
8 | pattern: /"[\x20\x21\x23-\x5B\x5D-\x7E]*"/,
|
9 | greedy: true
|
10 | },
|
11 | 'directive': {
|
12 | pattern: /^([ \t]*)#include\b.*/m,
|
13 | lookbehind: true,
|
14 | alias: 'property'
|
15 | },
|
16 |
|
17 | 'function-arg': {
|
18 | pattern: /(\b(?:algebra_solver|integrate_1d|integrate_ode|integrate_ode_bdf|integrate_ode_rk45|map_rect)\s*\(\s*)[a-zA-Z]\w*/,
|
19 | lookbehind: true,
|
20 | alias: 'function'
|
21 | },
|
22 | 'constraint': {
|
23 | pattern: /(\b(?:int|matrix|real|row_vector|vector)\s*)<[^<>]*>/,
|
24 | lookbehind: true,
|
25 | inside: {
|
26 | 'expression': {
|
27 | pattern: /(=\s*)(?:(?!\s*(?:>$|,\s*\w+\s*=))[\s\S])+/,
|
28 | lookbehind: true,
|
29 | inside: null
|
30 | },
|
31 | 'property': /\b[a-z]\w*(?=\s*=)/i,
|
32 | 'operator': /=/,
|
33 | 'punctuation': /^<|>$|[,]/
|
34 | }
|
35 | },
|
36 | 'keyword': [
|
37 | /\b(?:break|cholesky_factor_corr|cholesky_factor_cov|continue|corr_matrix|cov_matrix|data|else|for|functions|generated|if|in|increment_log_prob|int|matrix|model|ordered|parameters|positive_ordered|print|quantities|real|reject|return|row_vector|simplex|target|transformed|unit_vector|vector|void|while)\b/,
|
38 |
|
39 | /\b(?:algebra_solver|integrate_1d|integrate_ode|integrate_ode_bdf|integrate_ode_rk45|map_rect)\b/
|
40 | ],
|
41 | 'function': /\b[a-z]\w*(?=\s*\()/i,
|
42 | 'number': /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?\b/i,
|
43 | 'boolean': /\b(?:false|true)\b/,
|
44 |
|
45 | 'operator': /<-|\.[*/]=?|\|\|?|&&|[!=<>+\-*/]=?|['^%~?:]/,
|
46 | 'punctuation': /[()\[\]{},;]/
|
47 | };
|
48 |
|
49 | Prism.languages.stan.constraint.inside.expression.inside = Prism.languages.stan;
|