prism-dataweave.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. (function (Prism) {
  2. Prism.languages.dataweave = {
  3. 'url': /\b[A-Za-z]+:\/\/[\w/:.?=&-]+|\burn:[\w:.?=&-]+/,
  4. 'property': {
  5. pattern: /(?:\b\w+#)?(?:"(?:\\.|[^\\"\r\n])*"|\b\w+)(?=\s*[:@])/,
  6. greedy: true
  7. },
  8. 'string': {
  9. pattern: /(["'`])(?:\\[\s\S]|(?!\1)[^\\])*\1/,
  10. greedy: true
  11. },
  12. 'mime-type': /\b(?:application|audio|image|multipart|text|video)\/[\w+-]+/,
  13. 'date': {
  14. pattern: /\|[\w:+-]+\|/,
  15. greedy: true
  16. },
  17. 'comment': [
  18. {
  19. pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
  20. lookbehind: true,
  21. greedy: true
  22. },
  23. {
  24. pattern: /(^|[^\\:])\/\/.*/,
  25. lookbehind: true,
  26. greedy: true
  27. }
  28. ],
  29. 'regex': {
  30. pattern: /\/(?:[^\\\/\r\n]|\\[^\r\n])+\//,
  31. greedy: true
  32. },
  33. 'keyword': /\b(?:and|as|at|case|do|else|fun|if|input|is|match|not|ns|null|or|output|type|unless|update|using|var)\b/,
  34. 'function': /\b[A-Z_]\w*(?=\s*\()/i,
  35. 'number': /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
  36. 'punctuation': /[{}[\];(),.:@]/,
  37. 'operator': /<<|>>|->|[<>~=]=?|!=|--?-?|\+\+?|!|\?/,
  38. 'boolean': /\b(?:false|true)\b/,
  39. };
  40. }(Prism));