prism-concurnas.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. Prism.languages.concurnas = {
  2. 'comment': {
  3. pattern: /(^|[^\\])(?:\/\*[\s\S]*?(?:\*\/|$)|\/\/.*)/,
  4. lookbehind: true,
  5. greedy: true
  6. },
  7. 'langext': {
  8. pattern: /\b\w+\s*\|\|[\s\S]+?\|\|/,
  9. greedy: true,
  10. inside: {
  11. 'class-name': /^\w+/,
  12. 'string': {
  13. pattern: /(^\s*\|\|)[\s\S]+(?=\|\|$)/,
  14. lookbehind: true
  15. },
  16. 'punctuation': /\|\|/
  17. }
  18. },
  19. 'function': {
  20. pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/,
  21. lookbehind: true
  22. },
  23. 'keyword': /\b(?:abstract|actor|also|annotation|assert|async|await|bool|boolean|break|byte|case|catch|changed|char|class|closed|constant|continue|def|default|del|double|elif|else|enum|every|extends|false|finally|float|for|from|global|gpudef|gpukernel|if|import|in|init|inject|int|lambda|local|long|loop|match|new|nodefault|null|of|onchange|open|out|override|package|parfor|parforsync|post|pre|private|protected|provide|provider|public|return|shared|short|single|size_t|sizeof|super|sync|this|throw|trait|trans|transient|true|try|typedef|unchecked|using|val|var|void|while|with)\b/,
  24. 'boolean': /\b(?:false|true)\b/,
  25. 'number': /\b0b[01][01_]*L?\b|\b0x(?:[\da-f_]*\.)?[\da-f_p+-]+\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfls]?/i,
  26. 'punctuation': /[{}[\];(),.:]/,
  27. 'operator': /<==|>==|=>|->|<-|<>|&==|&<>|\?:?|\.\?|\+\+|--|[-+*/=<>]=?|[!^~]|\b(?:and|as|band|bor|bxor|comp|is|isnot|mod|or)\b=?/,
  28. 'annotation': {
  29. pattern: /@(?:\w+:)?(?:\w+|\[[^\]]+\])?/,
  30. alias: 'builtin'
  31. }
  32. };
  33. Prism.languages.insertBefore('concurnas', 'langext', {
  34. 'regex-literal': {
  35. pattern: /\br("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
  36. greedy: true,
  37. inside: {
  38. 'interpolation': {
  39. pattern: /((?:^|[^\\])(?:\\{2})*)\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
  40. lookbehind: true,
  41. inside: Prism.languages.concurnas
  42. },
  43. 'regex': /[\s\S]+/
  44. }
  45. },
  46. 'string-literal': {
  47. pattern: /(?:\B|\bs)("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
  48. greedy: true,
  49. inside: {
  50. 'interpolation': {
  51. pattern: /((?:^|[^\\])(?:\\{2})*)\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
  52. lookbehind: true,
  53. inside: Prism.languages.concurnas
  54. },
  55. 'string': /[\s\S]+/
  56. }
  57. }
  58. });
  59. Prism.languages.conc = Prism.languages.concurnas;