prism-wolfram.js 1.0 KB

1234567891011121314151617181920212223242526272829
  1. Prism.languages.wolfram = {
  2. 'comment': // Allow one level of nesting - note: regex taken from applescipt
  3. /\(\*(?:\(\*(?:[^*]|\*(?!\)))*\*\)|(?!\(\*)[\s\S])*?\*\)/,
  4. 'string': {
  5. pattern: /"(?:\\.|[^"\\\r\n])*"/,
  6. greedy: true
  7. },
  8. 'keyword': /\b(?:Abs|AbsArg|Accuracy|Block|Do|For|Function|If|Manipulate|Module|Nest|NestList|None|Return|Switch|Table|Which|While)\b/,
  9. 'context': {
  10. pattern: /\b\w+`+\w*/,
  11. alias: 'class-name'
  12. },
  13. 'blank': {
  14. pattern: /\b\w+_\b/,
  15. alias: 'regex'
  16. },
  17. 'global-variable': {
  18. pattern: /\$\w+/,
  19. alias: 'variable'
  20. },
  21. 'boolean': /\b(?:False|True)\b/,
  22. 'number': /(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?j?\b/i,
  23. 'operator': /\/\.|;|=\.|\^=|\^:=|:=|<<|>>|<\||\|>|:>|\|->|->|<-|@@@|@@|@|\/@|=!=|===|==|=|\+|-|\[\/-+%=\]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
  24. 'punctuation': /[{}[\];(),.:]/
  25. };
  26. Prism.languages.mathematica = Prism.languages.wolfram;
  27. Prism.languages.wl = Prism.languages.wolfram;
  28. Prism.languages.nb = Prism.languages.wolfram;