-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathwarpscript.js
32 lines (31 loc) · 1.13 KB
/
warpscript.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// @ts-nocheck
warpscript.displayName = 'warpscript'
warpscript.aliases = []
/** @type {import('../core.js').Syntax} */
export default function warpscript(Prism) {
Prism.languages.warpscript = {
comment: /#.*|\/\/.*|\/\*[\s\S]*?\*\//,
string: {
pattern:
/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'|<'(?:[^\\']|'(?!>)|\\.)*'>/,
greedy: true
},
variable: /\$\S+/,
macro: {
pattern: /@\S+/,
alias: 'property'
},
// WarpScript doesn't have any keywords, these are all functions under the control category
// https://www.warp10.io/tags/control
keyword:
/\b(?:BREAK|CHECKMACRO|CONTINUE|CUDF|DEFINED|DEFINEDMACRO|EVAL|FAIL|FOR|FOREACH|FORSTEP|IFT|IFTE|MSGFAIL|NRETURN|RETHROW|RETURN|SWITCH|TRY|UDF|UNTIL|WHILE)\b/,
number:
/[+-]?\b(?:NaN|Infinity|\d+(?:\.\d*)?(?:[Ee][+-]?\d+)?|0x[\da-fA-F]+|0b[01]+)\b/,
boolean: /\b(?:F|T|false|true)\b/,
punctuation: /<%|%>|[{}[\]()]/,
// Some operators from the "operators" category
// https://www.warp10.io/tags/operators
operator:
/==|&&?|\|\|?|\*\*?|>>>?|<<|[<>!~]=?|[-/%^]|\+!?|\b(?:AND|NOT|OR)\b/
}
}