prism-clike.js 835 B

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