-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
86 lines (82 loc) · 1.54 KB
/
index.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
'use strict';
module.exports = function(hljs) {
function longestFirst(a, b) {
return b.length - a.length;
}
var keywords = [
'and',
'as',
'contains',
'does not contain',
'does not end with',
'does not equal',
'does not start with',
'else',
'ends with',
'equals',
'exist',
'exist no',
'exists',
'exists no',
'false',
'if',
'is',
'is contained by',
'is equal to',
'is greater than',
'is greater than or equal to',
'is less than',
'is less than or equal to',
'is not',
'is not contained by',
'is not equal to',
'is not greater than',
'is not greater than or equal to',
'is not less than',
'is not less than or equal to',
'it',
'mod',
'nil',
'not',
'nothing',
'nothings',
'null',
'of',
'or',
'starts with',
'then',
'there do not exist',
'there does not exist',
'there exist',
'there exist no',
'there exists',
'there exists no',
'true',
'whose'
];
var keywordsRe = keywords
.sort(longestFirst)
.join('|')
.replace(/\s+/g, '\\s+((a|an|the)\\s+)*');
return {
case_insensitive: true,
contains: [
hljs.C_BLOCK_COMMENT_MODE,
{
className: 'number',
begin: '\\b[0-9]+',
relevance: 0
},
{
className: 'string',
begin: '"', end: '"',
relevance: 0
},
{
className: 'keyword',
begin: '\\b(' + keywordsRe + ')\\b',
relevance: 2
}
]
};
};