source: node_modules/refractor/lang/wolfram.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[d24f17c]1'use strict'
2
3module.exports = wolfram
4wolfram.displayName = 'wolfram'
5wolfram.aliases = ['mathematica', 'wl', 'nb']
6function wolfram(Prism) {
7 Prism.languages.wolfram = {
8 // Allow one level of nesting - note: regex taken from applescipt
9 comment: /\(\*(?:\(\*(?:[^*]|\*(?!\)))*\*\)|(?!\(\*)[\s\S])*?\*\)/,
10 string: {
11 pattern: /"(?:\\.|[^"\\\r\n])*"/,
12 greedy: true
13 },
14 keyword:
15 /\b(?:Abs|AbsArg|Accuracy|Block|Do|For|Function|If|Manipulate|Module|Nest|NestList|None|Return|Switch|Table|Which|While)\b/,
16 context: {
17 pattern: /\b\w+`+\w*/,
18 alias: 'class-name'
19 },
20 blank: {
21 pattern: /\b\w+_\b/,
22 alias: 'regex'
23 },
24 'global-variable': {
25 pattern: /\$\w+/,
26 alias: 'variable'
27 },
28 boolean: /\b(?:False|True)\b/,
29 number:
30 /(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?j?\b/i,
31 operator:
32 /\/\.|;|=\.|\^=|\^:=|:=|<<|>>|<\||\|>|:>|\|->|->|<-|@@@|@@|@|\/@|=!=|===|==|=|\+|-|\^|\[\/-+%=\]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
33 punctuation: /[{}[\];(),.:]/
34 }
35 Prism.languages.mathematica = Prism.languages.wolfram
36 Prism.languages.wl = Prism.languages.wolfram
37 Prism.languages.nb = Prism.languages.wolfram
38}
Note: See TracBrowser for help on using the repository browser.