prism-bqn.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. Prism.languages.bqn = {
  2. 'shebang': {
  3. pattern: /^#![ \t]*\/.*/,
  4. alias: 'important',
  5. greedy: true
  6. },
  7. 'comment': {
  8. pattern: /#.*/,
  9. greedy: true
  10. },
  11. 'string-literal': {
  12. pattern: /"(?:[^"]|"")*"/,
  13. greedy: true,
  14. alias: 'string'
  15. },
  16. 'character-literal': {
  17. pattern: /'(?:[\s\S]|[\uD800-\uDBFF][\uDC00-\uDFFF])'/,
  18. greedy: true,
  19. alias: 'char'
  20. },
  21. 'function': /•[\w¯.∞π]+[\w¯.∞π]*/,
  22. 'dot-notation-on-brackets': {
  23. pattern: /\{(?=.*\}\.)|\}\./,
  24. alias: 'namespace'
  25. },
  26. 'special-name': {
  27. pattern: /(?:𝕨|𝕩|𝕗|𝕘|𝕤|𝕣|𝕎|𝕏|𝔽|𝔾|𝕊|_𝕣_|_𝕣)/,
  28. alias: 'keyword'
  29. },
  30. 'dot-notation-on-name': {
  31. pattern: /[A-Za-z_][\w¯∞π]*\./,
  32. alias: 'namespace'
  33. },
  34. 'word-number-scientific': {
  35. pattern: /\d+(?:\.\d+)?[eE]¯?\d+/,
  36. alias: 'number'
  37. },
  38. 'word-name': {
  39. pattern: /[A-Za-z_][\w¯∞π]*/,
  40. alias: 'symbol'
  41. },
  42. 'word-number': {
  43. pattern: /[¯∞π]?(?:\d*\.?\b\d+(?:e[+¯]?\d+|E[+¯]?\d+)?|¯|∞|π)(?:j¯?(?:(?:\d+(?:\.\d+)?|\.\d+)(?:e[+¯]?\d+|E[+¯]?\d+)?|¯|∞|π))?/,
  44. alias: 'number'
  45. },
  46. 'null-literal': {
  47. pattern: /@/,
  48. alias: 'char'
  49. },
  50. 'primitive-functions': {
  51. pattern: /[-+×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍⋈↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!]/,
  52. alias: 'operator'
  53. },
  54. 'primitive-1-operators': {
  55. pattern: /[`˜˘¨⁼⌜´˝˙]/,
  56. alias: 'operator'
  57. },
  58. 'primitive-2-operators': {
  59. pattern: /[∘⊸⟜○⌾⎉⚇⍟⊘◶⎊]/,
  60. alias: 'operator'
  61. },
  62. 'punctuation': /[←⇐↩(){}⟨⟩[\]‿·⋄,.;:?]/
  63. };