-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmalltalk.js
51 lines (51 loc) · 1.21 KB
/
smalltalk.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
module.exports = function(hljs) {
var VAR_IDENT_RE = '[a-z][a-zA-Z0-9_]*';
var CHAR = {
className: 'char',
begin: '\\$.{1}'
};
var SYMBOL = {
className: 'symbol',
begin: '#' + hljs.UNDERSCORE_IDENT_RE
};
return {
keywords: 'self super nil true false thisContext', // only 6
contains: [
{
className: 'comment',
begin: '"', end: '"',
relevance: 0
},
hljs.APOS_STRING_MODE,
{
className: 'class',
begin: '\\b[A-Z][A-Za-z0-9_]*',
relevance: 0
},
{
className: 'method',
begin: VAR_IDENT_RE + ':'
},
hljs.C_NUMBER_MODE,
SYMBOL,
CHAR,
{
className: 'localvars',
// This looks more complicated than needed to avoid combinatorial
// explosion under V8. It effectively means `| var1 var2 ... |` with
// whitespace adjacent to `|` being optional.
begin: '\\|\\s*' + VAR_IDENT_RE + '(\\s+' + VAR_IDENT_RE + ')*\\s*\\|'
},
{
className: 'array',
begin: '\\#\\(', end: '\\)',
contains: [
hljs.APOS_STRING_MODE,
CHAR,
hljs.C_NUMBER_MODE,
SYMBOL
]
}
]
};
};