summaryrefslogtreecommitdiffstats
path: root/public/prism/prism-r.js
blob: b794fa93d8203198e3a431669f45c80416f78dfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Prism.languages.r = {
  comment: /#.*/,
  string: {
    pattern: /(['"])(?:\\.|(?!\1)[^\\\r\n])*\1/,
    greedy: true,
  },
  'percent-operator': {
    // Includes user-defined operators
    // and %%, %*%, %/%, %in%, %o%, %x%
    pattern: /%[^%\s]*%/,
    alias: 'operator',
  },
  boolean: /\b(?:FALSE|TRUE)\b/,
  ellipsis: /\.\.(?:\.|\d+)/,
  number: [
    /\b(?:Inf|NaN)\b/,
    /(?:\b0x[\dA-Fa-f]+(?:\.\d*)?|\b\d+(?:\.\d*)?|\B\.\d+)(?:[EePp][+-]?\d+)?[iL]?/,
  ],
  keyword:
    /\b(?:NA|NA_character_|NA_complex_|NA_integer_|NA_real_|NULL|break|else|for|function|if|in|next|repeat|while)\b/,
  operator: /->?>?|<(?:=|<?-)?|[>=!]=?|::?|&&?|\|\|?|[+*\/^$@~]/,
  punctuation: /[(){}\[\],;]/,
};
class="o">: [ { pattern: /(\|\s*)\w+/, lookbehind: !0, alias: 'filter' }, { pattern: /(\.\s*)(?:first|last|size)/, lookbehind: !0 }, ], boolean: /\b(?:false|nil|true)\b/, range: { pattern: /\.\./, alias: 'operator' }, number: /\b\d+(?:\.\d+)?\b/, operator: /[!=]=|<>|[<>]=?|[|?:=-]|\b(?:and|contains(?=\s)|or)\b/, punctuation: /[.,\[\]()]/, empty: { pattern: /\bempty\b/, alias: 'keyword' }, }), Prism.hooks.add('before-tokenize', function (e) { var i = !1; Prism.languages['markup-templating'].buildPlaceholders( e, 'liquid', /\{%\s*comment\s*%\}[\s\S]*?\{%\s*endcomment\s*%\}|\{(?:%[\s\S]*?%|\{\{[\s\S]*?\}\}|\{[\s\S]*?\})\}/g, function (e) { var t = /^\{%-?\s*(\w+)/.exec(e); if (t) { var n = t[1]; if ('raw' === n && !i) return (i = !0); if ('endraw' === n) return !(i = !1); } return !i; } ); }), Prism.hooks.add('after-tokenize', function (e) { Prism.languages['markup-templating'].tokenizePlaceholders(e, 'liquid'); });