prism-nevod.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. Prism.languages.nevod = {
  2. 'comment': /\/\/.*|(?:\/\*[\s\S]*?(?:\*\/|$))/,
  3. 'string': {
  4. pattern: /(?:"(?:""|[^"])*"(?!")|'(?:''|[^'])*'(?!'))!?\*?/,
  5. greedy: true,
  6. inside: {
  7. 'string-attrs': /!$|!\*$|\*$/,
  8. },
  9. },
  10. 'namespace': {
  11. pattern: /(@namespace\s+)[a-zA-Z0-9\-.]+(?=\s*\{)/,
  12. lookbehind: true,
  13. },
  14. 'pattern': {
  15. pattern: /(@pattern\s+)?#?[a-zA-Z0-9\-.]+(?:\s*\(\s*(?:~\s*)?[a-zA-Z0-9\-.]+\s*(?:,\s*(?:~\s*)?[a-zA-Z0-9\-.]*)*\))?(?=\s*=)/,
  16. lookbehind: true,
  17. inside: {
  18. 'pattern-name': {
  19. pattern: /^#?[a-zA-Z0-9\-.]+/,
  20. alias: 'class-name',
  21. },
  22. 'fields': {
  23. pattern: /\(.*\)/,
  24. inside: {
  25. 'field-name': {
  26. pattern: /[a-zA-Z0-9\-.]+/,
  27. alias: 'variable',
  28. },
  29. 'punctuation': /[,()]/,
  30. 'operator': {
  31. pattern: /~/,
  32. alias: 'field-hidden-mark',
  33. },
  34. },
  35. },
  36. },
  37. },
  38. 'search': {
  39. pattern: /(@search\s+|#)[a-zA-Z0-9\-.]+(?:\.\*)?(?=\s*;)/,
  40. alias: 'function',
  41. lookbehind: true,
  42. },
  43. 'keyword': /@(?:having|inside|namespace|outside|pattern|require|search|where)\b/,
  44. 'standard-pattern': {
  45. pattern: /\b(?:Alpha|AlphaNum|Any|Blank|End|LineBreak|Num|NumAlpha|Punct|Space|Start|Symbol|Word|WordBreak)\b(?:\([a-zA-Z0-9\-.,\s+]*\))?/,
  46. inside: {
  47. 'standard-pattern-name': {
  48. pattern: /^[a-zA-Z0-9\-.]+/,
  49. alias: 'builtin',
  50. },
  51. 'quantifier': {
  52. pattern: /\b\d+(?:\s*\+|\s*-\s*\d+)?(?!\w)/,
  53. alias: 'number',
  54. },
  55. 'standard-pattern-attr': {
  56. pattern: /[a-zA-Z0-9\-.]+/,
  57. alias: 'builtin',
  58. },
  59. 'punctuation': /[,()]/,
  60. },
  61. },
  62. 'quantifier': {
  63. pattern: /\b\d+(?:\s*\+|\s*-\s*\d+)?(?!\w)/,
  64. alias: 'number',
  65. },
  66. 'operator': [
  67. {
  68. pattern: /=/,
  69. alias: 'pattern-def',
  70. },
  71. {
  72. pattern: /&/,
  73. alias: 'conjunction',
  74. },
  75. {
  76. pattern: /~/,
  77. alias: 'exception',
  78. },
  79. {
  80. pattern: /\?/,
  81. alias: 'optionality',
  82. },
  83. {
  84. pattern: /[[\]]/,
  85. alias: 'repetition',
  86. },
  87. {
  88. pattern: /[{}]/,
  89. alias: 'variation',
  90. },
  91. {
  92. pattern: /[+_]/,
  93. alias: 'sequence',
  94. },
  95. {
  96. pattern: /\.{2,3}/,
  97. alias: 'span',
  98. },
  99. ],
  100. 'field-capture': [
  101. {
  102. pattern: /([a-zA-Z0-9\-.]+\s*\()\s*[a-zA-Z0-9\-.]+\s*:\s*[a-zA-Z0-9\-.]+(?:\s*,\s*[a-zA-Z0-9\-.]+\s*:\s*[a-zA-Z0-9\-.]+)*(?=\s*\))/,
  103. lookbehind: true,
  104. inside: {
  105. 'field-name': {
  106. pattern: /[a-zA-Z0-9\-.]+/,
  107. alias: 'variable',
  108. },
  109. 'colon': /:/,
  110. },
  111. },
  112. {
  113. pattern: /[a-zA-Z0-9\-.]+\s*:/,
  114. inside: {
  115. 'field-name': {
  116. pattern: /[a-zA-Z0-9\-.]+/,
  117. alias: 'variable',
  118. },
  119. 'colon': /:/,
  120. },
  121. },
  122. ],
  123. 'punctuation': /[:;,()]/,
  124. 'name': /[a-zA-Z0-9\-.]+/
  125. };