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
|
/*
Language: Smalltalk
Author: Vladimir Gubarkov <xonixx@gmail.com>
*/
this.lang = function(hljs){
hljs.LANGUAGES.smalltalk = function(){
var VAR_IDENT_RE = '[a-z][a-zA-Z0-9_]*';
return {
defaultMode: {
lexems: [hljs.UNDERSCORE_IDENT_RE],
contains: ['comment', 'string', 'class', 'method',
'number', 'symbol', 'char', 'localvars', 'array'],
keywords: {'self': 1, 'super': 1, 'nil': 1, 'true': 1, 'false': 1, 'thisContext': 1} // only 6
},
modes: [
{
className: 'class',
begin: '\\b[A-Z][A-Za-z0-9_]*', end: '^',
relevance: 0
},
{
className: 'symbol',
begin: '#' + hljs.UNDERSCORE_IDENT_RE, end: '^'
},
hljs.C_NUMBER_MODE,
hljs.APOS_STRING_MODE,
{
className: 'comment',
begin: '"', end: '"',
relevance: 0
},
{
className: 'method',
begin: VAR_IDENT_RE + ':', end:'^'
},
{
className: 'char',
begin: '\\$.{1}', end: '^'
},
{
className: 'localvars',
begin: '\\|\\s*((' + VAR_IDENT_RE + ')\\s*)+\\|', end: '^',
relevance: 10
},
{
className: 'array',
begin: '\\#\\(', end: '\\)',
contains: ['string', 'char', 'number', 'symbol']
}
]
};
}();
};
|