prism-turtle.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. Prism.languages.turtle = {
  2. 'comment': {
  3. pattern: /#.*/,
  4. greedy: true
  5. },
  6. 'multiline-string': {
  7. pattern: /"""(?:(?:""?)?(?:[^"\\]|\\.))*"""|'''(?:(?:''?)?(?:[^'\\]|\\.))*'''/,
  8. greedy: true,
  9. alias: 'string',
  10. inside: {
  11. 'comment': /#.*/
  12. }
  13. },
  14. 'string': {
  15. pattern: /"(?:[^\\"\r\n]|\\.)*"|'(?:[^\\'\r\n]|\\.)*'/,
  16. greedy: true
  17. },
  18. 'url': {
  19. pattern: /<(?:[^\x00-\x20<>"{}|^`\\]|\\(?:u[\da-fA-F]{4}|U[\da-fA-F]{8}))*>/,
  20. greedy: true,
  21. inside: {
  22. 'punctuation': /[<>]/
  23. }
  24. },
  25. 'function': {
  26. pattern: /(?:(?![-.\d\xB7])[-.\w\xB7\xC0-\uFFFD]+)?:(?:(?![-.])(?:[-.:\w\xC0-\uFFFD]|%[\da-f]{2}|\\.)+)?/i,
  27. inside: {
  28. 'local-name': {
  29. pattern: /([^:]*:)[\s\S]+/,
  30. lookbehind: true
  31. },
  32. 'prefix': {
  33. pattern: /[\s\S]+/,
  34. inside: {
  35. 'punctuation': /:/
  36. }
  37. }
  38. }
  39. },
  40. 'number': /[+-]?\b\d+(?:\.\d*)?(?:e[+-]?\d+)?/i,
  41. 'punctuation': /[{}.,;()[\]]|\^\^/,
  42. 'boolean': /\b(?:false|true)\b/,
  43. 'keyword': [
  44. /(?:\ba|@prefix|@base)\b|=/,
  45. /\b(?:base|graph|prefix)\b/i
  46. ],
  47. 'tag': {
  48. pattern: /@[a-z]+(?:-[a-z\d]+)*/i,
  49. inside: {
  50. 'punctuation': /@/
  51. }
  52. }
  53. };
  54. Prism.languages.trig = Prism.languages['turtle'];