prism-json.js 592 B

123456789101112131415161718192021222324252627
  1. // https://www.json.org/json-en.html
  2. Prism.languages.json = {
  3. 'property': {
  4. pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
  5. lookbehind: true,
  6. greedy: true
  7. },
  8. 'string': {
  9. pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
  10. lookbehind: true,
  11. greedy: true
  12. },
  13. 'comment': {
  14. pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
  15. greedy: true
  16. },
  17. 'number': /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
  18. 'punctuation': /[{}[\],]/,
  19. 'operator': /:/,
  20. 'boolean': /\b(?:false|true)\b/,
  21. 'null': {
  22. pattern: /\bnull\b/,
  23. alias: 'keyword'
  24. }
  25. };
  26. Prism.languages.webmanifest = Prism.languages.json;