-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprism-nue.js
40 lines (40 loc) · 1.1 KB
/
prism-nue.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
33
34
35
36
37
38
39
40
Prism.languages.nue = {
comment: [
{
pattern: /\/\/#([\s\S]*?)#\//,
greedy: true,
},
{
pattern: /\/\/.*/,
greedy: true,
},
],
string: [
{
pattern: /("""|''')[\s\S]*?\1/,
greedy: true,
},
{
pattern: /(["'])(?:\\[\s\S]|(?!\1)[^\\])*\1/,
greedy: true,
},
],
number: {
pattern:
/\b(?:0[xX][\da-fA-F_]+|0[bB][01_]+|0[oO][0-7_]+|\d[\d_]*(?:\.\d+)?(?:[eE][+-]?\d+)?)(?![\w_])/,
greedy: true,
},
keyword:
/\b(?:private|var|alias|if|else|for|in|step|while|continue|break|return|this|match|case|function)\b/,
boolean: /\b(?:true|false)\b/,
type: /\b(?:table|boolean|number|string|any|void|null)\b/,
operator:
/(?:\+\+|--|\+=|-=|\*=|\/=|\^=|==|!=|<=|>=|\|\||->|\.{2,3}|\^|\+|\-|\*|\/|%|\\|=|<|>|!|&|\||#|\?)/,
function: {
pattern: /\b[a-zA-Z_]\w*(?=\s*\()/,
lookbehind: false,
greedy: true,
},
punctuation: /[()[\]{},;.:]/,
identifier: /\b[a-zA-Z_]\w*\b/,
};