prism-clike.js 845 B

12345678910111213141516171819202122232425262728293031
  1. Prism.languages.clike = {
  2. 'comment': [
  3. {
  4. pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
  5. lookbehind: true,
  6. greedy: true
  7. },
  8. {
  9. pattern: /(^|[^\\:])\/\/.*/,
  10. lookbehind: true,
  11. greedy: true
  12. }
  13. ],
  14. 'string': {
  15. pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
  16. greedy: true
  17. },
  18. 'class-name': {
  19. pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
  20. lookbehind: true,
  21. inside: {
  22. 'punctuation': /[.\\]/
  23. }
  24. },
  25. 'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
  26. 'boolean': /\b(?:false|true)\b/,
  27. 'function': /\b\w+(?=\()/,
  28. 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
  29. 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
  30. 'punctuation': /[{}[\];(),.:]/
  31. };