prism-r.js 678 B

12345678910111213141516171819202122
  1. Prism.languages.r = {
  2. 'comment': /#.*/,
  3. 'string': {
  4. pattern: /(['"])(?:\\.|(?!\1)[^\\\r\n])*\1/,
  5. greedy: true
  6. },
  7. 'percent-operator': {
  8. // Includes user-defined operators
  9. // and %%, %*%, %/%, %in%, %o%, %x%
  10. pattern: /%[^%\s]*%/,
  11. alias: 'operator'
  12. },
  13. 'boolean': /\b(?:FALSE|TRUE)\b/,
  14. 'ellipsis': /\.\.(?:\.|\d+)/,
  15. 'number': [
  16. /\b(?:Inf|NaN)\b/,
  17. /(?:\b0x[\dA-Fa-f]+(?:\.\d*)?|\b\d+(?:\.\d*)?|\B\.\d+)(?:[EePp][+-]?\d+)?[iL]?/
  18. ],
  19. 'keyword': /\b(?:NA|NA_character_|NA_complex_|NA_integer_|NA_real_|NULL|break|else|for|function|if|in|next|repeat|while)\b/,
  20. 'operator': /->?>?|<(?:=|<?-)?|[>=!]=?|::?|&&?|\|\|?|[+*\/^$@~]/,
  21. 'punctuation': /[(){}\[\],;]/
  22. };