prism-r.js 673 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(?:TRUE|FALSE)\b/,
  14. 'ellipsis': /\.\.(?:\.|\d+)/,
  15. 'number': [
  16. /\b(?:NaN|Inf)\b/,
  17. /(?:\b0x[\dA-Fa-f]+(?:\.\d*)?|\b\d+\.?\d*|\B\.\d+)(?:[EePp][+-]?\d+)?[iL]?/
  18. ],
  19. 'keyword': /\b(?:if|else|repeat|while|function|for|in|next|break|NULL|NA|NA_integer_|NA_real_|NA_complex_|NA_character_)\b/,
  20. 'operator': /->?>?|<(?:=|<?-)?|[>=!]=?|::?|&&?|\|\|?|[+*\/^$@~]/,
  21. 'punctuation': /[(){}\[\],;]/
  22. };