prism-r.js 614 B

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