prism-solution-file.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. (function (Prism) {
  2. var guid = {
  3. // https://en.wikipedia.org/wiki/Universally_unique_identifier#Format
  4. pattern: /\{[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}\}/i,
  5. alias: 'constant',
  6. inside: {
  7. 'punctuation': /[{}]/
  8. }
  9. };
  10. Prism.languages['solution-file'] = {
  11. 'comment': {
  12. pattern: /#.*/,
  13. greedy: true
  14. },
  15. 'string': {
  16. pattern: /"[^"\r\n]*"|'[^'\r\n]*'/,
  17. greedy: true,
  18. inside: {
  19. 'guid': guid
  20. }
  21. },
  22. 'object': {
  23. // Foo
  24. // Bar("abs") = 9
  25. // EndBar
  26. // Prop = TRUE
  27. // EndFoo
  28. pattern: /^([ \t]*)(?:([A-Z]\w*)\b(?=.*(?:\r\n?|\n)(?:\1[ \t].*(?:\r\n?|\n))*\1End\2(?=[ \t]*$))|End[A-Z]\w*(?=[ \t]*$))/m,
  29. lookbehind: true,
  30. greedy: true,
  31. alias: 'keyword'
  32. },
  33. 'property': {
  34. pattern: /^([ \t]*)(?!\s)[^\r\n"#=()]*[^\s"#=()](?=\s*=)/m,
  35. lookbehind: true,
  36. inside: {
  37. 'guid': guid
  38. }
  39. },
  40. 'guid': guid,
  41. 'number': /\b\d+(?:\.\d+)*\b/,
  42. 'boolean': /\b(?:FALSE|TRUE)\b/,
  43. 'operator': /=/,
  44. 'punctuation': /[(),]/
  45. };
  46. Prism.languages['sln'] = Prism.languages['solution-file'];
  47. }(Prism));